This commit is contained in:
2024-10-10 16:41:42 +08:00
22 changed files with 471 additions and 252 deletions

View File

@@ -4,19 +4,16 @@
"version" : "0.0", "version" : "0.0",
"configurations" : [ "configurations" : [
{ {
"app-plus" : "app-plus" : {
{ "launchtype" : "local"
"launchtype" : "local" },
}, "default" : {
"default" : "launchtype" : "local"
{ },
"launchtype" : "local" "mp-weixin" : {
}, "launchtype" : "local"
"mp-weixin" : },
{ "type" : "uniCloud"
"launchtype" : "local"
},
"type" : "uniCloud"
}, },
{ {
"playground" : "custom", "playground" : "custom",

View File

@@ -389,4 +389,7 @@ text {
// } // }
// .u-font-32{ // .u-font-32{
// font-size: 16px; // font-size: 16px;
// } // }
.line-th{
text-decoration: line-through;
}

View File

@@ -78,7 +78,7 @@ function commonsProcess(showLoading, httpReqCallback){
// http响应码不正确 // http响应码不正确
if(statusCode != 200){ if(statusCode != 200){
isShowErrorToast = true isShowErrorToast = true
infoBox.showErrorToast('服务器异常') infoBox.showToast('服务器异常')
return Promise.reject(bodyData) // 跳转到catch函数 return Promise.reject(bodyData) // 跳转到catch函数
} }
@@ -105,14 +105,11 @@ function commonsProcess(showLoading, httpReqCallback){
return Promise.resolve({ bizData: bodyData.data, code: bodyData.code }) return Promise.resolve({ bizData: bodyData.data, code: bodyData.code })
}).catch( res => { }).catch( res => {
reqFinishFunc(); // 请求完毕的动作 reqFinishFunc(); // 请求完毕的动作
// 如果没有提示错误, 那么此处提示 异常。 // 如果没有提示错误, 那么此处提示 异常。
if(!isShowErrorToast){ if(!isShowErrorToast){
infoBox.showErrorToast(`请求网络异常`) infoBox.showToast(`请求网络异常`)
} }
return Promise.reject(res) return Promise.reject(res)
}).finally(() => { // finally 是 then结束后再执行, 此处不适用。 需要在请求完成后立马调用: reqFinishFunc() }).finally(() => { // finally 是 then结束后再执行, 此处不适用。 需要在请求完成后立马调用: reqFinishFunc()

View File

@@ -1508,6 +1508,13 @@
barCode: `${uni.getStorageSync("shopId")}${dayjs().valueOf()}` barCode: `${uni.getStorageSync("shopId")}${dayjs().valueOf()}`
} }
} }
}else{
//编辑
if (newval === 'sku') {
skuList.list = []
} else {
skuList.list=$goodsData.skuList
}
} }
}) })

View File

@@ -1,62 +1,53 @@
<template> <template>
<view class="page"> <view class="page">
<view class="box"> <view class="box">
<view class="block border-top-0">
<uni-forms ref="nameFormRef" :model="specifications" :rules="rules" :label-width="350"
label-position="top" validateTrigger="blur">
<uni-forms-item label="模版名称" required name="name">
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="specifications.name" placeholder="模版名称,如:衣服" />
</uni-forms-item>
</uni-forms>
</view>
<view v-for="(item,index) in specifications.list" :key="index"> <view v-for="(item,index) in specifications.list" :key="index">
<uni-forms :model="item" :rules="rules" err-show-type="undertext" validateTrigger="blur" <uni-forms :model="item" :rules="rules" err-show-type="undertext" validateTrigger="blur"
:ref="setFormRef(index)" :border="true" label-position="top" label-width="350"> :ref="setFormRef(index)" :border="true" label-position="top" label-width="350">
<view class="block"> <view class="block">
<view class="border-top-0"> <view class="border-top-0">
<uni-forms-item label="规格组名" required name="name" > <uni-forms-item label="规格组名" required name="name">
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder" <uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="item.name" placeholder="规格组名" /> v-model="item.name" placeholder="规格组名,如:尺码" />
</uni-forms-item> </uni-forms-item>
</view> </view>
<!-- <uni-forms-item label="最少可选" required name="MinOptional" > <uni-forms-item label="规格值">
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="item.MinOptional" type="number" placeholder="填写最小数量" />
</uni-forms-item>
<uni-forms-item label="最大可选" required name="MaxOptional" >
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="item.MaxOptional" type="number" placeholder="填写最大数量" />
</uni-forms-item> -->
<uni-forms-item label="选项值">
<view class="option"> <view class="option">
<view class="u-flex"> <view class="">
<view class="u-flex-1">名称</view> <view class="u-flex option-item" v-for="(option,optionIndex) in item.options"
<view class="u-flex-1 u-p-l-60">加价</view> :key="optionIndex">
</view>
<view class="u-m-t-32">
<view class="u-flex option-item"
v-for="(option,optionIndex) in item.options"
:key="optionIndex"
>
<view class="u-flex-1"> <view class="u-flex-1">
<uni-forms-item :key="optionIndex" :name="['options',optionIndex,'optionName']" <uni-forms-item :key="optionIndex" :name="['options',optionIndex,'name']"
:ref="setFormInputRef(index,optionIndex)" :ref="setFormInputRef(index,optionIndex)"
:rules="[{'required': true,errorMessage: '必填'}]" :rules="[{'required': true,errorMessage: '必填'}]" label-width="0"
label-width="0" label="" required :showRequired="false" label="" required :showRequired="false">
> <uni-easyinput
<uni-easyinput v-model="specifications.list[index].options[optionIndex].optionName" v-model="specifications.list[index].options[optionIndex].name"
@input="inpuChange(index,optionIndex)" @input="inpuChange(index,optionIndex)"
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder" :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
placeholder="选项名" /> placeholder="请输入规格值,如:S、M" />
</uni-forms-item> </uni-forms-item>
</view> </view>
<view class="u-p-l-60 u-flex-1 u-flex"> <view class=" u-flex">
<uni-forms-item :key="optionIndex" <uni-forms-item :key="optionIndex" label-width="0" label=""
:rules="[{'required': true,errorMessage: '必填'}]" :showRequired="false">
:ref="setFormInputRef(index,optionIndex)"
:name="['options',optionIndex,'optionPrice']" label-width="0" label="" required :showRequired="false"
>
<view class="u-flex"> <view class="u-flex">
<uni-easyinput v-model="specifications.list[index].options[optionIndex].optionPrice" <!-- <uni-easyinput v-model="specifications.list[index].options[optionIndex].optionPrice"
@input="inpuChange(index,optionIndex)" @input="inpuChange(index,optionIndex)"
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder" :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
type="digit" placeholder="填写价格" /> type="digit" placeholder="填写价格" /> -->
<view class="icon icon-reduce u-m-l-38" <view class="icon icon-reduce u-m-l-38"
@click="delOption(index,optionIndex)"> @click="delOption(index,optionIndex)">
@@ -79,7 +70,7 @@
</view> </view>
</uni-forms-item> </uni-forms-item>
<view class="u-flex u-m-t-48 u-m-b-24" @click="delSpecificationsGroup(index)"> <view class="u-flex u-m-t-48 u-m-b-24" @click="delSpecificationsGroup(index)">
<view class="icon icon-reduce u-m-r-22 "> <view class="icon icon-reduce u-m-r-22 ">
@@ -106,10 +97,14 @@
<script setup> <script setup>
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
import {
$productSpec
} from '@/http/yskApi/goods.js'
import { import {
onLoad, onLoad,
onReady onReady,
} from '@dcloudio/uni-app'; } from '@dcloudio/uni-app';
import infoBox from '@/commons/utils/infoBox.js'
import { import {
onMounted, onMounted,
reactive, reactive,
@@ -117,8 +112,9 @@
ref, ref,
onBeforeMount onBeforeMount
} from 'vue'; } from 'vue';
const nameFormRef = ref(null)
// 表单样式 // 表单样式
const placeholderStyle = ref('font-size:28rpx;') const placeholderStyle = ref('font-size:28rpx;')
//表单边框 //表单边框
const inputBorder = ref(false) const inputBorder = ref(false)
const form = ref(null) const form = ref(null)
@@ -143,12 +139,6 @@
errorMessage: '必填' errorMessage: '必填'
}] }]
}, },
optionName: {
rules: [{
required: true,
errorMessage: '必填'
}]
},
optionPrice: { optionPrice: {
rules: [{ rules: [{
required: true, required: true,
@@ -157,10 +147,10 @@
} }
} }
// 构造规格的选项值的基础数据 // 构造规格的选项值的基础数据
const specificationsOptionsBasicData = { const specificationsOptionsBasicData = {
optionName: '', name: '',
optionPrice: '0.00' optionPrice: '0.00'
} }
@@ -172,8 +162,8 @@
// 构造规格的基础数据 // 构造规格的基础数据
const specificationsBasicData = { const specificationsBasicData = {
name: '', name: '',
MinOptional: 1, // MinOptional: 1,
MaxOptional: 1, // MaxOptional: 1,
options: [] options: []
} }
@@ -189,6 +179,7 @@
} }
// 规格列表 // 规格列表
const specifications = reactive({ const specifications = reactive({
name: '',
list: [returnSpecificationsOptionsBasicData()] list: [returnSpecificationsOptionsBasicData()]
}) })
@@ -235,7 +226,8 @@
}; };
} }
// 绑定option input元素 // 绑定option input元素
const refFormInput=ref([]) const refFormInput = ref([])
function setFormInputRef(index, index1) { function setFormInputRef(index, index1) {
const newIndex = index * 10000 + index1 const newIndex = index * 10000 + index1
return (el) => { return (el) => {
@@ -252,61 +244,104 @@
console.log(refFormInput.value[newIndex]); console.log(refFormInput.value[newIndex]);
refFormInput.value[newIndex].onFieldChange() refFormInput.value[newIndex].onFieldChange()
} }
let emitName=''
function triggerEvent (emitName,data){
if(emitName){
uni.$emit(emitName,data) const option = {
} type: 'add',
id: undefined
} }
onLoad(opt=>{ onLoad(opt => {
const arr=uni.getStorageSync('guige')
if(arr.length){
specifications.list=arr
console.log(arr);
}
console.log(opt); console.log(opt);
if(opt&&JSON.stringify(opt)!=='{}'&&opt.emitName){ if (opt && JSON.stringify(opt) !== '{}' && opt.type) {
emitName=opt.emitName option.type = opt.type
const data = uni.getStorageSync('spec')
uni.removeStorageSync('spec')
if(data){
specifications.name = data.name
specifications.id = data.id
specifications.list = data.specList.map(v => {
return {
...v,
options: v.value.map(v => {
return {
name: v
}
})
}
})
}
} }
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title:emitName?'编辑规格模版':'添加规格模版' title: option.type === 'edit' ? '编辑规格模版' : '添加规格模版'
}) })
}) })
function emitspecificationsSave(){
// emitspecificationsSave 触发规格保存事件将数据给到添加商品页面 function returnPromise(prosise, index) {
// guigeEdit 触发规格保存事件将数据给到添加规格页面 return new Promise((resolve, reject) => {
uni.removeStorageSync('guige') prosise.then(res => {
triggerEvent(emitName,specifications.list)
}
function returnPromise(index,prosise){
return new Promise((resolve,reject)=>{
prosise.then(res=>{
console.log(res); console.log(res);
resolve({sucees:true}) resolve({
}).catch(err=>{ sucees: true
})
}).catch(err => {
console.log(err); console.log(err);
resolve({sucees:false}) resolve({
sucees: false
})
}) })
}) })
} }
async function save() {
let isAllPassForm=0 let timer = null
function settimeoutBack(time) {
clearTimeout(timer)
timer = setTimeout(() => {
uni.navigateBack()
}, time)
}
async function save() {
let isAllPassForm = 0
const nameFormRes = await returnPromise(nameFormRef.value.validate())
console.log(nameFormRes);
if (!nameFormRes.sucees) {
isAllPassForm -= 1
}
for (let i in specifications.list) { for (let i in specifications.list) {
const res=await returnPromise(i,formRefs.value[i].validate()) const res = await returnPromise(formRefs.value[i].validate(), i)
isAllPassForm+=res.sucees?1:0 isAllPassForm += res.sucees ? 1 : 0
} }
//判断验证是否通过 //判断验证是否通过
if(isAllPassForm===specifications.list.length){ if (isAllPassForm === specifications.list.length) {
console.log('pass'); console.log('pass');
emitspecificationsSave() const data = {
go.back() name: specifications.name,
id:specifications.id,
specList: specifications.list.map(v => {
return {
...v,
value: v.options.map(v => v.name),
options: undefined
}
})
}
if (option.type === 'add') {
return $productSpec.add(data).then(res => {
infoBox.showSuccessToast('添加成功')
settimeoutBack(1500)
})
}
$productSpec.update(data).then(res => {
infoBox.showSuccessToast('修改成功')
settimeoutBack(1500)
})
} }
} }

View File

@@ -124,12 +124,15 @@
<view class="save-btn-box"> <view class="save-btn-box">
<button class="save-btn" hover-class="btn-hover-class" @click="save">保存</button> <button class="save-btn" hover-class="btn-hover-class" @click="save">保存</button>
<button class="save-btn edit-btn" hover-class="btn-hover-class" @click="fastEditShow"> <view class="u-m-t-20">
<view class="u-flex u-row-center"> <button class="save-btn edit-btn" hover-class="btn-hover-class" @click="fastEditShow">
<view class="u-m-r-6">批量修改</view> <view class="u-flex u-row-center">
<up-icon name="edit-pen" :color="color.ColorMain"></up-icon> <view class="u-m-r-6">批量修改</view>
</view> <up-icon name="edit-pen" :color="color.ColorMain"></up-icon>
</button> </view>
</button>
</view>
</view> </view>
</view> </view>
<view class="bottom" ref="bottom"></view> <view class="bottom" ref="bottom"></view>

View File

@@ -8,16 +8,19 @@
</view> </view>
</view> </view>
<view class="u-m-t-36"> <view class="u-m-t-36">
<view class="u-m-b-24" v-for="(item,index) in list" :key="index"> <scroll-view scroll-y="true" style="max-height: 70vh;">
<view>{{item.text}}</view> <view class="u-m-b-24" v-for="(item,index) in list" :key="index">
<view class="u-m-t-24"> <view>{{item.text}}</view>
<up-input v-model="item.value"> <view class="u-m-t-24">
<template #suffix> <up-input v-model="item.value">
<up-button @click="itemClick(item)" type="primary" text="修改" size="mini"></up-button> <template #suffix>
</template> <up-button @click="itemClick(item)" type="primary" text="修改" size="mini"></up-button>
</up-input> </template>
</up-input>
</view>
</view> </view>
</view> </scroll-view>
<view class="u-m-t-60"> <view class="u-m-t-60">
<my-button type="primary" shape="circle" @tap="save"> <my-button type="primary" shape="circle" @tap="save">

View File

@@ -10,18 +10,20 @@
<view class="u-m-t-48"> <view class="u-m-t-48">
<view class="u-flex u-row-between border-bottom u-p-b-30"> <view class="u-flex u-row-between border-bottom u-p-b-30">
<view>当前状态</view> <view>当前状态</view>
<view class="u-flex"> <view class="u-flex u-relative">
<up-radio-group v-model="isGrounding" placement="row" @change="isGroundingChange"> <up-radio-group v-model="isGrounding" placement="row" @change="isGroundingChange">
<up-radio :customStyle="{marginRight: '10px'}" v-for="(item, index) in status.list" <up-radio :customStyle="{marginRight: '10px'}" v-for="(item, index) in status.list"
:key="index" :label="item.label" :name="item.name"> :key="index" :label="item.label" :name="item.name">
</up-radio> </up-radio>
</up-radio-group> </up-radio-group>
<view class="u-absolute position-all" @click="hasShangXiajia(true)" v-if="!canShangXiaJia"></view>
</view> </view>
</view> </view>
<view class=" u-flex u-row-between u-m-t-30"> <view class=" u-flex u-row-between u-m-t-30 u-relative">
<view>售罄</view> <view>售罄</view>
<up-switch :activeValue="1" :inactiveValue="0" :size="20" @change="isPauseSaleChange" v-model="isPauseSale"></up-switch> <up-switch :activeValue="1" :inactiveValue="0" :size="20" @change="isPauseSaleChange" v-model="isPauseSale"></up-switch>
<view class="u-absolute position-all" @click="hasShouQing(true)" v-if="!canShouQing"></view>
</view> </view>
</view> </view>
</view> </view>
@@ -44,6 +46,7 @@
$updateProductStatus,$updateProductData, $updateProductStatus,$updateProductData,
$tbProskuConV2 $tbProskuConV2
} from '@/http/yskApi/goods.js' } from '@/http/yskApi/goods.js'
import {hasPermission} from '@/commons/utils/hasPermission.js'
import infoBox from '@/commons/utils/infoBox.js' import infoBox from '@/commons/utils/infoBox.js'
const props = defineProps({ const props = defineProps({
show: { show: {
@@ -98,7 +101,8 @@
} }
function open() { function open() {
hasShangXiajia()
hasShouQing()
} }
function save() { function save() {
@@ -113,8 +117,20 @@
...par ...par
}]) }])
} }
let canShangXiaJia=ref(false)
async function hasShangXiajia(tips=false){
canShangXiaJia.value=await hasPermission({text:'允许上下架商品',tips})
}
let canShouQing=ref(false)
async function hasShouQing(tips=false){
canShouQing.value=await hasPermission({text:'允许售罄商品',tips})
}
async function isGroundingChange(e) { async function isGroundingChange(e) {
if(!canShangXiaJia.value){
return
}
await upDateGoods({ await upDateGoods({
key:'grounding', key:'grounding',
value: e value: e
@@ -124,6 +140,9 @@
} }
async function isPauseSaleChange(e) { async function isPauseSaleChange(e) {
if(!canShouQing.value){
return
}
console.log(e); console.log(e);
await upDateGoods({ await upDateGoods({
key:'pauseSale', key:'pauseSale',

View File

@@ -49,6 +49,7 @@ import { reactive, ref } from 'vue';
emits('del',props.index) emits('del',props.index)
} }
function edit(){ function edit(){
uni.$emit('edit:spec',props.data)
uni.setStorageSync('spec',props.data) uni.setStorageSync('spec',props.data)
go.to('PAGES_PRODUCT_GUIGE_ADD', { go.to('PAGES_PRODUCT_GUIGE_ADD', {
type: 'edit' type: 'edit'

View File

@@ -1,5 +1,5 @@
<template> <template>
<view class="item color-fff border-r-12" :class="[data.status]" @click="toOrderDetail"> <view class="item color-fff border-r-12" :class="[computedClass]" @click="toOrderDetail">
<view class="my-bg-main" :style="{'background-color':returnStutasColor(data.status)}"> <view class="my-bg-main" :style="{'background-color':returnStutasColor(data.status)}">
<view class="u-flex u-row-between"> <view class="u-flex u-row-between">
<view class="u-font-32">{{data.name}}</view> <view class="u-font-32">{{data.name}}</view>
@@ -18,10 +18,11 @@
<view class="u-flex u-flex-col u-row-center u-col-center bg-fff bottom"> <view class="u-flex u-flex-col u-row-center u-col-center bg-fff bottom">
<template v-if="data.status!='using'"> <template v-if="data.status!='using'">
<view class=" u-font-32" :style="{color:returnStutasColor(data.status)}"> <view class=" u-font-32" :style="{color:returnStutasColor(data.status)}">
{{returnStutasText(data.status)}}~</view> {{returnStutasText(data.status)}}~
</view>
</template> </template>
<view class=" w-full u-p-l-16 u-p-r-16 u-p-t-16 u-font-24"> <view class=" w-full u-p-l-16 u-p-r-16 u-p-t-16 u-font-24">
<template v-if="data.status=='using'"> <template v-if="data.status=='using'&& data.orderId">
<view class="color-666 u-text-left u-p-b-20 border-bottom"> <view class="color-666 u-text-left u-p-b-20 border-bottom">
<view class=""><text>已点</text><text class="u-m-l-20 color-333">{{data.productNum||0}}</text> <view class=""><text>已点</text><text class="u-m-l-20 color-333">{{data.productNum||0}}</text>
</view> </view>
@@ -38,7 +39,7 @@
<template v-else> <template v-else>
<view class="u-flex u-row-center u-m-t-16"> <view class="u-flex u-row-center u-m-t-16">
<template v-if="data.tableId"> <template v-if="data.tableId">
<template v-if="data.status=='idle' "> <template v-if="data.status=='idle'||(data.status=='using'&&!data.orderId) ">
<my-button color="#333" :width="150" :height="56" type="default" @click="diancan"> <my-button color="#333" :width="150" :height="56" type="default" @click="diancan">
选择 选择
</my-button> </my-button>
@@ -78,19 +79,30 @@
} from '@/http/yskApi/table.js' } from '@/http/yskApi/table.js'
import infoBox from '@/commons/utils/infoBox.js' import infoBox from '@/commons/utils/infoBox.js'
const status = $status const status = $status
const emits = defineEmits(['more','update']) const emits = defineEmits(['more', 'update'])
function returnStutasText(key) { function returnStutasText(key) {
key = returnIsUseing(key)
const item = status[key] const item = status[key]
return item ? item.label : '' return item ? item.label : ''
} }
const computedClass = computed(() => {
const key = returnIsUseing(props.data.status)
return key
})
function returnIsUseing(key) {
return key = key == 'using' ? (props.data.orderId ? key : 'idle') : key
}
function returnStutasColor(key) { function returnStutasColor(key) {
// if(key=='using'){ // if(key=='using'){
// return 'rgb(250,85,85)' // return 'rgb(250,85,85)'
// }else{ // }else{
// return '' // return ''
// } // }
key = returnIsUseing(key)
const item = status[key] const item = status[key]
return item ? item.type : '' return item ? item.type : ''
} }
@@ -126,10 +138,10 @@
function more() { function more() {
emits('more') emits('more')
} }
function diancan() { function diancan() {
const useType=props.status=='using'?props.data.useType:undefined const useType = props.status == 'using' ? props.data.useType : undefined
go.to('PAGES_CREATE_ORDER', { go.to('PAGES_CREATE_ORDER', {
tableId: props.data.tableId, tableId: props.data.tableId,
name: props.data.name, name: props.data.name,
@@ -139,7 +151,7 @@
} }
function toOrderDetail() { function toOrderDetail() {
if (props.data.status == 'using') { if (props.data.status == 'using' && props.data.orderId) {
const { const {
tableId, tableId,
name, name,
@@ -148,19 +160,25 @@
areaId, areaId,
orderId orderId
} = props.data } = props.data
if (!orderId) {
return uni.showToast({
icon: 'none',
title: '台桌未返回订单id'
})
}
go.to('PAGES_ORDER_DETAIL', { go.to('PAGES_ORDER_DETAIL', {
tableId, tableId,
name, name,
status, status,
amount, amount,
areaId, areaId,
id:orderId id: orderId
}) })
} }
} }
function qingtai() { function qingtai() {
const item=props.data const item = props.data
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '确定要清台:' + props.data.name + '', content: '确定要清台:' + props.data.name + '',
@@ -170,7 +188,7 @@
...item, ...item,
status: "idle", status: "idle",
qrcode: item.tableId, qrcode: item.tableId,
}).then(res=>{ }).then(res => {
infoBox.showToast('清台成功') infoBox.showToast('清台成功')
emits('update') emits('update')
}) })

View File

@@ -129,6 +129,9 @@
//编辑 //编辑
// refTableShow() // refTableShow()
if (index == 0) { if (index == 0) {
if(!item.orderId){
return infoBox.showToast('该桌台暂无要结账的订单!')
}
return return
} }
if (index == 1) { if (index == 1) {
@@ -353,7 +356,6 @@
prve[cur.id] = cur.name prve[cur.id] = cur.name
return prve return prve
}, {}) }, {})
console.log(areaMap);
} }
watch(() => tables.area.sel, (newval) => { watch(() => tables.area.sel, (newval) => {
console.log(newval); console.log(newval);

View File

@@ -62,7 +62,7 @@
<view class="u-m-t-24 u-flex u-row-between"> <view class="u-m-t-24 u-flex u-row-between">
<view></view> <view></view>
<view class="u-flex"> <view class="u-flex">
<view class="btn-default btn">查看订单</view> <view class="btn-default btn" @click="toOrder">查看订单</view>
<view class="btn-primary btn u-m-l-38" @click="moreOperate">更多操作</view> <view class="btn-primary btn u-m-l-38" @click="moreOperate">更多操作</view>
</view> </view>
</view> </view>
@@ -106,6 +106,12 @@
function toYue(){ function toYue(){
go.to('PAGES_RECHARGE_INDEX',{id:''}) go.to('PAGES_RECHARGE_INDEX',{id:''})
} }
function toOrder(){
go.to('PAGES_ORDER_INDEX',{
userId:props.data.id||'',
type:'user'
})
}
function remark(){ function remark(){
console.log(props.index); console.log(props.index);

View File

@@ -45,6 +45,9 @@
</view> </view>
</view> </view>
</view> </view>
<template v-if="tables.list.length<=0">
<my-img-empty tips="未找到相关的桌台"></my-img-empty>
</template>
</view> </view>
@@ -142,7 +145,7 @@
content content
} = await $table.get(query) } = await $table.get(query)
tables.hasAjax = true tables.hasAjax = true
content = content.filter(v => v.status != 'closed') content = content.filter(v => v.status == 'idle')
tables.list = content tables.list = content
tables.selIndex = content.findIndex(v => v.tableId == option.tableId) tables.selIndex = content.findIndex(v => v.tableId == option.tableId)
console.log(tables.selIndex ); console.log(tables.selIndex );
@@ -166,6 +169,10 @@
} }
watch(() => area.sel, (newval) => { watch(() => area.sel, (newval) => {
if(!newval){
tables.list = tables.originList
return
}
tables.list = tables.originList.filter(v => v.areaId == newval.id) tables.list = tables.originList.filter(v => v.areaId == newval.id)
}) })
let option = {} let option = {}

View File

@@ -48,6 +48,7 @@
function changeCauses(item) { function changeCauses(item) {
let prve=form.remark?',':'' let prve=form.remark?',':''
form.remark +=prve+item.name form.remark +=prve+item.name
console.log(form.remark);
} }
const causes = reactive([{ const causes = reactive([{

View File

@@ -84,7 +84,7 @@
<picker @change="userNumberChange" :value="userNumbers.defaultCateIndex" <picker @change="userNumberChange" :value="userNumbers.defaultCateIndex"
:range="userNumbers.list"> :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">{{userNumbers.defaultCateIndex||''}}</view> <view class="color-333">{{userNumbers.defaultCateIndex*1+1+''}}</view>
<uni-icons type="right" color="#999" size="16"></uni-icons> <uni-icons type="right" color="#999" size="16"></uni-icons>
</view> </view>
</picker> </picker>
@@ -221,7 +221,7 @@
<model-discount title="菜品打折/减免" :ref="setModel" name="discount" :price="allPrice"></model-discount> <model-discount title="菜品打折/减免" :ref="setModel" name="discount" :price="allPrice"></model-discount>
<give-food title="赠菜" :ref="setModel" name="giveFood"></give-food> <give-food title="赠菜" :ref="setModel" name="giveFood"></give-food>
<my-remark @confirm="goodsOneRemarkConfirm" title="单品备注" :ref="setModel" name="remark"></my-remark> <one-remark @confirm="goodsOneRemarkConfirm" title="单品备注" :ref="setModel" name="remark"></one-remark>
<edit-discount title="优惠金额" :ref="setModel" name="editMoney" :price="allPrice"></edit-discount> <edit-discount title="优惠金额" :ref="setModel" name="editMoney" :price="allPrice"></edit-discount>
</view> </view>
@@ -240,10 +240,9 @@
computed, computed,
watch watch
} from 'vue'; } from 'vue';
import myButton from '@/components/my-components/my-button'
import modelDiscount from './components/discount' import modelDiscount from './components/discount'
import giveFood from './components/give-food' import giveFood from './components/give-food'
import myRemark from './components/remark' import oneRemark from './components/remark'
import editDiscount from '@/pagesCreateOrder/components/edit-discount.vue' import editDiscount from '@/pagesCreateOrder/components/edit-discount.vue'
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
import { import {
@@ -273,10 +272,12 @@
} }
function showModel(key, index) { function showModel(key, index) {
modelData.data =goods.list[index] modelData.data = goods.list[index]
modelData.selIndex =index modelData.selIndex = index
const model = models.get(key) const model = models.get(key)
model && model.open({remark:modelData.data.note}) model && model.open({
remark: modelData.data.note||''
})
} }
function formatPrice(n) { function formatPrice(n) {
@@ -288,9 +289,10 @@
//用餐人数 //用餐人数
const userNumbers = reactive({ const userNumbers = reactive({
list: new Array(100).fill(1).map((v, index) => { list: new Array(100).fill(1).map((v, index) => {
return index === 0 ? '无' : index + '人' // return index === 0 ? '无' : index + '人'
return (index+1)+ '人'
}), }),
defaultCateIndex: 1, defaultCateIndex: 0,
}) })
watch(() => userNumbers.defaultCateIndex, (newval) => { watch(() => userNumbers.defaultCateIndex, (newval) => {
console.log(newval); console.log(newval);
@@ -305,15 +307,16 @@
const res = await Api.$choseCount({ const res = await Api.$choseCount({
masterId: option.masterId, masterId: option.masterId,
tableId: table.value.tableId, tableId: table.value.tableId,
num: userNumbers.defaultCateIndex, num: userNumbers.defaultCateIndex+1,
}) })
Object.assign($seatFee, res) Object.assign($seatFee, res)
userNumbers.defaultCateIndex = res.totalNumber userNumbers.defaultCateIndex = res.totalNumber-1
} }
} }
function userNumberChange(e) { function userNumberChange(e) {
console.log(e);
userNumbers.defaultCateIndex = e.detail.value userNumbers.defaultCateIndex = e.detail.value
} }
@@ -398,11 +401,11 @@
//监听桌台改变 //监听桌台改变
watch(() => table.value, (newval, oldval) => { watch(() => table.value, (newval, oldval) => {
if (newval && oldval) { if (newval && oldval) {
Api.$choseTable({ // Api.$choseTable({
orderId: 4462, // orderId: 4462,
oldTableId: oldval.tableId, // oldTableId: oldval.tableId,
newTableId: newval.tableId, // newTableId: newval.tableId,
}) // })
} }
}) })
@@ -464,7 +467,7 @@
} }
goods.list = getNowCart(records) goods.list = getNowCart(records)
if (seatFee && seatFee.totalNumber) { if (seatFee && seatFee.totalNumber) {
userNumbers.defaultCateIndex = seatFee.totalNumber || 1 userNumbers.defaultCateIndex = seatFee.totalNumber-1 || 0
Object.assign($seatFee, seatFee) Object.assign($seatFee, seatFee)
} }
@@ -496,7 +499,7 @@
await Api.$choseCount({ await Api.$choseCount({
masterId: option.masterId, masterId: option.masterId,
tableId: table.value.tableId, tableId: table.value.tableId,
num: userNumbers.defaultCateIndex, num: userNumbers.defaultCateIndex+1,
}) })
} }
// updateChoseCount() // updateChoseCount()
@@ -510,9 +513,16 @@
}) })
} else { } else {
//后付 //后付
uni.navigateBack({ if (option.isCreateOrderToDetail) {
delta: 2 go.to('PAGES_ORDER_DETAIL', {
}) id: res.id
})
} else {
uni.navigateBack({
delta: 2
})
}
// return go.to('PAGES_ORDER_DETAIL', { // return go.to('PAGES_ORDER_DETAIL', {
// id: res.id // id: res.id
// }) // })
@@ -531,7 +541,7 @@
//单品备注确认 //单品备注确认
async function goodsOneRemarkConfirm(e) { async function goodsOneRemarkConfirm(e) {
const cart=goods.list[modelData.selIndex] const cart = goods.list[modelData.selIndex]
await Api.$updateCart({ await Api.$updateCart({
cartId: cart.id, cartId: cart.id,
productId: cart.productId, productId: cart.productId,
@@ -540,11 +550,16 @@
note: e.remark, note: e.remark,
num: cart.number // 0会删除此商品 num: cart.number // 0会删除此商品
}) })
cart.note= e.remark cart.note = e.remark
} }
function init() { async function init() {
await getTbShopInfo()
await getCart()
console.log($seatFee);
if (!$seatFee.totalNumber) {
updateChoseCount()
}
} }
onLoad((opt) => { onLoad((opt) => {
@@ -558,8 +573,7 @@
} }
} }
init() init()
getCart()
getTbShopInfo()
// updateChoseCount() // updateChoseCount()
}) })

View File

@@ -76,6 +76,9 @@
return [] return []
} }
}, },
isCreateOrderToDetail:{
type:Boolean,default:false
},
user:{ user:{
type: Object, type: Object,
default: () => { default: () => {
@@ -123,7 +126,7 @@
const {tableId,name,maxCapacity,status,type}=props.table const {tableId,name,maxCapacity,status,type}=props.table
go.to('PAGES_CONFIRM_ORDER',{ go.to('PAGES_CONFIRM_ORDER',{
masterId:props.masterId,type, masterId:props.masterId,type,
tableId,name,maxCapacity,status tableId,name,maxCapacity,status,isCreateOrderToDetail:props.isCreateOrderToDetail
}) })
} }

View File

@@ -97,7 +97,7 @@
</template> </template>
<view class="bottom w-full"> <view class="bottom w-full">
<my-car @updateNumber="carsNumberChange" :user="data.vipUser" :masterId="data.masterId" :table="data.table" <my-car :isCreateOrderToDetail="isCreateOrderToDetail" @updateNumber="carsNumberChange" :user="data.vipUser" :masterId="data.masterId" :table="data.table"
:data="cars" @clear="onClearCart"></my-car> :data="cars" @clear="onClearCart"></my-car>
</view> </view>
@@ -650,6 +650,7 @@
productId, productId,
skuId skuId
}) })
infoBox.showToast('添加成功')
cars.push({ cars.push({
...cartGoods, ...cartGoods,
specSnap: sku.specSnap specSnap: sku.specSnap
@@ -754,6 +755,7 @@
productId, productId,
skuId skuId
}) })
infoBox.showToast('添加成功')
$goods.chooseNumber = num $goods.chooseNumber = num
cars.push(cartGoods) cars.push(cartGoods)
} }
@@ -913,16 +915,29 @@
init() init()
}) })
onBeforeUnmount(() => {}) onBeforeUnmount(() => {})
function watchUpdate() {
uni.$off('update:createOrderIndex')
uni.$on('update:createOrderIndex', (data) => {
console.log('update:createOrderIndex');
init()
})
}
onShow(() => { onShow(() => {
// watchChooseuser() // watchChooseuser()
watchChooseTable() watchChooseTable()
watchUpdate()
}) })
let isCreateOrderToDetail=ref(false)
onLoad((opt) => { onLoad((opt) => {
console.log(opt) console.log(opt)
Object.assign(data.table, opt) Object.assign(data.table, opt)
if(opt.useType){ if(opt.useType){
uni.setStorageSync('useType',opt.useType) uni.setStorageSync('useType',opt.useType)
} }
if(JSON.stringify(opt)=='{}'){
isCreateOrderToDetail.value=true
}
// if (!opt.tableId) { // if (!opt.tableId) {
// infoBox.showErrorToast('暂不支持不选择桌台下载,请从桌台点餐') // infoBox.showErrorToast('暂不支持不选择桌台下载,请从桌台点餐')
// return setTimeout(() => { // return setTimeout(() => {

View File

@@ -122,6 +122,8 @@
infoBox.showToast('支付成功') infoBox.showToast('支付成功')
setTimeout(() => { setTimeout(() => {
// uni.$emit('orderDetail:update') // uni.$emit('orderDetail:update')
uni.$emit('update:createOrderIndex')
console.log('update:createOrderIndex');
uni.navigateBack({ uni.navigateBack({
delta: 2 delta: 2
}) })

View File

@@ -2,18 +2,30 @@
<view class="default-box-padding bg-fff border-r-12 u-m-t-20"> <view class="default-box-padding bg-fff border-r-12 u-m-t-20">
<view class="u-flex u-row-between"> <view class="u-flex u-row-between">
<view class="font-bold">附加费</view> <view class="font-bold">附加费</view>
<template v-if="orderInfo.status=='unpaid'"> <template v-if="orderInfo.status=='unpaid'&&data.status!='return'">
<my-button plain shape="circle" :width="160" :height="56" @click="tuicai">退菜</my-button> <my-button plain shape="circle" :width="160" :height="56" @click="tuicai">退菜</my-button>
</template> </template>
<template v-if="orderInfo.status=='closed'"> <template v-if="orderInfo.status=='closed'">
<my-button plain shape="circle" :width="160" :height="56" @click="tuikuan">退款</my-button> <my-button plain shape="circle" :width="160" :height="56" @click="tuikuan">退款</my-button>
</template> </template>
</view> </view>
<view class="u-flex u-row-between u-m-t-20"> <template v-if="data.status!='return'">
<view>{{data.name||'餐位费'}}</view> <view class="u-flex u-row-between u-m-t-20">
<view>x{{data.number}}</view> <view>{{data.name||'餐位费'}}</view>
<view>{{data.number}}</view> <view>x{{data.number}}</view>
</view> <view>{{data.totalAmount}}</view>
</view>
</template>
<template v-else>
<view class="u-flex u-row-between u-m-t-20 color-999">
<view class="u-flex">
<view class="line-th ">{{data.name||'餐位费'}}</view>
<view class="tag yitui u-m-l-10">已退</view>
</view>
<view class="line-th">x{{data.number}}</view>
<view class="line-th">{{data.totalAmount}}</view>
</view>
</template>
</view> </view>
</template> </template>
@@ -49,4 +61,13 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.tag {
padding: 0 6rpx;
border-radius: 8rpx;
font-size: 24rpx;
&.yitui {
background-color: rgb(188, 188, 188);
color: #fff;
}
}
</style> </style>

View File

@@ -1,8 +1,8 @@
<template> <template>
<view class="default-box-padding bg-fff border-r-12 u-m-t-20" v-if="data.length"> <view class="default-box-padding bg-fff border-r-12 u-m-t-20" v-if="data.length">
<view class="u-font-32 font-bold"> <view class="u-font-32 color-999">
<text></text> <text></text>
<text class="color-main font-bold"> {{goodsNumber}}</text> <text class="color-333 "> {{goodsNumber}}</text>
<text>份菜品</text> <text>份菜品</text>
</view> </view>
<view class="u-m-b-20 u-m-t-20" v-for="(order,orderIndex) in data" :key="orderIndex"> <view class="u-m-b-20 u-m-t-20" v-for="(order,orderIndex) in data" :key="orderIndex">
@@ -16,23 +16,24 @@
</view> </view>
<view class="u-p-l-30 u-flex-1"> <view class="u-p-l-30 u-flex-1">
<view class="u-flex u-row-between u-col-top"> <view class="u-flex u-row-between u-col-top">
<view class=""> <view class="">
<view class="u-flex"> <view class="u-flex">
<view class="tui" v-if="item.status=='return'"> <view class="tui" v-if="item.status=='return'">
已退 已退
</view> </view>
<view :class="{'line-th':item.status=='return'}">{{item.name||item.productName}}</view> <view :class="{'line-th':item.status=='return'}">{{item.name||item.productName}}
</view>
</view> </view>
<view class="color-999 u-font-24 u-m-t-10">{{item.productSkuName||''}}</view> <view class="color-999 u-font-24 u-m-t-10">{{item.productSkuName||''}}</view>
</view> </view>
<view class="u-text-right"> <view class="u-text-right">
<template v-if="item.status=='return'"> <template v-if="item.status=='return'">
<view >0.00</view> <view>0.00</view>
<view class="line-th color-666 u-font-24">{{item.salePrice||item.price}}</view> <view class="line-th color-666 u-font-24">{{item.salePrice||item.price}}</view>
</template> </template>
<template v-else> <template v-else>
<view >{{item.salePrice||item.price}}</view> <view>{{item.salePrice||item.price}}</view>
</template> </template>
<view class="u-m-t-10 u-font-24">X{{item.number||item.num}}</view> <view class="u-m-t-10 u-font-24">X{{item.number||item.num}}</view>
</view> </view>
@@ -42,44 +43,70 @@
<template v-if="orderInfo.status=='unpaid'"> <template v-if="orderInfo.status=='unpaid'">
<view class="u-flex u-row-right gap-20 u-m-t-20" v-if="item.status!='return'"> <view class="u-flex u-row-right gap-20 u-m-t-20" v-if="item.status!='return'">
<!-- <my-button :height="60" color="#333" plain type="cancel" shape="circle">更多操作</my-button> --> <!-- <my-button :height="60" color="#333" plain type="cancel" shape="circle">更多操作</my-button> -->
<my-button :width="168" :height="60" plain shape="circle" @tap="tuicai(item,index)">退菜</my-button> <my-button :width="168" :height="60" plain shape="circle"
@tap="tuicai(item,index)">退菜</my-button>
</view> </view>
</template> </template>
<template v-if="orderInfo.status=='closed'"> <template v-if="orderInfo.status=='closed'">
<view class="u-flex u-row-right gap-20 u-m-t-20" v-if="item.status!='return'"> <view class="u-flex u-row-right gap-20 u-m-t-20" v-if="item.status!='return'">
<my-button :width="168" :height="60" plain shape="circle" @tap="tuikuan(item,index)">退款</my-button> <my-button :width="168" :height="60" plain shape="circle"
@tap="tuikuan(item,index)">退款</my-button>
</view> </view>
</template> </template>
</view> </view>
</view> </view>
<view class="bg-gray u-p-20 u-m-t-20"> <view class="bg-gray u-p-20 u-m-t-20" v-if="orderInfo.remark">
<view>备注</view> <view>备注</view>
<view class="u-m-t-10">{{orderInfo.remark}}</view> <view class="u-m-t-10">{{orderInfo.remark}}</view>
</view> </view>
</view> </view>
<view class="u-m-t-40"> <view class="u-m-t-32">
<view class="u-flex u-row-between border-bottom u-p-b-20"> <view class="u-flex u-row-between border-top u-p-t-32">
<view> <view>
<template v-if="orderInfo.status=='unpaid'"> <template v-if="orderInfo.status=='unpaid'">
<view class="tag no-pay"> <view class="tag no-pay">
未支付 未支付
</view> </view>
</template> </template>
<template v-if="orderInfo.status=='refund'">
<view class="tag refund">
退款成功
</view>
</template>
</view> </view>
<view> <view>
<text>小计</text> <text>小计</text>
<text class="font-bold u-font-32">{{allPrice}}</text> <text class="font-bold u-font-32">{{allPrice}}</text>
</view> </view>
</view> </view>
<template v-if="orderInfo.status=='refund'">
<view class="u-flex u-row-between u-m-t-32">
<view>退款金额</view>
<view class="color-999">
<text class="">{{orderInfo.originAmount}}</text>
</view>
</view>
<view class="u-flex u-row-between u-m-t-32">
<view>退款原因</view>
<view class="color-999">
<text class="">0.00</text>
</view>
</view>
<view class="u-flex u-row-between u-m-t-32 u-p-b-24 border-bottom">
<view></view>
<view class="">
<text class="">退款成功</text>
</view>
</view>
</template>
<view class="u-flex u-row-between u-m-t-20"> <view class="u-flex u-row-between u-m-t-20">
<view></view> <view></view>
<view> <view>
<text>总计</text> <text>总计</text>
<text class="font-bold u-font-32">{{seatFee*1+allPrice*1}}</text> <text class="font-bold u-font-32">{{allPrice*1+seatFeePrice*1}}</text>
</view> </view>
</view> </view>
<view class="u-m-t-30"> <view class="u-m-t-30">
@@ -94,18 +121,21 @@
computed computed
} from 'vue'; } from 'vue';
import color from '@/commons/color.js' import color from '@/commons/color.js'
const emits=defineEmits(['tuicai','tuikuan','printOrder']) const emits = defineEmits(['tuicai', 'tuikuan', 'printOrder'])
function tuicai(item,index){
emits('tuicai',item,index) function tuicai(item, index) {
emits('tuicai', item, index)
} }
function tuikuan(item,index){
emits('tuikuan',item,index) function tuikuan(item, index) {
emits('tuikuan', item, index)
} }
function printOrder(){
function printOrder() {
emits('printOrder') emits('printOrder')
} }
const props = defineProps({ const props = defineProps({
orderInfo:{ orderInfo: {
type: Object, type: Object,
default: () => {} default: () => {}
}, },
@@ -113,55 +143,79 @@
type: Array, type: Array,
default: () => [] default: () => []
}, },
seatFee:{ seatFee: {
type:[String,Number], type: Object,
default:0 default: () => {}
} }
}) })
const allPrice = computed(() => {
return props.data.reduce((prve, cur) => { const seatFeePrice = computed(() => {
const curTotal=cur.info.filter(v=>v.isGift !== "true"&& v.status !== "return").reduce((a,b)=>{ if (props.seatFee.totalAmount) {
return a+(b.salePrice||b.price) * (b.number||b.num) return 0
},0) }
return prve + curTotal const n = props.seatFee.totalAmount * (props.seatFee.status == 'return' ? 0 : 1)
}, 0).toFixed(2) return n.toFixed(2)
}) })
const allPrice = computed(() => {
const goodsPrice = props.data.reduce((prve, cur) => {
const curTotal = cur.info.filter(v => v.isGift !== "true" && v.status !== "return").reduce((a,
b) => {
return a + (b.salePrice || b.price) * (b.number || b.num)
}, 0)
return prve + curTotal
}, 0)
return goodsPrice.toFixed(2)
})
const goodsNumber = computed(() => { const goodsNumber = computed(() => {
let result = 0 let result = 0
result = props.data.reduce((a, b) => { result = props.data.reduce((a, b) => {
const bTotal = b.info.reduce((prve, cur) => { const bTotal = b.info.reduce((prve, cur) => {
return prve + (cur.number||cur.num) * 1; return prve + (cur.number || cur.num) * 1;
}, 0); }, 0);
return a + bTotal return a + bTotal
}, 0) }, 0)
return result return result
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.img { .img {
width: 70rpx; width: 152rpx;
height: 70rpx; height: 152rpx;
}
.border-top {
border-color: #F6F6F6;
} }
.border-bottom { .border-bottom {
border-color: rgb(240, 240, 240); // border-color: rgb(240, 240, 240);
border-color: #F6F6F6;
} }
.line-th{
.line-th {
text-decoration: line-through; text-decoration: line-through;
} }
.tag {
padding: 2rpx 8rpx;
border-radius: 8rpx;
.tag {
padding: 4rpx 8rpx 2rpx 10rpx;
border-radius: 8rpx;
font-size: 24rpx;
&.no-pay { &.no-pay {
background-color: rgb(170, 170, 170); background-color: rgb(170, 170, 170);
color: #fff; color: #fff;
} }
&.refund{
background-color: #FCE7E7;
padding: 8rpx 20rpx 6rpx 22rpx;
color: #EB4F4F;
}
} }
.tui{
.tui {
background-color: rgb(239, 239, 239); background-color: rgb(239, 239, 239);
border-radius: 4rpx; border-radius: 4rpx;
margin-right: 6rpx; margin-right: 6rpx;
@@ -169,5 +223,4 @@
padding: 0 4rpx; padding: 0 4rpx;
font-size: 20rpx; font-size: 20rpx;
} }
</style> </style>

View File

@@ -2,11 +2,11 @@
<view class="min-page bg-gray u-font-28 u-p-30"> <view class="min-page bg-gray u-font-28 u-p-30">
<user-vue :orderInfo="orderDetail.info" :user="user"></user-vue> <user-vue :orderInfo="orderDetail.info" :user="user"></user-vue>
<view class="default-box-padding bg-fff border-r-12 u-m-t-20"> <view class="default-box-padding bg-fff border-r-12 u-m-t-20">
<text class="color-666">桌位号</text> <text class="">桌位号</text>
<text class="font-bold">{{orderDetail.info.tableName}}</text> <text class="">{{orderDetail.info.tableName}}</text>
</view> </view>
<goods-list @printOrder="onPrintOrder" @tuikuan="onTuikuan" :orderInfo="orderDetail.info" <goods-list @printOrder="onPrintOrder" @tuikuan="onTuikuan" :orderInfo="orderDetail.info"
:data="orderDetail.goodsList" :seatFee="orderDetail.seatFee.totalAmount" @tuicai="onTuiCai"></goods-list> :data="orderDetail.goodsList" :seatFee="orderDetail.seatFee" @tuicai="onTuiCai"></goods-list>
<template v-if="orderDetail.seatFee.totalNumber&&orderDetail.seatFee.totalAmount"> <template v-if="orderDetail.seatFee.totalNumber&&orderDetail.seatFee.totalAmount">
<extra-vue @tuicai="onSeatFeeTuicai" @tuikuan="onSeatFeeTuiKuan" :orderInfo="orderDetail.info" <extra-vue @tuicai="onSeatFeeTuicai" @tuikuan="onSeatFeeTuiKuan" :orderInfo="orderDetail.info"
:data="orderDetail.seatFee"></extra-vue> :data="orderDetail.seatFee"></extra-vue>
@@ -88,24 +88,23 @@
id, id,
productId, productId,
productSkuId, productSkuId,
productName, name,
productSkuName,
cartId, cartId,
num, number,
priceAmount, totalAmount,
price salePrice
} = seatFee } = seatFee
go.to('PAGES_ORDER_TUIKUAN', { go.to('PAGES_ORDER_TUIKUAN', {
id, id:orderDetail.info.id,
cartId, cartId:seatFee.id,
productId, productId,
productSkuId, productSkuId,
productName, productName:name,
num, num:number,
number: 0, number: 0,
productSkuName: productSkuName || '', productSkuName: '',
priceAmount, priceAmount:totalAmount,
price price:salePrice
}) })
} }
@@ -120,8 +119,8 @@
cartId: tuicai.selGoods.hasOwnProperty('cartId') ? tuicai.selGoods.cartId : tuicai.selGoods.id, cartId: tuicai.selGoods.hasOwnProperty('cartId') ? tuicai.selGoods.cartId : tuicai.selGoods.id,
tableId: orderDetail.info.tableId, tableId: orderDetail.info.tableId,
}) })
tuicai.selGoods.status = 'return'
tuicai.show = false tuicai.show = false
init()
} }
@@ -263,11 +262,12 @@
} }
} }
orderDetail.seatFee = { orderDetail.seatFee = res.seatInfo|| {
name: '餐位费', name: '客座费',
number: res.seatCount, number: res.seatCount,
totalNumber: res.seatCount, totalNumber: res.seatCount,
totalAmount: res.seatAmount totalAmount: res.seatAmount,
status:''
} }
orderDetail.goodsList = Object.entries(goodsMap).map(([key, value]) => ({ orderDetail.goodsList = Object.entries(goodsMap).map(([key, value]) => ({
info: value, info: value,

View File

@@ -28,7 +28,7 @@
v-if="discount.price&&discount.currentPrice!=order.amount"> v-if="discount.price&&discount.currentPrice!=order.amount">
<view>服务员改价</view> <view>服务员改价</view>
<view class=" u-flex u-col-center"> <view class=" u-flex u-col-center">
<text style="color: rgb(255, 95, 46);">-{{order.amount- discount.currentPrice}}</text> <text style="color: rgb(255, 95, 46);">-{{to2(order.amount- discount.currentPrice)}}</text>
</view> </view>
</view> </view>
</view> </view>
@@ -132,7 +132,12 @@
clearInterval(timer) clearInterval(timer)
timer = null timer = null
} }
function to2(n){
if(!n){
return ''
}
return n.toFixed(2)
}
const pays = reactive({ const pays = reactive({
list: ['扫码收款', '二维码收款'], list: ['扫码收款', '二维码收款'],
selIndex: 0, selIndex: 0,
@@ -179,6 +184,7 @@
function editDiscountConfirm(form) { function editDiscountConfirm(form) {
console.log(form); console.log(form);
Object.assign(discount, form) Object.assign(discount, form)
getPayUrl()
} }
async function getPayType() { async function getPayType() {
const payTypeList = await Api.$getPayType() const payTypeList = await Api.$getPayType()
@@ -196,6 +202,7 @@
infoBox.showToast('支付成功') infoBox.showToast('支付成功')
setTimeout(() => { setTimeout(() => {
// uni.$emit('orderDetail:update') // uni.$emit('orderDetail:update')
uni.$emit('update:createOrderIndex')
uni.navigateBack({ uni.navigateBack({
delta: 2 delta: 2
}) })
@@ -270,22 +277,27 @@
async function init() { async function init() {
const res = await orderApi.tbOrderInfoDetail(order.orderId) const res = await orderApi.tbOrderInfoDetail(order.orderId)
Object.assign(order, res) Object.assign(order, res)
if(order.userId){
queryAllShopUser({id:order.userId}).then(res=>{
user.value=res.content[0]||opt
})
}
getPayUrl()
} }
onLoad(async(opt) => { function getPayUrl(){
orderApi.$getOrderPayUrl({ orderApi.$getOrderPayUrl({
orderId: opt.orderId orderId: order.id,
payAmount:discount.currentPrice?discount.currentPrice:order.amount
}).then(res => { }).then(res => {
payCodeUrl.value = res payCodeUrl.value = res
}) })
}
onLoad(async(opt) => {
console.log(opt); console.log(opt);
Object.assign(order, opt) Object.assign(order, opt)
const payTypeList = await Api.$getPayType() const payTypeList = await Api.$getPayType()
pays.payTypes.list = payTypeList pays.payTypes.list = payTypeList
if(order.userId){
queryAllShopUser({id:opt.userId}).then(res=>{
user.value=res.content[0]||opt
})
}
init() init()
}) })