增加单品备注
This commit is contained in:
parent
b37510e804
commit
cf6dbab969
|
|
@ -18,7 +18,9 @@
|
|||
<view class="u-p-30">
|
||||
<view class="u-m-t-10">
|
||||
<my-button @tap="confirm" shape="circle" showShadow>确认</my-button>
|
||||
<my-button type="cancel" bgColor="#fff" @tap="confirm">取消</my-button>
|
||||
<view class="u-m-t-10">
|
||||
<my-button type="cancel" bgColor="#fff" @tap="confirm">取消</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
|
@ -31,9 +33,6 @@
|
|||
nextTick,
|
||||
ref
|
||||
} from 'vue';
|
||||
import myModel from '@/components/my-components/my-model.vue'
|
||||
import myButton from '@/components/my-components/my-button.vue'
|
||||
import myTabs from '@/components/my-components/my-tabs.vue'
|
||||
const props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
|
|
@ -47,7 +46,7 @@
|
|||
|
||||
|
||||
function changeCauses(item) {
|
||||
let prve=form.remark.length?',':''
|
||||
let prve=form.remark?',':''
|
||||
form.remark +=prve+item.name
|
||||
}
|
||||
|
||||
|
|
@ -88,7 +87,8 @@
|
|||
|
||||
const model = ref(null)
|
||||
|
||||
function open() {
|
||||
function open(data) {
|
||||
Object.assign(form,data)
|
||||
model.value.open()
|
||||
}
|
||||
|
||||
|
|
@ -100,11 +100,12 @@
|
|||
function confirm() {
|
||||
const {remark
|
||||
} = form
|
||||
close()
|
||||
emits('confirm', {
|
||||
name,
|
||||
price
|
||||
remark
|
||||
})
|
||||
console.log(remark);
|
||||
close()
|
||||
|
||||
}
|
||||
defineExpose({
|
||||
open,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@
|
|||
</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>
|
||||
<view class="u-font-24 u-m-l-30"><text>余额:</text><text
|
||||
class="color-main">{{user.amount}}</text>
|
||||
</view>
|
||||
<view class="u-font-24 u-m-l-30"><text>积分:</text><text
|
||||
class="color-main">{{user.totalScore}}</text></view>
|
||||
|
|
@ -33,7 +34,7 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<view class=" " @tap="chooseTable">
|
||||
<view>选择桌码</view>
|
||||
<view class="u-m-t-24 u-flex u-row-between ">
|
||||
|
|
@ -44,9 +45,9 @@
|
|||
<uni-icons type="right" color="#999" size="16"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
<template v-if="user">
|
||||
<view class="block">
|
||||
<view class="">
|
||||
|
|
@ -80,7 +81,8 @@
|
|||
<view class="block">
|
||||
<view class=" ">
|
||||
<view>用餐人数(人)</view>
|
||||
<picker @change="userNumberChange" :value="userNumbers.defaultCateIndex" :range="userNumbers.list">
|
||||
<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>
|
||||
|
|
@ -147,7 +149,11 @@
|
|||
<view class="color-999 u-text-right u-font-24 u-m-t-12">×{{item.number}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<template v-if="item.note">
|
||||
<view class="u-p-20 bg-gray u-m-t-10">
|
||||
{{item.note}}
|
||||
</view>
|
||||
</template>
|
||||
<scroll-view scroll-x="true" v-if="index==goods.sel">
|
||||
<view class="u-m-t-32 u-flex no-wrap u-p-b-12">
|
||||
<!-- <view class="u-flex u-m-r-20 u-m-b-20">
|
||||
|
|
@ -167,7 +173,8 @@
|
|||
@tap="toggleWait(item)">{{item.isWait?'取消等叫':'等叫'}}</button>
|
||||
</view> -->
|
||||
<view class="u-flex u-m-r-20 u-m-b-20">
|
||||
<button class="tag" hover-class="hover-class" @tap="showModel('remark')">单品备注</button>
|
||||
<button class="tag" hover-class="hover-class"
|
||||
@tap="showModel('remark',index)">单品备注</button>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
|
@ -214,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 title="单品备注" :ref="setModel" name="remark"></my-remark>
|
||||
<my-remark @confirm="goodsOneRemarkConfirm" title="单品备注" :ref="setModel" name="remark"></my-remark>
|
||||
<edit-discount title="优惠金额" :ref="setModel" name="editMoney" :price="allPrice"></edit-discount>
|
||||
</view>
|
||||
|
||||
|
|
@ -252,6 +259,10 @@
|
|||
getNowCart
|
||||
} from '@/pagesCreateOrder/util.js'
|
||||
const models = new Map();
|
||||
const modelData = reactive({
|
||||
data: {},
|
||||
selIndex: -1
|
||||
})
|
||||
//备注
|
||||
let note = ref('')
|
||||
|
||||
|
|
@ -261,9 +272,11 @@
|
|||
}
|
||||
}
|
||||
|
||||
function showModel(key) {
|
||||
function showModel(key, index) {
|
||||
modelData.data =goods.list[index]
|
||||
modelData.selIndex =index
|
||||
const model = models.get(key)
|
||||
model && model.open()
|
||||
model && model.open({remark:modelData.data.note})
|
||||
}
|
||||
|
||||
function formatPrice(n) {
|
||||
|
|
@ -401,7 +414,7 @@
|
|||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
const goods = reactive({
|
||||
list: [],
|
||||
sel: 0
|
||||
|
|
@ -468,7 +481,7 @@
|
|||
console.log(res);
|
||||
return res
|
||||
}
|
||||
|
||||
|
||||
// 创建订单
|
||||
async function createOrder(par = {
|
||||
masterId: option.masterId,
|
||||
|
|
@ -497,7 +510,9 @@
|
|||
})
|
||||
} else {
|
||||
//后付
|
||||
uni.navigateBack({delta:2})
|
||||
uni.navigateBack({
|
||||
delta: 2
|
||||
})
|
||||
// return go.to('PAGES_ORDER_DETAIL', {
|
||||
// id: res.id
|
||||
// })
|
||||
|
|
@ -513,11 +528,25 @@
|
|||
// })
|
||||
// }, 500)
|
||||
}
|
||||
|
||||
function init(){
|
||||
|
||||
|
||||
//单品备注确认
|
||||
async function goodsOneRemarkConfirm(e) {
|
||||
const cart=goods.list[modelData.selIndex]
|
||||
await Api.$updateCart({
|
||||
cartId: cart.id,
|
||||
productId: cart.productId,
|
||||
skuId: cart.skuId,
|
||||
tableId: option.tableId,
|
||||
note: e.remark,
|
||||
num: cart.number // 0会删除此商品
|
||||
})
|
||||
cart.note= e.remark
|
||||
}
|
||||
|
||||
|
||||
function init() {
|
||||
|
||||
}
|
||||
|
||||
onLoad((opt) => {
|
||||
console.log('opt');
|
||||
console.log(opt);
|
||||
|
|
@ -548,7 +577,7 @@
|
|||
useType = `dine-in-${isPayAfter? "after" : "before"}`;
|
||||
uni.setStorageSync("useType", useType);
|
||||
}
|
||||
const tableId = useType=='takeout'?undefined: table.value.tableId;
|
||||
const tableId = useType == 'takeout' ? undefined : table.value.tableId;
|
||||
const res = await Api.$changeUseType({
|
||||
useType,
|
||||
tableId,
|
||||
|
|
|
|||
Loading…
Reference in New Issue