Merge branch 'test' of https://e.coding.net/g-cphe0354/cashier_front/cashier_admin_app into wwz
This commit is contained in:
commit
3a5460894b
|
|
@ -39,6 +39,10 @@
|
||||||
</up-radio-group>
|
</up-radio-group>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
</view>
|
</view>
|
||||||
|
<uni-forms-item required name="name" label="商品名称" showRequired>
|
||||||
|
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
|
||||||
|
:inputBorder="inputBorder" v-model="FormData.name" placeholder="请输入商品名称" />
|
||||||
|
</uni-forms-item>
|
||||||
<uni-forms-item ref="fileItem" label="图片" required showRequired>
|
<uni-forms-item ref="fileItem" label="图片" required showRequired>
|
||||||
<my-upload-file ref="refFile" :images="FormData.images"
|
<my-upload-file ref="refFile" :images="FormData.images"
|
||||||
:imageStyles="imageStyles"></my-upload-file>
|
:imageStyles="imageStyles"></my-upload-file>
|
||||||
|
|
@ -55,33 +59,27 @@
|
||||||
</up-checkbox-group>
|
</up-checkbox-group>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
</view>
|
</view>
|
||||||
<template v-if="FormData.type!='package'">
|
<view class="u-relative">
|
||||||
<uni-forms-item required name="name" label="商品名称" showRequired>
|
<uni-forms-item label="商品分类" required showRequired name="categoryId">
|
||||||
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
|
<uni-data-picker :clear-icon="false" :map="{text:'name',value:'id'}"
|
||||||
:inputBorder="inputBorder" v-model="FormData.name" placeholder="请输入商品名称" />
|
placeholder="请选择商品分类" popup-title="请选择商品分类" :localdata="pageData.category"
|
||||||
|
v-model="FormData.categoryId">
|
||||||
|
</uni-data-picker>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<view class="u-relative">
|
<view class="zhezhao u-absolute position-all" @click="canEditGoodsCategory(true)"
|
||||||
<uni-forms-item label="商品分类" required showRequired name="categoryId">
|
v-if="option.type=='edit'&&disabledChangeCategory">
|
||||||
<uni-data-picker :clear-icon="false" :map="{text:'name',value:'id'}"
|
|
||||||
placeholder="请选择商品分类" popup-title="请选择商品分类" :localdata="pageData.category"
|
|
||||||
v-model="FormData.categoryId">
|
|
||||||
</uni-data-picker>
|
|
||||||
</uni-forms-item>
|
|
||||||
<view class="zhezhao u-absolute position-all" @click="canEditGoodsCategory(true)"
|
|
||||||
v-if="option.type=='edit'&&disabledChangeCategory">
|
|
||||||
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="border-top-0">
|
</view>
|
||||||
<uni-forms-item label="单位" required showRequired name="units">
|
<view class="">
|
||||||
|
<uni-forms-item label="单位" required showRequired name="units">
|
||||||
<uni-data-picker :clear-icon="false" @change="unitIdChange"
|
|
||||||
:map="{text:'name',value:'id'}" placeholder="请选择单位" popup-title="请选择单位"
|
<uni-data-picker :clear-icon="false" @change="unitIdChange"
|
||||||
:localdata="pageData.units" v-model="FormData.unitId">
|
:map="{text:'name',value:'id'}" placeholder="请选择单位" popup-title="请选择单位"
|
||||||
</uni-data-picker>
|
:localdata="pageData.units" v-model="FormData.unitId">
|
||||||
</uni-forms-item>
|
</uni-data-picker>
|
||||||
</view>
|
</uni-forms-item>
|
||||||
</template>
|
</view>
|
||||||
<template v-if="FormData.type==='package'">
|
<template v-if="FormData.type==='package'">
|
||||||
<!-- <view class="block border-top-0">
|
<!-- <view class="block border-top-0">
|
||||||
<uni-forms-item label="选择规格" required name="categoryId">
|
<uni-forms-item label="选择规格" required name="categoryId">
|
||||||
|
|
@ -92,7 +90,8 @@
|
||||||
</uni-data-picker>
|
</uni-data-picker>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
</view> -->
|
</view> -->
|
||||||
<view class="border-top" >
|
|
||||||
|
<view class="border-top" v-if="FormData.proGroupVo">
|
||||||
<view class=""
|
<view class=""
|
||||||
v-if=" (FormData.groupType==1&&FormData.proGroupVo.length)||(FormData.groupType==0&&FormData.proGroupVo.length&&FormData.proGroupVo[0].goods.length) ">
|
v-if=" (FormData.groupType==1&&FormData.proGroupVo.length)||(FormData.groupType==0&&FormData.proGroupVo.length&&FormData.proGroupVo[0].goods.length) ">
|
||||||
<view class="border-bottom u-p-b-32"
|
<view class="border-bottom u-p-b-32"
|
||||||
|
|
@ -512,7 +511,7 @@
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-if="FormData.type=='weight'">
|
<template v-if="FormData.type=='weigh'">
|
||||||
<view class="block u-p-t-32 u-p-b-32">
|
<view class="block u-p-t-32 u-p-b-32">
|
||||||
<view class="font-bold">
|
<view class="font-bold">
|
||||||
<text class="color-red">*</text>
|
<text class="color-red">*</text>
|
||||||
|
|
@ -544,7 +543,7 @@
|
||||||
<view class="border-top-0">
|
<view class="border-top-0">
|
||||||
<view class="u-flex u-row-between u-p-b-24 u-p-t-20">
|
<view class="u-flex u-row-between u-p-b-24 u-p-t-20">
|
||||||
<view class="label-title">是否允许临时改价</view>
|
<view class="label-title">是否允许临时改价</view>
|
||||||
<my-switch disabled :openDisabledClass="false"
|
<my-switch
|
||||||
v-model="FormData.isTempPrice"></my-switch>
|
v-model="FormData.isTempPrice"></my-switch>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -1239,7 +1238,7 @@
|
||||||
singleOrderLimit:0,
|
singleOrderLimit:0,
|
||||||
singlePeopleLimit:0,
|
singlePeopleLimit:0,
|
||||||
type: 'normal',
|
type: 'normal',
|
||||||
showType: 'table',
|
showType: ['table'],
|
||||||
specsInfoName: '',
|
specsInfoName: '',
|
||||||
id: "",
|
id: "",
|
||||||
typeEnum: "normal",
|
typeEnum: "normal",
|
||||||
|
|
@ -1686,8 +1685,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (type == 'package') {
|
if (type == 'package') {
|
||||||
if (groupType == 0) {
|
if (groupType == 0&& FormData.proGroupVo[0].goods.length<=0) {
|
||||||
// 固定套餐
|
// 固定套餐
|
||||||
|
return infoBox.showToast('套餐组合至少需要包含一种商品,请添加商品')
|
||||||
}
|
}
|
||||||
if (groupType == 1) {
|
if (groupType == 1) {
|
||||||
let ispase = FormData.proGroupVo.length > 0 ? true : false
|
let ispase = FormData.proGroupVo.length > 0 ? true : false
|
||||||
|
|
@ -1711,7 +1711,7 @@
|
||||||
// 可选套餐
|
// 可选套餐
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (type == 'weight') {
|
if (type == 'weigh') {
|
||||||
if (!FormData.weight) {
|
if (!FormData.weight) {
|
||||||
return infoBox.showToast('请输入重量')
|
return infoBox.showToast('请输入重量')
|
||||||
}
|
}
|
||||||
|
|
@ -1937,6 +1937,9 @@
|
||||||
initDefaultProGroupVo()
|
initDefaultProGroupVo()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(FormData.groupType==null){
|
||||||
|
FormData.groupType=0
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (newval == 'package') {
|
if (newval == 'package') {
|
||||||
initDefaultProGroupVo()
|
initDefaultProGroupVo()
|
||||||
|
|
|
||||||
|
|
@ -638,7 +638,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pageId": "PAGES_ADD_TEMP_CUISINE",
|
"pageId": "PAGES_CHOOSE_ADD_TEMP_CUISINE",
|
||||||
"path": "add-temp-cuisine/add-temp-cuisine",
|
"path": "add-temp-cuisine/add-temp-cuisine",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "添加临时菜"
|
"navigationBarTitleText": "添加临时菜"
|
||||||
|
|
|
||||||
|
|
@ -125,9 +125,12 @@
|
||||||
reactive,
|
reactive,
|
||||||
onMounted,
|
onMounted,
|
||||||
ref,
|
ref,
|
||||||
onBeforeMount
|
onBeforeMount,
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
import {onLoad} from '@dcloudio/uni-app'
|
import {
|
||||||
|
onLoad,
|
||||||
|
onShow
|
||||||
|
} from '@dcloudio/uni-app'
|
||||||
const units = reactive({
|
const units = reactive({
|
||||||
list: [],
|
list: [],
|
||||||
current: ''
|
current: ''
|
||||||
|
|
@ -187,11 +190,12 @@
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
let timer=null
|
let timer = null
|
||||||
|
|
||||||
function submit() {
|
function submit() {
|
||||||
refform.value.validate(res => {
|
refform.value.validate(res => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
if(!res){
|
if (!res) {
|
||||||
$temporaryDishes({
|
$temporaryDishes({
|
||||||
"useType": option.useType,
|
"useType": option.useType,
|
||||||
"masterId": option.masterId,
|
"masterId": option.masterId,
|
||||||
|
|
@ -200,15 +204,15 @@
|
||||||
"categoryId": category[categoryCurrent.value].id,
|
"categoryId": category[categoryCurrent.value].id,
|
||||||
"price": form.price,
|
"price": form.price,
|
||||||
"num": form.num,
|
"num": form.num,
|
||||||
unit:units.list[units.current].id,
|
unit: units.list[units.current].id,
|
||||||
"note": form.note,
|
"note": form.note,
|
||||||
"vipUserId": option.vipUserId
|
"vipUserId": option.vipUserId
|
||||||
}).then(r=>{
|
}).then(r => {
|
||||||
uni.$emit('add:cashCai')
|
uni.$emit('add:cashCai')
|
||||||
clearInterval(timer)
|
clearInterval(timer)
|
||||||
timer=setTimeout(()=>{
|
timer = setTimeout(() => {
|
||||||
uni.navigateBack()
|
uni.navigateBack()
|
||||||
},500)
|
}, 500)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
|
|
@ -234,7 +238,7 @@
|
||||||
page: 0,
|
page: 0,
|
||||||
size: 600
|
size: 600
|
||||||
})
|
})
|
||||||
const arr = returnAllCategory(res.content).map(v => {
|
const arr = forList(res.content).map(v => {
|
||||||
return {
|
return {
|
||||||
...v,
|
...v,
|
||||||
value: v.id
|
value: v.id
|
||||||
|
|
@ -244,23 +248,39 @@
|
||||||
for (let i in arr) {
|
for (let i in arr) {
|
||||||
category[i] = arr[i]
|
category[i] = arr[i]
|
||||||
}
|
}
|
||||||
console.log(category);
|
}
|
||||||
|
|
||||||
|
function forList(arr) {
|
||||||
|
let arrs = []
|
||||||
|
arr.forEach(ele => {
|
||||||
|
arrs.push(ele)
|
||||||
|
if (ele.childrenList.length) {
|
||||||
|
ele.childrenList.forEach(res => {
|
||||||
|
arrs.push(res)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return arrs
|
||||||
}
|
}
|
||||||
async function init() {
|
async function init() {
|
||||||
getTbShopUnit()
|
getTbShopUnit()
|
||||||
getCategory()
|
getCategory()
|
||||||
}
|
}
|
||||||
onMounted(() => {
|
// onMounted(() => {
|
||||||
init()
|
// init()
|
||||||
|
// })
|
||||||
|
onLoad((opt) => {
|
||||||
|
Object.assign(option, opt)
|
||||||
|
setTimeout(() => {
|
||||||
|
init()
|
||||||
|
}, 600)
|
||||||
})
|
})
|
||||||
onBeforeMount(()=>{
|
|
||||||
|
onBeforeMount(() => {
|
||||||
clearInterval(timer)
|
clearInterval(timer)
|
||||||
})
|
})
|
||||||
const option=reactive({
|
const option = reactive({
|
||||||
|
|
||||||
})
|
|
||||||
onLoad((opt)=>{
|
|
||||||
Object.assign(option,opt)
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
<my-model ref="model" :title="title" iconColor="#000" @close="resetForm">
|
<my-model ref="model" :title="title" iconColor="#000" @close="resetForm">
|
||||||
<template #desc>
|
<template #desc>
|
||||||
<view class="u-m-t-48 tab">
|
<!-- <view class="u-m-t-48 tab">
|
||||||
<my-tabs :list="tabs" @change="tabsChange"></my-tabs>
|
<my-tabs :list="tabs" @change="tabsChange"></my-tabs>
|
||||||
</view>
|
</view> -->
|
||||||
<view class="u-text-left u-p-30 ">
|
<view class="u-text-left u-p-30 ">
|
||||||
<template v-if="!current">
|
<template v-if="!current">
|
||||||
<view>
|
<view>
|
||||||
|
|
@ -34,7 +34,6 @@
|
||||||
<view class="u-flex-1">
|
<view class="u-flex-1">
|
||||||
<input @input="discountMoneyInput" v-model="form.discountMoney" type="digit"
|
<input @input="discountMoneyInput" v-model="form.discountMoney" type="digit"
|
||||||
placeholder-class="placeholder-class" placeholder="减8.55元请输入8.55" />
|
placeholder-class="placeholder-class" placeholder="减8.55元请输入8.55" />
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<view class="color-999 u-p-l-48 u-p-r-48 u-flex u-row-center u-col-center">
|
<view class="color-999 u-p-l-48 u-p-r-48 u-flex u-row-center u-col-center">
|
||||||
<view>元</view>
|
<view>元</view>
|
||||||
|
|
@ -46,19 +45,22 @@
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<view class="u-m-t-48">
|
<view class="u-m-t-48">
|
||||||
<view class="u-font-24">
|
<view class="u-font-24">
|
||||||
<text class="color-999">打折原因</text>
|
<text class="color-999">当前单品价格:{{price}}</text>
|
||||||
<text class="color-red">*</text>
|
</view>
|
||||||
</view>
|
<view class="u-font-24">
|
||||||
|
<text class="color-999">打折原因</text>
|
||||||
|
<text class="color-red">*</text>
|
||||||
|
</view>
|
||||||
<view class="u-flex u-m-t-24">
|
<view class="u-flex u-m-t-24">
|
||||||
<view class="u-flex" v-for="(item,index) in causes" :key="index">
|
<view class="u-flex" v-for="(item,index) in causes" :key="index">
|
||||||
<button @tap="changeCauses(item)" class="tag u-m-r-20"
|
<button @tap="changeCauses(item,index)" class="tag u-m-r-20"
|
||||||
:class="{active:item.checked}">{{item.name}}</button>
|
:class="{active:item.checked}">{{item.name}}</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-m-t-32 u-flex ">
|
<view class="u-m-t-32 u-flex ">
|
||||||
<uni-easyinput type="textarea" v-model="value" placeholder="自定义内容"></uni-easyinput>
|
<uni-easyinput type="textarea" v-model="form.note" placeholder="自定义内容"></uni-easyinput>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -67,7 +69,10 @@
|
||||||
<view class="u-p-30">
|
<view class="u-p-30">
|
||||||
<view class="u-m-t-10">
|
<view class="u-m-t-10">
|
||||||
<my-button @tap="confirm" shape="circle" showShadow>确认</my-button>
|
<my-button @tap="confirm" shape="circle" showShadow>确认</my-button>
|
||||||
<my-button type="cancel" bgColor="#fff" @tap="confirm">取消</my-button>
|
<view style="height: 20rpx;">
|
||||||
|
|
||||||
|
</view>
|
||||||
|
<!-- <my-button type="cancel" bgColor="#fff" @tap="confirm">取消</my-button> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -86,7 +91,7 @@
|
||||||
import myTabs from '@/components/my-components/my-tabs.vue'
|
import myTabs from '@/components/my-components/my-tabs.vue'
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
price: {
|
price: {
|
||||||
type: [Number,String],
|
type: [Number, String],
|
||||||
default: 0
|
default: 0
|
||||||
},
|
},
|
||||||
title: {
|
title: {
|
||||||
|
|
@ -98,12 +103,10 @@
|
||||||
default: []
|
default: []
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function changeCauses(item) {
|
|
||||||
item.checked = !item.checked
|
|
||||||
}
|
|
||||||
|
|
||||||
const discounts = [95, 90, 85, 80]
|
const discounts = [95, 90, 85, 80]
|
||||||
const causes = reactive([{
|
const causes = reactive([{
|
||||||
|
|
@ -120,6 +123,11 @@
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
|
function changeCauses(item, index) {
|
||||||
|
item.checked = !item.checked
|
||||||
|
form.notes = causes
|
||||||
|
}
|
||||||
|
|
||||||
function discountInput(e) {
|
function discountInput(e) {
|
||||||
if (e.detail.value >= 100) {
|
if (e.detail.value >= 100) {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
|
|
@ -127,8 +135,9 @@
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function discountMoneyInput(e) {
|
function discountMoneyInput(e) {
|
||||||
const max=100
|
const max = 100
|
||||||
if (e.detail.value >= max) {
|
if (e.detail.value >= max) {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
form.discountMoney = 100
|
form.discountMoney = 100
|
||||||
|
|
@ -142,7 +151,7 @@
|
||||||
|
|
||||||
|
|
||||||
const tabs = ['打折', '减免']
|
const tabs = ['打折', '减免']
|
||||||
let current = ref(0)
|
let current = ref(1)
|
||||||
|
|
||||||
function tabsChange(i) {
|
function tabsChange(i) {
|
||||||
console.log(i);
|
console.log(i);
|
||||||
|
|
@ -158,11 +167,12 @@
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
...$form
|
...$form
|
||||||
})
|
})
|
||||||
watch(()=>props.price,(newval)=>{
|
watch(() => props.price, (newval) => {
|
||||||
console.log(newval);
|
console.log(newval);
|
||||||
form.price=newval
|
form.price = newval
|
||||||
form.currentPrice=newval
|
form.currentPrice = newval
|
||||||
})
|
})
|
||||||
|
|
||||||
function resetForm() {
|
function resetForm() {
|
||||||
Object.assign(form, {
|
Object.assign(form, {
|
||||||
...$form
|
...$form
|
||||||
|
|
@ -182,22 +192,23 @@
|
||||||
|
|
||||||
function confirm() {
|
function confirm() {
|
||||||
const {
|
const {
|
||||||
discount,discountMoney
|
discount,
|
||||||
|
discountMoney
|
||||||
} = form
|
} = form
|
||||||
if (current.value===0&& discount==='') {
|
if (current.value === 0 && discount === '') {
|
||||||
return uni.showToast({
|
return uni.showToast({
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
title: '请输入有效折扣!'
|
title: '请输入有效折扣!'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (current.value===1&& discountMoney==='') {
|
if (current.value === 1 && discountMoney === '') {
|
||||||
return uni.showToast({
|
return uni.showToast({
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
title: '请输入有效减免价格!'
|
title: '请输入有效减免价格!'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
close()
|
|
||||||
emits('confirm', form)
|
emits('confirm', form)
|
||||||
|
close()
|
||||||
}
|
}
|
||||||
defineExpose({
|
defineExpose({
|
||||||
open,
|
open,
|
||||||
|
|
|
||||||
|
|
@ -136,10 +136,15 @@
|
||||||
:key="index">
|
:key="index">
|
||||||
<view class="u-flex u-row-between ">
|
<view class="u-flex u-row-between ">
|
||||||
<view class="u-flex">
|
<view class="u-flex">
|
||||||
<image class="img" :src="item.coverImg" mode=""></image>
|
<image class="img" v-if="item.coverImg" :src="item.coverImg" mode=""></image>
|
||||||
|
<view
|
||||||
|
style="background-color: #3f9eff; width: 84rpx;height: 84rpx;line-height: 84rpx;text-align: center;color: #fff;"
|
||||||
|
v-else>
|
||||||
|
临时菜
|
||||||
|
</view>
|
||||||
<view class="u-m-l-32">
|
<view class="u-m-l-32">
|
||||||
<view class="u-flex">
|
<view class="u-flex">
|
||||||
<view class="u-flex u-m-r-20" v-if="item.isWait">
|
<view class="u-flex u-m-r-20" v-if="item.isWaitCall">
|
||||||
<uni-tag text="等叫"
|
<uni-tag text="等叫"
|
||||||
custom-style="background-color: #FFF0DF; border-color: #FFF0DF; color: #FF9F2E;">
|
custom-style="background-color: #FFF0DF; border-color: #FFF0DF; color: #FF9F2E;">
|
||||||
</uni-tag>
|
</uni-tag>
|
||||||
|
|
@ -154,6 +159,11 @@
|
||||||
custom-style="background-color: #E6F0FF; border-color: #E6F0FF; color: #318AFE;"
|
custom-style="background-color: #E6F0FF; border-color: #E6F0FF; color: #318AFE;"
|
||||||
size="small" text="打包" inverted type="success" />
|
size="small" text="打包" inverted type="success" />
|
||||||
</view>
|
</view>
|
||||||
|
<view class="u-m-r-20 u-flex" v-if="item.isPrint">
|
||||||
|
<uni-tag
|
||||||
|
custom-style="background-color: #E6F0FF; border-color: #E6F0FF; color: #318AFE;"
|
||||||
|
size="small" text="打印" inverted type="success" />
|
||||||
|
</view>
|
||||||
<view>
|
<view>
|
||||||
{{item.name}}
|
{{item.name}}
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -174,7 +184,8 @@
|
||||||
<text
|
<text
|
||||||
class="line-th color-999">¥{{formatPrice(item.salePrice*item.number) }}</text>
|
class="line-th color-999">¥{{formatPrice(item.salePrice*item.number) }}</text>
|
||||||
<view class="u-absolute" style="right: 0;bottom: 100%;">
|
<view class="u-absolute" style="right: 0;bottom: 100%;">
|
||||||
<text class="font-bold">¥{{formatPrice(item.memberPrice*item.number) }}</text>
|
<text
|
||||||
|
class="font-bold">¥{{formatPrice(item.memberPrice*item.number) }}</text>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
|
|
@ -196,9 +207,10 @@
|
||||||
</template>
|
</template>
|
||||||
<scroll-view class="u-m-t-32" scroll-x="true" v-if="index==goods.sel">
|
<scroll-view class="u-m-t-32" scroll-x="true" v-if="index==goods.sel">
|
||||||
<view class=" u-flex no-wrap ">
|
<view class=" u-flex no-wrap ">
|
||||||
<!-- <view class="u-flex u-m-r-20 u-m-b-20">
|
<view class="u-flex u-m-r-20 " v-if="!item.isGift">
|
||||||
<button class="tag" hover-class="hover-class" @tap="showModel('discount')">单品打折</button>
|
<button class="tag" hover-class="hover-class"
|
||||||
</view> -->
|
@tap="showModel('discount',index)">单品打折</button>
|
||||||
|
</view>
|
||||||
<view class="u-flex u-m-r-20 ">
|
<view class="u-flex u-m-r-20 ">
|
||||||
<!-- <button class="tag" hover-class="hover-class" @tap="showModel('giveFood')">赠菜</button> -->
|
<!-- <button class="tag" hover-class="hover-class" @tap="showModel('giveFood')">赠菜</button> -->
|
||||||
<button class="tag" hover-class="hover-class"
|
<button class="tag" hover-class="hover-class"
|
||||||
|
|
@ -208,10 +220,14 @@
|
||||||
<button class="tag" hover-class="hover-class"
|
<button class="tag" hover-class="hover-class"
|
||||||
@tap="toggleGoodsItemKey(item,index,'isPack')">{{item.isPack?'取消打包':'打包'}}</button>
|
@tap="toggleGoodsItemKey(item,index,'isPack')">{{item.isPack?'取消打包':'打包'}}</button>
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class="u-flex u-m-r-20 u-m-b-20">
|
<view class="u-flex u-m-r-20 ">
|
||||||
<button class="tag" hover-class="hover-class"
|
<button class="tag" hover-class="hover-class"
|
||||||
@tap="toggleWait(item)">{{item.isWait?'取消等叫':'等叫'}}</button>
|
@tap="toggleWait(item)">{{item.isWaitCall?'取消等叫':'等叫'}}</button>
|
||||||
</view> -->
|
</view>
|
||||||
|
<view class="u-flex u-m-r-20 ">
|
||||||
|
<button class="tag" hover-class="hover-class"
|
||||||
|
@tap="toggisPrint(item)">{{item.isPrint?'免厨打':'打印'}}</button>
|
||||||
|
</view>
|
||||||
<view class="u-flex u-m-r-20 ">
|
<view class="u-flex u-m-r-20 ">
|
||||||
<button class="tag" hover-class="hover-class"
|
<button class="tag" hover-class="hover-class"
|
||||||
@tap="showModel('remark',index)">单品备注</button>
|
@tap="showModel('remark',index)">单品备注</button>
|
||||||
|
|
@ -251,7 +267,7 @@
|
||||||
<view class="font-bold u-font-32">¥{{formatPrice(youhui) }}</view>
|
<view class="font-bold u-font-32">¥{{formatPrice(youhui) }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="u-flex price u-m-l-32">
|
<view class="u-flex price u-m-l-32">
|
||||||
<view class="">实收金额</view>
|
<view class="">实收金额</view>
|
||||||
<view class="font-bold u-font-32">¥{{formatPrice(allPrice) }}</view>
|
<view class="font-bold u-font-32">¥{{formatPrice(allPrice) }}</view>
|
||||||
|
|
@ -278,8 +294,8 @@
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
<model-discount title="菜品减免" :ref="setModel" name="discount" :price="modelData.data.salePrice"
|
||||||
<model-discount title="菜品打折/减免" :ref="setModel" name="discount" :price="allPrice"></model-discount>
|
@confirm="discountconfirm"></model-discount>
|
||||||
<give-food title="赠菜" :ref="setModel" name="giveFood"></give-food>
|
<give-food title="赠菜" :ref="setModel" name="giveFood"></give-food>
|
||||||
<one-remark @confirm="goodsOneRemarkConfirm" title="单品备注" :ref="setModel" name="remark"></one-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>
|
||||||
|
|
@ -351,7 +367,26 @@
|
||||||
return Number(n).toFixed(2)
|
return Number(n).toFixed(2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 单品打折
|
||||||
|
async function discountconfirm(form) {
|
||||||
|
if (form.discountMoney != '.') {
|
||||||
|
let str = ''
|
||||||
|
if (form.notes) {
|
||||||
|
form.notes.forEach(ele => {
|
||||||
|
if (ele.checked) {
|
||||||
|
str = str + ele.name + ','
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
let obj = {
|
||||||
|
saleAmount: form.discountMoney,
|
||||||
|
note: str + form.note,
|
||||||
|
cartId: modelData.data.id
|
||||||
|
}
|
||||||
|
const res = await Api.$updatePrice(obj)
|
||||||
|
getCart()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//用餐人数
|
//用餐人数
|
||||||
const userNumbers = reactive({
|
const userNumbers = reactive({
|
||||||
|
|
@ -416,18 +451,46 @@
|
||||||
skuId
|
skuId
|
||||||
}
|
}
|
||||||
par[key] = !item[key]
|
par[key] = !item[key]
|
||||||
|
|
||||||
|
|
||||||
const res = await Api.$updateCart(par)
|
const res = await Api.$updateCart(par)
|
||||||
goods.list[index][key] = returnBoolean(res[key])
|
goods.list[index][key] = returnBoolean(res[key])
|
||||||
if (key == 'isPack') {
|
getCart()
|
||||||
getCart()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//等叫
|
//等叫
|
||||||
function toggleWait(item) {
|
async function toggleWait(item) {
|
||||||
item.isWait = !item.isWait
|
item.isWaitCall = !item.isWaitCall
|
||||||
|
let obj = {
|
||||||
|
cartId: item.id,
|
||||||
|
isGift: item.isGift,
|
||||||
|
isPack: item.isPack,
|
||||||
|
isPrint: item.isPrint,
|
||||||
|
isWaitCall: item.isWaitCall,
|
||||||
|
masterId: option.masterId,
|
||||||
|
num: item.number, // 0会删除此商品
|
||||||
|
productId: item.productId,
|
||||||
|
skuId: item.skuId,
|
||||||
|
vipUserId: '',
|
||||||
|
}
|
||||||
|
let res = await Api.$updateCart(obj)
|
||||||
|
}
|
||||||
|
// 打印
|
||||||
|
async function toggisPrint(item) {
|
||||||
|
item.isPrint = !item.isPrint
|
||||||
|
let obj = {
|
||||||
|
cartId: item.id,
|
||||||
|
isGift: item.isGift,
|
||||||
|
isPack: item.isPack,
|
||||||
|
isPrint: item.isPrint,
|
||||||
|
isWaitCall: item.isWaitCall,
|
||||||
|
masterId: option.masterId,
|
||||||
|
num: item.number, // 0会删除此商品
|
||||||
|
productId: item.productId,
|
||||||
|
skuId: item.skuId,
|
||||||
|
vipUserId: '',
|
||||||
|
}
|
||||||
|
let res = await Api.$updateCart(obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const eatTypes = reactive({
|
const eatTypes = reactive({
|
||||||
list: [{
|
list: [{
|
||||||
|
|
@ -479,7 +542,6 @@
|
||||||
function watchChooseuser() {
|
function watchChooseuser() {
|
||||||
uni.$off('choose-user')
|
uni.$off('choose-user')
|
||||||
uni.$on('choose-user', (data) => {
|
uni.$on('choose-user', (data) => {
|
||||||
console.log(data);
|
|
||||||
user.value = data
|
user.value = data
|
||||||
setUser()
|
setUser()
|
||||||
})
|
})
|
||||||
|
|
@ -520,20 +582,25 @@
|
||||||
totalNumber: 0,
|
totalNumber: 0,
|
||||||
totalAmount: 0,
|
totalAmount: 0,
|
||||||
})
|
})
|
||||||
const isVip=computed(()=>{
|
const isVip = computed(() => {
|
||||||
return $shop.value.isMemberPrice&& user.value&&user.value.id&&user.value.isVip
|
return $shop.value.isMemberPrice && user.value && user.value.id && user.value.isVip
|
||||||
|
})
|
||||||
|
const discountSaleAmount = computed(() => {
|
||||||
|
return goods.list.filter((v) => v.discountSaleAmount && v.discountSaleAmount > 0)
|
||||||
|
.reduce((a, b) => {
|
||||||
|
return a + b.number * b.discountSaleAmount;
|
||||||
|
}, 0);
|
||||||
})
|
})
|
||||||
const goodsPrice = computed(() => {
|
const goodsPrice = computed(() => {
|
||||||
const goodsTotalPrice = goods.list.reduce((prve, cur) => {
|
const goodsTotalPrice = goods.list.reduce((prve, cur) => {
|
||||||
const memberPrice=cur.memberPrice?cur.memberPrice:cur.salePrice
|
const memberPrice = cur.memberPrice ? cur.memberPrice : cur.salePrice
|
||||||
const tPrice = (isVip.value? memberPrice:cur.salePrice) * cur.number
|
const tPrice = (isVip.value ? memberPrice : cur.salePrice) * cur.number
|
||||||
const tpackFee = cur.isPack ? cur.packFee * 1 : 0
|
const tpackFee = cur.isPack ? cur.packFee * 1 : 0
|
||||||
return prve + (cur.isGift ? 0 : tPrice) + tpackFee
|
return prve + (cur.isGift ? 0 : tPrice) + tpackFee
|
||||||
}, 0)
|
}, 0)
|
||||||
return (goodsTotalPrice || 0).toFixed(2)
|
return ((goodsTotalPrice - discountSaleAmount.value) || 0).toFixed(2)
|
||||||
})
|
})
|
||||||
const allPrice = computed(() => {
|
const allPrice = computed(() => {
|
||||||
console.log(goodsPrice.value);
|
|
||||||
const n = goodsPrice.value * 1 + $seatFee.totalAmount
|
const n = goodsPrice.value * 1 + $seatFee.totalAmount
|
||||||
return n.toFixed(2)
|
return n.toFixed(2)
|
||||||
// const goodsTotalPrice = goods.list.reduce((prve, cur) => {
|
// const goodsTotalPrice = goods.list.reduce((prve, cur) => {
|
||||||
|
|
@ -541,18 +608,21 @@
|
||||||
// }, 0)
|
// }, 0)
|
||||||
// return (goodsTotalPrice + ($seatFee.totalAmount || 0)).toFixed(2)
|
// return (goodsTotalPrice + ($seatFee.totalAmount || 0)).toFixed(2)
|
||||||
})
|
})
|
||||||
const youhui=computed(()=>{
|
const youhui = computed(() => {
|
||||||
if(user.value&&user.value.id&&user.value.isVip){
|
let goodsTotalPrice = 0
|
||||||
const goodsTotalPrice = goods.list.reduce((prve, cur) => {
|
if (user.value && user.value.id && user.value.isVip) {
|
||||||
|
goodsTotalPrice = goods.list.reduce((prve, cur) => {
|
||||||
const tPrice = cur.salePrice * cur.number
|
const tPrice = cur.salePrice * cur.number
|
||||||
const tpackFee = cur.isPack ? cur.packFee * 1 : 0
|
const tpackFee = cur.isPack ? cur.packFee * 1 : 0
|
||||||
return prve + tPrice + tpackFee
|
return prve + tPrice + tpackFee
|
||||||
}, 0)
|
}, 0)
|
||||||
return goodsTotalPrice-allPrice.value
|
return goodsTotalPrice - allPrice.value
|
||||||
}else{
|
} else {
|
||||||
return 0
|
console.log(discountSaleAmount.value,'优惠金额')
|
||||||
|
return (discountSaleAmount.value)
|
||||||
}
|
}
|
||||||
return goodsTotalPrice
|
console.log(discountSaleAmount.value,'优惠金额1')
|
||||||
|
return (goodsTotalPrice + discountSaleAmount.value * 1).toFixed(2)
|
||||||
})
|
})
|
||||||
|
|
||||||
function setGoodsItem(key, val) {
|
function setGoodsItem(key, val) {
|
||||||
|
|
@ -573,16 +643,16 @@
|
||||||
records,
|
records,
|
||||||
seatFee
|
seatFee
|
||||||
} = await Api.getCart(par)
|
} = await Api.getCart(par)
|
||||||
let useType=''
|
let useType = ''
|
||||||
if (seatFee && seatFee.useType) {
|
if (seatFee && seatFee.useType) {
|
||||||
useType=seatFee.useType
|
useType = seatFee.useType
|
||||||
$storageManage.useType(useType)
|
$storageManage.useType(useType)
|
||||||
}else{
|
} else {
|
||||||
useType=records[0].info[0].useType
|
useType = records[0].info[0].useType
|
||||||
$storageManage.useType(useType)
|
$storageManage.useType(useType)
|
||||||
}
|
}
|
||||||
console.log(useType);
|
console.log(useType);
|
||||||
eatTypes.active =useType == 'takeout' ? useType : useType.replace(
|
eatTypes.active = useType == 'takeout' ? useType : useType.replace(
|
||||||
/-after|-before/g, '');
|
/-after|-before/g, '');
|
||||||
goods.list = getNowCart(records)
|
goods.list = getNowCart(records)
|
||||||
if (seatFee && seatFee.totalNumber) {
|
if (seatFee && seatFee.totalNumber) {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
<view class="u-absolute goods bg-fff">
|
<view class="u-absolute goods bg-fff">
|
||||||
<view
|
<view
|
||||||
class="u-p-t-32 color-666 border-bottom bg-fff u-absolute total u-p-r-28 u-p-b-32 u-p-l-28 u-flex u-row-between">
|
class="u-p-t-32 color-666 border-bottom bg-fff u-absolute total u-p-r-28 u-p-b-32 u-p-l-28 u-flex u-row-between">
|
||||||
<view>已添加{{goodsNumber}}件商品</view>
|
<view>已添加{{goodsNumber.toFixed(0)}}件商品</view>
|
||||||
<view class="color-666">
|
<view class="color-666">
|
||||||
<uni-icons color="#666" type="trash"></uni-icons>
|
<uni-icons color="#666" type="trash"></uni-icons>
|
||||||
<text class="u-m-l-10" @tap="setModalShow('clear',true)">清空</text>
|
<text class="u-m-l-10" @tap="setModalShow('clear',true)">清空</text>
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,11 @@
|
||||||
|
|
||||||
<up-image :src="data.coverImg" mode="aspectFill" :width="img.width" :height="img.height"></up-image>
|
<up-image :src="data.coverImg" mode="aspectFill" :width="img.width" :height="img.height"></up-image>
|
||||||
<!-- <image lazy-load class="img" :src="data.coverImg" mode="aspectFill" :style="computedImgStyle()"></image> -->
|
<!-- <image lazy-load class="img" :src="data.coverImg" mode="aspectFill" :style="computedImgStyle()"></image> -->
|
||||||
<view class="info u-flex u-row-between u-col-top u-flex-col" @tap="emitEvent('add')">
|
<view class="info u-flex u-row-between u-col-top u-flex-col" >
|
||||||
<view>
|
<view>
|
||||||
<view>
|
<view>
|
||||||
<text class="u-line-2">{{data.name}}</text>
|
<text class="u-line-2">{{data.name}}
|
||||||
|
</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-font-32 font-bold u-m-t-16">
|
<view class="u-font-32 font-bold u-m-t-16">
|
||||||
¥{{data.price}}
|
¥{{data.price}}
|
||||||
|
|
@ -14,7 +15,7 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="u-flex">
|
<view class="u-flex">
|
||||||
<template v-if="!isSellout">
|
<template v-if="!isSellout">
|
||||||
<template v-if="!data.isDan">
|
<template v-if="!data.isDan||data.groupType==1">
|
||||||
<button class="btn" hover-class="btn-hover-class" @tap="emitEvent('chooseGuige')">选规格</button>
|
<button class="btn" hover-class="btn-hover-class" @tap="emitEvent('chooseGuige')">选规格</button>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,174 @@
|
||||||
|
<template>
|
||||||
|
<my-model ref="model" borderRadius="12" :title="datas.title">
|
||||||
|
<template #desc>
|
||||||
|
<scroll-view scroll-y="true" style="height: 50vh;" class="u-p-30 guigeModel">
|
||||||
|
<view class="u-m-b-40" v-for="(item,index) in datas.skus" :key="index">
|
||||||
|
<view class="u-text-left">
|
||||||
|
<view class="color-333">{{item.title}} <text
|
||||||
|
style="color:#999">({{item.count}}选{{item.number}})</text> </view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex u-m-t-20 u-flex-wrap">
|
||||||
|
<view class="item" @tap="chooseSkd(skd,item.number)" :class="{active:skd.select==true}"
|
||||||
|
v-for="(skd,skdIndex) in item.goods" :key="skdIndex">
|
||||||
|
{{skd.proName}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
</template>
|
||||||
|
<template #btn>
|
||||||
|
<view class="u-p-30 border-top ">
|
||||||
|
<view class="u-flex u-p-b-30 u-row-between">
|
||||||
|
<view class="price">
|
||||||
|
<text>¥</text>
|
||||||
|
<text>{{datas.price}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-10">
|
||||||
|
<my-button @tap="confirm">添加</my-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</my-model>
|
||||||
|
<uni-popup ref="popup" type="message">
|
||||||
|
<uni-popup-message type="info" message="请选择套餐" :duration="2000"></uni-popup-message>
|
||||||
|
</uni-popup>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
computed,
|
||||||
|
getCurrentInstance,
|
||||||
|
reactive,
|
||||||
|
ref,
|
||||||
|
watch
|
||||||
|
} from 'vue';
|
||||||
|
import util from '../util.js';
|
||||||
|
import infobox from '@/commons/utils/infoBox.js'
|
||||||
|
import myModel from '@/components/my-components/my-model.vue'
|
||||||
|
import myButton from '@/components/my-components/my-button.vue'
|
||||||
|
import {
|
||||||
|
onShow,
|
||||||
|
} from '@dcloudio/uni-app';
|
||||||
|
const props = defineProps({
|
||||||
|
goodsData: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
let datas = reactive({
|
||||||
|
item: "",
|
||||||
|
title: "",
|
||||||
|
price: "",
|
||||||
|
skus: [],
|
||||||
|
selectData: [],
|
||||||
|
// 几选几,的和
|
||||||
|
selectNumber: 0,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// const selSku = computed(() => {
|
||||||
|
// return props.skus.reduce((prve, cur) => {
|
||||||
|
// prve.push(cur.sel)
|
||||||
|
// return prve
|
||||||
|
// }, []).join()
|
||||||
|
// })
|
||||||
|
|
||||||
|
|
||||||
|
// const goods = computed(() => {
|
||||||
|
// return props.skuMap[selSku.value]
|
||||||
|
// })
|
||||||
|
watch(() => props.goodsData, (newval) => {
|
||||||
|
datas.item = newval
|
||||||
|
datas.title = newval.name
|
||||||
|
datas.price = newval.price
|
||||||
|
datas.skus = newval.proGroupVo
|
||||||
|
datas.skus.forEach(ele => {
|
||||||
|
datas.selectNumber += ele.number
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
const emits = defineEmits(['confirm', 'updateSku'])
|
||||||
|
let number = ref(1)
|
||||||
|
|
||||||
|
function chooseSkd(skd, number) {
|
||||||
|
if (datas.selectData.includes(skd.proId)) {
|
||||||
|
skd.select = false
|
||||||
|
let indexs = datas.selectData.indexOf(skd.proId)
|
||||||
|
datas.selectData.splice(indexs, 1)
|
||||||
|
} else {
|
||||||
|
if (datas.selectData.length < number) {
|
||||||
|
skd.select = true
|
||||||
|
datas.selectData.push(skd.proId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const model = ref(null)
|
||||||
|
|
||||||
|
function open() {
|
||||||
|
model.value.open()
|
||||||
|
}
|
||||||
|
|
||||||
|
function close() {
|
||||||
|
model.value.close()
|
||||||
|
}
|
||||||
|
const instance = getCurrentInstance();
|
||||||
|
|
||||||
|
function confirm() {
|
||||||
|
console.log(datas.selectData.length)
|
||||||
|
console.log(datas.selectNumber,'调试1111')
|
||||||
|
if (datas.selectData.length == datas.selectNumber) {
|
||||||
|
emits('confirm', datas.selectData,datas.item)
|
||||||
|
close()
|
||||||
|
} else {
|
||||||
|
instance.ctx.$refs.popup.open()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
defineExpose({
|
||||||
|
open,
|
||||||
|
close
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.border-top {}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
width: 40rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.guigeModel {
|
||||||
|
.item {
|
||||||
|
color: #666;
|
||||||
|
font-size: 24rpx;
|
||||||
|
padding: 4rpx 28rpx;
|
||||||
|
border: 1px solid #E5E5E5;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
margin-right: 20rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
transition: all .2s ease-in-out;
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
border-color: $my-main-color;
|
||||||
|
color: $my-main-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.disabled {
|
||||||
|
color: #ccc;
|
||||||
|
border-color: #eee;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.price {
|
||||||
|
color: #EB4F4F;
|
||||||
|
}
|
||||||
|
|
||||||
|
.border-top {
|
||||||
|
border-top: 1px solid #E5E5E5;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -105,7 +105,6 @@
|
||||||
@add="searchGoodsUpdate(goodsItem,goodsIndex,true)"
|
@add="searchGoodsUpdate(goodsItem,goodsIndex,true)"
|
||||||
@reduce="searchGoodsUpdate(goodsItem,goodsIndex,false)"
|
@reduce="searchGoodsUpdate(goodsItem,goodsIndex,false)"
|
||||||
:index="goodsItem.goodsIndex" :data="goodsItem"></list-goods-item>
|
:index="goodsItem.goodsIndex" :data="goodsItem"></list-goods-item>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<my-img-empty v-if="!searchResult.length" tips="未搜索到相关商品"></my-img-empty>
|
<my-img-empty v-if="!searchResult.length" tips="未搜索到相关商品"></my-img-empty>
|
||||||
|
|
@ -120,7 +119,8 @@
|
||||||
<my-car :isCreateOrderToDetail="isCreateOrderToDetail" @updateNumber="carsNumberChange" :user="data.vipUser"
|
<my-car :isCreateOrderToDetail="isCreateOrderToDetail" @updateNumber="carsNumberChange" :user="data.vipUser"
|
||||||
:masterId="data.masterId" :table="data.table" :data="cars" @clear="onClearCart"></my-car>
|
:masterId="data.masterId" :table="data.table" :data="cars" @clear="onClearCart"></my-car>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- 套餐选择规格 -->
|
||||||
|
<taocanModel ref="taocanModelRef" @confirm="taocanConfirm" :goodsData="selGoods"></taocanModel>
|
||||||
<!-- 选择规格 -->
|
<!-- 选择规格 -->
|
||||||
<guige-model @update-sku="updateSkuSel" @confirm="guigeConfirm" ref="chooseGuigeModel" :goodsData="selGoods"
|
<guige-model @update-sku="updateSkuSel" @confirm="guigeConfirm" ref="chooseGuigeModel" :goodsData="selGoods"
|
||||||
:title="guigeModelData.title" :sku-map="guigeModelData.chooseGoods.skuMap"
|
:title="guigeModelData.title" :sku-map="guigeModelData.chooseGoods.skuMap"
|
||||||
|
|
@ -150,6 +150,7 @@
|
||||||
import util from './util.js';
|
import util from './util.js';
|
||||||
import color from '@/commons/color.js';
|
import color from '@/commons/color.js';
|
||||||
import guigeModel from './components/guige'
|
import guigeModel from './components/guige'
|
||||||
|
import taocanModel from './components/taocanModel.vue'
|
||||||
import listGoodsItem from './components/list-goods-item.vue'
|
import listGoodsItem from './components/list-goods-item.vue'
|
||||||
import mySurcharge from './components/surcharge'
|
import mySurcharge from './components/surcharge'
|
||||||
import {
|
import {
|
||||||
|
|
@ -277,6 +278,26 @@
|
||||||
}
|
}
|
||||||
return obj
|
return obj
|
||||||
}
|
}
|
||||||
|
// 添加套餐
|
||||||
|
async function taocanConfirm(d, item) {
|
||||||
|
const cartGoods = await addCart({
|
||||||
|
num: 1,
|
||||||
|
groupProductIdList: d,
|
||||||
|
productId: item.id,
|
||||||
|
skuId: item.specList[0].id
|
||||||
|
})
|
||||||
|
infoBox.showToast('添加成功')
|
||||||
|
// guigeConfirm(item, 1)
|
||||||
|
// updateCartGoods({
|
||||||
|
// productId: item.id,
|
||||||
|
// skuId: item.specList[0].id,
|
||||||
|
// cartId: cartGoods.id
|
||||||
|
// })
|
||||||
|
cars.push({
|
||||||
|
...cartGoods,
|
||||||
|
specSnap: item.specSnap
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function scanCode() {
|
function scanCode() {
|
||||||
// 只允许通过相机扫码
|
// 只允许通过相机扫码
|
||||||
|
|
@ -671,11 +692,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function toLinshi() {
|
function toLinshi() {
|
||||||
go.to('PAGES_ADD_TEMP_CUISINE',{
|
go.to('PAGES_CHOOSE_ADD_TEMP_CUISINE', {
|
||||||
masterId:data.masterId,
|
masterId: data.masterId,
|
||||||
tableId:data.table.tableId,
|
tableId: data.table.tableId,
|
||||||
vipUserId:option.vipUserId?option.vipUserId:'',
|
vipUserId: option.vipUserId ? option.vipUserId : '',
|
||||||
useType:uni.getStorageSync('useType')
|
useType: uni.getStorageSync('useType')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -833,7 +854,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let selGoods = ref({})
|
let selGoods = ref({});
|
||||||
|
|
||||||
function chooseGuige(foodsindex, index) {
|
function chooseGuige(foodsindex, index) {
|
||||||
if (!canAddGoods()) {
|
if (!canAddGoods()) {
|
||||||
|
|
@ -843,13 +864,19 @@
|
||||||
}
|
}
|
||||||
const $goods = data.tabbar[index].foods[foodsindex]
|
const $goods = data.tabbar[index].foods[foodsindex]
|
||||||
selGoods.value = $goods
|
selGoods.value = $goods
|
||||||
guigeModelData.title = $goods.name
|
if ($goods.groupType == 1) {
|
||||||
const specList = $goods.specList;
|
instance.ctx.$refs.taocanModelRef.open()
|
||||||
const tagSnap = JSON.parse($goods.skuResult.tagSnap)
|
} else {
|
||||||
const skuMap = returnSelGoodsSkuMap(specList)
|
guigeModelData.title = $goods.name
|
||||||
const skuList = returnSelGoodsSkuList(tagSnap)
|
const specList = $goods.specList;
|
||||||
setSkugoodsDefaultInit($goods, skuList, skuMap, specList)
|
const skuMap = returnSelGoodsSkuMap(specList)
|
||||||
chooseGuigeModel.value.open()
|
// 多规格,和套餐规格区分.groupType=1 套餐多规格
|
||||||
|
let tagSnap = JSON.parse($goods.skuResult.tagSnap)
|
||||||
|
const skuList = returnSelGoodsSkuList(tagSnap)
|
||||||
|
setSkugoodsDefaultInit($goods, skuList, skuMap, specList)
|
||||||
|
chooseGuigeModel.value.open()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function guigeConfirm(sku, num) {
|
async function guigeConfirm(sku, num) {
|
||||||
|
|
@ -902,13 +929,15 @@
|
||||||
categoryId,
|
categoryId,
|
||||||
skuId
|
skuId
|
||||||
} = goods
|
} = goods
|
||||||
|
|
||||||
const cartId = goods.id
|
const cartId = goods.id
|
||||||
const tabbarIndex = data.tabbar.findIndex(v => v.id == categoryId)
|
const tabbarIndex = data.tabbar.findIndex(v => v.id == categoryId)
|
||||||
//临时菜没有对应商品数据
|
//临时菜没有对应商品数据
|
||||||
const $goods =!productId?undefined:data.tabbar[tabbarIndex].foods.find(v => v.id == productId)
|
const $goods = !productId ? undefined : data.tabbar[tabbarIndex].foods.find(v => v.id == productId)
|
||||||
//临时菜没有skuList
|
//临时菜没有skuList
|
||||||
const $sku =!productId?{suit:1}:$goods.specList.find(v => v.id == skuId)
|
const $sku = !productId ? {
|
||||||
|
suit: 1
|
||||||
|
} : $goods.specList.find(v => v.id == skuId)
|
||||||
|
|
||||||
if (num === 0 || num < $sku.suit) {
|
if (num === 0 || num < $sku.suit) {
|
||||||
//移除
|
//移除
|
||||||
|
|
@ -1000,16 +1029,19 @@
|
||||||
$goods.chooseNumber = number
|
$goods.chooseNumber = number
|
||||||
setSearchGoods(searchGoodsIndex, number)
|
setSearchGoods(searchGoodsIndex, number)
|
||||||
} else {
|
} else {
|
||||||
//增加
|
// 套餐和单规格
|
||||||
const num = suit
|
if ($goods.groupType != 1) {
|
||||||
const cartGoods = await addCart({
|
//增加
|
||||||
num,
|
const num = suit
|
||||||
productId,
|
const cartGoods = await addCart({
|
||||||
skuId
|
num,
|
||||||
})
|
productId,
|
||||||
infoBox.showToast('添加成功')
|
skuId
|
||||||
$goods.chooseNumber = num
|
})
|
||||||
cars.push(cartGoods)
|
infoBox.showToast('添加成功')
|
||||||
|
$goods.chooseNumber = num
|
||||||
|
cars.push(cartGoods)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -1188,7 +1220,7 @@
|
||||||
setTabBar($category, $originGoods, cars)
|
setTabBar($category, $originGoods, cars)
|
||||||
}
|
}
|
||||||
onBeforeUnmount(() => {})
|
onBeforeUnmount(() => {})
|
||||||
|
|
||||||
function watchUpdate() {
|
function watchUpdate() {
|
||||||
uni.$off('update:createOrderIndex')
|
uni.$off('update:createOrderIndex')
|
||||||
uni.$off('get:table')
|
uni.$off('get:table')
|
||||||
|
|
@ -1201,7 +1233,7 @@
|
||||||
console.log('update:createOrderIndex');
|
console.log('update:createOrderIndex');
|
||||||
init()
|
init()
|
||||||
})
|
})
|
||||||
uni.$on('add:cashCai', async() => {
|
uni.$on('add:cashCai', async () => {
|
||||||
console.log('add:cashCai');
|
console.log('add:cashCai');
|
||||||
const cartRes = await getCart()
|
const cartRes = await getCart()
|
||||||
cars.length = 0
|
cars.length = 0
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue