更新订单列表详情,更新商品管理,更新代客下单

This commit is contained in:
2024-09-23 17:39:38 +08:00
parent 90e3866524
commit edcf844adb
36 changed files with 5301 additions and 949 deletions

View File

@@ -6,9 +6,10 @@
<view class="u-m-t-24 u-flex u-row-between " @tap="chooseUser">
<view v-if="!user">选择用户</view>
<view class="u-flex" v-else>
<view class="headeimg">
<up-avatar :src="user.headImg" shape="square" :size="30"></up-avatar>
<!-- <view class="headeimg">
<image class="img" :src="user.headImg" mode=""></image>
</view>
</view> -->
<view class="u-m-l-20">{{user.nickName}}</view>
<view class="color-main u-m-l-10 u-font-24">{{user.isVip?'会员':'' }}</view>
<view class="u-font-24 u-m-l-30"><text>余额</text><text class="color-main">{{user.amount}}</text>
@@ -16,69 +17,55 @@
<view class="u-font-24 u-m-l-30"><text>积分</text><text
class="color-main">{{user.totalScore}}</text></view>
</view>
<uni-icons type="right" color="#999" size="22"></uni-icons>
<uni-icons type="right" color="#999" size="16"></uni-icons>
</view>
</view>
<view class="u-p-b-24 u-m-b-24 border-bottom">
<view>就餐类型</view>
<view class="u-m-t-24 u-flex ">
<view class="u-flex color-666">
<radio-group @change="radioGroupChange">
<label class="radio u-m-r-60" v-for="(item,index) in eatTypes.list" :key="index">
<radio :value="''+item.value" :checked="item.value == eatTypes.active"
class="scale7 " />
<text>{{item.label}}</text>
</label>
</radio-group>
<up-radio-group v-model="eatTypes.active" placement="row">
<up-radio :customStyle="{marginRight: '30px'}" v-for="(item, index) in eatTypes.list"
:key="index" :label="item.name" :name="item.value">
</up-radio>
</up-radio-group>
</view>
</view>
</view>
<view class="u-p-b-24 u-m-b-24 border-bottom" @tap="chooseTable">
<view class=" " @tap="chooseTable">
<view>选择桌码</view>
<view class="u-m-t-24 u-flex u-row-between ">
<view>
<text v-if="table">{{table.name}}</text>
<text v-else>不选择桌台</text>
</view>
<uni-icons type="right" color="#999" size="22"></uni-icons>
<uni-icons type="right" color="#999" size="16"></uni-icons>
</view>
</view>
</view>
<view class="block">
<template v-if="!user">
<view class="u-p-b-24 u-m-b-24 border-bottom">
<view>用餐人数</view>
<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>
<uni-icons type="right" color="#999" size="22"></uni-icons>
</view>
</picker>
</view>
</template>
<template v-else>
<view>
<view class="u-flex border-bottom u-p-b-24">
<image class="headeimg" src="@/static/uni.png" mode=""></image>
<template v-if="user">
<view class="block">
<view class="">
<view class="u-flex border-bottom u-p-b-24 ">
<up-avatar :src="user.headImg" shape="square" :size="60"></up-avatar>
<!-- <image class="headeimg" src="@/static/uni.png" mode=""></image> -->
<view class="u-m-l-32">
<view class="">{{user.name}}</view>
<view class="color-main u-font-24">{{user.isVip?'永久会员':'' }}</view>
<view class="">{{user.nickName}}</view>
<view class="color-main u-font-24">{{user.isVip?'会员':'' }}</view>
</view>
</view>
<view class="u-flex u-m-t-24 u-row-between u-font-24 color-999">
<view class="u-flex">
<view>余额</view>
<view class="color-333 u-m-l-10"> 0.00</view>
<view class="color-333 u-m-l-10"> {{user.amount}}</view>
</view>
<view class="u-flex">
<view>积分</view>
<view class="color-333 u-m-l-10"> 0</view>
<view class="color-333 u-m-l-10"> {{user.totalScore}}</view>
</view>
<view class="u-flex">
<view>已消费</view>
@@ -86,10 +73,23 @@
</view>
</view>
</view>
</template>
</view>
</view>
</template>
<template v-if="$shop.registerType!='restaurant'">
<!-- 不免餐位费 -->
<view class="block">
<view class=" ">
<view>用餐人数</view>
<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>
<uni-icons type="right" color="#999" size="16"></uni-icons>
</view>
</picker>
</view>
</view>
</template>
<view class="block">
<view class="u-p-b-24 ">
@@ -150,9 +150,9 @@
<scroll-view scroll-x="true" v-if="index==goods.sel">
<view class="u-m-t-32 u-flex no-wrap">
<view class="u-flex u-m-r-20 u-m-b-20">
<!-- <view class="u-flex u-m-r-20 u-m-b-20">
<button class="tag" hover-class="hover-class" @tap="showModel('discount')">单品打折</button>
</view>
</view> -->
<view class="u-flex u-m-r-20 u-m-b-20">
<!-- <button class="tag" hover-class="hover-class" @tap="showModel('giveFood')">赠菜</button> -->
<button class="tag" hover-class="hover-class"
@@ -177,7 +177,7 @@
<view class="u-flex u-row-between u-m-t-30 u-p-b-34 border-bottom">
<view>
<text v-if="eatTypes.active==2">包装费</text>
<text v-if="eatTypes.active=='takeout'">包装费</text>
<text v-else>桌位费</text>
</view>
<view>{{$seatFee.totalAmount||'0.00'}}</view>
@@ -196,14 +196,16 @@
<view style="height: 300rpx;"></view>
<view class="safe-bottom fixed">
<view>
<!-- <view class="u-m-b-48">
<label class="radio">
<radio value="" class="scale7" /><text>打印预结算</text>
</label>
</view>
</view> -->
<view class="u-m-t-48 btn">
<my-button shape="circle" @click="createOrder">提交</my-button>
<view class="btn ">
<my-button shape="circle" @click="createOrder">
{{$shop.registerType=='munchies'?'结算': '下单'}}
</my-button>
</view>
</view>
@@ -240,7 +242,12 @@
} from '@/commons/utils/format.js';
import color from '@/commons/color.js';
import * as Api from '@/http/yskApi/Instead.js'
import {getNowCart} from '@/pagesCreateOrder/util.js'
import {
tbShopInfo
} from '@/http/yskApi/user.js'
import {
getNowCart
} from '@/pagesCreateOrder/util.js'
const models = new Map();
//备注
let note = ref('')
@@ -270,16 +277,22 @@
defaultCateIndex: 1,
})
watch(() => userNumbers.defaultCateIndex, (newval) => {
console.log(newval);
updateChoseCount()
})
//更新就餐人数
async function updateChoseCount(){
await Api.$choseCount({
masterId: option.masterId,
tableId: option.tableId,
num: userNumbers.defaultCateIndex,
})
async function updateChoseCount() {
console.log($shop.value);
if($shop.value.registerType!='restaurant'){
//不免餐位费
await Api.$choseCount({
masterId: option.masterId,
tableId: option.tableId,
num: userNumbers.defaultCateIndex,
})
}
}
function userNumberChange(e) {
@@ -315,21 +328,17 @@
const eatTypes = reactive({
list: [{
label: '堂食',
value: 1
name: "堂食",
value: "dine-in",
},
{
label: '自取',
value: 2
},
name: "自取",
value: "takeout",
}
],
active: 1
active: 'dine-in'
})
function radioGroupChange(e) {
eatTypes.active = e.detail.value
}
function chooseUser() {
go.to('PAGES_CHOOSE_USER')
@@ -343,12 +352,24 @@
// 监听选择用户事件
let user = ref(null)
//更新选择用户
function setUser(par) {
const submitPar = {
masterId: option.masterId,
tableId: option.tableId,
vipUserId: user.value.id ? user.value.id : '',
type: user.value.id ? 0 : 1 //0 设置 1 取消
}
Object.assign(submitPar, par)
return Api.$setUser(submitPar)
}
function watchChooseuser() {
uni.$off('choose-user')
uni.$on('choose-user', (data) => {
console.log(data);
user.value = data
setUser()
})
}
let table = ref(null)
@@ -415,15 +436,24 @@
records,
seatFee
} = await Api.getCart(par)
goods.list =getNowCart(records)
if(seatFee&&seatFee.totalNumber){
goods.list = getNowCart(records)
if (seatFee && seatFee.totalNumber) {
userNumbers.defaultCateIndex = seatFee.totalNumber || 1
Object.assign($seatFee, seatFee)
}
console.log(goods.list);
}
let $shop = ref()
// 获取账号信息
async function getTbShopInfo() {
const res = await tbShopInfo()
$shop.value = res
console.log(res);
return res
}
// 创建订单
async function createOrder(par = {
masterId: option.masterId,
@@ -435,6 +465,13 @@
}) {
updateChoseCount()
const res = await Api.$createOrder(par)
console.log($shop.value);
if($shop.value.registerType=='munchies'){
//先付
return go.to('PAGES_ORDER_DETAIL',{
id:res.id
})
}
uni.showToast({
title: '提交成功',
icon: 'none'
@@ -453,10 +490,36 @@
if (opt) {
table.value = {
tableId: opt.tableId,
name: opt.tableName
name: opt.name
}
}
getCart()
getTbShopInfo()
updateChoseCount()
})
async function changeUseType() {
const {
registerType
} = $shop.value
//munchies 先付 restaurant 后付
const isPayAfter = registerType == "munchies" ? false : true;
let useType = "takeout";
if (eatTypes.active == "takeout") {
uni.setStorageSync("useType", "takeout");
} else {
//堂食
useType = `dine-in-${isPayAfter? "after" : "before"}`;
uni.setStorageSync("useType", useType);
}
const res = await Api.$changeUseType({
useType,
cartIds: goods.list.map((v) => v.id),
})
return res
}
watch(() => eatTypes.active, (newval) => {
changeUseType()
})
onBeforeUnmount(() => {