8 Commits

36 changed files with 5651 additions and 3989 deletions

252
components/change-table.vue Normal file
View File

@@ -0,0 +1,252 @@
<template>
<view>
<up-popup :show="show" mode="center" @close="close">
<view class="bg-fff u-p-30 box">
<scroll-view direction="vertical" scroll-y style="max-height: 80vh;">
<view class="u-flex gap-20">
<view>转桌到</view>
<view>
<chooseTable v-model="form.mewTable"></chooseTable>
</view>
</view>
<view class="u-flex gap-20 u-m-t-32 u-col-baseline">
<view>转入类型</view>
<up-radio-group v-model="form.type" placement="column">
<up-radio label="转桌(可将部分商品转入)" :name="1" :key="1"></up-radio>
<up-radio label="并桌(并台会将全部购物车商品转入)" :name="2" :key="2"></up-radio>
</up-radio-group>
</view>
<template v-if="form.type==1">
<view class=" u-m-t-32 ">
<view class="u-m-b-24">购物车商品</view>
<goodsTable :data="nowCartData" :columns="columnsCheck1" row-key="id"
@selection-change="handleSelectionChange($event,'now')"></goodsTable>
<!-- <u-table2 :data="nowCartData" :columns="columnsCheck1" row-key="id"
@selection-change="handleSelectionChange($event,'now')" /> -->
</view>
<view class=" u-m-t-50 ">
<view class="u-m-b-24">历史订单商品</view>
<view v-for="(order,orderIndex) in goodsList" class="u-m-t-32" :key="index">
<view>{{ orderIndex }}次下单</view>
<goodsTable :data="order" :columns="columnsCheck" row-key="id"
@selection-change="handleSelectionChange($event,'old')" />
<!-- <u-table2 :data="order" :columns="columnsCheck" row-key="id"
@selection-change="handleSelectionChange($event,'old')" /> -->
</view>
</view>
</template>
</scroll-view>
<view class="u-flex gap-20 u-p-t-30">
<view class="u-flex-1">
<my-button type="default" @click="close">取消</my-button>
</view>
<view class="u-flex-1">
<my-button @click="confirm">确认</my-button>
</view>
</view>
</view>
</up-popup>
</view>
</template>
<script setup>
import goodsTable from './goods-table.vue'
import {
reactive,
ref,
watch
} from 'vue';
import chooseTable from './choose-table.vue'
import {
mergeOrder
} from '@/http/api/order/order.js'
const show = defineModel(false)
const allChecked = ref(false)
const props = defineProps({
goodsList: {},
order: {
id: ''
},
nowCartData: []
})
watch(() => props.nowCartData, (newval) => {
console.log('props.nowCartData', props.nowCartData)
}, {
deep: true
})
function close() {
console.log('close');
form.mewTable = {id: ''}
show.value = false
}
const form = reactive({
mewTable: {
id: ''
},
type: 1,
now: [],
old: []
})
const columnsCheck = ref([
// 复选框列
{
type: 'selection',
width: '50px'
},
// 普通列
{
title: '商品',
key: 'productName'
},
{
title: '数量',
key: 'num'
}
]);
const columnsCheck1 = ref([
// 复选框列
{
type: 'selection',
width: '50px'
},
// 普通列
{
title: '商品',
key: 'name'
},
{
title: '数量',
key: 'number'
}
]);
const handleSelectionChange = (selection, key) => {
console.log('handleSelectionChange', selection);
if (key === 'old') {
form.old = selection
}
if (key === 'now') {
form.now = selection
}
};
const emits = defineEmits('update', 'confirm')
function confirm() {
if (!form.mewTable.id) {
return uni.showToast({
title: '请选择目标台桌',
icon: 'none'
})
}
if (form.type == 1) {
if (form.old.length <= 0 && form.now.length <= 0) {
return uni.showToast({
title: '请选择转桌商品',
icon: 'none'
})
}
}
if (form.type == 2) {
if (props.nowCartData.length <= 0) {
mergeOrder({
allMerge: 1,
sourceOrderId: props.order ? props.order.id : '',
targetTableCode: form.mewTable.tableCode,
detailIds: Object.entries(props.goodsList).reduce((prve, cur) => {
prve.push(...cur.map(v => v.id))
return prve
}, [])
}).then(res => {
uni.showToast({
title: '转桌成功',
icon: 'none'
})
emits('update', 1)
close()
})
} else {
emits('confirm', {
targetTableCode: form.mewTable.tableCode,
old: {
allMerge: 1,
sourceOrderId: props.order ? props.order.id : '',
targetTableCode: form.mewTable.tableCode,
detailIds: Object.entries(props.goodsList).reduce((prve, cur) => {
prve.push(...cur.map(v => v.id))
return prve
}, [])
},
now: {
allMerge: 1,
cart_id: props.nowCartData.map(v => v.id)
}
})
close()
}
return
}
console.log(form);
let allOldLen = 0;
for (let key in props.goodsList) {
allOldLen += props.goodsList[key].length
}
const allMerge = form.old.length === allOldLen ? 1 : 0
if (props.nowCartData.length <= 0) {
mergeOrder({
allMerge,
sourceOrderId: props.order ? props.order.id : '',
targetTableCode: form.mewTable.tableCode,
detailIds: form.old.map(v => v.id)
}).then(res => {
uni.showToast({
title: '转桌成功',
icon: 'none'
})
emits('update', allMerge)
close()
})
} else {
emits('confirm', {
targetTableCode: form.mewTable.tableCode,
old: {
allMerge,
sourceOrderId: props.order ? props.order.id : '',
targetTableCode: form.mewTable.tableCode,
detailIds: form.old.map(v => v.id)
},
now: {
allMerge: props.nowCartData.length == form.now.length,
cart_id: form.now.map(v => v.id)
}
})
close()
}
}
</script>
<style scoped>
.box {
width: 690rpx;
border-radius: 18rpx;
}
</style>

152
components/choose-table.vue Normal file
View File

@@ -0,0 +1,152 @@
<template>
<view>
<view class="u-flex input-box u-row-between" @click="openPopup">
<template v-if="!modelValue||!modelValue.id">
<text class="color-999">请选择转桌到</text>
<up-icon name="arrow-down" color="#999"></up-icon>
</template>
<template v-else>
<text class="color-333">{{modelValue.name}}</text>
<up-icon name="arrow-down" color="#999"></up-icon>
</template>
</view>
<up-popup :show="show" mode="bottom">
<view class="box bg-fff u-p-30">
<up-search v-model="query.name" @search="search" @clear="search" @custom="search"></up-search>
<scroll-view direction="vertical" scroll-y style="max-height: 50vh;">
<view class="u-m-t-30 list">
<view class="item" v-for="(item,index) in list" :key="index" :class="{active:selIndex==index}"
@click="selIndex=index">
<text> {{item.name}}</text>
</view>
</view>
<up-loadmore status="nomore"></up-loadmore>
</scroll-view>
</view>
<view class="u-flex gap-20 u-p-l-30 u-p-r-30 u-p-b-30">
<view class="u-flex-1">
<my-button type="default" @click="close">取消</my-button>
</view>
<view class="u-flex-1">
<my-button @click="confirm">确认</my-button>
</view>
</view>
</up-popup>
</view>
</template>
<script setup>
import {
reactive,
ref,
watch,
onMounted
} from 'vue';
import {
onLoad
} from '@dcloudio/uni-app'
import {
getShopTable
} from '@/http/api/table.js'
const modelValue = defineModel({
default:{id:''}
})
const list = ref([])
const show = ref(false)
const selIndex = ref(-1)
function close() {
show.value = false
selIndex.value = -1;
}
function confirm() {
if (selIndex.value < 0) {
return uni.showToast({
title: '请选择桌台',
icon: 'none'
})
}
modelValue.value = list.value[selIndex.value]
console.log('selIndex.value', selIndex.value );
console.log('modelValue.value ', modelValue.value );
close()
}
const query = reactive({
page: 1,
size: 999,
// status: 'idle',
name: ''
})
/**
* 获取桌台列表
*/
async function getTable() {
let res = await getShopTable(query)
list.value = res.records
}
function search() {
selIndex.value = -1;
getTable()
}
function openPopup() {
const index = list.value.findIndex(v => v.id === modelValue.value.id)
if (index != -1) {
selIndex.value = index
}
show.value = true
}
onMounted(() => {
getTable()
})
</script>
<style lang="scss" scoped>
.input-box {
padding: 20rpx 20rpx;
border-radius: 8rpx;
border: 1px solid #dedede;
min-width: 300rpx;
}
.box {
border-radius: 18rpx;
}
.list {
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
grid-gap: 20rpx;
.item {
margin-bottom: 24rpx;
padding: 20rpx 40rpx;
display: flex;
justify-content: center;
align-items: center;
border-radius: 6rpx;
border: 1px solid #dedede;
transition: all .3s ease-in-out;
&.active {
border-color: $my-main-color;
background-color: $my-main-color;
color: #fff;
}
}
}
</style>

156
components/goods-table.vue Normal file
View File

@@ -0,0 +1,156 @@
<template>
<view class="table u-font-28">
<!-- 表头根据 columns 渲染 + 全选框 -->
<view class="u-flex u-row-between no-wrap title">
<!-- 全选框 -->
<view class="table-th">
<up-checkbox @change="handleSelectAll" usedAlone v-model:checked="internalAllChecked" shape="square"
:size="20" />
</view>
<!-- 动态列标题 -->
<view class="table-th" v-for="col in columns" :key="col.key" :style="col.style || {}">
{{ col.title }}
</view>
</view>
<!-- 有数据 渲染列表 -->
<template v-if="internalData.length > 0">
<view @click="handleRowCheck(item)" class="u-m-t-12 u-flex u-p-24 u-row-between row"
v-for="(item, index) in internalData" :key="item.id || index" row-key="id">
<view class="table-td">
<up-checkbox @change="handleRowCheck(item)" usedAlone v-model:checked="item._checked" shape="square" :size="20"></up-checkbox>
</view>
<view class="table-td" v-for="col in columns" :key="col.key" :style="col.style || {}">
<slot v-if="col.slot" :name="col.slot" :row="item" />
<template v-else>{{ item[col.key] }}</template>
</view>
</view>
</template>
<!-- 无数据 显示暂无数据 -->
<view v-else class="empty-text u-p-t-40 u-p-b-40 u-text-center">
暂无数据
</view>
</view>
</template>
<script setup>
import {
ref,
computed,
watch
} from 'vue';
// 完全对齐 u-table2 的 props
const props = defineProps({
data: {
type: Array,
default: () => []
},
columns: {
type: Array,
default: () => []
},
rowKey: {
type: String,
default: 'id'
}
});
// 抛出和 u-table2 一样的 selection-change 事件
const emits = defineEmits(['selection-change']);
// 内部数据(增加选中状态 _checked
const internalData = ref([]);
// 全选状态
const internalAllChecked = ref(false);
// 监听外部 data 变化,自动注入选中状态
watch(
() => props.data,
(val) => {
internalData.value = val.map(item => ({
...item,
_checked: item._checked || false
}));
}, {
immediate: true,
deep: true
}
);
// 全选切换
function handleSelectAll() {
internalAllChecked.value = !internalAllChecked.value
const checked = internalAllChecked.value;
internalData.value = internalData.value.map(item => {
item._checked = checked;
return item;
})
console.log('internalData.value', internalData.value);
emitChange();
}
// 行选中切换
function handleRowCheck(row) {
row._checked = !row._checked;
emitChange();
}
// 抛出选中结果(和 u-table2 行为一致)
function emitChange() {
const selectedRows = internalData.value.filter(item => item._checked);
emits('selection-change', selectedRows);
}
// 监听所有行选中状态,自动更新全选框
watch(
() => internalData.value,
() => {
const total = internalData.value.length;
const checkedCount = internalData.value.filter(i => i._checked).length;
internalAllChecked.value = total > 0 && checkedCount === total;
}, {
deep: true
}
);
</script>
<style lang="scss">
.table {
background: #f9f9f9;
border-radius: 8rpx;
overflow: hidden;
.title {
padding: 12rpx 24rpx;
background: #aebad2;
border-radius: 8rpx 8rpx 0 0;
color: #fff;
}
.table-th,
.table-td {
flex: 1;
text-align: center;
}
.row {
cursor: pointer;
}
.row:nth-of-type(2n + 1) {
background: #f0f0f0;
}
// 空数据样式
.empty-text {
font-size: 28rpx;
color: #999;
}
}
</style>

View File

@@ -8,9 +8,9 @@
:height="height" :height="height"
:maxCount="maxCount" :maxCount="maxCount"
> >
<template #default v-if="$slots.default"> <!-- <template #default v-if="$slots.default">
<slot></slot> <slot></slot>
</template> </template> -->
</up-upload> </up-upload>
</template> </template>

View File

@@ -1,5 +1,5 @@
//当前环境 test,prod //当前环境 test,prod
export const ENV = 'prod' export const ENV = 'test'
export const ENV_BASE_URL = { export const ENV_BASE_URL = {
java: { java: {
prod: 'https://cashier.sxczgkj.com/', prod: 'https://cashier.sxczgkj.com/',

2
data/icon.js Normal file
View File

@@ -0,0 +1,2 @@
// static/coupon/qrcode.svg
export const qrcode = 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/6/7070aa441e4e4126b0bba32502a3521e.svg'

View File

@@ -14,6 +14,16 @@ export function categoryPage(data, urlType = 'product') {
} }
}) })
} }
/**
* 获取分类详情
* @returns
*/
export function getCategoryDetail(id, urlType = 'product') {
return request({
url: `${urlType}/admin/prod/category/`+id,
method: "GET",
})
}
/** /**
* 分类添加 * 分类添加

View File

@@ -14,7 +14,19 @@ export function getConsPage(data, urlType = 'product') {
} }
}) })
} }
/**
* 耗材库存列表接口
* @returns
*/
export function getConsStock(data, urlType = 'product') {
return request({
url: `${urlType}/admin/product/cons/consStock`,
method: "GET",
data: {
...data
}
})
}
/** /**
* 获取耗材列表 * 获取耗材列表
* @returns * @returns

16
http/api/order/order.js Normal file
View File

@@ -0,0 +1,16 @@
import http from "@/http/http.js";
const request = http.request;
const urlType = "order";
export function mergeOrder(data) {
return request({
url: urlType + '/admin/order/mergeOrder',
method: "POST",
data: {
...data,
},
});
}

View File

@@ -13,15 +13,22 @@
</view> </view>
<view class=""> <view class="">
<uni-forms-item label="分类名称" required name="name"> <uni-forms-item label="分类名称" required name="name">
<uni-easyinput padding-none :placeholderStyle="'font-size:28rpx;'" <uni-easyinput padding-none :placeholderStyle="'font-size:28rpx;'" :inputBorder="false"
:inputBorder="false" v-model="category.name" placeholder="输入分类名称" /> v-model="category.name" placeholder="输入分类名称" />
</uni-forms-item>
</view>
<view class="">
<uni-forms-item label="退菜是否退库存" required name=" refundMode">
<up-radio-group v-model="category.refundMode" placement="row">
<up-radio v-for="(item, index) in refundModes" :key="index" :label="item.name"
:name="item.value" activeColor="rgb(49, 138, 254)"></up-radio>
</up-radio-group>
</uni-forms-item> </uni-forms-item>
</view> </view>
<template v-if="option.type==='edit'"> <template v-if="option.type==='edit'">
<uni-forms-item label="排序" required name="sort"> <uni-forms-item label="排序" required name="sort">
<uni-easyinput padding-none :placeholderStyle="'font-size:28rpx;'" <uni-easyinput padding-none :placeholderStyle="'font-size:28rpx;'" :inputBorder="false"
:inputBorder="false" v-model="category.sort" type="number" v-model="category.sort" type="number" placeholder="排序越小越靠前" />
placeholder="排序越小越靠前" />
</uni-forms-item> </uni-forms-item>
</template> </template>
<uni-forms-item label=""> <uni-forms-item label="">
@@ -50,14 +57,35 @@
</template> </template>
<script setup> <script setup>
import { reactive, ref } from 'vue'; import {
reactive,
ref
} from 'vue';
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
import infoBox from '@/commons/utils/infoBox.js'; import infoBox from '@/commons/utils/infoBox.js';
import mySwitch from '@/components/my-components/my-switch' import mySwitch from '@/components/my-components/my-switch'
import myUploadFile from '@/components/my-components/my-upload-file' import myUploadFile from '@/components/my-components/my-upload-file'
import { onLoad, onReady } from '@dcloudio/uni-app'; import {
import { addCategory, putCategory } from '@/http/api/cateGory.js' onLoad,
onReady
} from '@dcloudio/uni-app';
import {
addCategory,
putCategory
} from '@/http/api/cateGory.js'
const refundModes = [{
name: "退菜退库存",
value: 1
},
{
name: "仅退菜不退库存",
value: 2
},
{
name: "每次询问-退菜后弹窗提示",
value: 3
},
]
// 构造分类的基础数据 // 构造分类的基础数据
const category = reactive({ const category = reactive({
@@ -121,6 +149,7 @@
} }
} }
} }
function validateFunc(key, value) { function validateFunc(key, value) {
if (validateFuncObj.hasOwnProperty(key)) { if (validateFuncObj.hasOwnProperty(key)) {
const func = validateFuncObj[key] const func = validateFuncObj[key]

View File

@@ -18,6 +18,12 @@
<view>预警值</view> <view>预警值</view>
<view><input type="number" placeholder="请输入预警值" v-model="datas.form.conWarning" name="" id="" /></view> <view><input type="number" placeholder="请输入预警值" v-model="datas.form.conWarning" name="" id="" /></view>
</view> </view>
<view>
<view>是否检测耗材</view>
<up-switch size="20" :inactive-value="0" :active-value="1" v-model="datas.form.isStock"></up-switch>
</view>
<view v-if="!datas.form.id" style="justify-content: space-between"> <view v-if="!datas.form.id" style="justify-content: space-between">
<view>耗材类型</view> <view>耗材类型</view>
<view style="width: 54%" @tap="datas.show = !datas.show"> <view style="width: 54%" @tap="datas.show = !datas.show">
@@ -55,7 +61,8 @@
<view class="label">默认入库单位</view> <view class="label">默认入库单位</view>
<view class="ipt"> <view class="ipt">
<u-radio-group v-model="datas.form.defaultUnit"> <u-radio-group v-model="datas.form.defaultUnit">
<u-radio :name="item" :label="item" v-for="(item, index) in unitList" :key="index"></u-radio> <u-radio :name="item" :label="item" v-for="(item, index) in unitList"
:key="index"></u-radio>
</u-radio-group> </u-radio-group>
</view> </view>
</view> </view>
@@ -63,19 +70,30 @@
</view> </view>
</template> </template>
<view class="bottombutton"> <view class="bottombutton">
<up-button type="primary" style="background-color: #318afe; color: #fff" @tap="sumbit" :plain="true" text="保存"></up-button> <up-button type="primary" style="background-color: #318afe; color: #fff" @tap="sumbit" :plain="true"
text="保存"></up-button>
</view> </view>
<up-picker :show="datas.show" :columns="datas.typeList" keyName="name" @cancel="datas.show = false" @confirm="confirmConsGroup"></up-picker> <up-picker :show="datas.show" :columns="datas.typeList" keyName="name" @cancel="datas.show = false"
@confirm="confirmConsGroup"></up-picker>
<!-- 消息提示 --> <!-- 消息提示 -->
<up-toast ref="uToastRef"></up-toast> <up-toast ref="uToastRef"></up-toast>
<u-picker :show="unitShow" :columns="unitList"></u-picker> <u-picker :show="unitShow" :columns="unitList"></u-picker>
</template> </template>
<script setup> <script setup>
import { ref, reactive } from 'vue'; import {
import { onLoad } from '@dcloudio/uni-app'; ref,
reactive
} from 'vue';
import {
onLoad
} from '@dcloudio/uni-app';
import { getConsGrpupList, addCons, editCons } from '@/http/api/cons.js'; import {
getConsGrpupList,
addCons,
editCons
} from '@/http/api/cons.js';
let datas = reactive({ let datas = reactive({
show: false, show: false,
@@ -87,7 +105,8 @@ let datas = reactive({
consGroupId: null, consGroupId: null,
conUnitTwo: '', // 第二单位 conUnitTwo: '', // 第二单位
conUnitTwoConvert: '', // 第二单位转换数量 conUnitTwoConvert: '', // 第二单位转换数量
defaultUnit: 2 defaultUnit: '',
isStock: 1,
}, },
consGroupName: '', consGroupName: '',
typeList: [] typeList: []
@@ -148,9 +167,13 @@ let sumbit = async () => {
return; return;
} }
if (!datas.form.id) { if (!datas.form.id) {
await addCons({ ...datas.form }); await addCons({
...datas.form
});
} else { } else {
await editCons({ ...datas.form }); await editCons({
...datas.form
});
} }
uni.navigateBack(); uni.navigateBack();
}; };
@@ -191,7 +214,7 @@ page {
.df; .df;
>view:first-child { >view:first-child {
width: 190rpx; width: 240rpx;
height: 84rpx; height: 84rpx;
line-height: 84rpx; line-height: 84rpx;
// text-align: left; // text-align: left;
@@ -233,10 +256,12 @@ page {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.tips-wrap { .tips-wrap {
--pColor: #e6a23c; --pColor: #e6a23c;
--iColor: #fdf6ec; --iColor: #fdf6ec;
padding: 0 28upx; padding: 0 28upx;
.content { .content {
display: flex; display: flex;
align-items: center; align-items: center;
@@ -248,10 +273,12 @@ page {
flex-direction: column; flex-direction: column;
padding-left: 10px; padding-left: 10px;
gap: 8upx; gap: 8upx;
.t1 { .t1 {
font-size: 32upx; font-size: 32upx;
color: var(--pColor); color: var(--pColor);
} }
.t2 { .t2 {
font-size: 24upx; font-size: 24upx;
color: var(--pColor); color: var(--pColor);
@@ -259,13 +286,16 @@ page {
} }
} }
} }
.form-wrap { .form-wrap {
padding: 28upx 28upx 0; padding: 28upx 28upx 0;
.form { .form {
padding: 28upx; padding: 28upx;
background-color: #fff; background-color: #fff;
border-radius: 16upx; border-radius: 16upx;
} }
.row { .row {
height: 84upx; height: 84upx;
display: flex; display: flex;
@@ -273,13 +303,16 @@ page {
align-items: center; align-items: center;
background-color: #fcfcfc; background-color: #fcfcfc;
padding: 0 20upx; padding: 0 20upx;
&:not(:last-child) { &:not(:last-child) {
margin-bottom: 28upx; margin-bottom: 28upx;
} }
.label { .label {
font-size: 32upx; font-size: 32upx;
color: #333; color: #333;
} }
.ipt { .ipt {
flex: 1; flex: 1;
} }

View File

@@ -12,25 +12,25 @@
<view> <view>
<view> <text style="color: red;">*</text> 入库时间 </view> <view> <text style="color: red;">*</text> 入库时间 </view>
<view> <view>
<up-datetime-picker <up-datetime-picker hasInput v-model="datas.form.inOutDate" mode="date"></up-datetime-picker>
hasInput
v-model="datas.form.inOutDate"
mode="date"
></up-datetime-picker>
</view> </view>
</view> </view>
<view> <view>
<view> <text style="color: red;">*</text> 入库数量 </view> <view> <text style="color: red;">*</text> 入库数量 </view>
<view> <input type="number" placeholder="请输入数量" v-model="datas.form.bodyList.inOutNumber" @change="datas.form.bodyList.inOutNumber = $utils.isNumber(datas.form.bodyList.inOutNumber)" name="" id=""> </view> <view> <input type="number" placeholder="请输入数量" v-model="datas.form.bodyList.inOutNumber"
@change="datas.form.bodyList.inOutNumber = $utils.isNumber(datas.form.bodyList.inOutNumber)"
name="" id=""> </view>
</view> </view>
<view> <view>
<view> <text style="color: red;">*</text>单价 </view> <view> <text style="color: red;">*</text>单价 </view>
<view> <input type="number" placeholder="请输入单价(元)" v-model="datas.form.bodyList.purchasePrice" @change="datas.form.bodyList.purchasePrice = $utils.isMoney(datas.form.bodyList.purchasePrice)" name="" id=""> </view> <view> <input type="number" placeholder="请输入单价(元)" v-model="datas.form.bodyList.purchasePrice"
@change="datas.form.bodyList.purchasePrice = $utils.isMoney(datas.form.bodyList.purchasePrice)"
name="" id=""> </view>
</view> </view>
<view style="justify-content: space-between;"> <view style="justify-content: space-between;">
<view> 单位 </view> <view> 单位 </view>
<view> <input type="text" placeholder="请输入单位" v-model="datas.form.bodyList.conUnit" name="" id=""> </view> <view> <input type="text" placeholder="请输入单位" v-model="datas.form.bodyList.conUnit" name="" id="">
</view>
</view> </view>
<view> <view>
<view> 应付金额 </view> <view> 应付金额 </view>
@@ -43,7 +43,8 @@
<view style="justify-content: space-between;align-items: center;"> <view style="justify-content: space-between;align-items: center;">
<view> 供应商 </view> <view> 供应商 </view>
<picker @change="changeNowStatusIndex" :value="nowStatusIndex" :range="datas.status"> <picker @change="changeNowStatusIndex" :value="nowStatusIndex" :range="datas.status">
<view class="color-333" style="height: 84rpx;line-height: 84rpx;">{{datas.status[nowStatusIndex]}}</view> <view class="color-333" style="height: 84rpx;line-height: 84rpx;">{{datas.status[nowStatusIndex]}}
</view>
</picker> </picker>
<uni-icons type="bottom" size="16"></uni-icons> <uni-icons type="bottom" size="16"></uni-icons>
<view style="color: #318AFE;width: 80rpx;text-align: center;" @tap="toggle"> 新增 </view> <view style="color: #318AFE;width: 80rpx;text-align: center;" @tap="toggle"> 新增 </view>
@@ -64,13 +65,24 @@
<script setup> <script setup>
import { ref, computed, reactive } from 'vue'; import {
import { onShow, onLoad } from '@dcloudio/uni-app'; ref,
computed,
reactive
} from 'vue';
import {
onShow,
onLoad
} from '@dcloudio/uni-app';
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { getVendorPage } from '@/http/api/vendor.js'; import {
import { consStockIn } from '@/http/api/cons.js'; getVendorPage
} from '@/http/api/vendor.js';
import {
consStockIn
} from '@/http/api/cons.js';
let showStatus = ref(false) let showStatus = ref(false)
let datas = reactive({ let datas = reactive({
@@ -157,10 +169,11 @@
datas.form.bodyList.conId = datas.item.id datas.form.bodyList.conId = datas.item.id
datas.form.bodyList = [datas.form.bodyList] datas.form.bodyList = [datas.form.bodyList]
datas.form.inOutDate = dayjs(datas.form.inOutDate).format('YYYY-MM-DD') datas.form.inOutDate = dayjs(datas.form.inOutDate).format('YYYY-MM-DD')
consStockIn({ consStockIn({
...datas.form, ...datas.form,
// 供应商id // 供应商id
vendorId: datas.list[nowStatusIndex.value].id, vendorId: datas.list[nowStatusIndex.value]?datas.list[nowStatusIndex.value].id:'',
amountPayable: datas.form.bodyList[0].inOutNumber * datas.form.bodyList[0].purchasePrice, amountPayable: datas.form.bodyList[0].inOutNumber * datas.form.bodyList[0].purchasePrice,
}).then(res => { }).then(res => {
uni.$utils.showToast("保存成功") uni.$utils.showToast("保存成功")
@@ -194,9 +207,11 @@
list-style: none; list-style: none;
padding: 0; padding: 0;
} }
::v-deep.u-input { ::v-deep.u-input {
border: none !important; border: none !important;
} }
.status { .status {
margin: 0 32rpx; margin: 0 32rpx;
position: absolute; position: absolute;

View File

@@ -31,7 +31,7 @@
<view> 领券后{{ item.validDays }}天过期 </view> <view> 领券后{{ item.validDays }}天过期 </view>
</view> </view>
<view class="JQclass"> <view class="JQclass">
<image :src="'/static/coupon/qrcode.svg'" mode="scaleToFill" /> <image :src="qrcode" mode="scaleToFill" />
</view> </view>
</view> </view>
<view class="couponContentListcontent2"> <view class="couponContentListcontent2">
@@ -69,6 +69,7 @@
</template> </template>
<script setup> <script setup>
import {qrcode} from '@/data/icon.js'
import { reactive, ref } from 'vue'; import { reactive, ref } from 'vue';
import { onShow } from '@dcloudio/uni-app'; import { onShow } from '@dcloudio/uni-app';
import go from '@/commons/utils/go.js' import go from '@/commons/utils/go.js'

View File

@@ -42,6 +42,7 @@ async function getProductListAjax() {
mask: true mask: true
}); });
const res = await getProductList(); const res = await getProductList();
console.log('res',res);
list.value = res; list.value = res;
} catch (error) { } catch (error) {
console.log(error); console.log(error);

View File

@@ -0,0 +1,300 @@
<template>
<view class="page-gray color-333 u-font-28">
<view class="block">
<picker-item title="打印机品牌" required v-model="form.contentType" :modelValue="form.contentType"
:list="pageData.brandList"></picker-item>
<picker-item title="小票打印" required v-model="form.subType" :modelValue="form.subType"
:list="pageData.receiptsList"></picker-item>
<picker-item title="类型" required v-model="form.connectionType" :modelValue="form.connectionType"
:list="pageData.connectionTypeList"></picker-item>
<view class="u-p-b-14 u-m-b-24 border-bottom">
<view class="title"><span style="color: red;">*</span>打印机名称</view>
<view class="">
<uni-easyinput :inputBorder="false" :padding-none="true" v-model="form.name"
placeholder="设置打印机名称"></uni-easyinput>
</view>
</view>
<view class="u-p-b-14 u-m-b-24 border-bottom">
<view class="title"><span style="color: red;">*</span>打印机编号</view>
<view class="">
<uni-easyinput :inputBorder="false" :padding-none="true" v-model="form.address"
placeholder="设置打印机编号"></uni-easyinput>
</view>
</view>
<view class="u-p-b-14 u-m-b-24 border-bottom">
<view class="title">打印机密钥</view>
<view class="">
<uni-easyinput :inputBorder="false" :padding-none="true" v-model="form.port"
placeholder="设置打印机密钥"></uni-easyinput>
</view>
</view>
<view class="u-p-b-24 u-m-b-24 border-bottom">
<view class="title">小票尺寸</view>
<view class="u-m-t-16">
<radio-group class="u-flex u-flex-wrap" @change="sizeChange($event,'receiptSize')">
<label class="radio u-m-r-60" v-for="(item,index) in pageData.deciveSizeList" :key="index">
<radio :value="item.value" :checked="form.receiptSize == item.value" class="scale7" />
<text>{{item.label}}</text>
</label>
</radio-group>
</view>
</view>
<view class="u-p-b-24 u-m-b-24 border-bottom">
<view class="title">分类打印 </view>
<view class="u-m-t-16">
<radio-group class="u-flex u-flex-wrap" @change="sizeChange($event,'classifyPrint')">
<label class="radio u-m-r-60" v-for="(item,index) in pageData.classifyPrintList" :key="index">
<radio :value="item.value" :checked="form.classifyPrint == item.value" class="scale7" />
<text>{{item.label}}</text>
</label>
</radio-group>
</view>
</view>
<view class="u-p-b-24 u-m-b-24 border-bottom" v-if="form.classifyPrint ==1">
<view class="title">部分打印</view>
<view class="u-m-t-16" style="display: flex;">
<up-checkbox-group v-model="form.selectcheckbox">
<up-checkbox v-for="item in pageData.partList" :key="item.id" :customStyle="{marginBottom: '16rpx',marginRight: '20rpx'}"
:label="item.name" :name="item.id" style="margin-right: 40rpx;font-size: 28rpx;">
</up-checkbox>
</up-checkbox-group>
</view>
</view>
<view class="u-p-b-24 u-m-b-24 border-bottom">
<view class="title">打印数量</view>
<view class="u-m-t-16">
<radio-group class="u-flex u-flex-wrap" @change="sizeChange($event,'printQty')">
<label class="radio u-m-r-60" v-for="(item,index) in pageData.printQtyList" :key="index">
<radio :value="item.value" :checked="form.printQty == item.value" class="scale7" />
<text>{{item.label}}</text>
</label>
</radio-group>
</view>
</view>
<view class="u-p-b-24 u-m-b-24 border-bottom">
<view class="title">打印方式</view>
<view class="u-m-t-16">
<radio-group class="u-flex u-flex-wrap" @change="sizeChange($event,'printMethod')">
<label class="radio u-m-r-60" v-for="(item,index) in pageData.printMethodList" :key="index">
<radio :value="item.value" :checked="form.printMethod == item.value" class="scale7" />
<text>{{item.label}}</text>
</label>
</radio-group>
</view>
</view>
<view class="u-p-b-24 u-m-b-24 border-bottom">
<view class="title">打印类型</view>
<view class="u-m-t-16" style="display: flex;">
<up-checkbox-group v-model="form.printType">
<up-checkbox v-for="(item,index) in pageData.printTypeList" :key="index" :customStyle="{marginBottom: '16rpx',marginRight:'40rpx'}" :label="item.label" :name="item.value" ></up-checkbox>
</up-checkbox-group>
</view>
</view>
<view class="u-p-b-24 u-flex u-row-between u-m-b-24 border-bottom">
<view class="title">打印机状态</view>
<view class="">
<my-switch v-model="form.status"></my-switch>
</view>
</view>
</view>
<view style="height: 60rpx;"></view>
<view class="">
<view class="btn">
<my-button shape="circle" @click="save">保存</my-button>
</view>
</view>
</view>
</template>
<script setup>
import { ref, reactive } from 'vue';
import { onLoad } from '@dcloudio/uni-app'
import go from '@/commons/utils/go.js';
import pickerItem from './components/picker-item.vue';
import myRadioGroup from './components/my-radio-group.vue';
import { devices, subTypes, brand, receipts,connectionType } from '@/pagePrinter/devices.js'
import { getPrinterDetail, addPrinter, updatePrinter } from '@/http/api/printer.js'
import { categoryPage } from '@/http/api/cateGory.js'
const pageData = reactive({
brandList: brand, // 打印机品牌列表
receiptsList: receipts, // 小票
connectionTypeList: connectionType, // 类型
deciveSizeList: [ // 小票尺寸
{ label: '58mm', value: '58mm' },
{ label: '80mm', value: '80mm' },
],
classifyPrintList: [ // 分类打印
{ label: '打印所有', value: '0' },
{ label: '部分分类(仅打印制作单[厨房])', value: '1' },
],
printQtyList: [ // 打印数量
{ label: '顾客联+商家联「2张」', value: 'c1m1^2' },
{ label: '只打印商家联「1张」', value: 'm1^1' },
{ label: '只打印顾客联「1张」', value: 'c1^1' },
{ label: '2张顾客联+1张商家联「3张」', value: 'c2m1^3' },
],
printMethodList: [ // 打印方式
{ label: '打印全部', value: 'all' },
{ label: '仅打印制作单「厨房」', value: 'one' },
{ label: '仅打印结账单「前台」', value: 'normal' },
],
printTypeList: [ // 打印类型
{ label: '确认退款单', value: 'refund' },
{ label: '交班单', value: 'handover' },
{ label: '排队取号', value: 'queue' },
],
partList: [], // 部分打印
})
let form = reactive({
id: null,
sort: "0",
status: 1,
contentType: '',
subType: '',
connectionType: "network",
printType: [],
name: '',
receiptSize: '58mm',
classifyPrint: '0',
printQty: 'm1^1',
printMethod: "all",
selectcheckbox:[]
})
onLoad((options) => {
getlist()
if (options.id) {
getdetails(options.id)
} else {
}
// Object.assign(option, opt)
})
/**
* 获取商品分类列表
*/
let getlist = async () => {
const res = await categoryPage({
page: 1,
size: 500
})
let arr = []
res.records.forEach(ele => {
arr.push({
id: ele.id,
name: ele.name
})
})
pageData.partList = arr
}
/**
* 获取打印机详情
*/
async function getdetails(id) {
const res = await getPrinterDetail({id: id})
if (res.categoryList) {
let arrs = []
res.categoryList.forEach(eles => {
arrs.push(eles)
})
res.selectcheckbox = arrs
}
form = Object.assign(form, res)
if(form.printType)form.printType = JSON.parse(form.printType)
}
function sizeChange(e, name) {
form[name] = e.detail.value
}
/**
* 保存
*/
async function save() {
// 效验
if (!form.contentType || !form.subType || !form.name || !form.address) {
uni.$utils.showToast("请输入必填项")
return
}
if (form.classifyPrint == 1 && form.selectcheckbox.length == 0) {
uni.$utils.showToast("请选择部分分类")
return
}
// 部分分类处理
if (form.classifyPrint == 1) {
let idstr = ''
let arr = []
form.selectcheckbox.forEach(element => {
idstr += element + ','
arr.push(pageData.partList.filter(ele => ele.id == element)[0])
})
console.log(form.selectcheckbox)
form.categoryIds = idstr.substring(0, idstr.length - 1)
form.categoryIds = JSON.stringify(form.selectcheckbox)
form.categoryList = JSON.stringify(arr)
}
delete form.selectcheckbox;
form.printType = JSON.stringify(form.printType)
if (form.id) {
delete form.createdAt
delete form.updatedAt
const res = updatePrinter({
...form
})
} else {
const res = addPrinter({
...form
})
}
go.back()
}
</script>
<style lang="scss" scoped>
.page-gray {
padding: 32rpx 28rpx;
}
.block {
background-color: #fff;
padding: 32rpx 24rpx;
border-radius: 18rpx;
margin-bottom: 32rpx;
box-shadow: 0 0 5px #eee;
}
.title {
font-weight: 700;
}
.radio {
display: flex;
align-items: center;
}
.fixed_b {
left: 30rpx;
right: 30rpx;
bottom: calc(env(safe-area-inset-bottom) + 10rpx);
/* #ifdef H5 */
bottom: 30rpx;
/* #endif */
}
</style>

View File

@@ -1,31 +1,60 @@
<template> <template>
<view class="page-gray color-333 u-font-28"> <view class="page-gray color-333 u-font-28">
<view class="block"> <view class="block">
<picker-item title="打印机品牌" required v-model="form.contentType" :modelValue="form.contentType"
:list="pageData.brandList"></picker-item>
<picker-item title="小票打印" required v-model="form.subType" :modelValue="form.subType"
:list="pageData.receiptsList"></picker-item>
<picker-item title="类型" required v-model="form.connectionType" :modelValue="form.connectionType"
:list="pageData.connectionTypeList"></picker-item>
<view class="u-p-b-14 u-m-b-24 border-bottom"> <view class="u-p-b-14 u-m-b-24 border-bottom">
<view class="title"><span style="color: red;">*</span>打印机名称</view> <view class="title"><span style="color: red;">*</span>设备名称</view>
<view class=""> <view class="">
<uni-easyinput :inputBorder="false" :padding-none="true" v-model="form.name" <uni-easyinput :inputBorder="false" :padding-none="true" v-model="form.name"
placeholder="设置打印机名称"></uni-easyinput> placeholder="设名称"></uni-easyinput>
</view> </view>
</view> </view>
<view class="u-p-b-14 u-m-b-24 border-bottom"> <view class="u-p-b-14 u-m-b-24 border-bottom">
<view class="title"><span style="color: red;">*</span>打印机编号</view> <view class="title"><span style="color: red;">*</span>设备类型</view>
<view class="u-m-t-16">
<up-radio-group v-model="form.connectionType">
<up-radio v-for="(item,index) in pageData.connectionTypeList" :key="index" :label="item.name"
:name="item.value"></up-radio>
</up-radio-group>
</view>
</view>
<view class="u-p-b-14 u-m-b-24 border-bottom">
<view class="title"><span style="color: red;">*</span>小票类型</view>
<view class="u-m-t-16">
<up-radio-group v-model="form.printType ">
<up-radio v-for="(item,index) in pageData.receiptsList" :key="index" :label="item.name"
:name="item.value"></up-radio>
</up-radio-group>
</view>
</view>
<view class="u-p-b-14 u-m-b-24 border-bottom">
<view class="title"><span style="color: red;">*</span>打印机品牌</view>
<view class="u-m-t-16">
<up-radio-group v-model="form.brand">
<up-radio v-for="(item,index) in pageData.brandList" :key="index" :label="item.name"
:name="item.value"></up-radio>
</up-radio-group>
</view>
</view>
<view class="u-p-b-14 u-m-b-24 border-bottom">
<view class="title"><span style="color: red;">*</span>ip地址/MAC地址</view>
<view class=""> <view class="">
<uni-easyinput :inputBorder="false" :padding-none="true" v-model="form.address" <uni-easyinput :inputBorder="false" :padding-none="true" v-model="form.address"
placeholder="设置打印机编号"></uni-easyinput> placeholder="ip地址/MAC地址"></uni-easyinput>
</view> </view>
</view> </view>
<view class="u-p-b-14 u-m-b-24 border-bottom"> <view class="u-p-b-14 u-m-b-24 border-bottom">
<view class="title">打印机密钥</view> <view class="title">端口</view>
<view class=""> <view class="">
<uni-easyinput :inputBorder="false" :padding-none="true" v-model="form.port" <uni-easyinput :inputBorder="false" :padding-none="true" v-model="form.port"
placeholder="设置打印机密钥"></uni-easyinput> placeholder="端口"></uni-easyinput>
</view> </view>
</view> </view>
<view class="u-p-b-24 u-m-b-24 border-bottom"> <view class="u-p-b-24 u-m-b-24 border-bottom">
@@ -39,63 +68,73 @@
</radio-group> </radio-group>
</view> </view>
</view> </view>
<view class="u-p-b-14 u-m-b-24 border-bottom">
<view class="title"><span style="color: red;">*</span>打印数量</view>
<view class="u-m-t-16">
<up-number-box input-width="100" v-model="form.printNum"></up-number-box>
</view>
</view>
<view class="u-p-b-14 u-m-b-24 border-bottom">
<view class="title">打印内容</view>
<view class="u-m-t-16">
<view v-for="(pItem,pIndex) in printTypeList" :key="pIndex" class="u-m-b-16">
<view>{{pItem.label}}</view>
<view class="u-m-t-6">
<up-checkbox-group v-model="printContentType[pIndex]">
<up-checkbox :customStyle="{marginBottom: '16rpx',marginRight: '30rpx'}"
v-for="(item,index) in pItem.list" :key="index" :label="item.label"
:name="item.value"></up-checkbox>
</up-checkbox-group>
</view>
</view>
</view>
</view>
<view class="u-p-b-24 u-m-b-24 border-bottom"> <view class="u-p-b-24 u-m-b-24 border-bottom">
<view class="title">分类打印 </view> <view class="title">分类打印 </view>
<view class="u-m-t-16"> <view class="u-m-t-16">
<radio-group class="u-flex u-flex-wrap" @change="sizeChange($event,'classifyPrint')"> <!-- <radio-group class="u-flex u-flex-wrap" @change="sizeChange($event,'classifyPrint')">
<label class="radio u-m-r-60" v-for="(item,index) in pageData.classifyPrintList" :key="index"> <label class="radio u-m-r-60" v-for="(item,index) in pageData.classifyPrintList" :key="index">
<radio :value="item.value" :checked="form.classifyPrint == item.value" class="scale7" /> <radio :value="item.value" :checked="form.classifyPrint == item.value"
:disabled="returnClassifyPrintDisabled(item)" class="scale7" />
<text>{{item.label}}</text> <text>{{item.label}}</text>
</label> </label>
</radio-group> </radio-group> -->
<up-radio-group v-model="form.classifyPrint" placement="column">
<up-radio v-for="(item,index) in pageData.classifyPrintList" :key="index" :label="item.label"
:disabled="returnClassifyPrintDisabled(item)" :name="item.value"></up-radio>
</up-radio-group>
</view> </view>
</view> </view>
<view class="u-p-b-24 u-m-b-24 border-bottom" v-if="form.classifyPrint ==1"> <view class="u-p-b-24 u-m-b-24 border-bottom" v-if="form.classifyPrint ==1">
<view class="title">部分打印</view> <view class="title">部分打印</view>
<view class="u-m-t-16" style="display: flex;"> <view class="u-m-t-16" style="display: flex;">
<up-checkbox-group v-model="form.selectcheckbox"> <up-checkbox-group v-model="form.categoryIds">
<up-checkbox v-for="item in pageData.partList" :key="item.id" :customStyle="{marginBottom: '16rpx',marginRight: '20rpx'}" <up-checkbox v-for="item in pageData.partList" :key="item.id"
:label="item.name" :name="item.id" style="margin-right: 40rpx;font-size: 28rpx;"> :customStyle="{marginBottom: '16rpx',marginRight: '20rpx'}" :label="item.name"
:name="item.id" style="margin-right: 40rpx;font-size: 28rpx;">
</up-checkbox> </up-checkbox>
</up-checkbox-group> </up-checkbox-group>
</view> </view>
</view> </view>
<view class="u-p-b-24 u-m-b-24 border-bottom">
<view class="title">打印数量</view>
<view class="u-m-t-16">
<radio-group class="u-flex u-flex-wrap" @change="sizeChange($event,'printQty')">
<label class="radio u-m-r-60" v-for="(item,index) in pageData.printQtyList" :key="index">
<radio :value="item.value" :checked="form.printQty == item.value" class="scale7" />
<text>{{item.label}}</text>
</label>
</radio-group>
</view>
</view>
<view class="u-p-b-24 u-m-b-24 border-bottom">
<view class="title">打印方式</view>
<view class="u-m-t-16">
<radio-group class="u-flex u-flex-wrap" @change="sizeChange($event,'printMethod')">
<label class="radio u-m-r-60" v-for="(item,index) in pageData.printMethodList" :key="index">
<radio :value="item.value" :checked="form.printMethod == item.value" class="scale7" />
<text>{{item.label}}</text>
</label>
</radio-group>
</view>
</view>
<view class="u-p-b-24 u-flex u-row-between u-m-b-24 border-bottom">
<view class="u-p-b-24 u-m-b-24 border-bottom"> <view class="title">媒体音量</view>
<view class="title">打印类型</view> <view class="">
<view class="u-m-t-16" style="display: flex;"> <my-switch v-model="form.volumeSwitch"></my-switch>
<up-checkbox-group v-model="form.printType">
<up-checkbox v-for="(item,index) in pageData.printTypeList" :key="index" :customStyle="{marginBottom: '16rpx',marginRight:'40rpx'}" :label="item.label" :name="item.value" ></up-checkbox>
</up-checkbox-group>
</view> </view>
</view> </view>
<view class="u-p-b-24 u-flex u-row-between u-m-b-24 border-bottom"> <view class="u-p-b-24 u-flex u-row-between u-m-b-24 border-bottom">
<view class="title">打印机状态</view> <view class="title">启用状态</view>
<view class=""> <view class="">
<my-switch v-model="form.status"></my-switch> <my-switch v-model="form.status"></my-switch>
</view> </view>
@@ -116,43 +155,116 @@
</template> </template>
<script setup> <script setup>
import { ref, reactive } from 'vue'; import {
import { onLoad } from '@dcloudio/uni-app' ref,
reactive,
watch
} from 'vue';
import {
onLoad
} from '@dcloudio/uni-app'
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
import pickerItem from './components/picker-item.vue'; import pickerItem from './components/picker-item.vue';
import myRadioGroup from './components/my-radio-group.vue'; import myRadioGroup from './components/my-radio-group.vue';
import { devices, subTypes, brand, receipts,connectionType } from '@/pagePrinter/devices.js' import {
import { getPrinterDetail, addPrinter, updatePrinter } from '@/http/api/printer.js' devices,
import { categoryPage } from '@/http/api/cateGory.js' subTypes,
brand,
receipts,
connectionType,
printTypeList
} from '@/pagePrinter/devices.js'
import {
getPrinterDetail,
addPrinter,
updatePrinter,
} from '@/http/api/printer.js'
import {
categoryPage
} from '@/http/api/cateGory.js'
// 判断是否可选部分分类打印
function returnClassifyPrintDisabled(item) {
if (item.label != '打印所有') {
if (printContentType.value[1].length <= 0) {
return true
} else {
return false
}
}
return false
}
const pageData = reactive({ const pageData = reactive({
brandList: brand, // 打印机品牌列表 brandList: brand, // 打印机品牌列表
receiptsList: receipts, // 小票 receiptsList: receipts, // 小票
connectionTypeList: connectionType, // 类型 connectionTypeList: connectionType, // 类型
deciveSizeList: [ // 小票尺寸 deciveSizeList: [ // 小票尺寸
{ label: '58mm', value: '58mm' }, {
{ label: '80mm', value: '80mm' }, label: '58mm',
value: '58mm'
},
{
label: '80mm',
value: '80mm'
},
], ],
classifyPrintList: [ // 分类打印 classifyPrintList: [ // 分类打印
{ label: '打印所有', value: '0' }, {
{ label: '部分分类(仅打印制作单[厨房])', value: '1' }, label: '打印所有',
value: '0'
},
{
label: '部分分类(仅打印制作单[厨房])',
value: '1'
},
], ],
printQtyList: [ // 打印数量 printQtyList: [ // 打印数量
{ label: '顾客联+商家联「2张」', value: 'c1m1^2' }, {
{ label: '只打印商家联「1张」', value: 'm1^1' }, label: '顾客联+商家联「2张」',
{ label: '只打印顾客联「1张」', value: 'c1^1' }, value: 'c1m1^2'
{ label: '2张顾客联+1张商家联「3张」', value: 'c2m1^3' }, },
{
label: '只打印商家联「1张」',
value: 'm1^1'
},
{
label: '只打印顾客联「1张」',
value: 'c1^1'
},
{
label: '2张顾客联+1张商家联「3张」',
value: 'c2m1^3'
},
], ],
printMethodList: [ // 打印方式 printMethodList: [ // 打印方式
{ label: '打印全部', value: 'all' }, {
{ label: '打印制作单「厨房」', value: 'one' }, label: '打印全部',
{ label: '仅打印结账单「前台」', value: 'normal' }, value: 'all'
},
{
label: '仅打印制作单「厨房」',
value: 'one'
},
{
label: '仅打印结账单「前台」',
value: 'normal'
},
], ],
printTypeList: [ // 打印类型 printTypeList: [ // 打印类型
{ label: '确认退款单', value: 'refund' }, {
{ label: '交班单', value: 'handover' }, label: '确认退款单',
{ label: '排队取号', value: 'queue' }, value: 'refund'
},
{
label: '交班单',
value: 'handover'
},
{
label: '排队取号',
value: 'queue'
},
], ],
partList: [], // 部分打印 partList: [], // 部分打印
}) })
@@ -160,26 +272,32 @@
let form = reactive({ let form = reactive({
id: null, id: null,
sort: "0", sort: "0",
volumeSwitch: 1,
status: 1, status: 1,
contentType: '', brand: '',
subType: '', subType: 'cash',
connectionType: "network", connectionType: "云打印",
printType: [], categoryIds:[],
name: '', name: '',
receiptSize: '58mm', receiptSize: '58mm',
classifyPrint: '0', classifyPrint: '0',
printQty: 'm1^1', printQty: 'm1^1',
printMethod: "all", printMethod: "all",
selectcheckbox:[] printContentType: []
})
const printContentType = ref(printTypeList.map(v => []))
watch(() => printContentType.value, (newval, oldval) => {
if (newval[0].length <= 0) {
form.classifyPrint = '0'
}
}, {
deep: true
}) })
onLoad((options) => { onLoad((options) => {
getlist() getlist()
if (options.id) { if (options.id) {
getdetails(options.id) getdetails(options.id)
} else { } else {}
}
// Object.assign(option, opt) // Object.assign(option, opt)
}) })
@@ -205,17 +323,19 @@
* 获取打印机详情 * 获取打印机详情
*/ */
async function getdetails(id) { async function getdetails(id) {
const res = await getPrinterDetail({id: id}) const res = await getPrinterDetail({
if (res.categoryList) { id: id
let arrs = []
res.categoryList.forEach(eles => {
arrs.push(eles)
}) })
res.selectcheckbox = arrs
}
form = Object.assign(form, res)
if(form.printType)form.printType = JSON.parse(form.printType)
res.categoryIds = res.categoryIds.split(',').filter(v => v);
form = Object.assign(form, res)
const arr = res.printContentType.split(',')
printContentType.value = printTypeList.map(v => {
const listValues = v.list.map(listitem => listitem.value)
const selArr = listValues.filter(listItem => arr.includes(listItem))
return selArr
})
console.log(printContentType.value);
} }
@@ -228,43 +348,30 @@
*/ */
async function save() { async function save() {
// 效验 // 效验
if (!form.contentType || !form.subType || !form.name || !form.address) { if (!form.brand || !form.printType || !form.name || !form.address) {
uni.$utils.showToast("请输入必填项") uni.$utils.showToast("请输入必填项")
return return
} }
if (form.classifyPrint == 1 && form.selectcheckbox.length == 0) { if (form.classifyPrint == 1 && form.categoryIds.length == 0) {
uni.$utils.showToast("请选择部分分类") uni.$utils.showToast("请选择部分分类")
return return
} }
// 部分分类处理 console.log('form',form);
if (form.classifyPrint == 1) { const submitJson = {
let idstr = '' ...form,
let arr = [] categoryIds: form.classifyPrint == 0 ? '' : form.categoryIds.join(','),
form.selectcheckbox.forEach(element => { printContentType: printContentType.value.flat().join(',')
idstr += element + ','
arr.push(pageData.partList.filter(ele => ele.id == element)[0])
})
console.log(form.selectcheckbox)
form.categoryIds = idstr.substring(0, idstr.length - 1)
form.categoryIds = JSON.stringify(form.selectcheckbox)
form.categoryList = JSON.stringify(arr)
} }
delete form.selectcheckbox; console.log(submitJson);
form.printType = JSON.stringify(form.printType)
if (form.id) { if (form.id) {
delete form.createdAt delete form.createdAt
delete form.updatedAt delete form.updatedAt
const res = updatePrinter({ const res = updatePrinter(submitJson)
...form
})
} else { } else {
const res = addPrinter({ const res = addPrinter(submitJson)
...form
})
} }
go.back() go.back()
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@@ -11,10 +11,10 @@ export const receipts = [{
value: 'label', value: 'label',
name: '标签' name: '标签'
}, },
{ // {
value: 'kitchen', // value: 'kitchen',
name: '出品' // name: '出品'
}, // },
{ {
value: 'cash', value: 'cash',
name: '小票' name: '小票'
@@ -66,11 +66,89 @@ export const connectionType = [{
name: 'USB' name: 'USB'
}, },
{ {
value: '蓝牙', value: '云打印',
name: '蓝牙' name: '云打印'
}, },
{ {
value: '网', value: '局域网',
name: '网' name: '局域网'
}
]
export const printTypeList = [{
label: '前台',
list: [{
label: '客看单',
value: 'GUEST_ORDER'
},
{
label: '预结算单',
value: 'PRE_ORDER'
},
{
label: '结算单',
value: 'ORDER'
},
{
label: '退菜单',
value: 'RETURN_ORDER'
},
{
label: '退款单',
value: 'REFUND_ORDER'
},
]
},
{
label: '后厨',
list: [{
label: '后厨-整单',
value: 'ALL_KITCHEN'
},
{
label: '后厨-分单',
value: 'ONLY_KITCHEN'
},
{
label: '后厨-退菜单',
value: 'REFUND_KITCHEN'
},
]
},
{
label: '其它',
list: [{
label: '交班单',
value: 'HANDOVER'
},
{
label: '排队取号',
value: 'CALL'
},
{
label: '储值单',
value: 'RECHARGE'
},
{
label: '入库单',
value: 'STOCK'
},
{
label: '盘点单',
value: 'STOCK_CHECK'
},
{
label: '商品报表',
value: 'PRODUCT_REPORT'
},
{
label: '经营日报',
value: 'DAY_REPORT'
},
{
label: '日结单',
value: 'DAY_ORDER'
},
]
} }
] ]

View File

@@ -4,15 +4,16 @@
<my-tabs :list="tabsList" v-model="tabsCurrent"></my-tabs> <my-tabs :list="tabsList" v-model="tabsCurrent"></my-tabs>
</up-sticky> </up-sticky>
<view class="box"> <view class="box">
<template v-if="tabsCurrent === 0"> <view class="basic" v-show="tabsCurrent === 0">
<view class="basic"> <uni-forms :model="FormData" :rules="rules" :border="true" label-position="top"
<uni-forms :model="FormData" :rules="rules" :border="true" label-position="top" err-show-type="toast" validateTrigger="submit" label-width="350" ref="Forms"> err-show-type="toast" validateTrigger="submit" label-width="350" ref="Forms">
<view class="block"> <view class="block">
<view class="border-top-0 typeEnum"> <view class="border-top-0 typeEnum">
<uni-forms-item label="商品类型" required showRequired> <uni-forms-item label="商品类型" required showRequired>
<up-radio-group v-model="FormData.type" @change="changeFormDatatype"> <up-radio-group v-model="FormData.type" @change="changeFormDatatype">
<view style="display: flex; flex-wrap: wrap; justify-content: flex-start"> <view style="display: flex; flex-wrap: wrap; justify-content: flex-start">
<view v-for="(item, index) in pageData.types" :key="index" style="margin-right: 30rpx"> <view v-for="(item, index) in pageData.types" :key="index"
style="margin-right: 30rpx">
<up-radio :label="item.name" :name="item.value"></up-radio> <up-radio :label="item.name" :name="item.value"></up-radio>
</view> </view>
</view> </view>
@@ -23,65 +24,45 @@
<view class="" v-if="FormData.type === 'package'"> <view class="" v-if="FormData.type === 'package'">
<uni-forms-item label="套餐商品"> <uni-forms-item label="套餐商品">
<up-radio-group v-model="FormData.groupType" placement="row"> <up-radio-group v-model="FormData.groupType" placement="row">
<up-radio <up-radio :custom-style="{ marginRight: '30px' }"
:custom-style="{ marginRight: '30px' }" v-for="(item, index) in packageType.list" :key="index" :label="item.name"
v-for="(item, index) in packageType.list" :name="item.value"></up-radio>
:key="index"
:label="item.name"
:name="item.value"
></up-radio>
</up-radio-group> </up-radio-group>
</uni-forms-item> </uni-forms-item>
</view> </view>
<uni-forms-item required name="name" label="商品名称" showRequired> <uni-forms-item required name="name" label="商品名称" showRequired>
<uni-easyinput <uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
:paddingNone="inputPaddingNone" :inputBorder="inputBorder" v-model="FormData.name" placeholder="请输入商品名称" />
:placeholderStyle="placeholderStyle"
:inputBorder="inputBorder"
v-model="FormData.name"
placeholder="请输入商品名称"
/>
</uni-forms-item> </uni-forms-item>
<uni-forms-item ref="fileItem" label="图片" required showRequired> <uni-forms-item ref="fileItem" label="图片" required showRequired>
<my-upload-file ref="refFile" :images="FormData.images" :imageStyles="imageStyles"></my-upload-file> <my-upload-file ref="refFile" :images="FormData.images"
:imageStyles="imageStyles"></my-upload-file>
<view class="u-m-t-16 color-999 u-font-24">:第一张图为商品封面图图片尺寸为750x750</view> <view class="u-m-t-16 color-999 u-font-24">:第一张图为商品封面图图片尺寸为750x750</view>
</uni-forms-item> </uni-forms-item>
<view class="u-relative"> <view class="u-relative">
<uni-forms-item label="商品分类" required showRequired name="categoryId"> <uni-forms-item label="商品分类" required showRequired name="categoryId">
<uni-data-picker <uni-data-picker :clear-icon="false" :map="{ text: 'name', value: 'id' }"
:clear-icon="false" placeholder="请选择商品分类" popup-title="请选择商品分类" :localdata="pageData.category"
:map="{ text: 'name', value: 'id' }" v-model="FormData.categoryId"></uni-data-picker>
placeholder="请选择商品分类"
popup-title="请选择商品分类"
:localdata="pageData.category"
v-model="FormData.categoryId"
></uni-data-picker>
</uni-forms-item> </uni-forms-item>
<view class="zhezhao u-absolute position-all" @click="canEditGoodsCategory(true)" v-if="option.type == 'edit' && disabledChangeCategory"></view> <view class="zhezhao u-absolute position-all" @click="canEditGoodsCategory(true)"
v-if="option.type == 'edit' && disabledChangeCategory"></view>
</view> </view>
<view class=""> <view class="">
<uni-forms-item label="单位" required showRequired name="units"> <uni-forms-item label="单位" required showRequired name="units">
<uni-data-picker <uni-data-picker :clear-icon="false" @change="unitIdChange"
:clear-icon="false" :map="{ text: 'name', value: 'id' }" placeholder="请选择单位" popup-title="请选择单位"
@change="unitIdChange" :localdata="pageData.units" v-model="FormData.unitId"></uni-data-picker>
:map="{ text: 'name', value: 'id' }"
placeholder="请选择单位"
popup-title="请选择单位"
:localdata="pageData.units"
v-model="FormData.unitId"
></uni-data-picker>
</uni-forms-item> </uni-forms-item>
</view> </view>
<template v-if="FormData.type === 'package'"> <template v-if="FormData.type === 'package'">
<view class="border-top" v-if="FormData.proGroupVo"> <view class="border-top" v-if="FormData.proGroupVo">
<view <view class="" v-if="
class=""
v-if="
(FormData.groupType == 1 && FormData.proGroupVo.length) || (FormData.groupType == 1 && FormData.proGroupVo.length) ||
(FormData.groupType == 0 && FormData.proGroupVo.length && FormData.proGroupVo[0].goods.length) (FormData.groupType == 0 && FormData.proGroupVo.length && FormData.proGroupVo[0].goods.length)
" ">
> <view class="border-bottom u-p-b-32"
<view class="border-bottom u-p-b-32" v-for="(item, index) in FormData.proGroupVo" :key="index"> v-for="(item, index) in FormData.proGroupVo" :key="index">
<view class="u-p-t-24" v-if="FormData.groupType == 1"> <view class="u-p-t-24" v-if="FormData.groupType == 1">
<view class="u-flex u-row-between"> <view class="u-flex u-row-between">
<view class="u-flex"> <view class="u-flex">
@@ -90,14 +71,17 @@
</view> </view>
<view class="u-flex color-999" @tap="delproGroupVo(index)"> <view class="u-flex color-999" @tap="delproGroupVo(index)">
<uni-icons type="minus-filled" :size="16" :color="$utils.ColorRed"></uni-icons> <uni-icons type="minus-filled" :size="16"
:color="$utils.ColorRed"></uni-icons>
<view class="u-m-l-10">删除套餐组</view> <view class="u-m-l-10">删除套餐组</view>
</view> </view>
</view> </view>
<view class="u-flex u-m-t-16"> <view class="u-flex u-m-t-16">
<up-input v-model="item.title" placeholder="请输入套餐名称"></up-input> <up-input v-model="item.title" placeholder="请输入套餐名称"></up-input>
<view class="u-flex color-main u-font-24 u-m-l-24" @click="proGroupVoAddGoods(index, item.goods)"> <view class="u-flex color-main u-font-24 u-m-l-24"
<up-icon name="plus" :size="12" :color="$utils.ColorMain"></up-icon> @click="proGroupVoAddGoods(index, item.goods)">
<up-icon name="plus" :size="12"
:color="$utils.ColorMain"></up-icon>
<view class="font-bold">添加商品</view> <view class="font-bold">添加商品</view>
</view> </view>
</view> </view>
@@ -113,19 +97,25 @@
<view class="u-p-r-40">数量</view> <view class="u-p-r-40">数量</view>
</view> </view>
</view> </view>
<view class="u-flex row u-p-24 u-row-between" v-for="(product, goodsIndex) in item.goods" :key="goodsIndex"> <view class="u-flex row u-p-24 u-row-between"
v-for="(product, goodsIndex) in item.goods" :key="goodsIndex">
<view class="u-flex u-flex-1"> <view class="u-flex u-flex-1">
<view class=" "> <view class=" ">
{{ product.name || product.proName }} {{ product.name || product.proName }}
</view> </view>
</view> </view>
<view class="u-flex u-row-center u-flex-1"> <view class="u-flex u-row-center u-flex-1">
<view @click="refChooseGuigeOpen(product.skuList, index, goodsIndex)" class=""> <view
<template v-if="!product.skuName && product.type == 'sku'"> @click="refChooseGuigeOpen(product.skuList, index, goodsIndex)"
<up-button type="primary" size="mini">设置规格</up-button> class="">
<template
v-if="!product.skuName && product.type == 'sku'">
<up-button type="primary"
size="mini">设置规格</up-button>
</template> </template>
<template v-else> <template v-else>
<text class="color-main">{{ product.skuName }}</text> <text
class="color-main">{{ product.skuName }}</text>
</template> </template>
</view> </view>
</view> </view>
@@ -136,7 +126,8 @@
</view> </view>
<view class="u-flex u-text-right u-flex-1 u-row-right"> <view class="u-flex u-text-right u-flex-1 u-row-right">
<view class="u-flex u-p-r-30"> <view class="u-flex u-p-r-30">
<up-number-box :button-size="14" integer v-model="product.number"> <up-number-box :button-size="14" integer
v-model="product.number">
<template #minus> <template #minus>
<view class="minus"> <view class="minus">
<up-icon name="minus" size="12"></up-icon> <up-icon name="minus" size="12"></up-icon>
@@ -149,7 +140,9 @@
</template> </template>
</up-number-box> </up-number-box>
</view> </view>
<up-icon @click="proGroupVoGoodsDel(index, goodsIndex)" size="14" name="trash" :color="$utils.ColorMain"></up-icon> <up-icon @click="proGroupVoGoodsDel(index, goodsIndex)"
size="14" name="trash"
:color="$utils.ColorMain"></up-icon>
</view> </view>
</view> </view>
</view> </view>
@@ -160,20 +153,24 @@
<text class="font-bold">几选几</text> <text class="font-bold">几选几</text>
</view> </view>
<view class="u-flex u-m-t-16"> <view class="u-flex u-m-t-16">
<uni-number-box :min="1" :max="item.goods.length" :width="200" v-model="item.number" placeholder="几选几"></uni-number-box> <uni-number-box :min="1" :max="item.goods.length" :width="200"
v-model="item.number" placeholder="几选几"></uni-number-box>
</view> </view>
</template> </template>
</view> </view>
</view> </view>
<template v-if="FormData.groupType == 1"> <template v-if="FormData.groupType == 1">
<view class="bg-fff u-flex u-p-t-24 u-p-b-24 border-r-12" @tap="proGroupVoPush"> <view class="bg-fff u-flex u-p-t-24 u-p-b-24 border-r-12" @tap="proGroupVoPush">
<uni-icons type="plus-filled" :color="$utils.ColorMain" :size="20"></uni-icons> <uni-icons type="plus-filled" :color="$utils.ColorMain"
:size="20"></uni-icons>
<view class="u-m-l-16">添加套餐组</view> <view class="u-m-l-16">添加套餐组</view>
</view> </view>
</template> </template>
<template v-else> <template v-else>
<view class="bg-fff u-flex u-p-t-24 u-p-b-24 border-r-12" @tap="proGroupVoAddGoods()"> <view class="bg-fff u-flex u-p-t-24 u-p-b-24 border-r-12"
<uni-icons type="plus-filled" :color="$utils.ColorMain" :size="20"></uni-icons> @tap="proGroupVoAddGoods()">
<uni-icons type="plus-filled" :color="$utils.ColorMain"
:size="20"></uni-icons>
<view class="u-m-l-16">添加商品</view> <view class="u-m-l-16">添加商品</view>
</view> </view>
</template> </template>
@@ -182,13 +179,8 @@
<view class=""> <view class="">
<uni-forms-item label="商品描述"> <uni-forms-item label="商品描述">
<uni-easyinput <uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
:paddingNone="inputPaddingNone" type="textarea" v-model="FormData.shortTitle" placeholder="请填写商品简述" />
:placeholderStyle="placeholderStyle"
type="textarea"
v-model="FormData.shortTitle"
placeholder="请填写商品简述"
/>
</uni-forms-item> </uni-forms-item>
</view> </view>
</view> </view>
@@ -222,7 +214,8 @@
<text>原价</text> <text>原价</text>
</view> </view>
<view class="u-m-t-16"> <view class="u-m-t-16">
<price-number-box placeholder="请输入原价" v-model="sku.originPrice"></price-number-box> <price-number-box placeholder="请输入原价"
v-model="sku.originPrice"></price-number-box>
</view> </view>
</view> </view>
<view class="u-flex-1"> <view class="u-flex-1">
@@ -231,7 +224,8 @@
<text>售价</text> <text>售价</text>
</view> </view>
<view class="u-m-t-16"> <view class="u-m-t-16">
<price-number-box placeholder="请输入售价" v-model="sku.salePrice"></price-number-box> <price-number-box placeholder="请输入售价"
v-model="sku.salePrice"></price-number-box>
</view> </view>
</view> </view>
</view> </view>
@@ -242,7 +236,8 @@
<text>会员价</text> <text>会员价</text>
</view> </view>
<view class="u-m-t-16"> <view class="u-m-t-16">
<price-number-box placeholder="请输入会员价(元)" v-model="sku.memberPrice"></price-number-box> <price-number-box placeholder="请输入会员价(元)"
v-model="sku.memberPrice"></price-number-box>
</view> </view>
</view> </view>
<view class="u-flex-1"> <view class="u-flex-1">
@@ -251,7 +246,8 @@
<text>成本价</text> <text>成本价</text>
</view> </view>
<view class="u-m-t-16"> <view class="u-m-t-16">
<price-number-box placeholder="请输入成本价" v-model="sku.costPrice"></price-number-box> <price-number-box placeholder="请输入成本价"
v-model="sku.costPrice"></price-number-box>
</view> </view>
</view> </view>
</view> </view>
@@ -261,7 +257,8 @@
<text>起售数量</text> <text>起售数量</text>
</view> </view>
<view class="u-m-t-16"> <view class="u-m-t-16">
<price-number-box inputType="number" placeholder="请输入起售数量" v-model="sku.suitNum"></price-number-box> <price-number-box inputType="number" placeholder="请输入起售数量"
v-model="sku.suitNum"></price-number-box>
</view> </view>
</view> </view>
<view class="u-m-t-24"> <view class="u-m-t-24">
@@ -314,11 +311,12 @@
<uni-forms-item label=""> <uni-forms-item label="">
<view class="u-flex u-row-between"> <view class="u-flex u-row-between">
<view class="label-title">上架</view> <view class="label-title">上架</view>
<my-switch disabled :openDisabledClass="false" @click="isGroundingChange" v-model="FormData.isSale"></my-switch> <my-switch disabled :openDisabledClass="false" @click="isGroundingChange"
v-model="FormData.isSale"></my-switch>
</view> </view>
</uni-forms-item> </uni-forms-item>
</view> </view>
<uni-forms-item label=""> <!-- <uni-forms-item label="">
<view class="u-flex u-row-between"> <view class="u-flex u-row-between">
<view class="label-title">库存开关</view> <view class="label-title">库存开关</view>
<my-switch v-model="FormData.isStock"></my-switch> <my-switch v-model="FormData.isStock"></my-switch>
@@ -341,7 +339,7 @@
</uni-forms-item> </uni-forms-item>
<view class="u-absolute position-all" v-if="disabledStock" @click="canEditGoodsStock(true)"></view> <view class="u-absolute position-all" v-if="disabledStock" @click="canEditGoodsStock(true)"></view>
</view> </view>
</template> </template> -->
<uni-forms-item label=""> <uni-forms-item label="">
<view class="u-flex u-row-between"> <view class="u-flex u-row-between">
@@ -351,33 +349,51 @@
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="打包费"> <uni-forms-item label="打包费">
<uni-easyinput <uni-easyinput @blur="priceFormat(FormData, 'packFee')"
@blur="priceFormat(FormData, 'packFee')" :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
:paddingNone="inputPaddingNone" :inputBorder="inputBorder" v-model="FormData.packFee" type="digit"
:placeholderStyle="placeholderStyle" placeholder="请输入打包费" />
:inputBorder="inputBorder"
v-model="FormData.packFee"
type="digit"
placeholder="请输入打包费"
/>
</uni-forms-item> </uni-forms-item>
<template v-if="option.type === 'edit'"> <template v-if="option.type === 'edit'">
<uni-forms-item label="排序"> <uni-forms-item label="排序">
<uni-easyinput <uni-easyinput @blur="priceFormat(FormData, 'sort')"
@blur="priceFormat(FormData, 'sort')" :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
:paddingNone="inputPaddingNone" :inputBorder="inputBorder" v-model="FormData.sort" type="digit"
:placeholderStyle="placeholderStyle" placeholder="请输入排序" />
:inputBorder="inputBorder"
v-model="FormData.sort"
type="digit"
placeholder="请输入排序"
/>
</uni-forms-item> </uni-forms-item>
</template> </template>
<uni-forms-item label="关联推荐商品">
<view class="tips">
</view>
</template>
</uni-forms>
<view style="height: 100rpx"></view>
<view style="padding-left: 110rpx; padding-right: 110rpx" class="u-m-t-20"
v-if="option.type === 'edit'" @click="delModelShow">
<my-button bgColor="#F9F9F9" shape="circle" type="cancel">
<view class="color-red">删除该商品</view>
</my-button>
</view>
<view class="bootom">
<view class="save-btn-box">
<my-button fontWeight="700" shape="circle" @tap="save">保存</my-button>
</view>
</view>
</view>
<template v-if="tabsCurrent === 1">
<edit-haocai @updateGoods="updateGoodsDetail" :goods="FormData"
v-model:isAutoSoldStock="FormData.isAutoSoldStock"
v-model:refundMode="FormData.refundMode"
@cancel="changeTabsCurrent(0)"></edit-haocai>
</template>
<template v-if="tabsCurrent === 2">
<view class="link-goods">
<view class="font-bold">关联推荐商品</view>
<view class="tips u-m-t-10">
<text class="t">设置商品后,用户可以在商品详情页中看到推荐商品,最多设置{{ goodsListMax }}个商品</text> <text class="t">设置商品后,用户可以在商品详情页中看到推荐商品,最多设置{{ goodsListMax }}个商品</text>
</view> </view>
<view class="table"> <view class="table">
@@ -403,7 +419,8 @@
<text class="t">{{ item.name }}</text> <text class="t">{{ item.name }}</text>
</view> </view>
<view class="td"> <view class="td">
<u-text type="error" text="删除" @click="FormData.relatedRecommendJson.splice(index, 1)"></u-text> <u-text type="error" text="删除"
@click="FormData.relatedRecommendJson.splice(index, 1)"></u-text>
</view> </view>
</view> </view>
<view class="table-tips" v-if="!FormData.relatedRecommendJson.length"> <view class="table-tips" v-if="!FormData.relatedRecommendJson.length">
@@ -413,48 +430,47 @@
</view> </view>
<view class="add-goods" v-if="FormData.relatedRecommendJson.length < goodsListMax"> <view class="add-goods" v-if="FormData.relatedRecommendJson.length < goodsListMax">
<view class="btn"> <view class="btn">
<u-text type="primary" text="添加商品" prefixIcon="plus" iconStyle="color:#409EFF;" @click="toSelectGoodsPage"></u-text> <u-text type="primary" text="添加商品" prefixIcon="plus" iconStyle="color:#409EFF;"
</view> @click="toSelectGoodsPage"></u-text>
</view>
</uni-forms-item>
</view>
</template>
</uni-forms>
<view style="height: 100rpx"></view>
<view style="padding-left: 110rpx; padding-right: 110rpx" class="u-m-t-20" v-if="option.type === 'edit'" @click="delModelShow">
<my-button bgColor="#F9F9F9" shape="circle" type="cancel">
<view class="color-red">删除该商品</view>
</my-button>
</view>
<view class="bootom">
<view class="save-btn-box">
<my-button fontWeight="700" shape="circle" @tap="save">保存</my-button>
</view> </view>
</view> </view>
</view> </view>
</template>
<template v-if="tabsCurrent === 1">
<edit-haocai @updateGoods="updateGoodsDetail" :goods="FormData" @cancel="changeTabsCurrent(0)"></edit-haocai>
</template> </template>
</view> </view>
<!-- 删除弹窗 --> <!-- 删除弹窗 -->
<my-model @confirm="delmodelConfirm" ref="delModel" desc="确认删除"></my-model> <my-model @confirm="delmodelConfirm" ref="delModel" desc="确认删除"></my-model>
<!-- 选择商品 --> <!-- 选择商品 -->
<choose-goods ref="refChooseGoods" @confirm="refChooseGoodsConfirm" :category="pageData.category"></choose-goods> <choose-goods ref="refChooseGoods" @confirm="refChooseGoodsConfirm"
:category="pageData.category"></choose-goods>
<!-- 选择规格 --> <!-- 选择规格 -->
<choose-guige ref="refChooseGuige" @confirm="refChooseGuigeConfirm"></choose-guige> <choose-guige ref="refChooseGuige" @confirm="refChooseGuigeConfirm"></choose-guige>
</view> </view>
</template> </template>
<script setup> <script setup>
import { computed, onBeforeUnmount, reactive, ref, watch, nextTick } from 'vue'; import {
import { onLoad, onShow, onReady } from '@dcloudio/uni-app'; computed,
onBeforeUnmount,
reactive,
ref,
watch,
nextTick
} from 'vue';
import {
onLoad,
onShow,
onReady
} from '@dcloudio/uni-app';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { formatPrice } from '@/commons/utils/format.js'; import {
formatPrice
} from '@/commons/utils/format.js';
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
import linkGoods from './components/link-goods.vue';
import chooseGoods from './components/choose-goods'; import chooseGoods from './components/choose-goods';
import chooseGuige from './components/choose-guige'; import chooseGuige from './components/choose-guige';
import editHaocai from './components/edit-haocai.vue'; import editHaocai from './components/edit-haocai.vue';
@@ -463,12 +479,26 @@ import priceNumberBox from './components/price-number-box';
import infoBox from '@/commons/utils/infoBox.js'; import infoBox from '@/commons/utils/infoBox.js';
import { hasPermission } from '@/commons/utils/hasPermission.js'; import {
hasPermission
} from '@/commons/utils/hasPermission.js';
import { $defaultSku } from '@/commons/goodsData.js'; import {
$defaultSku
} from '@/commons/goodsData.js';
import { getCategoryList, getProdUnitList, getProductDetail, addProduct, updateProduct, delProduct, productBindCons } from '@/http/api/product.js'; import {
import { uploadFile } from '@/http/api/index.js'; getCategoryList,
getProdUnitList,
getProductDetail,
addProduct,
updateProduct,
delProduct,
productBindCons
} from '@/http/api/product.js';
import {
uploadFile
} from '@/http/api/index.js';
const imageStyles = reactive({ const imageStyles = reactive({
width: 82, width: 82,
@@ -518,7 +548,9 @@ function getLocalSelectGoods() {
}); });
return; return;
} }
FormData.relatedRecommendJson.push({ ...res }); FormData.relatedRecommendJson.push({
...res
});
} }
uni.setStorageSync('packageSelectGoods', ''); uni.setStorageSync('packageSelectGoods', '');
} }
@@ -551,7 +583,8 @@ const FormData = reactive({
packFee: 0, //打包费 packFee: 0, //打包费
sort: 1, //排序值 sort: 1, //排序值
specName: '', //规格模版名称 specName: '', //规格模版名称
isAutoSoldStock:0,
isRefundStock:1,
unitName: '', unitName: '',
specificationsGroup: '', specificationsGroup: '',
relatedRecommendJson: [] // 关联商品 relatedRecommendJson: [] // 关联商品
@@ -559,8 +592,7 @@ const FormData = reactive({
//页面全部数据 //页面全部数据
const pageData = reactive({ const pageData = reactive({
// 商品类型 // 商品类型
types: [ types: [{
{
name: '单规格商品', name: '单规格商品',
value: 'single' value: 'single'
}, },
@@ -589,12 +621,10 @@ const pageData = reactive({
skuList: [] skuList: []
}); });
const skuList = reactive({ const skuList = reactive({
list: [ list: [{
{
...$defaultSku, ...$defaultSku,
barCode: `${uni.getStorageSync('shopId')}${dayjs().valueOf()}` barCode: `${uni.getStorageSync('shopId')}${dayjs().valueOf()}`
} }]
]
}); });
let $goodsData = {}; let $goodsData = {};
@@ -619,12 +649,10 @@ watch(
} }
} else { } else {
if (newval != 'sku') { if (newval != 'sku') {
skuList.list = [ skuList.list = [{
{
...$defaultSku, ...$defaultSku,
barCode: `${uni.getStorageSync('shopId')}${dayjs().valueOf()}` barCode: `${uni.getStorageSync('shopId')}${dayjs().valueOf()}`
} }];
];
} else { } else {
skuList.list = []; skuList.list = [];
} }
@@ -635,12 +663,10 @@ watch(
} else { } else {
FormData.specId = ''; FormData.specId = '';
if (newval != 'sku') { if (newval != 'sku') {
skuList.list = [ skuList.list = [{
{
...$defaultSku, ...$defaultSku,
barCode: `${uni.getStorageSync('shopId')}${dayjs().valueOf()}` barCode: `${uni.getStorageSync('shopId')}${dayjs().valueOf()}`
} }];
];
} else { } else {
skuList.list = []; skuList.list = [];
} }
@@ -920,7 +946,15 @@ function refChooseGoodsClose() {
function refChooseGoodsConfirm(arr) { function refChooseGoodsConfirm(arr) {
refChooseGoodsClose(); refChooseGoodsClose();
arr = arr.map((v) => { arr = arr.map((v) => {
const { proId, id, name, unitName, lowPrice, type, skuList } = v; const {
proId,
id,
name,
unitName,
lowPrice,
type,
skuList
} = v;
if (proId) { if (proId) {
return v; return v;
} }
@@ -979,8 +1013,7 @@ function priceFormat(item, key) {
* 套餐商品类型 * 套餐商品类型
*/ */
const packageType = reactive({ const packageType = reactive({
list: [ list: [{
{
name: '固定套餐', name: '固定套餐',
value: 0 value: 0
}, },
@@ -992,14 +1025,13 @@ const packageType = reactive({
sel: 0 sel: 0
}); });
const tabsList = ['基础设置', '耗材绑定']; const tabsList = ['基础设置', '耗材设置', '关联推荐商品'];
let tabsCurrent = ref(0); let tabsCurrent = ref(0);
const Forms = ref(null); const Forms = ref(null);
const delModel = ref(null); const delModel = ref(null);
const rules = { const rules = {
images: { images: {
rules: [ rules: [{
{
validateFunction: function(rule, value, data, callback) { validateFunction: function(rule, value, data, callback) {
console.log(value); console.log(value);
if (value.length < 1) { if (value.length < 1) {
@@ -1007,12 +1039,10 @@ const rules = {
} }
return true; return true;
} }
} }]
]
}, },
name: { name: {
rules: [ rules: [{
{
required: true, required: true,
errorMessage: '请输入商品名称' errorMessage: '请输入商品名称'
}, },
@@ -1024,20 +1054,16 @@ const rules = {
] ]
}, },
categoryId: { categoryId: {
rules: [ rules: [{
{
required: true, required: true,
errorMessage: '请选择商品分类' errorMessage: '请选择商品分类'
} }]
]
}, },
floorPrice: { floorPrice: {
rules: [ rules: [{
{
required: true, required: true,
errorMessage: '请填写商品底价' errorMessage: '请填写商品底价'
} }]
]
} }
}; };
@@ -1065,7 +1091,8 @@ function delmodelConfirm() {
} }
function updateGoodsDetail() { function updateGoodsDetail() {
getGoodsDetail(); // getGoodsDetail();
save()
} }
let timer = null; let timer = null;
@@ -1087,7 +1114,10 @@ async function save() {
Forms.value Forms.value
.validate() .validate()
.then((res) => { .then((res) => {
const { groupType, type } = FormData; const {
groupType,
type
} = FormData;
const images = refFile.value.getFileList(); const images = refFile.value.getFileList();
if (images.length <= 0) { if (images.length <= 0) {
@@ -1286,14 +1316,12 @@ function returnTimerTimeText() {
} }
function initDefaultProGroupVo() { function initDefaultProGroupVo() {
FormData.proGroupVo = [ FormData.proGroupVo = [{
{
title: '', title: '',
count: 1, count: 1,
number: 1, number: 1,
goods: [] goods: []
} }];
];
console.log(FormData.proGroupVo); console.log(FormData.proGroupVo);
} }
@@ -1362,6 +1390,7 @@ page {
font-size: 28upx; font-size: 28upx;
color: #999; color: #999;
} }
.barCode { .barCode {
border: 1px solid #e5e5e5; border: 1px solid #e5e5e5;
border-radius: 8rpx 8rpx 8rpx 8rpx; border-radius: 8rpx 8rpx 8rpx 8rpx;
@@ -1441,11 +1470,9 @@ page {
z-index: 9; z-index: 9;
} }
.minus { .minus {}
}
.plus { .plus {}
}
.box { .box {
margin-top: 32rpx; margin-top: 32rpx;
@@ -1480,6 +1507,32 @@ page {
color: #333; color: #333;
} }
.link-goods {
background-color: #fff;
padding: 32rpx 20rpx;
}
::v-deep .link-goods .uni-forms-item {
align-items: inherit;
}
::v-deep .link-goods .typeEnum .u-radio-group--row {
flex-wrap: nowrap;
justify-content: space-between;
}
::v-deep .link-goods .typeEnum .u-checkbox-group--row {
flex-wrap: nowrap;
justify-content: space-between;
}
::v-deep .link-goods .uni-forms-item .uni-forms-item__label {
text-indent: 0;
font-size: 28rpx !important;
font-weight: bold;
color: #333;
}
::v-deep .stock .uni-forms-item { ::v-deep .stock .uni-forms-item {
min-height: initial !important; min-height: initial !important;
} }
@@ -1618,48 +1671,60 @@ page {
} }
} }
} }
.table { .table {
border: 1px solid #ececec; border: 1px solid #ececec;
margin-top: 28upx; margin-top: 28upx;
.table-tips { .table-tips {
padding: 28upx; padding: 28upx;
display: flex; display: flex;
justify-content: center; justify-content: center;
.t { .t {
font-size: 28upx; font-size: 28upx;
color: #999; color: #999;
} }
} }
.tabhead { .tabhead {
background-color: #f8f8f8; background-color: #f8f8f8;
border-bottom: 1px solid #ececec; border-bottom: 1px solid #ececec;
.t { .t {
font-weight: bold; font-weight: bold;
} }
} }
.tr { .tr {
display: flex; display: flex;
&:not(:last-child) { &:not(:last-child) {
border-bottom: 1px solid #ececec; border-bottom: 1px solid #ececec;
} }
.td { .td {
flex: 1; flex: 1;
min-height: 80upx; min-height: 80upx;
display: flex; display: flex;
align-items: center; align-items: center;
padding: 20upx; padding: 20upx;
&:not(:last-child) { &:not(:last-child) {
border-right: 1px solid #ececec; border-right: 1px solid #ececec;
} }
&:nth-child(2) { &:nth-child(2) {
flex: 2; flex: 2;
} }
.cover { .cover {
$size: 80upx; $size: 80upx;
width: $size; width: $size;
height: $size; height: $size;
border-radius: 8upx; border-radius: 8upx;
} }
.t { .t {
font-size: 28upx; font-size: 28upx;
color: #333; color: #333;
@@ -1667,6 +1732,7 @@ page {
} }
} }
} }
.add-goods { .add-goods {
display: flex; display: flex;
justify-content: center; justify-content: center;

View File

@@ -145,7 +145,7 @@
let obj = pageData.types.find(item=> item.value == e) let obj = pageData.types.find(item=> item.value == e)
return obj.name return obj.name
} }
let selArr=[]
getGoods() getGoods()
/** /**
* 获取商品列表 * 获取商品列表
@@ -200,7 +200,6 @@
const show = ref(props.modelValue) const show = ref(props.modelValue)
let selArr=[]
let $selGoodsMap={} let $selGoodsMap={}
async function open(arr) { async function open(arr) {

View File

@@ -1,6 +1,7 @@
<template> <template>
<view> <view>
<view class="default-box-padding bg-fff border-r-18"> <view class="default-box-padding bg-fff border-r-18">
<view class="font-bold u-m-b-32">绑定耗材</view>
<view class="u-flex u-row-between"> <view class="u-flex u-row-between">
<view>商品名称</view> <view>商品名称</view>
</view> </view>
@@ -58,8 +59,25 @@
</view> </view>
</view> </view>
<view class="default-box-padding bg-fff border-r-18 u-flex u-row-between u-m-t-32"> <view class="default-box-padding bg-fff border-r-18 u-m-t-32">
<view>当某个耗材的使用库存不足时商品自动售罄</view> <view class="up-border-bottom u-p-b-32">
<view class="u-flex u-row-between ">
<view class="font-bold"> 自动售罄</view>
<up-switch :size="16" v-model="isAutoSoldStock" :inactive-value="0" :active-value="1"></up-switch>
</view>
<view class=" u-m-t-10">当某个耗材的使用库存不足时商品自动售罄</view>
</view>
<view class=" u-p-t-32">
<view class="">
<view class="font-bold u-m-b-16"> 退菜是否退库存</view>
<up-radio-group v-model="refundMode">
<up-radio v-for="(item,index) in tuiStockTypes" :key="index" :label="item.label"
:name="item.key"></up-radio>
</up-radio-group>
<view class="color-red u-m-t-10">当前店铺退菜退库存规则{{nowRefundRule}}</view>
</view>
</view>
</view> </view>
<view class="bottom"> <view class="bottom">
@@ -72,15 +90,42 @@
</template> </template>
<script setup> <script setup>
import { ref, reactive, watch, computed, onMounted } from 'vue'; import {
ref,
reactive,
watch,
computed,
onMounted
} from 'vue';
import infoBox from '@/commons/utils/infoBox.js' import infoBox from '@/commons/utils/infoBox.js'
import chooseHaocai from './choose-haocai.vue'; import chooseHaocai from './choose-haocai.vue';
import chooseDanwei from './choose-danwei.vue'; import chooseDanwei from './choose-danwei.vue';
import { hasPermission } from '@/commons/utils/hasPermission.js'; import {
hasPermission
} from '@/commons/utils/hasPermission.js';
import { getConsList } from '@/http/api/cons.js'; import {
import { productBindCons } from '@/http/api/product.js'; getConsList
} from '@/http/api/cons.js';
import {
productBindCons
} from '@/http/api/product.js';
const tuiStockTypes = ref([{
label: '退菜退库存',
key: 1
},
{
label: '仅退菜不退库存',
key: 2
},
{
label: '每次询问-退菜后弹窗提示,可手动选择',
key: 3
},
])
const isAutoSoldStock=defineModel('isAutoSoldStock',0)
const refundMode=defineModel('refundMode',1)
const emits = defineEmits(['cancel', 'updateGoods']) const emits = defineEmits(['cancel', 'updateGoods'])
@@ -91,12 +136,20 @@
return { return {
consList: [], consList: [],
skuList: [], skuList: [],
type: '' type: '',
isAutoSoldStock:0,
isRefundStock:1,
} }
} }
} }
}) })
const shopInfo=uni.getStorageSync('shopInfo')
const nowRefundRule=computed(()=>{
if(!shopInfo||!shopInfo.refundMode){
return ''
}
return shopInfo.refundMode==1?'跟随商品分类':'跟随单商品'
})
const pageData = reactive({ const pageData = reactive({
isBindGuige: false, //是否绑定至规格 isBindGuige: false, //是否绑定至规格
}) })
@@ -105,6 +158,7 @@
let $haocaiMap = reactive({}) let $haocaiMap = reactive({})
const skuList = ref(props.goods.skuList) const skuList = ref(props.goods.skuList)
const consList = ref(props.goods.consList || []) const consList = ref(props.goods.consList || [])
watch(() => props.goods.consList, (newval) => { watch(() => props.goods.consList, (newval) => {
consList.value = newval consList.value = newval
}) })
@@ -207,7 +261,6 @@
emits('updateGoods') emits('updateGoods')
infoBox.showToast('修改成功') infoBox.showToast('修改成功')
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@@ -0,0 +1,11 @@
<template>
<view>
<view></view>
</view>
</template>
<script setup>
</script>
<style lang="scss" scoped>
</style>

View File

@@ -6,10 +6,10 @@
<text class="">排序</text> <text class="">排序</text>
<text class="u-m-l-20">{{data.sort}}</text> <text class="u-m-l-20">{{data.sort}}</text>
</view> </view>
<view class="color-333 u-m-l-42 u-flex"> <!-- <view class="color-333 u-m-l-42 u-flex">
<text class="stock u-m-l-4">库存:{{data.stockNumber}}</text> <text class="stock u-m-l-4">库存:{{data.stockNumber}}</text>
<up-icon @click="editStock" name="edit-pen" :size="16" :color="$utils.ColorMain"></up-icon> <up-icon @click="editStock" name="edit-pen" :size="16" :color="$utils.ColorMain"></up-icon>
</view> </view> -->
</view> </view>
<view> <view>
<!-- <text class="u-font-28 color-666" @click="changePrice">改价</text> --> <!-- <text class="u-font-28 color-666" @click="changePrice">改价</text> -->

View File

@@ -103,7 +103,7 @@
import { import {
getHistoryOrder getHistoryOrder
} from '@/http/api/order.js'; } from '@/http/api/order.js';
import tableStatus from './tableStatus'
const pageData = reactive({ const pageData = reactive({
statusShow: false, statusShow: false,
hasAjax: false, hasAjax: false,
@@ -121,7 +121,8 @@
key: '', key: '',
label: '全部' label: '全部'
}, },
...uni.$utils.objToArrary(uni.$dict.tableStatus) // ...uni.$utils.objToArrary(uni.$dict.tableStatus)
...tableStatus
] ]
], ],
statusName: '全部', statusName: '全部',
@@ -188,8 +189,9 @@
* @param {Object} e * @param {Object} e
*/ */
function confirmStatus(e) { function confirmStatus(e) {
console.log('---',e);
pageData.statusShow = false; pageData.statusShow = false;
pageData.query.status = e.value[0].key; pageData.query.status = e.value[0].type;
pageData.statusName = e.value[0].label; pageData.statusName = e.value[0].label;
getTable(); getTable();
} }

View File

@@ -3,39 +3,30 @@
<view class="page-cell"> <view class="page-cell">
<view class="label">头像</view> <view class="label">头像</view>
<view class="right"> <view class="right">
<up-avatar <up-avatar class="fileImg" :src="vdata.shopInfo.coverImg ? vdata.shopInfo.coverImg : ''"
class="fileImg" mode="aspectFill"></up-avatar>
:src="vdata.shopInfo.coverImg ? vdata.shopInfo.coverImg : ''"
mode="aspectFill"
></up-avatar>
<view class="file" @tap="chooseAndUploadAvatar('coverImg')"></view> <view class="file" @tap="chooseAndUploadAvatar('coverImg')"></view>
</view> </view>
</view> </view>
<!-- <view class="page-cell m" @tap="updateValue('商户名称','shopName',vdata.shopInfo.shopName)"> --> <!-- <view class="page-cell m" @tap="updateValue('商户名称','shopName',vdata.shopInfo.shopName)"> -->
<view <view class="page-cell m" @tap="
class="page-cell m"
@tap="
go.to('PAGES_SHOP_EDITVAL', { go.to('PAGES_SHOP_EDITVAL', {
name: 'shopName', name: 'shopName',
value: vdata.shopInfo.shopName, value: vdata.shopInfo.shopName,
}) })
" ">
>
<view class="label">商户名称</view> <view class="label">商户名称</view>
<view class="right"> <view class="right">
<view>{{ vdata.shopInfo.shopName }}</view> <view>{{ vdata.shopInfo.shopName }}</view>
<up-icon name="arrow-right" color="#999999" size="15"></up-icon> <up-icon name="arrow-right" color="#999999" size="15"></up-icon>
</view> </view>
</view> </view>
<view <view class="page-cell m" @tap="
class="page-cell m"
@tap="
go.to('PAGES_SHOP_EDITVAL', { go.to('PAGES_SHOP_EDITVAL', {
name: 'phone', name: 'phone',
value: vdata.shopInfo.phone, value: vdata.shopInfo.phone,
}) })
" ">
>
<view class="label">商户电话</view> <view class="label">商户电话</view>
<view class="right"> <view class="right">
<view>{{ vdata.shopInfo.phone }}</view> <view>{{ vdata.shopInfo.phone }}</view>
@@ -49,14 +40,8 @@
<view class="page-cell m"> <view class="page-cell m">
<view class="label">营业状态</view> <view class="label">营业状态</view>
<view class="right"> <view class="right">
<up-switch <up-switch v-model="vdata.shopInfo.status" size="20" :inactiveValue="2" :activeValue="1"
v-model="vdata.shopInfo.status" activeColor="#0FC161" @change="switchChange('status')"></up-switch>
size="20"
:inactiveValue="2"
:activeValue="1"
activeColor="#0FC161"
@change="switchChange('status')"
></up-switch>
</view> </view>
</view> </view>
<view class="page-cell m" @tap="showMap"> <view class="page-cell m" @tap="showMap">
@@ -72,58 +57,31 @@
</view> --> </view> -->
<view class="page-cell"> <view class="page-cell">
<view class="label">允许打包</view> <view class="label">允许打包</view>
<view class="right" <view class="right"><up-switch v-model="vdata.takeout" size="20" activeColor="#0FC161"
><up-switch @change="switchChange('eatModel')"></up-switch></view>
v-model="vdata.takeout"
size="20"
activeColor="#0FC161"
@change="switchChange('eatModel')"
></up-switch
></view>
</view> </view>
<view class="page-cell m"> <view class="page-cell m">
<view class="label">是否开启会员余额支付</view> <view class="label">是否开启会员余额支付</view>
<view class="right"> <view class="right">
<up-switch <up-switch v-model="vdata.shopInfo.isAccountPay" size="20" :inactiveValue="0" :activeValue="1"
v-model="vdata.shopInfo.isAccountPay" activeColor="#0FC161" @change="switchChange('isAccountPay')"></up-switch>
size="20"
:inactiveValue="0"
:activeValue="1"
activeColor="#0FC161"
@change="switchChange('isAccountPay')"
></up-switch>
</view> </view>
</view> </view>
<view class="page-cell m"> <view class="page-cell m">
<view class="label">是否开启数签子</view> <view class="label">是否开启数签子</view>
<view class="right"> <view class="right">
<up-switch <up-switch v-model="vdata.shopInfo.isCountStick" size="20" :inactiveValue="0" :activeValue="1"
v-model="vdata.shopInfo.isCountStick" activeColor="#0FC161" @change="switchChange('isCountStick')"></up-switch>
size="20"
:inactiveValue="0"
:activeValue="1"
activeColor="#0FC161"
@change="switchChange('isCountStick')"
></up-switch>
</view> </view>
</view> </view>
<view class="page-cell m" style="display: block"> <view class="page-cell m" style="display: block">
<view class="u-flex u-row-between"> <view class="u-flex u-row-between">
<view class="label">点餐电子围栏</view> <view class="label">点餐电子围栏</view>
<view class="right" <view class="right"><up-switch v-model="vdata.shopInfo.isOrderFence" size="20" :inactiveValue="0"
><up-switch :activeValue="1" activeColor="#0FC161" @change="switchChange('isOrderFence')"></up-switch>
v-model="vdata.shopInfo.isOrderFence"
size="20"
:inactiveValue="0"
:activeValue="1"
activeColor="#0FC161"
@change="switchChange('isOrderFence')"
></up-switch
></view>
</view> </view>
<view class="u-m-t-6 color-666 u-font-24" </view>
>开启后用户只能在店铺附近两公里范围内点餐</view <view class="u-m-t-6 color-666 u-font-24">开启后用户只能在店铺附近两公里范围内点餐</view>
>
</view> </view>
<!-- <view class="page-cell m"> <!-- <view class="page-cell m">
@@ -142,29 +100,20 @@
<view class="page-cell"> <view class="page-cell">
<view class="label"> <view class="label">
桌位费 桌位费
<view <view v-if="!vdata.isTableFee" class="tableFee" @tap="
v-if="!vdata.isTableFee"
class="tableFee"
@tap="
go.to('PAGES_SHOP_EDITVAL', { go.to('PAGES_SHOP_EDITVAL', {
name: 'tableFee', name: 'tableFee',
value: vdata.shopInfo.tableFee, value: vdata.shopInfo.tableFee,
}) })
" ">
>
{{ vdata.shopInfo.tableFee }} {{ vdata.shopInfo.tableFee }}
</view> </view>
</view> </view>
<view class="right"> <view class="right">
<view> <view>
<up-checkbox-group> <up-checkbox-group>
<up-checkbox <up-checkbox label="免桌位费" v-model:checked="vdata.isTableFee" activeColor="#0FC161"
label="免桌位费" shape="circle" @change="isTableFeeChange"></up-checkbox>
v-model:checked="vdata.isTableFee"
activeColor="#0FC161"
shape="circle"
@change="isTableFeeChange"
></up-checkbox>
</up-checkbox-group> </up-checkbox-group>
</view> </view>
</view> </view>
@@ -186,45 +135,74 @@
</view> </view>
</view> --> </view> -->
<view class="page-cell m"> <view class="page-cell">
<view class="label">付费模式</view> <view class="label">付费模式</view>
<view class="right"> <view class="right">
<up-radio-group v-model="vdata.shopInfo.registerType" placement="row"> <up-radio-group v-model="vdata.shopInfo.registerType" placement="row">
<up-radio <up-radio :customStyle="{ marginRight: '10px' }" v-for="(item, index) in vdata.registerTypeList"
:customStyle="{ marginRight: '10px' }" :key="index" :label="item.name" :name="item.value" activeColor="#0FC161"
v-for="(item, index) in vdata.registerTypeList" @change="radioChange"></up-radio>
:key="index"
:label="item.name"
:name="item.value"
activeColor="#0FC161"
@change="radioChange"
></up-radio>
</up-radio-group> </up-radio-group>
</view> </view>
</view> </view>
<view <view class="page-cell m">
class="page-cell" <view class="label">退菜退库存模式</view>
@tap=" <view class="right">
<up-radio-group v-model="vdata.shopInfo.refundMode" placement="row">
<up-radio v-for="(item, index) in vdata.refund_modes" :key="index" :label="item.name"
:name="item.value" activeColor="#0FC161" @change="refundModeChange"></up-radio>
</up-radio-group>
</view>
</view>
<view class="page-cell" @tap="
go.to('PAGES_SHOP_QRCODE', { go.to('PAGES_SHOP_QRCODE', {
paymentQrcode: vdata.shopInfo.paymentQrcode, paymentQrcode: vdata.shopInfo.paymentQrcode,
}) })
" ">
>
<view class="label">店铺收款码</view> <view class="label">店铺收款码</view>
<view class="right" <view class="right"><up-icon name="arrow-right" color="#999999" size="15"></up-icon></view>
><up-icon name="arrow-right" color="#999999" size="15"></up-icon
></view>
</view> </view>
<!-- <view class="cutShop" @tap="go.to('PAGES_SHOP_LIST')">切换门店</view> --> <!-- <view class="cutShop" @tap="go.to('PAGES_SHOP_LIST')">切换门店</view> -->
<up-modal :show="refundMode.show" title="提示" asyncClose android-*=""
showCancelButton
@close="refundMode.show=false"
@cancel="refundModeCancel"
@confirm="refundModeConfirm"
>
<view>
<view class="u-font-28">
<text>当前操作退菜退库存模式切换为</text>
<text class="color-red">{{refundMode.mode}}</text>
</view>
<view class="u-font-28 color-666 u-m-t-12">
<text class="">修改后可前往商品管理-商品分类中编辑/查看配置</text>
</view>
<view class="u-m-t-40 u-font-28 color-red">
本操作将会影响耗材库存数量的统计请谨慎操作
</view>
</view>
</up-modal>
</view> </view>
</template> </template>
<script setup> <script setup>
import { ref, reactive, onMounted } from "vue"; import {
import { onShow } from "@dcloudio/uni-app"; ref,
reactive,
onMounted
} from "vue";
import {
onShow
} from "@dcloudio/uni-app";
import go from "@/commons/utils/go.js"; import go from "@/commons/utils/go.js";
import { uploadFile } from "@/http/api/index.js"; import {
uploadFile
} from "@/http/api/index.js";
import { import {
getShopInfo, getShopInfo,
editShopInfo, editShopInfo,
@@ -232,6 +210,31 @@ import {
editShopExtend, editShopExtend,
} from "@/http/api/shop.js"; } from "@/http/api/shop.js";
const refundMode = reactive({
show: false,
mode: ''
})
function refundModeCancel(){
vdata.shopInfo.refundMode=vdata.shopInfo.refundMode==1?2:1
refundMode.show = false
}
function refundModeConfirm(){
let params = {
id: vdata.shopInfo.id,
refundMode: vdata.shopInfo.refundMode,
};
updateShopInfo(params);
refundMode.show = false
}
function refundModeChange(e) {
console.log(e);
const item = vdata.refund_modes.find(v => v.value == e)
if (item) {
refundMode.mode = item.name
}
refundMode.show = true
}
const vdata = reactive({ const vdata = reactive({
shopInfo: { shopInfo: {
status: 2, status: 2,
@@ -239,9 +242,23 @@ const vdata = reactive({
isMemberPrice: 0, isMemberPrice: 0,
}, },
extendList: [], extendList: [],
registerTypeList: [ registerTypeList: [{
{ name: "先付费", value: "before" }, name: "先付费",
{ name: "后付费", value: "after" }, value: "before"
},
{
name: "后付费",
value: "after"
},
],
refund_modes: [{
name: "跟随商品分类",
value: 1
},
{
name: "跟随单商品",
value: 2
},
], ],
extendIndex: 0, extendIndex: 0,
extendInfo: {}, extendInfo: {},
@@ -281,7 +298,9 @@ let refreshData = (e) => {
* 获取店铺信息 * 获取店铺信息
*/ */
const shopInfo = () => { const shopInfo = () => {
getShopInfo({ id: uni.getStorageSync("shopInfo").id }).then((res) => { getShopInfo({
id: uni.getStorageSync("shopInfo").id
}).then((res) => {
vdata.isTableFee = res.isTableFee == 1 ? true : false; vdata.isTableFee = res.isTableFee == 1 ? true : false;
if (res.eatModel.split(",").indexOf("dine-in") != -1) { if (res.eatModel.split(",").indexOf("dine-in") != -1) {
vdata.dineIn = true; vdata.dineIn = true;
@@ -326,6 +345,7 @@ let radioChange = (n) => {
updateShopInfo(params); updateShopInfo(params);
}; };
/** /**
* 修改 * 修改
*/ */
@@ -499,6 +519,7 @@ let showMap = () => {
.page-wrapper { .page-wrapper {
background-color: #f8f8f8; background-color: #f8f8f8;
padding-bottom: 32rpx; padding-bottom: 32rpx;
.page-cell { .page-cell {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
@@ -506,6 +527,7 @@ let showMap = () => {
padding: 32rpx 28rpx; padding: 32rpx 28rpx;
box-sizing: border-box; box-sizing: border-box;
background-color: #fff; background-color: #fff;
.label { .label {
font-weight: bold; font-weight: bold;
font-size: 28rpx; font-size: 28rpx;
@@ -514,6 +536,7 @@ let showMap = () => {
align-items: center; align-items: center;
flex-shrink: 0; flex-shrink: 0;
margin-right: 20rpx; margin-right: 20rpx;
.tableFee { .tableFee {
width: 186rpx; width: 186rpx;
height: 54rpx; height: 54rpx;
@@ -528,14 +551,17 @@ let showMap = () => {
box-sizing: border-box; box-sizing: border-box;
} }
} }
.extendList { .extendList {
width: 100%; width: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
margin-top: 24rpx; margin-top: 24rpx;
.extendTab { .extendTab {
display: flex; display: flex;
justify-content: flex-start; justify-content: flex-start;
.extendTab_item { .extendTab_item {
font-size: 24rpx; font-size: 24rpx;
font-weight: 400; font-weight: 400;
@@ -544,21 +570,25 @@ let showMap = () => {
border: 2rpx solid #e5e5e5; border: 2rpx solid #e5e5e5;
margin-right: 20rpx; margin-right: 20rpx;
} }
.active { .active {
background: #318afe; background: #318afe;
border: 2rpx solid #318afe; border: 2rpx solid #318afe;
color: #fff; color: #fff;
} }
} }
.extend_content { .extend_content {
display: flex; display: flex;
margin-top: 32rpx; margin-top: 32rpx;
.preview { .preview {
min-width: 146rpx; min-width: 146rpx;
height: 342rpx; height: 342rpx;
position: relative; position: relative;
margin-right: 32rpx; margin-right: 32rpx;
background-color: #f7f7f7; background-color: #f7f7f7;
::v-deep .bg, ::v-deep .bg,
::v-deep .bg .u-image, ::v-deep .bg .u-image,
::v-deep .bg .u-image__image { ::v-deep .bg .u-image__image {
@@ -603,6 +633,7 @@ let showMap = () => {
position: absolute; position: absolute;
top: 0; top: 0;
} }
::v-deep .bg.ticket_logo, ::v-deep .bg.ticket_logo,
::v-deep .bg.ticket_logo .u-image, ::v-deep .bg.ticket_logo .u-image,
::v-deep .bg.ticket_logo .u-image__image { ::v-deep .bg.ticket_logo .u-image__image {
@@ -611,6 +642,7 @@ let showMap = () => {
position: absolute; position: absolute;
top: 0; top: 0;
} }
::v-deep .ticket_logo.img .u-image, ::v-deep .ticket_logo.img .u-image,
::v-deep .ticket_logo.img .u-image__image { ::v-deep .ticket_logo.img .u-image__image {
width: 146rpx !important; width: 146rpx !important;
@@ -628,19 +660,23 @@ let showMap = () => {
background-color: #fff; background-color: #fff;
} }
} }
.extend_img { .extend_img {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.extend_title { .extend_title {
font-weight: 400; font-weight: 400;
font-size: 24rpx; font-size: 24rpx;
color: #333333; color: #333333;
margin-bottom: 16rpx; margin-bottom: 16rpx;
} }
.fileUp { .fileUp {
width: 148rpx; width: 148rpx;
height: 148rpx; height: 148rpx;
position: relative; position: relative;
.file { .file {
width: 148rpx; width: 148rpx;
height: 148rpx; height: 148rpx;
@@ -648,6 +684,7 @@ let showMap = () => {
top: 0; top: 0;
} }
} }
::v-deep .u-image, ::v-deep .u-image,
::v-deep .u-image__image { ::v-deep .u-image__image {
width: 148rpx !important; width: 148rpx !important;
@@ -657,15 +694,19 @@ let showMap = () => {
} }
} }
} }
.column { .column {
flex-direction: column; flex-direction: column;
.label { .label {
align-self: flex-start; align-self: flex-start;
} }
} }
.m { .m {
margin-bottom: 12rpx; margin-bottom: 12rpx;
} }
.cutShop { .cutShop {
width: 530rpx; width: 530rpx;
height: 80rpx; height: 80rpx;
@@ -701,6 +742,7 @@ let showMap = () => {
.fileImg { .fileImg {
width: 112rpx !important; width: 112rpx !important;
height: 112rpx !important; height: 112rpx !important;
::v-deep .u-avatar__image { ::v-deep .u-avatar__image {
width: 112rpx !important; width: 112rpx !important;
height: 112rpx !important; height: 112rpx !important;
@@ -708,4 +750,8 @@ let showMap = () => {
} }
} }
} }
.color-red {
color: red;
}
</style> </style>

View File

@@ -1,10 +1,7 @@
<template> <template>
<view class="page-gray color-333 u-font-28"> <view class="page-gray color-333 u-font-28">
<template v-if="true"> <template v-if="true">
<view <view class="block u-p-t-32 u-p-b-32" v-if="pageData.table && pageData.table.id">
class="block u-p-t-32 u-p-b-32"
v-if="pageData.table && pageData.table.id"
>
<view>桌位号</view> <view>桌位号</view>
<view class="font-bold u-font-32 u-m-t-16"> <view class="font-bold u-font-32 u-m-t-16">
{{ pageData.table.name || "" }} {{ pageData.table.name || "" }}
@@ -16,11 +13,7 @@
<view class="u-m-t-24 u-flex u-row-between" @tap="chooseUser"> <view class="u-m-t-24 u-flex u-row-between" @tap="chooseUser">
<view v-if="!pageData.user || !pageData.user.id">选择用户</view> <view v-if="!pageData.user || !pageData.user.id">选择用户</view>
<view class="u-flex" v-if="pageData.user && pageData.user.id"> <view class="u-flex" v-if="pageData.user && pageData.user.id">
<up-avatar <up-avatar :src="pageData.user.headImg" shape="square" :size="30"></up-avatar>
:src="pageData.user.headImg"
shape="square"
:size="30"
></up-avatar>
<view class="u-m-l-20"> <view class="u-m-l-20">
<view class="">{{ pageData.user.nickName }}</view> <view class="">{{ pageData.user.nickName }}</view>
@@ -43,18 +36,11 @@
<view>就餐类型</view> <view>就餐类型</view>
<view class="u-m-t-24 u-flex"> <view class="u-m-t-24 u-flex">
<view class="u-flex color-666"> <view class="u-flex color-666">
<up-radio-group <up-radio-group :disabled="option.type == 'add'" v-model="pageData.eatTypes.active"
:disabled="option.type == 'add'" placement="row">
v-model="pageData.eatTypes.active" <up-radio :customStyle="{ marginRight: '30px' }"
placement="row" v-for="(item, index) in pageData.eatTypes.list" :key="index" :label="item.name"
> :name="item.value"></up-radio>
<up-radio
:customStyle="{ marginRight: '30px' }"
v-for="(item, index) in pageData.eatTypes.list"
:key="index"
:label="item.name"
:name="item.value"
></up-radio>
</up-radio-group> </up-radio-group>
</view> </view>
</view> </view>
@@ -65,11 +51,7 @@
<view class="block"> <view class="block">
<view class=""> <view class="">
<view class="u-flex border-bottom u-p-b-24"> <view class="u-flex border-bottom u-p-b-24">
<up-avatar <up-avatar :src="pageData.user.headImg" shape="square" :size="60"></up-avatar>
:src="pageData.user.headImg"
shape="square"
:size="60"
></up-avatar>
<!-- <image class="headeimg" src="@/static/uni.png" mode=""></image> --> <!-- <image class="headeimg" src="@/static/uni.png" mode=""></image> -->
<view class="u-m-l-32"> <view class="u-m-l-32">
<view class="">{{ pageData.user.nickName }}</view> <view class="">{{ pageData.user.nickName }}</view>
@@ -101,20 +83,15 @@
</view> </view>
</view> </view>
</template> </template>
<template <template v-if="
v-if="
!pageData.shopInfo.isTableFee && pageData.table && pageData.table.id !pageData.shopInfo.isTableFee && pageData.table && pageData.table.id
" ">
>
<!-- 不免餐位费 --> <!-- 不免餐位费 -->
<view class="block"> <view class="block">
<view class=" "> <view class=" ">
<view>用餐人数(人)</view> <view>用餐人数(人)</view>
<picker <picker @change="userNumberChange" :value="userNumbers.defaultCateIndex"
@change="userNumberChange" :range="userNumbers.list">
:value="userNumbers.defaultCateIndex"
:range="userNumbers.list"
>
<view class="u-m-t-24 u-flex u-row-between"> <view class="u-m-t-24 u-flex u-row-between">
<view class="color-333">{{ <view class="color-333">{{
userNumbers.defaultCateIndex * 1 + 1 + "人" userNumbers.defaultCateIndex * 1 + 1 + "人"
@@ -138,11 +115,7 @@
<view class="u-p-b-24"> <view class="u-p-b-24">
<view class="font-bold">订单备注</view> <view class="font-bold">订单备注</view>
<view class="u-m-t-32 u-flex"> <view class="u-m-t-32 u-flex">
<uni-easyinput <uni-easyinput type="textarea" v-model="pageData.form.note" placeholder="请输入备注"></uni-easyinput>
type="textarea"
v-model="pageData.form.note"
placeholder="请输入备注"
></uni-easyinput>
</view> </view>
</view> </view>
</view> </view>
@@ -155,83 +128,46 @@
</view> </view>
<view class="goods u-m-t-32"> <view class="goods u-m-t-32">
<view <view class="item u-m-b-48" @click="changeGoodsSel(index)" v-for="(item, index) in goods.list"
class="item u-m-b-48" :key="index">
@click="changeGoodsSel(index)"
v-for="(item, index) in goods.list"
:key="index"
>
<view class="u-flex u-row-between"> <view class="u-flex u-row-between">
<view class="u-flex"> <view class="u-flex">
<view v-if="item.coverImg" class="u-relative"> <view v-if="item.coverImg" class="u-relative">
<view class="limit-discount" v-if="item.is_time_discount" <view class="limit-discount" v-if="item.is_time_discount">限时折扣</view>
>限时折扣</view
>
<image class="img" :src="item.coverImg" mode=""></image> <image class="img" :src="item.coverImg" mode=""></image>
</view> </view>
<view <view style="
style="
background-color: #3f9eff; background-color: #3f9eff;
width: 84rpx; width: 84rpx;
height: 84rpx; height: 84rpx;
line-height: 84rpx; line-height: 84rpx;
text-align: center; text-align: center;
color: #fff; color: #fff;
" " v-else>
v-else
>
{{ item.name }} {{ item.name }}
</view> </view>
<view class="u-m-l-32"> <view class="u-m-l-32">
<view class="u-flex"> <view class="u-flex">
<view <view class="u-flex u-m-r-20" v-if="item.is_wait_call" style="flex-shrink: 0">
class="u-flex u-m-r-20" <uni-tag text="等叫"
v-if="item.is_wait_call" custom-style="background-color: #FFF0DF; border-color: #FFF0DF; color: #FF9F2E;">
style="flex-shrink: 0"
>
<uni-tag
text="等叫"
custom-style="background-color: #FFF0DF; border-color: #FFF0DF; color: #FF9F2E;"
>
</uni-tag> </uni-tag>
</view> </view>
<view <view class="u-m-r-20 u-flex" v-if="item.is_gift" style="flex-shrink: 0">
class="u-m-r-20 u-flex" <uni-tag text="赠送"
v-if="item.is_gift" custom-style="background-color: #FFF0DF; border-color: #FFF0DF; color: #FF9F2E;">
style="flex-shrink: 0"
>
<uni-tag
text="赠送"
custom-style="background-color: #FFF0DF; border-color: #FFF0DF; color: #FF9F2E;"
>
</uni-tag> </uni-tag>
</view> </view>
<view <view class="u-m-r-20 u-flex" v-if="item.pack_number > 0" style="flex-shrink: 0">
class="u-m-r-20 u-flex"
v-if="item.pack_number > 0"
style="flex-shrink: 0"
>
<uni-tag <uni-tag
custom-style="background-color: #E6F0FF; border-color: #E6F0FF; color: #318AFE;" custom-style="background-color: #E6F0FF; border-color: #E6F0FF; color: #318AFE;"
size="small" size="small" text="打包" inverted type="success" />
text="打包"
inverted
type="success"
/>
</view> </view>
<view <view class="u-m-r-20 u-flex" v-if="item.is_print" style="flex-shrink: 0">
class="u-m-r-20 u-flex"
v-if="item.is_print"
style="flex-shrink: 0"
>
<uni-tag <uni-tag
custom-style="background-color: #E6F0FF; border-color: #E6F0FF; color: #318AFE;" custom-style="background-color: #E6F0FF; border-color: #E6F0FF; color: #318AFE;"
size="small" size="small" text="打印" inverted type="success" />
text="打印"
inverted
type="success"
/>
</view> </view>
<view> <view>
{{ item.name }} {{ item.name }}
@@ -245,74 +181,53 @@
<view class=""> <view class="">
<view class="u-relative"> <view class="u-relative">
<template v-if="item.is_gift"> <template v-if="item.is_gift">
<text class="line-th color-999" <text class="line-th color-999">¥{{
>¥{{
$utils.toFixed(item.lowPrice * item.number, item) $utils.toFixed(item.lowPrice * item.number, item)
}}</text }}</text>
>
<view class="u-absolute" style="right: 0; bottom: 100%"> <view class="u-absolute" style="right: 0; bottom: 100%">
<text class="font-bold">¥0</text> <text class="font-bold">¥0</text>
</view> </view>
</template> </template>
<template v-else> <template v-else>
<template <template v-if="
v-if="
item.discount_sale_amount && item.discount_sale_amount &&
item.discount_sale_amount * 1 > 0 item.discount_sale_amount * 1 > 0
" ">
> <text class="line-th color-999">¥{{
<text class="line-th color-999"
>¥{{
$utils.toFixed(item.lowPrice * item.number, item) $utils.toFixed(item.lowPrice * item.number, item)
}}</text }}</text>
>
<view class="u-absolute" style="right: 0; bottom: 100%"> <view class="u-absolute" style="right: 0; bottom: 100%">
<text class="font-bold" <text class="font-bold">¥{{
>¥{{
$utils.toFixed( $utils.toFixed(
item.discount_sale_amount * item.number, item.discount_sale_amount * item.number,
item item
) )
}}</text }}</text>
>
</view> </view>
</template> </template>
<template v-else-if="item.is_time_discount"> <template v-else-if="item.is_time_discount">
<text class="line-th color-999" <text class="line-th color-999">¥{{
>¥{{
$utils.toFixed(item.lowPrice * item.number, item) $utils.toFixed(item.lowPrice * item.number, item)
}}</text }}</text>
> <view class="u-absolute xianshi" style="right: 0; bottom: 100%">
<view <text class="font-bold">¥{{ returnLimitTotalMoney(item) }}</text>
class="u-absolute xianshi"
style="right: 0; bottom: 100%"
>
<text class="font-bold"
>¥{{ returnLimitTotalMoney(item) }}</text
>
</view> </view>
</template> </template>
<template <template v-else-if="
v-else-if="
isVip && isVip &&
item.lowMemberPrice && item.lowMemberPrice &&
item.lowMemberPrice * 1 !=0 item.lowMemberPrice * 1 !=0
" ">
> <text class="line-th color-999">¥{{
<text class="line-th color-999"
>¥{{
$utils.toFixed(item.lowPrice * item.number, item) $utils.toFixed(item.lowPrice * item.number, item)
}}</text }}</text>
>
<view class="u-absolute" style="right: 0; bottom: 100%"> <view class="u-absolute" style="right: 0; bottom: 100%">
<text class="font-bold" <text class="font-bold">¥{{
>¥{{
$utils.toFixed( $utils.toFixed(
item.lowMemberPrice * item.number, item.lowMemberPrice * item.number,
item item
) )
}}</text }}</text>
>
</view> </view>
</template> </template>
<template v-else> <template v-else>
@@ -325,9 +240,7 @@
</template> </template>
</template> </template>
</view> </view>
<view class="color-999 u-text-right u-font-24 u-m-t-12" <view class="color-999 u-text-right u-font-24 u-m-t-12">×{{ item.number }}</view>
>×{{ item.number }}</view
>
</view> </view>
</view> </view>
<template v-if="item.remark"> <template v-if="item.remark">
@@ -335,64 +248,37 @@
{{ item.remark }} {{ item.remark }}
</view> </view>
</template> </template>
<scroll-view <scroll-view class="u-m-t-32" scroll-x="true" v-if="index == goods.sel">
class="u-m-t-32"
scroll-x="true"
v-if="index == goods.sel"
>
<view class="u-flex no-wrap"> <view class="u-flex no-wrap">
<view class="u-flex u-m-r-20" v-if="!item.is_gift"> <view class="u-flex u-m-r-20" v-if="!item.is_gift">
<button <button class="tag" hover-class="hover-class" @tap="showModel('discount', index)">
class="tag"
hover-class="hover-class"
@tap="showModel('discount', index)"
>
单品打折 单品打折
</button> </button>
</view> </view>
<view class="u-flex u-m-r-20"> <view class="u-flex u-m-r-20">
<!-- <button class="tag" hover-class="hover-class" @tap="showModel('giveFood')">赠菜</button> --> <!-- <button class="tag" hover-class="hover-class" @tap="showModel('giveFood')">赠菜</button> -->
<button <button class="tag" hover-class="hover-class" @tap="toggleItem(item, 'is_gift')">
class="tag"
hover-class="hover-class"
@tap="toggleItem(item, 'is_gift')"
>
{{ item.is_gift ? "取消赠送" : "赠送" }} {{ item.is_gift ? "取消赠送" : "赠送" }}
</button> </button>
</view> </view>
<view class="u-flex u-m-r-20"> <view class="u-flex u-m-r-20">
<button <button class="tag" hover-class="hover-class"
class="tag" @tap="showModel('packNumber', index, item)">
hover-class="hover-class"
@tap="showModel('packNumber', index, item)"
>
{{ item.pack_number > 0 ? "取消打包" : "打包" }} {{ item.pack_number > 0 ? "取消打包" : "打包" }}
</button> </button>
</view> </view>
<view class="u-flex u-m-r-20"> <view class="u-flex u-m-r-20">
<button <button class="tag" hover-class="hover-class" @tap="toggleItem(item, 'is_wait_call')">
class="tag"
hover-class="hover-class"
@tap="toggleItem(item, 'is_wait_call')"
>
{{ item.is_wait_call ? "取消等叫" : "等叫" }} {{ item.is_wait_call ? "取消等叫" : "等叫" }}
</button> </button>
</view> </view>
<view class="u-flex u-m-r-20"> <view class="u-flex u-m-r-20">
<button <button class="tag" hover-class="hover-class" @tap="toggleItem(item, 'is_print')">
class="tag"
hover-class="hover-class"
@tap="toggleItem(item, 'is_print')"
>
{{ item.is_print ? "免厨打" : "打印" }} {{ item.is_print ? "免厨打" : "打印" }}
</button> </button>
</view> </view>
<view class="u-flex u-m-r-20"> <view class="u-flex u-m-r-20">
<button <button class="tag" hover-class="hover-class" @tap="showModel('remark', index)">
class="tag"
hover-class="hover-class"
@tap="showModel('remark', index)"
>
单品备注 单品备注
</button> </button>
</view> </view>
@@ -423,34 +309,33 @@
<view class="u-flex u-row-between u-m-t-38"> <view class="u-flex u-row-between u-m-t-38">
<view class="u-flex"> <view class="u-flex">
<view <view class="u-flex price" v-if="orderCostSummary.totalDiscountAmount">
class="u-flex price"
v-if="orderCostSummary.totalDiscountAmount"
>
<view class="">优惠金额</view> <view class="">优惠金额</view>
<view class="font-bold u-font-32 u-m-r-16" <view class="font-bold u-font-32 u-m-r-16">¥{{ orderCostSummary.totalDiscountAmount }}</view>
>¥{{ orderCostSummary.totalDiscountAmount }}</view <up-icon name="question-circle" color="#666" @click="showDiscountInfo = true"></up-icon>
>
<up-icon
name="question-circle"
color="#666"
@click="showDiscountInfo = true"
></up-icon>
</view> </view>
</view> </view>
<view class="u-flex price u-m-l-32"> <view class="u-flex price u-m-l-32">
<view class="">实收金额</view> <view class="">实收金额</view>
<view class="font-bold u-font-32" <view class="font-bold u-font-32">¥{{ orderCostSummary.finalPayAmount }}</view>
>¥{{ orderCostSummary.finalPayAmount }}</view
>
</view> </view>
</view> </view>
</view> </view>
<view :style="{ height: bottomHeight + 'px' }"></view> <view :style="{ height: bottomHeight + 'px' }"></view>
<view class="safe-bottom fixed"> <view class="safe-bottom fixed u-flex gap-20">
<view class="btn"> <view class="btn u-flex-1">
<my-button shape="circle" @click="changeTableShow=true" type="default">
<view class="font-bold u-font-32">
<text>
转桌
</text>
</view>
</my-button>
</view>
<view class="btn u-flex-1">
<my-button shape="circle" @click="createAnOrder"> <my-button shape="circle" @click="createAnOrder">
<view class="font-bold u-font-32"> <view class="font-bold u-font-32">
<text v-if="pageData.shopInfo.registerType == 'before'"> <text v-if="pageData.shopInfo.registerType == 'before'">
@@ -463,28 +348,14 @@
</my-button> </my-button>
</view> </view>
</view> </view>
<model-discount <model-discount title="菜品减免" :ref="setModel" name="discount" :price="modelData.data.salePrice"
title="菜品减免" @confirm="discountconfirm"></model-discount>
:ref="setModel"
name="discount"
:price="modelData.data.salePrice"
@confirm="discountconfirm"
></model-discount>
<give-food title="赠菜" :ref="setModel" name="giveFood"></give-food> <give-food title="赠菜" :ref="setModel" name="giveFood"></give-food>
<one-remark <one-remark @confirm="goodsOneRemarkConfirm" title="单品备注" :ref="setModel" name="remark"></one-remark>
@confirm="goodsOneRemarkConfirm" <pack-number @confirm="goodsOnePackNumberConfirm" title="打包" :ref="setModel" name="packNumber"></pack-number>
title="单品备注"
:ref="setModel"
name="remark"
></one-remark>
<pack-number
@confirm="goodsOnePackNumberConfirm"
title="打包"
:ref="setModel"
name="packNumber"
></pack-number>
<up-popup :show="showDiscountInfo" mode="center" round="16rpx" @close="showDiscountInfo = false" closeOnClickOverlay > <up-popup :show="showDiscountInfo" mode="center" round="16rpx" @close="showDiscountInfo = false"
closeOnClickOverlay>
<view class="u-p-30 u-flex u-flex-col gap-20" style="min-width: 300rpx;"> <view class="u-p-30 u-flex u-flex-col gap-20" style="min-width: 300rpx;">
<view class="u-flex gap-20 u-row-between w-full" v-if="orderCostSummary.goodsDiscountAmount"> <view class="u-flex gap-20 u-row-between w-full" v-if="orderCostSummary.goodsDiscountAmount">
<text>商品优惠</text> <text>商品优惠</text>
@@ -505,12 +376,22 @@
</view> </view>
</up-popup> </up-popup>
<changeTable v-model="changeTableShow" :nowCartData="goods.list"
:goodsList="pageData.orderInfo?pageData.orderInfo.detailMap:[]" :order="pageData.orderInfo"
@update="changeTableUpdate" @confirm="changeTableConfirm"></changeTable>
<!-- <edit-discount title="优惠金额" :ref="setModel" name="editMoney" :price="allPrice"></edit-discount> --> <!-- <edit-discount title="优惠金额" :ref="setModel" name="editMoney" :price="allPrice"></edit-discount> -->
</view> </view>
</template> </template>
<script setup> <script setup>
import { onLoad, onReady, onShow, onHide } from "@dcloudio/uni-app"; import {
onLoad,
onReady,
onShow,
onHide
} from "@dcloudio/uni-app";
import { import {
ref, ref,
inject, inject,
@@ -522,6 +403,65 @@ import {
provide, provide,
} from "vue"; } from "vue";
import changeTable from '@/components/change-table.vue'
const changeTableShow = ref(false)
function transformTable() {
changeTableShow.value = true
}
function changeTableUpdate(allMerge) {
if (allMerge) {
uni.navigateBack()
} else {
init();
}
}
import {
mergeOrder
} from '@/http/api/order/order.js'
function changeTableConfirm(json) {
console.log('changeTableConfirm',json);
websocketUtil.send(
JSON.stringify({
type: "shopping",
operate_type: "rottable",
table_code: pageData.table.tableCode,
new_table_code: json.targetTableCode,
shop_id: uni.getStorageSync("shopInfo").id,
cart_id: json.now.cart_id
})
);
if (!json.old.sourceOrderId) {
uni.showToast({
title: '转桌成功',
icon: 'none'
})
if (json.now.allMerge) {
setTimeout(() => {
uni.navigateBack()
}, 1500)
} else {
init();
}
return
}
mergeOrder(json.old).then(res => {
uni.showToast({
title: '转桌成功',
icon: 'none'
})
if (json.old.allMerge && json.now.allMerge) {
setTimeout(() => {
uni.navigateBack()
}, 1500)
} else {
init();
}
})
}
import modelDiscount from "./components/discount"; import modelDiscount from "./components/discount";
import giveFood from "./components/give-food"; import giveFood from "./components/give-food";
import packNumber from "./components/pack-number"; import packNumber from "./components/pack-number";
@@ -530,17 +470,36 @@ import orderList from "./components/list";
// import editDiscount from '@/pagesCreateOrder/components/edit-discount.vue' // import editDiscount from '@/pagesCreateOrder/components/edit-discount.vue'
import { getSafeBottomHeight } from "@/commons/utils/safe-bottom.js"; import {
getSafeBottomHeight
} from "@/commons/utils/safe-bottom.js";
import go from "@/commons/utils/go.js"; import go from "@/commons/utils/go.js";
import { hasPermission } from "@/commons/utils/hasPermission.js"; import {
import { getNowCart } from "@/pagesCreateOrder/util.js"; hasPermission
} from "@/commons/utils/hasPermission.js";
import {
getNowCart
} from "@/pagesCreateOrder/util.js";
import { getShopInfo } from "@/http/api/shop.js"; import {
import { getShopTableDetail } from "@/http/api/table.js"; getShopInfo
import { getProductList } from "@/http/api/product.js"; } from "@/http/api/shop.js";
import { createOrder, getHistoryOrder } from "@/http/api/order.js"; import {
import { shopUserDetail } from "@/http/yskApi/shop-user.js"; getShopTableDetail
import { discountActivity } from "@/http/yskApi/market/discountActivity.js"; } from "@/http/api/table.js";
import {
getProductList
} from "@/http/api/product.js";
import {
createOrder,
getHistoryOrder
} from "@/http/api/order.js";
import {
shopUserDetail
} from "@/http/yskApi/shop-user.js";
import {
discountActivity
} from "@/http/yskApi/market/discountActivity.js";
import BigNumber from "bignumber.js"; import BigNumber from "bignumber.js";
import * as limitTimeDiscountApi from "@/http/yskApi/limitTimeDiscount.js"; import * as limitTimeDiscountApi from "@/http/yskApi/limitTimeDiscount.js";
@@ -554,6 +513,7 @@ provide("yskUtils", yskUtils);
const shopInfo = uni.getStorageSync("shopInfo"); const shopInfo = uni.getStorageSync("shopInfo");
provide("shopInfo", shopInfo); provide("shopInfo", shopInfo);
function returnLimitTotalMoney(data) { function returnLimitTotalMoney(data) {
// const price = yskUtils.limitUtils.returnPrice({ // const price = yskUtils.limitUtils.returnPrice({
const price = limitUtils.returnPrice({ const price = limitUtils.returnPrice({
@@ -597,8 +557,7 @@ const pageData = reactive({
table: {}, table: {},
user: {}, user: {},
eatTypes: { eatTypes: {
list: [ list: [{
{
name: "堂食", name: "堂食",
value: "dine-in", value: "dine-in",
}, },
@@ -707,7 +666,9 @@ onUnmounted(() => {
* @param {Object} tableCode * @param {Object} tableCode
*/ */
async function getHistoryOrderDetail(tableCode) { async function getHistoryOrderDetail(tableCode) {
let res = await getHistoryOrder({ tableCode: tableCode }); let res = await getHistoryOrder({
tableCode: tableCode
});
pageData.orderInfo = res; pageData.orderInfo = res;
} }
@@ -759,8 +720,11 @@ function onMessage() {
}) })
); );
} }
if (msg.status == 0) { if (msg.status == 0 && msg.operate_type != "time_discount_save") {
infoBox.showToast(msg.msg || "操作失败"); uni.showToast({
title: msg.msg || "操作失败",
icon: 'none'
})
return false; return false;
} }
@@ -896,7 +860,9 @@ function getCart() {
* 获取店铺信息 * 获取店铺信息
*/ */
async function getTbShopInfo() { async function getTbShopInfo() {
const res = await getShopInfo({ id: uni.getStorageSync("shopInfo").id }); const res = await getShopInfo({
id: uni.getStorageSync("shopInfo").id
});
pageData.shopInfo = res; pageData.shopInfo = res;
uni.setStorageSync("shopInfo", res); uni.setStorageSync("shopInfo", res);
} }
@@ -907,7 +873,10 @@ async function getTbShopInfo() {
async function getTableInfo(opt) { async function getTableInfo(opt) {
let res = {}; let res = {};
if (opt.id) { if (opt.id) {
res = await getShopTableDetail({ id: opt.id, tableCode: opt.tableCode }); res = await getShopTableDetail({
id: opt.id,
tableCode: opt.tableCode
});
} }
Object.assign(pageData.table, res); Object.assign(pageData.table, res);
if (!pageData.shopInfo.isTableFee && pageData.table && pageData.table.id) { if (!pageData.shopInfo.isTableFee && pageData.table && pageData.table.id) {
@@ -965,9 +934,9 @@ function uodateCartAndHistory() {
pageData.shopInfo, pageData.shopInfo,
pageData.user, pageData.user,
"product_id" "product_id"
) ) ?
? 1 1 :
: 0; 0;
console.log("uodateCartAndHistory", pageData.user); console.log("uodateCartAndHistory", pageData.user);
if (canUseLimitTimeDiscount != cart.is_time_discount) { if (canUseLimitTimeDiscount != cart.is_time_discount) {
newData.cart.push({ newData.cart.push({
@@ -1058,9 +1027,9 @@ async function discountconfirm(form) {
} }
}); });
} }
let lowMemberPrice = modelData.data.lowMemberPrice let lowMemberPrice = modelData.data.lowMemberPrice ?
? modelData.data.lowMemberPrice modelData.data.lowMemberPrice :
: modelData.data.lowPrice; modelData.data.lowPrice;
let discount_sale_amount = modelData.data.is_gift ? 0 : form.discountMoney; let discount_sale_amount = modelData.data.is_gift ? 0 : form.discountMoney;
let par = { let par = {
id: modelData.data.id, id: modelData.data.id,
@@ -1180,8 +1149,7 @@ async function updateChoseCount() {
console.log("不免餐位费"); console.log("不免餐位费");
let seatFee = { let seatFee = {
totalNumber: userNumbers.defaultCateIndex * 1 + 1, totalNumber: userNumbers.defaultCateIndex * 1 + 1,
totalAmount: totalAmount: (userNumbers.defaultCateIndex * 1 + 1) * pageData.shopInfo.tableFee,
(userNumbers.defaultCateIndex * 1 + 1) * pageData.shopInfo.tableFee,
}; };
Object.assign($seatFee, seatFee); Object.assign($seatFee, seatFee);
userNumbers.defaultCateIndex = $seatFee.totalNumber - 1; userNumbers.defaultCateIndex = $seatFee.totalNumber - 1;
@@ -1240,8 +1208,7 @@ async function createAnOrder() {
tableCode: pageData.table.tableCode, //台桌编码 tableCode: pageData.table.tableCode, //台桌编码
dineMode: pageData.eatTypes.active, //用餐模式 堂食 dine-in 外带 take-out 外卖 take-away dineMode: pageData.eatTypes.active, //用餐模式 堂食 dine-in 外带 take-out 外卖 take-away
remark: pageData.form.note, //备注 remark: pageData.form.note, //备注
seatNum: seatNum: pageData.eatTypes.active == "dine-in" ? seatFeeConfig.personCount : 0, //用餐人数
pageData.eatTypes.active == "dine-in" ? seatFeeConfig.personCount : 0, //用餐人数
packFee: orderCostSummary.value.packFee, //打包费 packFee: orderCostSummary.value.packFee, //打包费
originAmount: orderCostSummary.value.goodsRealAmount, //订单原金额(不包含打包费+餐位费) originAmount: orderCostSummary.value.goodsRealAmount, //订单原金额(不包含打包费+餐位费)
placeNum: placeNum, //当前订单下单次数 placeNum: placeNum, //当前订单下单次数
@@ -1285,8 +1252,7 @@ async function createAnOrder() {
) { ) {
//先付 //先付
return go.to( return go.to(
"PAGES_ORDER_PAY", "PAGES_ORDER_PAY", {
{
orderId: res.id, orderId: res.id,
isNowPay: true, isNowPay: true,
dinnerType: pageData.eatTypes.active, dinnerType: pageData.eatTypes.active,
@@ -1296,8 +1262,7 @@ async function createAnOrder() {
} else { } else {
if (!res.id && pageData.orderInfo.id) { if (!res.id && pageData.orderInfo.id) {
return go.to( return go.to(
"PAGES_ORDER_PAY", "PAGES_ORDER_PAY", {
{
orderId: pageData.orderInfo.id, orderId: pageData.orderInfo.id,
isNowPay: true, isNowPay: true,
dinnerType: pageData.eatTypes.active, dinnerType: pageData.eatTypes.active,
@@ -1308,8 +1273,7 @@ async function createAnOrder() {
//后付 //后付
if (option.isCreateOrderToDetail != "0") { if (option.isCreateOrderToDetail != "0") {
go.to( go.to(
"PAGES_ORDER_DETAIL", "PAGES_ORDER_DETAIL", {
{
id: res.id || pageData.orderInfo.id, id: res.id || pageData.orderInfo.id,
dinnerType: pageData.eatTypes.active, dinnerType: pageData.eatTypes.active,
}, },
@@ -1394,9 +1358,9 @@ const allGoodsList = computed(() => {
cur.map((v) => { cur.map((v) => {
v.number = v.num; v.number = v.num;
v.salePrice = v.price; v.salePrice = v.price;
v.discount_sale_amount = v.discount_sale_amount v.discount_sale_amount = v.discount_sale_amount ?
? v.discount_sale_amount * 1 v.discount_sale_amount * 1 :
: 0; 0;
}); });
prve.push(...cur); prve.push(...cur);
return prve; return prve;
@@ -1414,8 +1378,7 @@ const orderCostSummary = computed(() => {
pageData.eatTypes.active, pageData.eatTypes.active,
selCoupon.value, selCoupon.value,
activityList.value, activityList.value,
orderExtraConfig.value, orderExtraConfig.value, {},
{},
new Date() new Date()
); );
console.log(" 订单费用汇总", costSummary); console.log(" 订单费用汇总", costSummary);
@@ -1425,8 +1388,7 @@ watch(
() => $seatFee.totalNumber, () => $seatFee.totalNumber,
(newVal, oldVal) => { (newVal, oldVal) => {
seatFeeConfig.personCount = newVal; seatFeeConfig.personCount = newVal;
}, }, {
{
immediate: true, immediate: true,
} }
); );
@@ -1510,7 +1472,7 @@ watch(
z-index: 10; z-index: 10;
.btn { .btn {
padding: 0 88rpx 56rpx 88rpx; // padding: 0 88rpx 56rpx 88rpx;
} }
} }
@@ -1543,9 +1505,11 @@ watch(
z-index: 9; z-index: 9;
color: #fff; color: #fff;
} }
.u-row-between { .u-row-between {
justify-content: space-between; justify-content: space-between;
} }
.w-full { .w-full {
width: 100%; width: 100%;
} }

View File

@@ -3,7 +3,9 @@
<up-image :src="data.coverImg" mode="aspectFill" :width="img.width" :height="img.height"></up-image> <up-image :src="data.coverImg" mode="aspectFill" :width="img.width" :height="img.height"></up-image>
<view class="info u-flex u-row-between u-col-top u-flex-col"> <view class="info u-flex u-row-between u-col-top u-flex-col">
<view class="limit-discount" v-if="is_time_discount">限时折扣</view> <view class="limit-discount" v-if="is_time_discount">限时折扣</view>
<view class="nowStockerNumber" v-if="data.isAutoSoldStock&&nowStockerNumber<=10&&nowStockerNumber>0">
剩余库存{{nowStockerNumber}}
</view>
<view> <view>
<view> <view>
<text class="up-line-1">{{ data.name }}</text> <text class="up-line-1">{{ data.name }}</text>
@@ -56,7 +58,7 @@
<view class="isSellout" v-else-if="data.isSoldStock == 1"> <view class="isSellout" v-else-if="data.isSoldStock == 1">
<image class="isSellout_icon" src="/pagesCreateOrder/static/images/no-sold.svg" mode=""></image> <image class="isSellout_icon" src="/pagesCreateOrder/static/images/no-sold.svg" mode=""></image>
</view> </view>
<view class="isSellout" v-else-if="data.isStock == 1 && data.stockNumber <= 0"> <view class="isSellout" v-else>
<image class="isSellout_icon" src="/pagesCreateOrder/static/images/no-stock.svg" mode=""></image> <image class="isSellout_icon" src="/pagesCreateOrder/static/images/no-stock.svg" mode=""></image>
</view> </view>
</template> </template>
@@ -107,6 +109,10 @@
return {}; return {};
}, },
}, },
consStockList: {
type: Array,
default:[]
}
}); });
//判断是否是时间折扣商品 //判断是否是时间折扣商品
@@ -156,12 +162,54 @@
return false; return false;
} }
return ( return (
(item.isStock == 1 && item.stockNumber <= 0) || !consStockisFull(item) ||
item.isSoldStock == 1 || item.isSoldStock == 1 ||
item.isSale == 0 || item.isSale == 0 ||
!isProductAvailable(item.days, item.startTime, item.endTime) !isProductAvailable(item.days, item.startTime, item.endTime)
); );
}); });
const stockNumber=computed(()=>{
})
// 1. 筛选匹配的耗材列表,增加对应商品数量
const conslist=computed(()=>{
if(props.consStockList.length<=0){
return []
}
return props.consStockList.filter(v => {
return props.data.consList.find(i =>{
return i.consInfoId == v.consId
});
}).map(v=>{
const cItem=props.data.consList.find(c=>c.consInfoId==v.consId)
const goodsNumber=Math.floor(v.stockNumber/cItem.surplusStock)
console.log('props.data',props.data.name);
console.log('goodsNumber',goodsNumber);
return {
...v,
goodsNumber
}
}).sort((a,b)=>{
return a.goodsNumber-b.goodsNumber
})
})
const nowStockerNumber=computed(()=>{
return conslist.value[0]?conslist.value[0].goodsNumber:9999
})
function consStockisFull(item) {
if(!item.isAutoSoldStock){
return true
}
// 4. 判断:最小库存 > 每份消耗库存 → 返回 true否则 false
if (nowStockerNumber.value>=1) {
return true;
} else {
return false;
}
}
// 判断商品是否在可售时间内 // 判断商品是否在可售时间内
function isProductAvailable(sellDaysStr, startTimeStr, endTimeStr) { function isProductAvailable(sellDaysStr, startTimeStr, endTimeStr) {
// 将后端返回的字符串转换为数组 // 将后端返回的字符串转换为数组
@@ -306,4 +354,14 @@
color: rgba(255, 255, 255, 0.8); color: rgba(255, 255, 255, 0.8);
text-decoration: line-through; text-decoration: line-through;
} }
.nowStockerNumber{
position: absolute;
left: 24rpx;
bottom: 80rpx;
background-color: rgba(255, 255, 255, .8);
color: red;
padding: 4rpx 8rpx;
font-size: 24rpx;
border-radius: 4rpx ;
}
</style> </style>

View File

@@ -36,9 +36,7 @@
</view> </view>
</scroll-view> </scroll-view>
<scroll-view :scroll-top="data.scrollRightTop" scroll-y scroll-with-animation class="right-box" <scroll-view :scroll-top="data.scrollRightTop" scroll-y scroll-with-animation class="right-box"
@scroll="rightScroll" @scroll="rightScroll" @scrolltoupper="scrolltoupper">
@scrolltoupper="scrolltoupper"
>
<view class="page-view u-p-l-24"> <view class="page-view u-p-l-24">
<view class="list-tight-top"> <view class="list-tight-top">
<template v-if="lingshi.show"> <template v-if="lingshi.show">
@@ -62,7 +60,7 @@
<view class="item-container"> <view class="item-container">
<view class="thumb-box" v-for="(goodsItem, goodsIndex) in item.foods" :key="goodsIndex"> <view class="thumb-box" v-for="(goodsItem, goodsIndex) in item.foods" :key="goodsIndex">
<list-goods-item :limitTimeDiscount="data.limitTimeDiscount" <list-goods-item :limitTimeDiscount="data.limitTimeDiscount"
@chooseGuige="chooseGuige($event, index)" :consStockList="consStockList" @chooseGuige="chooseGuige($event, index)"
@add="goodsUpdate($event, index, true)" @add="goodsUpdate($event, index, true)"
@reduce="goodsUpdate($event, index, false)" @tapweigh="tapweigh($event, index)" @reduce="goodsUpdate($event, index, false)" @tapweigh="tapweigh($event, index)"
:index="goodsIndex" :data="goodsItem"></list-goods-item> :index="goodsIndex" :data="goodsItem"></list-goods-item>
@@ -81,7 +79,7 @@
<view class="u-flex u-m-t-20 u-flex-wrap u-row-between"> <view class="u-flex u-m-t-20 u-flex-wrap u-row-between">
<view class="u-m-b-30" v-for="(goodsItem, goodsIndex) in searchResult" :key="goodsIndex"> <view class="u-m-b-30" v-for="(goodsItem, goodsIndex) in searchResult" :key="goodsIndex">
<list-goods-item :img="{ width: '330rpx', height: '330rpx' }" <list-goods-item :img="{ width: '330rpx', height: '330rpx' }"
:limitTimeDiscount="data.limitTimeDiscount" :consStockList="consStockList" :limitTimeDiscount="data.limitTimeDiscount"
@chooseGuige="chooseGuige(goodsItem.goodsIndex, goodsItem.index)" @chooseGuige="chooseGuige(goodsItem.goodsIndex, goodsItem.index)"
@add="searchGoodsUpdate(goodsItem, goodsIndex, true)" @add="searchGoodsUpdate(goodsItem, goodsIndex, true)"
@reduce="searchGoodsUpdate(goodsItem, goodsIndex, false)" @reduce="searchGoodsUpdate(goodsItem, goodsIndex, false)"
@@ -98,8 +96,7 @@
<view class="bottom w-full"> <view class="bottom w-full">
<my-car :isCreateOrderToDetail="isCreateOrderToDetail" @updateNumber="carsNumberChange" :table="data.table" <my-car :isCreateOrderToDetail="isCreateOrderToDetail" @updateNumber="carsNumberChange" :table="data.table"
:data="cars" :orderInfo="data.orderInfo" :limitTimeDiscount="data.limitTimeDiscount" :data="cars" :orderInfo="data.orderInfo" :limitTimeDiscount="data.limitTimeDiscount"
@changeNumber="goodsChangeNumber" @changeNumber="goodsChangeNumber" @clear="cleaCart"></my-car>
@clear="cleaCart"></my-car>
</view> </view>
<!-- 套餐选择规格 --> <!-- 套餐选择规格 -->
<taocanModel ref="taocanModelRef" @confirm="taocanConfirm" :goodsData="selGoods"></taocanModel> <taocanModel ref="taocanModelRef" @confirm="taocanConfirm" :goodsData="selGoods"></taocanModel>
@@ -117,7 +114,8 @@
</view> </view>
<!-- 修改购物车数量 --> <!-- 修改购物车数量 -->
<popupChangeNumber v-model="popupChangeNumberData.show" :goods="popupChangeNumberData.data" @confirm="carsNumberChange"></popupChangeNumber> <popupChangeNumber v-model="popupChangeNumberData.show" :goods="popupChangeNumberData.data"
@confirm="carsNumberChange"></popupChangeNumber>
</view> </view>
</template> </template>
<script setup> <script setup>
@@ -196,6 +194,9 @@
cancelOrder, cancelOrder,
rmPlaceOrder, rmPlaceOrder,
} from "@/http/api/order.js"; } from "@/http/api/order.js";
import {
getConsStock
} from '@/http/api/cons.js'
const modal = reactive({ const modal = reactive({
key: "", key: "",
@@ -349,6 +350,24 @@
let $originGoods = []; let $originGoods = [];
let $category = []; let $category = [];
const consStockList = ref([])
function getCons() {
return new Promise((resolve, reject) => {
try {
getConsStock({
shopId: uni.getStorageSync("shopInfo").id
}).then(res => {
consStockList.value = res || []
console.log('consStockList', consStockList.value);
resolve()
})
} catch (err) {
reject()
}
})
}
async function init() { async function init() {
if (option.type == "add") { if (option.type == "add") {
setTabBar($category, $originGoods, []); setTabBar($category, $originGoods, []);
@@ -364,6 +383,8 @@
size: 300 size: 300
}); });
$category = categoryRes.records; $category = categoryRes.records;
// 获取耗材数据
await getCons()
// 获取商品数据 // 获取商品数据
const goodsRes = await getGoods(); const goodsRes = await getGoods();
const goods = goodsRes.filter((v) => { const goods = goodsRes.filter((v) => {
@@ -387,6 +408,8 @@
initCart(); initCart();
} }
const allHistoryOrder = ref([])
/** /**
* 获取订单详情 * 获取订单详情
*/ */
@@ -409,13 +432,13 @@
console.log("data.historyOrder===", data.historyOrder); console.log("data.historyOrder===", data.historyOrder);
let allHistoryOrder = data.historyOrder.map((item) => { allHistoryOrder.value = data.historyOrder.map((item) => {
return [...item.info]; return [...item.info];
}); }).flat();
// console.log('allHistoryOrder===', allHistoryOrder.flat()); // console.log('allHistoryOrder===', allHistoryOrder.flat());
data.historyOrderNum = 0; data.historyOrderNum = 0;
allHistoryOrder.flat().map((item) => { allHistoryOrder.value.map((item) => {
data.historyOrderNum += item.num; data.historyOrderNum += item.num;
}); });
// console.log('data.historyOrderNum===', data.historyOrderNum); // console.log('data.historyOrderNum===', data.historyOrderNum);
@@ -741,7 +764,22 @@
} }
// initCart() // initCart()
} }
// 封装成 Promise 的确认弹窗
const showConfirmModal = (title, content) => {
return new Promise((resolve) => {
uni.showModal({
title: title,
content: content,
showCancel: true,
cancelText: '取消添加',
confirmText: '继续',
success(res) {
// 确认返回 true取消/关闭返回 false
resolve(res.confirm === true);
}
});
});
};
/** /**
* 菜品操作 * 菜品操作
* @param {Object} foodsindex * @param {Object} foodsindex
@@ -800,6 +838,34 @@
//更新 //更新
let cartItem = cars[goodsInCarIndex]; let cartItem = cars[goodsInCarIndex];
let number = isAdd ? cartItem.number + 1 : +cartItem.number - 1; let number = isAdd ? cartItem.number + 1 : +cartItem.number - 1;
if (isAdd) {
if (allHistoryOrder.value.find(v => v.productId == $goods.id)) {
// 等待用户点击
const isConfirm = await showConfirmModal(
'该商品已下单过,请确认是否重复',
'菜品名称:《' + $goods.name + '》'
);
if (!isConfirm) {
return
}
}else{
if (number == 2) {
// 等待用户点击
const isConfirm = await showConfirmModal(
'购物车已有该商品,请确认是否重复',
'菜品名称:《' + $goods.name + '》'
);
if (!isConfirm) {
return
}
}
}
}
if (!isAdd) { if (!isAdd) {
if (number === 0 || number < suitNum) { if (number === 0 || number < suitNum) {
//移除 //移除
@@ -828,6 +894,7 @@
data.isGoodsAdd = false; data.isGoodsAdd = false;
setSearchGoods(searchGoodsIndex, number); setSearchGoods(searchGoodsIndex, number);
} else { } else {
// 不影响之前的代码 称重suit单独处理 // 不影响之前的代码 称重suit单独处理
if ($goods.type == "weight" && showCurrentInput) { if ($goods.type == "weight" && showCurrentInput) {
suitNum = showCurrentInput; suitNum = showCurrentInput;
@@ -839,6 +906,16 @@
return; return;
} }
} }
if (allHistoryOrder.value.find(v => v.productId == $goods.id)) {
// 等待用户点击
const isConfirm = await showConfirmModal(
'该商品已下单过,请确认是否重复',
'菜品名称:《' + $goods.name + '》'
);
if (!isConfirm) {
return
}
}
// 套餐和单规格 // 套餐和单规格
if ($goods.groupType != 1) { if ($goods.groupType != 1) {
//增加 //增加
@@ -937,8 +1014,7 @@
tabbarItem.foods.find((v) => v.id == e.goods.product_id); tabbarItem.foods.find((v) => v.id == e.goods.product_id);
} }
}); });
$sku = !e.goods.product_id ? $sku = !e.goods.product_id ? {
{
suitNum: 1 suitNum: 1
} : } :
$goods.skuList.find((v) => v.id == e.goods.sku_id); $goods.skuList.find((v) => v.id == e.goods.sku_id);
@@ -1018,13 +1094,22 @@
* @param {Object} skuList * @param {Object} skuList
*/ */
function returnSelGoodsSkuList(selectSpecInfo) { function returnSelGoodsSkuList(selectSpecInfo) {
// 👇 修复:如果是字符串,转成对象
if (typeof selectSpecInfo === 'string') {
selectSpecInfo = JSON.parse(selectSpecInfo);
}
let specInfo = []; let specInfo = [];
console.log('selectSpecInfo', selectSpecInfo);
for (var key in selectSpecInfo) { for (var key in selectSpecInfo) {
console.log('key', key); // 现在会正确打印:口味、汤
specInfo.push({ specInfo.push({
name: key, name: key,
value: selectSpecInfo[key], value: selectSpecInfo[key],
}); });
} }
let result = specInfo.map((v, index) => { let result = specInfo.map((v, index) => {
return { return {
...v, ...v,
@@ -1062,9 +1147,30 @@
} = res; } = res;
let carGoods = cars[index]; let carGoods = cars[index];
let cartId = carGoods.id; let cartId = carGoods.id;
let newNumber = carGoods.number * 1 + suitNum;
let suitNum = goods.skuList[0].suitNum || 1; let suitNum = goods.skuList[0].suitNum || 1;
let newNumber = carGoods.number * 1 + suitNum;
if (allHistoryOrder.value.find(v => v.productId == goods.id)) {
// 等待用户点击
const isConfirm = await showConfirmModal(
'该商品已下单过,请确认是否重复',
'菜品名称:《' + goods.name + '》'
);
if (!isConfirm) {
return
}
}else{
if (newNumber == 2 && carGoods.number < newNumber) {
// 等待用户点击
const isConfirm = await showConfirmModal(
'购物车已有该商品,请确认是否重复?',
'菜品名称:《' + goods.name + '》'
);
if (!isConfirm) {
return
}
}
}
editCart({ editCart({
id: cartId, id: cartId,
number: newNumber, number: newNumber,
@@ -1079,6 +1185,17 @@
); );
data.isGoodsAdd = false; data.isGoodsAdd = false;
} else { } else {
if (allHistoryOrder.value.find(v => v.productId == goods.id)) {
// 等待用户点击
const isConfirm = await showConfirmModal(
'该商品已下单过,请确认是否重复',
'菜品名称:《' + goods.name + '》'
);
if (!isConfirm) {
return
}
}
//添加 //添加
editCart({ editCart({
number: suitNum, number: suitNum,
@@ -1106,8 +1223,7 @@
return carsGoods.sku_id == sku_id && carsGoods.product_id == product_id; return carsGoods.sku_id == sku_id && carsGoods.product_id == product_id;
}); });
const carGoods = cars[goodsInCarIndex]; const carGoods = cars[goodsInCarIndex];
return carGoods ? return carGoods ? {
{
index: goodsInCarIndex, index: goodsInCarIndex,
carGoods, carGoods,
} : } :

View File

@@ -1,4 +1,5 @@
<template> <template>
<view>
<my-model title="退菜" ref="model" @close="onModelClose" @open="onModelOpen"> <my-model title="退菜" ref="model" @close="onModelClose" @open="onModelOpen">
<template #desc> <template #desc>
<view class="u-p-30 u-text-left"> <view class="u-p-30 u-text-left">
@@ -36,8 +37,8 @@
<view class="u-flex u-m-r-16 u-m-b-16" v-for="(item,index) in tags" :key="index"> <view class="u-flex u-m-r-16 u-m-b-16" v-for="(item,index) in tags" :key="index">
<up-tag @click="changeTagSel(item)" :text="item.label" plain borderColor="#E6FOFF" <up-tag @click="changeTagSel(item)" :text="item.label" plain borderColor="#E6FOFF"
color="#318AFE" v-if="item.checked"> </up-tag> color="#318AFE" v-if="item.checked"> </up-tag>
<up-tag @click="changeTagSel(item)" borderColor="#E5E5E5" color="#666" :text="item.label" <up-tag @click="changeTagSel(item)" borderColor="#E5E5E5" color="#666"
plain v-else> </up-tag> :text="item.label" plain v-else> </up-tag>
</view> </view>
</view> </view>
<view class="u-m-t-24"> <view class="u-m-t-24">
@@ -50,16 +51,37 @@
<view class="u-p-t-18 u-p-l-30 u-p-r-30 u-p-b-10"> <view class="u-p-t-18 u-p-l-30 u-p-r-30 u-p-b-10">
<my-button box-shadow shape="circle" @tap="confirm">确认退菜</my-button> <my-button box-shadow shape="circle" @tap="confirm">确认退菜</my-button>
<view class="u-m-t-10"> <view class="u-m-t-10">
<my-button @tap="onModelClose" shape="circle" bgColor="#fff" type="cancel" box-shadow>取消</my-button> <my-button @tap="onModelClose" shape="circle" bgColor="#fff" type="cancel"
box-shadow>取消</my-button>
</view> </view>
</view> </view>
</template> </template>
</my-model> </my-model>
<up-modal :show="confirmModal.show" title="提示" @close="confirmModalClose" @cancel="confirmModalClose"
@confirm="confirmModalConfirm" showCancelButton>
<view>
<view>
<up-radio-group v-model="confirmModal.selRefundStock">
<up-radio v-for="(item,index) in confirmModal.refundStocks" :key="index" :label="item.name"
:name="item.key"></up-radio>
</up-radio-group>
</view>
</view>
</up-modal>
</view>
</template> </template>
<script setup> <script setup>
import { reactive, ref, watch } from 'vue'; import {
reactive,
ref,
watch
} from 'vue';
import infoBox from '@/commons/utils/infoBox.js' import infoBox from '@/commons/utils/infoBox.js'
const emits = defineEmits(['update:show', 'confirm']) const emits = defineEmits(['update:show', 'confirm'])
const props = defineProps({ const props = defineProps({
@@ -76,6 +98,22 @@
default: false default: false
} }
}) })
const confirmModal = reactive({
show: false,
selRefundStock: false,
refundStocks: [{
name: '已上菜(仅退菜不退库存)',
key: false
}, {
name: '未上菜(退菜后退库存)',
key: true,
}]
})
function confirmModalClose() {
confirmModal.show = false
confirmModal.selRefundStock = false
}
const form = reactive({ const form = reactive({
note: '' note: ''
}) })
@@ -157,11 +195,51 @@
}) })
form.note = '' form.note = ''
} }
import {
getProductDetail
} from '@/http/api/product.js'
import {
getCategoryDetail
} from '@/http/api/cateGory.js'
async function getGoodsCategory(goods) {
const res = await getProductDetail(goods.productId)
if (res) {
console.log('res', res);
const res1 = await getCategoryDetail(res.categoryId)
return res1
}
uni.showToast({
title: '获取该商品信息数据失败',
icon: 'none'
})
return null
}
function confirmModalConfirm() {
refundGoods()
confirmModalClose()
}
function refundGoods() {
const selTag = tags.value.filter(item => item.checked).map(item => item.label).join(",")
const note = selTag + (form.note.length > 0 ? "," + form.note : "");
let par = {
orderId: props.data.orderId,
refundAmount: number.value * props.data.unitPrice,
refundReason: note,
refundStock: confirmModal.selRefundStock,
refundDetails: [{
id: props.data.id,
returnAmount: number.value * props.data.unitPrice,
num: number.value,
}],
}
emits('confirm', par)
}
/** /**
* 确认退菜 * 确认退菜
*/ */
function confirm() { async function confirm() {
const selTag = tags.value.filter(item => item.checked).map(item => item.label).join(",") const selTag = tags.value.filter(item => item.checked).map(item => item.label).join(",")
const note = selTag + (form.note.length > 0 ? "," + form.note : ""); const note = selTag + (form.note.length > 0 ? "," + form.note : "");
console.log({ console.log({
@@ -171,17 +249,22 @@
if (!note) { if (!note) {
return infoBox.showToast("请输入退菜原因"); return infoBox.showToast("请输入退菜原因");
} }
let par = { const shopInfo = uni.getStorageSync('shopInfo')
orderId: props.data.orderId, if (shopInfo.refundMode == 1) {
refundAmount: number.value * props.data.unitPrice, const res = await getGoodsCategory(props.data)
refundReason: note, if (res.refundMode === 3) {
refundDetails: [{ confirmModal.show = true
id: props.data.id, return
returnAmount: number.value * props.data.unitPrice,
num: number.value,
}],
} }
emits('confirm', par) }
if (shopInfo.refundMode == 2) {
const res = await getProductDetail(props.data.productId)
if (res.refundMode === 3) {
confirmModal.show = true
return
}
}
refundGoods()
} }
</script> </script>

View File

@@ -23,10 +23,15 @@
</template> </template>
<template v-else> <template v-else>
<template v-if="orderDetail.info.status=='unpaid'"> <template v-if="orderDetail.info.status=='unpaid'">
<view class="u-flex-1"> <view class="u-flex-1">
<my-button @tap="diancan" color="#fff" bgColor="rgb(57,53,52)" borderRadius="100rpx 0 0 100rpx" fontWeight="700" <my-button @tap="diancan" color="#fff" bgColor="rgb(57,53,52)" borderRadius="100rpx 0 0 100rpx" fontWeight="700"
shape="circle" plain type="primary">加菜</my-button> shape="circle" plain type="primary">加菜</my-button>
</view> </view>
<view class="u-flex-1" style="border-right: 1px solid #fff;">
<my-button @tap="transformTable" borderRadius="0 0 0 0" shape="circle" fontWeight="700"
type="primary">转桌</my-button>
</view>
<view class="u-flex-1"> <view class="u-flex-1">
<my-button @tap="toPay" borderRadius="0 100rpx 100rpx 0" shape="circle" fontWeight="700" <my-button @tap="toPay" borderRadius="0 100rpx 100rpx 0" shape="circle" fontWeight="700"
type="primary">结账</my-button> type="primary">结账</my-button>
@@ -37,6 +42,10 @@
</view> </view>
<tuicai-vue @confirm="tuicaiConfirm" v-model:show="tuicai.show" :data="tuicai.selGoods"></tuicai-vue> <tuicai-vue @confirm="tuicaiConfirm" v-model:show="tuicai.show" :data="tuicai.selGoods"></tuicai-vue>
<changeTable v-model="changeTableShow" :nowCartData="[]" :goodsList="orderDetail.info?orderDetail.info.detailMap:[]" :order="orderDetail.info"
@update="changeTableUpdate"
></changeTable>
</view> </view>
</template> </template>
@@ -60,6 +69,12 @@
import { shopUserDetail } from '@/http/api/shopUser.js' import { shopUserDetail } from '@/http/api/shopUser.js'
import { getShopInfo } from '@/http/api/shop.js' import { getShopInfo } from '@/http/api/shop.js'
import changeTable from '@/components/change-table.vue'
const changeTableShow=ref(false)
function transformTable(){
changeTableShow.value=true
}
const tuicai = reactive({ const tuicai = reactive({
show: false, show: false,
isSeatFee: false, isSeatFee: false,
@@ -128,6 +143,8 @@
item.unitPrice = uni.$utils.isGoodsPrice(item,user.value) item.unitPrice = uni.$utils.isGoodsPrice(item,user.value)
}) })
}) })
console.log('orderDetail.goodsList',orderDetail.goodsList);
console.log('orderDetail.info',orderDetail.info);
orderDetail.info = res orderDetail.info = res
} }
@@ -316,7 +333,13 @@
}) })
} }
function changeTableUpdate(allMerge){
if(allMerge===1){
uni.navigateBack()
}else{
getOrderDetail()
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@@ -12,7 +12,8 @@
</view> </view>
<view class="u-flex"> <view class="u-flex">
<view> <view>
<text :class="[data.status]">{{$dict.getDiceName(data.status,'orderStatus')}}{{data.refundType?'['+$dict.getDiceName(data.refundType,'refundType')+']':''}}</text> <text
:class="[data.status]">{{$dict.getDiceName(data.status,'orderStatus')}}{{data.refundType?'['+$dict.getDiceName(data.refundType,'refundType')+']':''}}</text>
</view> </view>
<view class="line"></view> <view class="line"></view>
<view class=" color-main"> <view class=" color-main">
@@ -33,13 +34,18 @@
<view class="" v-for="(item,index) in data.goods" :key="index"> <view class="" v-for="(item,index) in data.goods" :key="index">
<view class="u-flex u-row-between u-col-top u-m-t-32" v-if="item.productId!=-999"> <view class="u-flex u-row-between u-col-top u-m-t-32" v-if="item.productId!=-999">
<view> <view>
<view class=""> {{item.productName}}</view> <view class="">
<text>{{item.productName}}</text>
</view>
<view class="color-999 u-font-24 u-m-t-8"> <view class="color-999 u-font-24 u-m-t-8">
{{item.skuName}} {{item.skuName}}
</view> </view>
</view> </view>
<view class="u-flex u-flex-1 u-row-right" style="align-items: center;"> <view class="u-flex u-flex-1 u-row-right" style="align-items: center;">
<view style="margin-right: 10rpx;">×{{item.num}}</view> <view style="margin-right: 10rpx;">
<text>×{{item.num}}</text>
<text class="color-red u-m-l-10 font-bold" v-if="item.returnNum">(退{{item.returnNum}})</text>
</view>
<view class="u-text-right u-relative" :style="computedPriceStyle()"> <view class="u-text-right u-relative" :style="computedPriceStyle()">
<text>{{item.unitPrice}}</text> <text>{{item.unitPrice}}</text>
</view> </view>
@@ -98,7 +104,12 @@
</template> </template>
<script setup> <script setup>
import { computed, reactive, ref, watch } from 'vue'; import {
computed,
reactive,
ref,
watch
} from 'vue';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import go from '@/commons/utils/go.js' import go from '@/commons/utils/go.js'

View File

@@ -392,7 +392,6 @@ async function init() {
} }
Object.assign(order, orderRes); Object.assign(order, orderRes);
pageData.goodsList = objToArrary(orderRes.detailMap); pageData.goodsList = objToArrary(orderRes.detailMap);
// console.log("order===",order) // console.log("order===",order)
// console.log("pageData.user===",pageData.user) // console.log("pageData.user===",pageData.user)
// 获取用户信息 // 获取用户信息
@@ -412,6 +411,7 @@ async function init() {
} }
pageData.seatNum = order.seatNum; pageData.seatNum = order.seatNum;
seatFeeConfig.personCount = order.seatNum; seatFeeConfig.personCount = order.seatNum;
console.log('seatFeeConfig',seatFeeConfig);
} }
/** /**
@@ -464,7 +464,7 @@ const pointDeductionRule = reactive({
const seatFeeConfig = reactive({ const seatFeeConfig = reactive({
pricePerPerson: pageData.shopInfo.tableFee || 0, pricePerPerson: pageData.shopInfo.tableFee || 0,
personCount: 0, //就餐人数 personCount: 0, //就餐人数
isEnabled: !pageData.shopInfo.isTableFee isEnabled: !pageData.shopInfo.isTableFee,
}); });
//使用积分数量 //使用积分数量
const userPoints = ref(0); const userPoints = ref(0);
@@ -517,7 +517,7 @@ const orderExtraConfig = computed(() => {
memberDiscountRate: 1, memberDiscountRate: 1,
newUserDiscount: newUserDiscount.value, newUserDiscount: newUserDiscount.value,
fullReductionActivities: fullReductionActivities.value, fullReductionActivities: fullReductionActivities.value,
currentDinnerType: options.dinnerType, currentDinnerType: options.dinnerType||order.dineMode,
isFreeDine: false, //霸王餐 isFreeDine: false, //霸王餐
freeDineConfig: freeDineConfig.value, freeDineConfig: freeDineConfig.value,
limitTimeDiscount: order.limitRate, limitTimeDiscount: order.limitRate,
@@ -528,7 +528,7 @@ const orderExtraConfig = computed(() => {
const orderCostSummary = computed(() => { const orderCostSummary = computed(() => {
const costSummary = yskUtils.OrderPriceCalculator.calculateOrderCostSummary( const costSummary = yskUtils.OrderPriceCalculator.calculateOrderCostSummary(
pageData.goodsList, pageData.goodsList,
options.dinnerType, (options.dinnerType||order.dineMode),
selCoupon.value, selCoupon.value,
activityList.value, activityList.value,
orderExtraConfig.value, orderExtraConfig.value,
@@ -633,6 +633,7 @@ watch(
); );
function getPayParam() { function getPayParam() {
const dinnerType=options.dinnerType||order.dineMode
let params = { let params = {
shopId: uni.getStorageSync('shopInfo').id || '', shopId: uni.getStorageSync('shopInfo').id || '',
orderId: order.id, orderId: order.id,
@@ -646,7 +647,7 @@ function getPayParam() {
roundAmount: 0, //抹零金额 减免多少钱 roundAmount: 0, //抹零金额 减免多少钱
pointsDiscountAmount: orderCostSummary.value.pointDeductionAmount, //积分抵扣金额(tb_points_basic_setting表) pointsDiscountAmount: orderCostSummary.value.pointDeductionAmount, //积分抵扣金额(tb_points_basic_setting表)
pointsNum: orderCostSummary.value.pointUsed, //(扣除各类折扣 enable_deduction后使用) pointsNum: orderCostSummary.value.pointUsed, //(扣除各类折扣 enable_deduction后使用)
seatNum: options.dinnerType == 'dine-in' ? seatFeeConfig.personCount : 0, //用餐人数 seatNum: dinnerType == 'dine-in' ? seatFeeConfig.personCount : 0, //用餐人数
newCustomerDiscountAmount: orderCostSummary.value.newUserDiscount, //新客立减 newCustomerDiscountAmount: orderCostSummary.value.newUserDiscount, //新客立减
newCustomerDiscountId: orderCostSummary.value.newUserDiscount > 0 ? newUserDiscountRes.value.id : '', newCustomerDiscountId: orderCostSummary.value.newUserDiscount > 0 ? newUserDiscountRes.value.id : '',

View File

@@ -2,12 +2,15 @@
<view class="min-page bg-gray u-p-30"> <view class="min-page bg-gray u-p-30">
<view class="bg-fff u-p-l-30 u-p-r-30 "> <view class="bg-fff u-p-l-30 u-p-r-30 ">
<view class="myTabs u-m-t-20"> <view class="myTabs u-m-t-20">
<my-tabs :list="pageData.tabsList" :modelValue="pageData.tabsIndex" :textKey="'label'" @change="tabsChange"></my-tabs> <my-tabs :list="pageData.tabsList" :modelValue="pageData.tabsIndex" :textKey="'label'"
@change="tabsChange"></my-tabs>
</view> </view>
</view> </view>
<view v-if="pageData.tabsIndex == 2" class="bg-fff u-p-24 border-r-12 u-flex u-row-between" style="margin-top: 30rpx;"> <view v-if="pageData.tabsIndex == 2" class="bg-fff u-p-24 border-r-12 u-flex u-row-between"
<up-input type="digit" placeholder="请输入退款金额" @change="parseIntNumber($event)" border="surround" v-model="pageData.modify" > style="margin-top: 30rpx;">
<up-input type="digit" placeholder="请输入退款金额" @change="parseIntNumber($event)" border="surround"
v-model="pageData.modify">
<template #prefix> <template #prefix>
<up-text text="¥" margin="0 3px 0 0" type="tips"></up-text> <up-text text="¥" margin="0 3px 0 0" type="tips"></up-text>
</template> </template>
@@ -96,28 +99,60 @@
:color="$utils.ColorMain"></up-button> :color="$utils.ColorMain"></up-button>
</view> </view>
<confirmRefundPopup ref="refundPopup" /> <confirmRefundPopup ref="refundPopup" />
<up-modal :show="confirmModal.show" title="提示" @close="confirmModalClose" @cancel="confirmModalClose"
@confirm="confirmModalConfirm" showCancelButton>
<view>
<view>
<up-radio-group v-model="confirmModal.selRefundStock">
<up-radio v-for="(item,index) in confirmModal.refundStocks" :key="index" :label="item.name"
:name="item.key"></up-radio>
</up-radio-group>
</view>
</view>
</up-modal>
</view> </view>
</template> </template>
<script setup> <script setup>
import { computed, reactive, ref, watch } from 'vue'; import {
import { onLoad, onShow } from '@dcloudio/uni-app'; computed,
reactive,
ref,
watch
} from 'vue';
import {
onLoad,
onShow
} from '@dcloudio/uni-app';
import confirmRefundPopup from './components/confirmRefundPopup.vue'; import confirmRefundPopup from './components/confirmRefundPopup.vue';
import {hasPermission} from '@/commons/utils/hasPermission.js' import {
import { refundOrder } from '@/http/api/order.js' hasPermission
import { mathFloorPrice } from '@/commons/utils/goodsUtil.js' } from '@/commons/utils/hasPermission.js'
import {
refundOrder
} from '@/http/api/order.js'
import {
mathFloorPrice
} from '@/commons/utils/goodsUtil.js'
let note = ref('') let note = ref('')
const tuikuan = reactive({ const tuikuan = reactive({
list: ['点错', '数量点错', '客人要求', '协商退费'], list: ['点错', '数量点错', '客人要求', '协商退费'],
sel: -1 sel: -1
}) })
const pageData = reactive({ const pageData = reactive({
tabsList: [ tabsList: [{
{label: '部分退款', value: 0}, label: '部分退款',
{label: '全部退款', value: 1}, value: 0
{label: '自定义退款', value: 2}, },
{
label: '全部退款',
value: 1
},
{
label: '自定义退款',
value: 2
},
], ],
tabsIndex: 0, tabsIndex: 0,
modify: '', modify: '',
@@ -168,6 +203,7 @@
function changeTuiKuanSel(i) { function changeTuiKuanSel(i) {
tuikuan.sel = i tuikuan.sel = i
} }
function parseIntNumber(e) { function parseIntNumber(e) {
if (e > (orderDetail.info.payAmount - orderDetail.info.refundAmount)) { if (e > (orderDetail.info.payAmount - orderDetail.info.refundAmount)) {
setTimeout(() => { setTimeout(() => {
@@ -272,6 +308,7 @@
params = { params = {
orderId: option.orderId, orderId: option.orderId,
refundReason: noteResult, refundReason: noteResult,
refundStock: confirmModal.selRefundStock,
refundDetails: orderDetail.goodsList.filter(v => v.number * 1).map(v => { refundDetails: orderDetail.goodsList.filter(v => v.number * 1).map(v => {
return { return {
id: v.id, id: v.id,
@@ -297,17 +334,77 @@
refundPost() refundPost()
} }
async function refundPost (payPassword) {
import {
getProductList,
getCategoryList
} from '@/http/api/product.js'
const confirmModal = reactive({
show: false,
selRefundStock: false,
payPassword: '',
refundStocks: [{
name: '已上菜(仅退菜不退库存)',
key: false
}, {
name: '未上菜(退菜后退库存)',
key: true,
}]
})
function confirmModalClose() {
confirmModal.show = false
confirmModal.selRefundStock = false
confirmModal.payPassword = ''
}
function confirmModalConfirm() {
refundSubmit(confirmModal.payPassword)
confirmModalClose()
}
async function refundSubmit(payPassword) {
if (payPassword) { if (payPassword) {
params.pwd = payPassword params.pwd = payPassword
} }
params.refundStock = confirmModal.selRefundStock
await refundOrder(params) await refundOrder(params)
uni.$utils.showToast('退款请求提交成功') uni.$utils.showToast('退款请求提交成功')
setTimeout(() => { setTimeout(() => {
uni.navigateBack({delta:1}) uni.navigateBack({
delta: 1
})
}, 500) }, 500)
} }
async function refundPost(payPassword) {
confirmModal.payPassword = confirmModal.payPassword
const shopInfo = uni.getStorageSync('shopInfo')
if (pageData.tabsIndex != 2) {
if (shopInfo.refundMode == 1) {
const res = await getCategoryList()
for (let goods of res) {
if (goods.refundMode == 3) {
confirmModal.show = true
return
}
}
}
if (shopInfo.refundMode == 2) {
const res = await getProductList()
for (let goods of res) {
console.log(goods);
if (goods.refundMode == 3) {
confirmModal.show = true
return
}
}
}
}
refundSubmit(payPassword)
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24.1" height="24.1" viewBox="0 0 24.1 24.1"><defs><style>.a{fill:#333;}</style></defs><path class="a" d="M179.826,184.148v-2.183h-2.231v2.185Zm3.33,0a1,1,0,0,0,.993-.993v-1.192h-2.139v2.183m-13.222-21.914v6.555h-6.555v-6.555h6.555m1.192-2.185h-8.938a1,1,0,0,0-.993.993v8.938a1,1,0,0,0,.993.993h8.938a1,1,0,0,0,.993-.993v-8.938a1,1,0,0,0-.993-.993Zm-4.469,5.462-1.092,0a1.092,1.092,0,1,0,1.092-1.092A1.092,1.092,0,0,0,164.419,165.512Zm17.545-3.277v6.555H175.41v-6.555h6.555m1.192-2.185h-8.938a1,1,0,0,0-.993.993v8.938a1,1,0,0,0,.993.993h8.938a1,1,0,0,0,.993-.993v-8.938a1,1,0,0,0-.993-.993Zm-4.469,5.462-1.092,0a1.092,1.092,0,1,0,1.092-1.092A1.092,1.092,0,0,0,177.595,165.512Zm-8.806,9.9v6.555h-6.555V175.41h6.555m1.192-2.185h-8.938a1,1,0,0,0-.993.993v8.938a1,1,0,0,0,.993.993h8.938a1,1,0,0,0,.993-.993v-8.938a1,1,0,0,0-.993-.993Zm-4.469,5.462-1.092,0a1.092,1.092,0,1,0,1.092-1.092A1.092,1.092,0,0,0,164.419,178.688Zm18.737-5.462h-1.218v4.37h-2.185v-4.37h-5.535a1,1,0,0,0-.993.993v8.938a1,1,0,0,0,.993.993h1.192V177.6h2.185v2.185h6.555v-5.562A1,1,0,0,0,183.156,173.225Z" transform="translate(-160.049 -160.05)"/></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -1 +0,0 @@
<svg id="图层_1" data-name="图层 1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 195 60"><defs><style>.cls-1{fill:url(#未命名的渐变_2);}.cls-2{fill:url(#未命名的渐变_2-2);}.cls-3{fill:url(#未命名的渐变_2-3);}.cls-4{fill:url(#未命名的渐变_2-4);}</style><linearGradient id="未命名的渐变_2" x1="0.64" y1="28.6" x2="37.23" y2="28.6" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#238ffc"/><stop offset="1" stop-color="#1a66ff"/></linearGradient><linearGradient id="未命名的渐变_2-2" x1="41.89" y1="28.6" x2="77.05" y2="28.6" xlink:href="#未命名的渐变_2"/><linearGradient id="未命名的渐变_2-3" x1="81.86" y1="28.83" x2="118.14" y2="28.83" xlink:href="#未命名的渐变_2"/><linearGradient id="未命名的渐变_2-4" x1="123.38" y1="28.67" x2="157.74" y2="28.67" xlink:href="#未命名的渐变_2"/></defs><path class="cls-1" d="M.64,46.58h.48v.31H.64ZM15.2,10.3h6.67c.31,1.48.46,2.28.46,2.38h14.9V16H29.79l-.33,1.28c-.1.31-.37,1.3-.79,3H33a3.25,3.25,0,0,1,3.17,2.22,3.8,3.8,0,0,1,.15,1.12V39.76q0,4.76-2.07,7.13H28.05a10.71,10.71,0,0,0,1.89-6.33V25A1.39,1.39,0,0,0,29,23.77a.69.69,0,0,0-.49-.16H8.25V46.89H2.07V20.27H9.5c-.63-2.64-1-4.06-1.1-4.27H1V12.68H15.69Zm3.17,15.05-3,6.34H9l3.17-6.34Zm-7.74,7h5.85v7.92h5.24V37.39A1.65,1.65,0,0,0,21.23,36,1.82,1.82,0,0,0,20,35.65H17.58V32.33H24.4a3.25,3.25,0,0,1,3.32,3.16v8.08H10.63ZM15.05,16l1.28,4.27h5.54L23.12,16Zm4.75,9.35H26c.11,0,.42.58.95,1.74l2.22,4.6H22.82L22,30Z"/><path class="cls-2" d="M55.84,10.3h6.64c0,.11.43,1.16,1.28,3.17h9.81a2.91,2.91,0,0,1,2.53,1.1A2.52,2.52,0,0,1,76.89,16v7.92c0,1.69.06,4.38.16,8.08H50.91v4.29a22.27,22.27,0,0,1-1.25,8.07c-.33.84-.7,1.68-1.13,2.53H41.89q2.37-4,2.38-10.6V13.47h6.64V28.83H70.25V18.22a1.45,1.45,0,0,0-1.43-1.43H52V13.47h4.91C56.2,11.46,55.84,10.41,55.84,10.3Z"/><path class="cls-3" d="M96.6,15.21h6.8v16h14.74v3.33H103.4V46.89H96.6V34.53H81.86V31.2H96.6ZM83.45,10.76h33.11v3.35H83.45Zm1.1,6.83h6.82l3,10.14H87.71c-.1,0-.2-.27-.3-.79S86.35,23.39,84.55,17.59Zm24.24,0h6.65l-3.17,10.14h-6.65Z"/><path class="cls-4" d="M135.41,10.46q-4.75,9.2-5.06,10l-.15.15c0,.53.31.89.94,1.1h17.28l1.4,3.32H126.24c-1.48,0-2.39-.53-2.71-1.58a1.41,1.41,0,0,1-.15-.62,8.64,8.64,0,0,1,1.27-3.65q.16-.48,4.12-8.71ZM124.48,27.24h6.66V43.72H149V32.15a1.46,1.46,0,0,0-1.1-1.58H132.4V27.24h20.13a3,3,0,0,1,2.84,1.92,2.63,2.63,0,0,1,.33,1.25V46.89H124.48Zm26.93-15.68,1,2.07q5.06,10.94,5.36,11.39H151.1q-.32-.46-6.34-13.29v-.17Z"/></svg>

Before

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -1,30 +0,0 @@
<svg width="750" height="1624" viewBox="0 0 750 1624" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_530_174)">
<rect width="750" height="1624" fill="white"/>
<rect width="750" height="398" fill="url(#paint0_linear_530_174)"/>
<g clip-path="url(#clip1_530_174)">
<path d="M446.619 -69C388.364 -39.9258 273.972 31.5229 282.446 84.7239C293.038 151.225 415.806 129.54 537.612 116.529C659.417 103.518 661.343 148.334 577.09 261.097C492.837 373.86 613.68 393.617 787 317.478" stroke="url(#paint1_linear_530_174)" stroke-opacity="0.1" stroke-width="50"/>
</g>
<rect opacity="0.1" width="750" height="1624" fill="url(#paint2_linear_530_174)"/>
</g>
<defs>
<linearGradient id="paint0_linear_530_174" x1="375" y1="398" x2="375" y2="6.81275e-06" gradientUnits="userSpaceOnUse">
<stop stop-color="#2A95F8" stop-opacity="0"/>
<stop offset="1" stop-color="#215CF5" stop-opacity="0.07"/>
</linearGradient>
<linearGradient id="paint1_linear_530_174" x1="787" y1="363" x2="281.535" y2="-68.4548" gradientUnits="userSpaceOnUse">
<stop stop-color="#76DEFF" stop-opacity="0.5"/>
<stop offset="1" stop-color="#003AAD"/>
</linearGradient>
<linearGradient id="paint2_linear_530_174" x1="375" y1="1624" x2="375" y2="3.81125e-06" gradientUnits="userSpaceOnUse">
<stop stop-color="white"/>
<stop offset="1" stop-color="#339DFF"/>
</linearGradient>
<clipPath id="clip0_530_174">
<rect width="750" height="1624" fill="white"/>
</clipPath>
<clipPath id="clip1_530_174">
<rect width="750" height="398" fill="white"/>
</clipPath>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 1.5 KiB