更新订单列表详情,更新商品管理,更新代客下单
This commit is contained in:
@@ -33,8 +33,10 @@
|
||||
<template #btn>
|
||||
<view class="u-p-30">
|
||||
<view class="u-m-t-10">
|
||||
<my-button @tap="confirm" shape="circle" showShadow>修改</my-button>
|
||||
<my-button @tap="close" type="cancel" bgColor="#fff" >取消</my-button>
|
||||
<my-button @tap="confirm" shape="circle" >修改</my-button>
|
||||
<view class="">
|
||||
<my-button @tap="close" type="cancel" bgColor="#fff" >取消</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -60,6 +62,10 @@
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
discount:{
|
||||
type: [Number,String],
|
||||
default:100
|
||||
},
|
||||
price: {
|
||||
type: [Number,String],
|
||||
default: 0
|
||||
@@ -119,6 +125,9 @@
|
||||
|
||||
function open() {
|
||||
model.value.open()
|
||||
form.price=props.price
|
||||
form.currentPrice=props.price
|
||||
form.discount=props.discount
|
||||
}
|
||||
|
||||
function close() {
|
||||
@@ -127,11 +136,9 @@
|
||||
const emits = defineEmits(['confirm'])
|
||||
|
||||
function confirm() {
|
||||
const {
|
||||
price,
|
||||
} = form
|
||||
console.log(form);
|
||||
emits('confirm',{...form,currentPrice:Number(form.currentPrice).toFixed(2)})
|
||||
close()
|
||||
emits('confirm',form)
|
||||
}
|
||||
defineExpose({
|
||||
open,
|
||||
|
||||
@@ -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(() => {
|
||||
|
||||
|
||||
@@ -2,7 +2,18 @@
|
||||
<view class="u-wrap">
|
||||
|
||||
<view class="top bg-fff w-full">
|
||||
<view class="u-flex u-row-between choose-user" @tap="chooseUser">
|
||||
<view class="u-flex u-row-between choose-user" @tap="chooseTable">
|
||||
<view>
|
||||
<view v-if="!data.table.tableId">选择桌台</view>
|
||||
<view class="u-flex" v-else>
|
||||
<view class="u-m-l-20">{{data.table.name}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
<uni-icons type="right" size="20" color="#999"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="u-flex u-row-between choose-user" @tap="chooseUser">
|
||||
<view>
|
||||
<view v-if="!data.vipUser.id">选择用户</view>
|
||||
<view class="u-flex" v-else>
|
||||
@@ -20,7 +31,7 @@
|
||||
<view class="u-flex">
|
||||
<uni-icons type="right" size="20" color="#999"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="search u-flex u-col-center ">
|
||||
<view class="u-flex-1">
|
||||
<uni-search-bar bgColor="#F9F9F9" cancelButton="none" placeholder="搜索店内商品" @confirm="search"
|
||||
@@ -86,6 +97,7 @@
|
||||
<script setup>
|
||||
import _ from 'lodash';
|
||||
import * as Api from '@/http/yskApi/Instead.js'
|
||||
import {$table} from '@/http/yskApi/table.js'
|
||||
import {
|
||||
$tbShopCategory
|
||||
} from '@/http/yskApi/goods.js'
|
||||
@@ -107,12 +119,15 @@
|
||||
computed,
|
||||
reactive,
|
||||
ref,
|
||||
nextTick
|
||||
nextTick,
|
||||
watch
|
||||
} from 'vue';
|
||||
import myCar from './components/car'
|
||||
import go from '@/commons/utils/go.js';
|
||||
import infoBox from '@/commons/utils/infoBox.js';
|
||||
import {getNowCart} from '@/pagesCreateOrder/util.js'
|
||||
import {
|
||||
getNowCart
|
||||
} from '@/pagesCreateOrder/util.js'
|
||||
const cars = reactive([])
|
||||
const data = reactive({
|
||||
scrollTop: 0, //tab标题的滚动条位置
|
||||
@@ -294,16 +309,23 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//获取台桌信息
|
||||
async function getTableInfo(){
|
||||
const res=await $table.get({qrcode:data.table.tableId})
|
||||
console.log(res);
|
||||
if(res&&res.content[0]){
|
||||
// data.table=res.content[0]
|
||||
}
|
||||
}
|
||||
async function init() {
|
||||
getTableInfo()
|
||||
const {
|
||||
masterId
|
||||
} = await getMasterId()
|
||||
data.masterId = masterId
|
||||
const cartRes = await getCart()
|
||||
cars.length = 0
|
||||
const cartArr =getNowCart(cartRes.records)
|
||||
const cartArr = getNowCart(cartRes.records)
|
||||
for (let i in cartArr) {
|
||||
cars.push(cartArr[i])
|
||||
}
|
||||
@@ -351,13 +373,27 @@
|
||||
let searchValue = ref('')
|
||||
|
||||
function search() {
|
||||
|
||||
console.log(searchValue.value);
|
||||
console.log(data.tabbar );
|
||||
}
|
||||
|
||||
function chooseUser() {
|
||||
go.to('PAGES_CHOOSE_USER')
|
||||
}
|
||||
|
||||
function chooseTable() {
|
||||
go.to('PAGES_CHOOSE_TABLE', {
|
||||
...data.table
|
||||
})
|
||||
}
|
||||
|
||||
function watchChooseTable() {
|
||||
uni.$off('choose-table')
|
||||
uni.$on('choose-table', (tableData) => {
|
||||
data.table = tableData
|
||||
})
|
||||
}
|
||||
|
||||
function toLinshi() {
|
||||
go.to('PAGES_ADD_TEMP_CUISINE')
|
||||
}
|
||||
@@ -499,7 +535,7 @@
|
||||
prve[i] = matchArr
|
||||
.filter((v) => v.specSnap.match(i))
|
||||
.every((v) => {
|
||||
return util.isCanBuy(v)
|
||||
return !util.isCanBuy(v)
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -801,9 +837,14 @@
|
||||
setUser()
|
||||
})
|
||||
}
|
||||
watch(()=>data.table.tableId,(newval)=>{
|
||||
console.log(newval);
|
||||
init()
|
||||
})
|
||||
onBeforeUnmount(() => {})
|
||||
onShow(() => {
|
||||
watchChooseuser()
|
||||
// watchChooseuser()
|
||||
watchChooseTable()
|
||||
})
|
||||
onLoad((opt) => {
|
||||
console.log(opt)
|
||||
|
||||
Reference in New Issue
Block a user