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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,62 +1,53 @@
<template>
<view class="page">
<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">
<uni-forms :model="item" :rules="rules" err-show-type="undertext" validateTrigger="blur"
:ref="setFormRef(index)" :border="true" label-position="top" label-width="350">
<view class="block">
<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"
v-model="item.name" placeholder="规格组名" />
v-model="item.name" placeholder="规格组名,如:尺码" />
</uni-forms-item>
</view>
<!-- <uni-forms-item label="最少可选" required name="MinOptional" >
<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="选项值">
<uni-forms-item label="规格值">
<view class="option">
<view class="u-flex">
<view class="u-flex-1">名称</view>
<view class="u-flex-1 u-p-l-60">加价</view>
</view>
<view class="u-m-t-32">
<view class="u-flex option-item"
v-for="(option,optionIndex) in item.options"
:key="optionIndex"
>
<view class="">
<view class="u-flex option-item" v-for="(option,optionIndex) in item.options"
:key="optionIndex">
<view class="u-flex-1">
<uni-forms-item :key="optionIndex" :name="['options',optionIndex,'optionName']"
:ref="setFormInputRef(index,optionIndex)"
:rules="[{'required': true,errorMessage: '必填'}]"
label-width="0" label="" required :showRequired="false"
>
<uni-easyinput v-model="specifications.list[index].options[optionIndex].optionName"
@input="inpuChange(index,optionIndex)"
<uni-forms-item :key="optionIndex" :name="['options',optionIndex,'name']"
:ref="setFormInputRef(index,optionIndex)"
:rules="[{'required': true,errorMessage: '必填'}]" label-width="0"
label="" required :showRequired="false">
<uni-easyinput
v-model="specifications.list[index].options[optionIndex].name"
@input="inpuChange(index,optionIndex)"
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
placeholder="选项名" />
placeholder="请输入规格值,如:S、M" />
</uni-forms-item>
</view>
<view class="u-p-l-60 u-flex-1 u-flex">
<uni-forms-item :key="optionIndex"
:rules="[{'required': true,errorMessage: '必填'}]"
:ref="setFormInputRef(index,optionIndex)"
:name="['options',optionIndex,'optionPrice']" label-width="0" label="" required :showRequired="false"
>
<view class=" u-flex">
<uni-forms-item :key="optionIndex" label-width="0" label=""
:showRequired="false">
<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)"
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
type="digit" placeholder="填写价格" />
type="digit" placeholder="填写价格" /> -->
<view class="icon icon-reduce u-m-l-38"
@click="delOption(index,optionIndex)">
@ -79,7 +70,7 @@
</view>
</uni-forms-item>
<view class="u-flex u-m-t-48 u-m-b-24" @click="delSpecificationsGroup(index)">
<view class="icon icon-reduce u-m-r-22 ">
@ -106,10 +97,14 @@
<script setup>
import go from '@/commons/utils/go.js';
import {
$productSpec
} from '@/http/yskApi/goods.js'
import {
onLoad,
onReady
onReady,
} from '@dcloudio/uni-app';
import infoBox from '@/commons/utils/infoBox.js'
import {
onMounted,
reactive,
@ -117,8 +112,9 @@
ref,
onBeforeMount
} from 'vue';
const nameFormRef = ref(null)
//
const placeholderStyle = ref('font-size:28rpx;')
const placeholderStyle = ref('font-size:28rpx;')
//
const inputBorder = ref(false)
const form = ref(null)
@ -143,12 +139,6 @@
errorMessage: '必填'
}]
},
optionName: {
rules: [{
required: true,
errorMessage: '必填'
}]
},
optionPrice: {
rules: [{
required: true,
@ -157,10 +147,10 @@
}
}
//
const specificationsOptionsBasicData = {
optionName: '',
name: '',
optionPrice: '0.00'
}
@ -172,8 +162,8 @@
//
const specificationsBasicData = {
name: '',
MinOptional: 1,
MaxOptional: 1,
// MinOptional: 1,
// MaxOptional: 1,
options: []
}
@ -189,6 +179,7 @@
}
//
const specifications = reactive({
name: '',
list: [returnSpecificationsOptionsBasicData()]
})
@ -235,7 +226,8 @@
};
}
// option input
const refFormInput=ref([])
const refFormInput = ref([])
function setFormInputRef(index, index1) {
const newIndex = index * 10000 + index1
return (el) => {
@ -252,61 +244,104 @@
console.log(refFormInput.value[newIndex]);
refFormInput.value[newIndex].onFieldChange()
}
let emitName=''
function triggerEvent (emitName,data){
if(emitName){
uni.$emit(emitName,data)
}
const option = {
type: 'add',
id: undefined
}
onLoad(opt=>{
const arr=uni.getStorageSync('guige')
if(arr.length){
specifications.list=arr
console.log(arr);
}
onLoad(opt => {
console.log(opt);
if(opt&&JSON.stringify(opt)!=='{}'&&opt.emitName){
emitName=opt.emitName
if (opt && JSON.stringify(opt) !== '{}' && opt.type) {
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({
title:emitName?'编辑规格模版':'添加规格模版'
title: option.type === 'edit' ? '编辑规格模版' : '添加规格模版'
})
})
function emitspecificationsSave(){
// emitspecificationsSave
// guigeEdit
uni.removeStorageSync('guige')
triggerEvent(emitName,specifications.list)
}
function returnPromise(index,prosise){
return new Promise((resolve,reject)=>{
prosise.then(res=>{
function returnPromise(prosise, index) {
return new Promise((resolve, reject) => {
prosise.then(res => {
console.log(res);
resolve({sucees:true})
}).catch(err=>{
resolve({
sucees: true
})
}).catch(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) {
const res=await returnPromise(i,formRefs.value[i].validate())
isAllPassForm+=res.sucees?1:0
const res = await returnPromise(formRefs.value[i].validate(), i)
isAllPassForm += res.sucees ? 1 : 0
}
//
if(isAllPassForm===specifications.list.length){
if (isAllPassForm === specifications.list.length) {
console.log('pass');
emitspecificationsSave()
go.back()
const data = {
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">
<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-flex u-row-center">
<view class="u-m-r-6">批量修改</view>
<up-icon name="edit-pen" :color="color.ColorMain"></up-icon>
</view>
</button>
<view class="u-m-t-20">
<button class="save-btn edit-btn" hover-class="btn-hover-class" @click="fastEditShow">
<view class="u-flex u-row-center">
<view class="u-m-r-6">批量修改</view>
<up-icon name="edit-pen" :color="color.ColorMain"></up-icon>
</view>
</button>
</view>
</view>
</view>
<view class="bottom" ref="bottom"></view>

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
<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="u-flex u-row-between">
<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">
<template v-if="data.status!='using'">
<view class=" u-font-32" :style="{color:returnStutasColor(data.status)}">
{{returnStutasText(data.status)}}~</view>
{{returnStutasText(data.status)}}~
</view>
</template>
<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=""><text>已点</text><text class="u-m-l-20 color-333">{{data.productNum||0}}</text>
</view>
@ -38,7 +39,7 @@
<template v-else>
<view class="u-flex u-row-center u-m-t-16">
<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>
@ -78,19 +79,30 @@
} from '@/http/yskApi/table.js'
import infoBox from '@/commons/utils/infoBox.js'
const status = $status
const emits = defineEmits(['more','update'])
const emits = defineEmits(['more', 'update'])
function returnStutasText(key) {
key = returnIsUseing(key)
const item = status[key]
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) {
// if(key=='using'){
// return 'rgb(250,85,85)'
// }else{
// return ''
// }
key = returnIsUseing(key)
const item = status[key]
return item ? item.type : ''
}
@ -126,10 +138,10 @@
function more() {
emits('more')
}
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', {
tableId: props.data.tableId,
name: props.data.name,
@ -139,7 +151,7 @@
}
function toOrderDetail() {
if (props.data.status == 'using') {
if (props.data.status == 'using' && props.data.orderId) {
const {
tableId,
name,
@ -148,19 +160,25 @@
areaId,
orderId
} = props.data
if (!orderId) {
return uni.showToast({
icon: 'none',
title: '台桌未返回订单id'
})
}
go.to('PAGES_ORDER_DETAIL', {
tableId,
name,
status,
amount,
areaId,
id:orderId
id: orderId
})
}
}
function qingtai() {
const item=props.data
const item = props.data
uni.showModal({
title: '提示',
content: '确定要清台:' + props.data.name + '',
@ -170,7 +188,7 @@
...item,
status: "idle",
qrcode: item.tableId,
}).then(res=>{
}).then(res => {
infoBox.showToast('清台成功')
emits('update')
})

View File

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

View File

@ -62,7 +62,7 @@
<view class="u-m-t-24 u-flex u-row-between">
<view></view>
<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>
</view>
@ -106,6 +106,12 @@
function toYue(){
go.to('PAGES_RECHARGE_INDEX',{id:''})
}
function toOrder(){
go.to('PAGES_ORDER_INDEX',{
userId:props.data.id||'',
type:'user'
})
}
function remark(){
console.log(props.index);

View File

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

View File

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

View File

@ -84,7 +84,7 @@
<picker @change="userNumberChange" :value="userNumbers.defaultCateIndex"
:range="userNumbers.list">
<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>
</view>
</picker>
@ -221,7 +221,7 @@
<model-discount title="菜品打折/减免" :ref="setModel" name="discount" :price="allPrice"></model-discount>
<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>
</view>
@ -240,10 +240,9 @@
computed,
watch
} from 'vue';
import myButton from '@/components/my-components/my-button'
import modelDiscount from './components/discount'
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 go from '@/commons/utils/go.js';
import {
@ -273,10 +272,12 @@
}
function showModel(key, index) {
modelData.data =goods.list[index]
modelData.selIndex =index
modelData.data = goods.list[index]
modelData.selIndex = index
const model = models.get(key)
model && model.open({remark:modelData.data.note})
model && model.open({
remark: modelData.data.note||''
})
}
function formatPrice(n) {
@ -288,9 +289,10 @@
//
const userNumbers = reactive({
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) => {
console.log(newval);
@ -305,15 +307,16 @@
const res = await Api.$choseCount({
masterId: option.masterId,
tableId: table.value.tableId,
num: userNumbers.defaultCateIndex,
num: userNumbers.defaultCateIndex+1,
})
Object.assign($seatFee, res)
userNumbers.defaultCateIndex = res.totalNumber
userNumbers.defaultCateIndex = res.totalNumber-1
}
}
function userNumberChange(e) {
console.log(e);
userNumbers.defaultCateIndex = e.detail.value
}
@ -398,11 +401,11 @@
//
watch(() => table.value, (newval, oldval) => {
if (newval && oldval) {
Api.$choseTable({
orderId: 4462,
oldTableId: oldval.tableId,
newTableId: newval.tableId,
})
// Api.$choseTable({
// orderId: 4462,
// oldTableId: oldval.tableId,
// newTableId: newval.tableId,
// })
}
})
@ -464,7 +467,7 @@
}
goods.list = getNowCart(records)
if (seatFee && seatFee.totalNumber) {
userNumbers.defaultCateIndex = seatFee.totalNumber || 1
userNumbers.defaultCateIndex = seatFee.totalNumber-1 || 0
Object.assign($seatFee, seatFee)
}
@ -496,7 +499,7 @@
await Api.$choseCount({
masterId: option.masterId,
tableId: table.value.tableId,
num: userNumbers.defaultCateIndex,
num: userNumbers.defaultCateIndex+1,
})
}
// updateChoseCount()
@ -510,9 +513,16 @@
})
} else {
//
uni.navigateBack({
delta: 2
})
if (option.isCreateOrderToDetail) {
go.to('PAGES_ORDER_DETAIL', {
id: res.id
})
} else {
uni.navigateBack({
delta: 2
})
}
// return go.to('PAGES_ORDER_DETAIL', {
// id: res.id
// })
@ -531,7 +541,7 @@
//
async function goodsOneRemarkConfirm(e) {
const cart=goods.list[modelData.selIndex]
const cart = goods.list[modelData.selIndex]
await Api.$updateCart({
cartId: cart.id,
productId: cart.productId,
@ -540,11 +550,16 @@
note: e.remark,
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) => {
@ -558,8 +573,7 @@
}
}
init()
getCart()
getTbShopInfo()
// updateChoseCount()
})

View File

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

View File

@ -97,7 +97,7 @@
</template>
<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>
</view>
@ -650,6 +650,7 @@
productId,
skuId
})
infoBox.showToast('添加成功')
cars.push({
...cartGoods,
specSnap: sku.specSnap
@ -754,6 +755,7 @@
productId,
skuId
})
infoBox.showToast('添加成功')
$goods.chooseNumber = num
cars.push(cartGoods)
}
@ -913,16 +915,29 @@
init()
})
onBeforeUnmount(() => {})
function watchUpdate() {
uni.$off('update:createOrderIndex')
uni.$on('update:createOrderIndex', (data) => {
console.log('update:createOrderIndex');
init()
})
}
onShow(() => {
// watchChooseuser()
watchChooseTable()
watchUpdate()
})
let isCreateOrderToDetail=ref(false)
onLoad((opt) => {
console.log(opt)
Object.assign(data.table, opt)
if(opt.useType){
uni.setStorageSync('useType',opt.useType)
}
if(JSON.stringify(opt)=='{}'){
isCreateOrderToDetail.value=true
}
// if (!opt.tableId) {
// infoBox.showErrorToast('')
// return setTimeout(() => {

View File

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

View File

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

View File

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

View File

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

View File

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