代客下单更新部分页面跳转请求。页面展示
This commit is contained in:
@@ -25,7 +25,8 @@
|
|||||||
<view class="u-flex color-666">
|
<view class="u-flex color-666">
|
||||||
<radio-group @change="radioGroupChange">
|
<radio-group @change="radioGroupChange">
|
||||||
<label class="radio u-m-r-60" v-for="(item,index) in eatTypes.list" :key="index">
|
<label class="radio u-m-r-60" v-for="(item,index) in eatTypes.list" :key="index">
|
||||||
<radio :value="''+index" :checked="index === eatTypes.active" class="scale7 " />
|
<radio :value="''+item.value" :checked="item.value == eatTypes.active"
|
||||||
|
class="scale7 " />
|
||||||
<text>{{item.label}}</text>
|
<text>{{item.label}}</text>
|
||||||
</label>
|
</label>
|
||||||
</radio-group>
|
</radio-group>
|
||||||
@@ -176,10 +177,10 @@
|
|||||||
|
|
||||||
<view class="u-flex u-row-between u-m-t-30 u-p-b-34 border-bottom">
|
<view class="u-flex u-row-between u-m-t-30 u-p-b-34 border-bottom">
|
||||||
<view>
|
<view>
|
||||||
<text v-if="eatTypes.active==1">包装费</text>
|
<text v-if="eatTypes.active==2">包装费</text>
|
||||||
<text v-else>桌位费</text>
|
<text v-else>桌位费</text>
|
||||||
</view>
|
</view>
|
||||||
<view>¥0.00</view>
|
<view>¥{{$seatFee.totalAmount||'0.00'}}</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="u-flex u-row-right u-m-t-38">
|
<view class="u-flex u-row-right u-m-t-38">
|
||||||
@@ -218,13 +219,15 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {
|
import {
|
||||||
onLoad,onShow
|
onLoad,
|
||||||
|
onShow
|
||||||
} from '@dcloudio/uni-app'
|
} from '@dcloudio/uni-app'
|
||||||
import {
|
import {
|
||||||
ref,
|
ref,
|
||||||
onBeforeUnmount,
|
onBeforeUnmount,
|
||||||
reactive,
|
reactive,
|
||||||
computed
|
computed,
|
||||||
|
watch
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
import myButton from '@/components/my-components/my-button'
|
import myButton from '@/components/my-components/my-button'
|
||||||
import modelDiscount from './components/discount'
|
import modelDiscount from './components/discount'
|
||||||
@@ -237,9 +240,11 @@
|
|||||||
} from '@/commons/utils/format.js';
|
} from '@/commons/utils/format.js';
|
||||||
import color from '@/commons/color.js';
|
import color from '@/commons/color.js';
|
||||||
import * as Api from '@/http/yskApi/Instead.js'
|
import * as Api from '@/http/yskApi/Instead.js'
|
||||||
|
import {getNowCart} from '@/pagesCreateOrder/util.js'
|
||||||
const models = new Map();
|
const models = new Map();
|
||||||
//备注
|
//备注
|
||||||
let note=ref('')
|
let note = ref('')
|
||||||
|
|
||||||
function setModel(el) {
|
function setModel(el) {
|
||||||
if (el && el.$attrs['name']) {
|
if (el && el.$attrs['name']) {
|
||||||
models.set(el.$attrs['name'], el);
|
models.set(el.$attrs['name'], el);
|
||||||
@@ -264,6 +269,18 @@
|
|||||||
}),
|
}),
|
||||||
defaultCateIndex: 1,
|
defaultCateIndex: 1,
|
||||||
})
|
})
|
||||||
|
watch(() => userNumbers.defaultCateIndex, (newval) => {
|
||||||
|
updateChoseCount()
|
||||||
|
})
|
||||||
|
|
||||||
|
//更新就餐人数
|
||||||
|
async function updateChoseCount(){
|
||||||
|
await Api.$choseCount({
|
||||||
|
masterId: option.masterId,
|
||||||
|
tableId: option.tableId,
|
||||||
|
num: userNumbers.defaultCateIndex,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function userNumberChange(e) {
|
function userNumberChange(e) {
|
||||||
userNumbers.defaultCateIndex = e.detail.value
|
userNumbers.defaultCateIndex = e.detail.value
|
||||||
@@ -299,11 +316,11 @@
|
|||||||
const eatTypes = reactive({
|
const eatTypes = reactive({
|
||||||
list: [{
|
list: [{
|
||||||
label: '堂食',
|
label: '堂食',
|
||||||
value: '1'
|
value: 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '自取',
|
label: '自取',
|
||||||
value: '2'
|
value: 2
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
active: 1
|
active: 1
|
||||||
@@ -311,7 +328,6 @@
|
|||||||
|
|
||||||
function radioGroupChange(e) {
|
function radioGroupChange(e) {
|
||||||
eatTypes.active = e.detail.value
|
eatTypes.active = e.detail.value
|
||||||
console.log(eatTypes.active);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -320,7 +336,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function chooseTable() {
|
function chooseTable() {
|
||||||
go.to('PAGES_CHOOSE_TABLE',{
|
go.to('PAGES_CHOOSE_TABLE', {
|
||||||
...table.value
|
...table.value
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -336,6 +352,16 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
let table = ref(null)
|
let table = ref(null)
|
||||||
|
//监听桌台改变
|
||||||
|
watch(() => table.value, (newval, oldval) => {
|
||||||
|
if (newval && oldval) {
|
||||||
|
Api.$choseTable({
|
||||||
|
orderId: 4462,
|
||||||
|
oldTableId: oldval.tableId,
|
||||||
|
newTableId: newval.tableId,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
function watchChooseTable() {
|
function watchChooseTable() {
|
||||||
uni.$off('choose-table')
|
uni.$off('choose-table')
|
||||||
@@ -344,7 +370,7 @@
|
|||||||
console.log(table.value);
|
console.log(table.value);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const option = reactive({
|
const option = reactive({
|
||||||
masterId: '',
|
masterId: '',
|
||||||
tableId: ""
|
tableId: ""
|
||||||
@@ -360,6 +386,11 @@
|
|||||||
}, 0)
|
}, 0)
|
||||||
return result
|
return result
|
||||||
})
|
})
|
||||||
|
//餐位费
|
||||||
|
const $seatFee = reactive({
|
||||||
|
totalNumber: 0,
|
||||||
|
totalAmount: 0,
|
||||||
|
})
|
||||||
const allPrice = computed(() => {
|
const allPrice = computed(() => {
|
||||||
return goods.list.reduce((prve, cur) => {
|
return goods.list.reduce((prve, cur) => {
|
||||||
return prve + cur.salePrice * cur.number * (cur.isGift ? 0 : 1)
|
return prve + cur.salePrice * cur.number * (cur.isGift ? 0 : 1)
|
||||||
@@ -380,43 +411,49 @@
|
|||||||
masterId: option.masterId,
|
masterId: option.masterId,
|
||||||
tableId: option.tableId
|
tableId: option.tableId
|
||||||
}) {
|
}) {
|
||||||
const res = await Api.getCart(par)
|
const {
|
||||||
goods.list = res.records.map(item => {
|
records,
|
||||||
return {
|
seatFee
|
||||||
...item,
|
} = await Api.getCart(par)
|
||||||
isPack: returnBoolean(item.isPack),
|
goods.list =getNowCart(records)
|
||||||
isGift: returnBoolean(item.isGift)
|
if(seatFee&&seatFee.totalNumber){
|
||||||
}
|
userNumbers.defaultCateIndex = seatFee.totalNumber || 1
|
||||||
})
|
Object.assign($seatFee, seatFee)
|
||||||
|
}
|
||||||
|
|
||||||
console.log(goods.list);
|
console.log(goods.list);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建订单
|
// 创建订单
|
||||||
async function createOrder(par = {
|
async function createOrder(par = {
|
||||||
masterId: option.masterId,
|
masterId: option.masterId,
|
||||||
vipUserId:user.value?user.value.id:'',
|
vipUserId: user.value ? user.value.id : '',
|
||||||
note:note.value,
|
note: note.value,
|
||||||
postPay:true,
|
postPay: true,
|
||||||
orderId:'',
|
orderId: '',
|
||||||
tableId: option.tableId
|
tableId: option.tableId
|
||||||
}) {
|
}) {
|
||||||
|
updateChoseCount()
|
||||||
const res = await Api.$createOrder(par)
|
const res = await Api.$createOrder(par)
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title:'提交成功',
|
title: '提交成功',
|
||||||
icon:'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
setTimeout(()=>{
|
setTimeout(() => {
|
||||||
uni.navigateBack({delta:2})
|
uni.$emit('orderDetail:update')
|
||||||
},500)
|
uni.navigateBack({
|
||||||
|
delta: 2
|
||||||
|
})
|
||||||
|
}, 500)
|
||||||
}
|
}
|
||||||
|
|
||||||
onLoad((opt) => {
|
onLoad((opt) => {
|
||||||
console.log(opt);
|
console.log(opt);
|
||||||
Object.assign(option, opt)
|
Object.assign(option, opt)
|
||||||
if(opt){
|
if (opt) {
|
||||||
table.value={
|
table.value = {
|
||||||
tableId:opt.tableId,
|
tableId: opt.tableId,
|
||||||
name:opt.tableName
|
name: opt.tableName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getCart()
|
getCart()
|
||||||
@@ -424,11 +461,10 @@
|
|||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
|
|
||||||
})
|
})
|
||||||
onShow(()=>{
|
onShow(() => {
|
||||||
watchChooseuser()
|
watchChooseuser()
|
||||||
watchChooseTable()
|
watchChooseTable()
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
<view class="search u-flex u-col-center ">
|
<view class="search u-flex u-col-center ">
|
||||||
<view class="u-flex-1">
|
<view class="u-flex-1">
|
||||||
<uni-search-bar bgColor="#F9F9F9" cancelButton="none" placeholder="搜索店内商品" @confirm="search"
|
<uni-search-bar bgColor="#F9F9F9" cancelButton="none" placeholder="搜索店内商品" @confirm="search"
|
||||||
:focus="true" v-model="searchValue">
|
v-model="searchValue">
|
||||||
</uni-search-bar>
|
</uni-search-bar>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-flex">
|
<view class="u-flex">
|
||||||
@@ -70,18 +70,18 @@
|
|||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
<view class="bottom w-full">
|
<view class="bottom w-full">
|
||||||
<my-car @updateNumber="carsNumberChange" :user="data.vipUser" :masterId="data.masterId"
|
<my-car @updateNumber="carsNumberChange" :user="data.vipUser" :masterId="data.masterId" :table="data.table"
|
||||||
:table="data.table"
|
:data="cars" @clear="onClearCart"></my-car>
|
||||||
:data="cars" @clear="onClearCart"></my-car>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 选择规格 -->
|
<!-- 选择规格 -->
|
||||||
<guige-model @update-sku="updateSkuSel" @confirm="guigeConfirm" ref="chooseGuigeModel" :title="guigeModelData.title"
|
<guige-model @update-sku="updateSkuSel" @confirm="guigeConfirm" ref="chooseGuigeModel"
|
||||||
:sku-map="guigeModelData.chooseGoods.skuMap" :skus="guigeModelData.chooseGoods.skus"></guige-model>
|
:title="guigeModelData.title" :sku-map="guigeModelData.chooseGoods.skuMap"
|
||||||
<!-- 添加附加费 -->
|
:skus="guigeModelData.chooseGoods.skus"></guige-model>
|
||||||
<my-surcharge @confirm="surchargeConfirm" ref="surcharge" title="添加附加费"></my-surcharge>
|
<!-- 添加附加费 -->
|
||||||
|
<my-surcharge @confirm="surchargeConfirm" ref="surcharge" title="添加附加费"></my-surcharge>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
@@ -112,6 +112,7 @@
|
|||||||
import myCar from './components/car'
|
import myCar from './components/car'
|
||||||
import go from '@/commons/utils/go.js';
|
import go from '@/commons/utils/go.js';
|
||||||
import infoBox from '@/commons/utils/infoBox.js';
|
import infoBox from '@/commons/utils/infoBox.js';
|
||||||
|
import {getNowCart} from '@/pagesCreateOrder/util.js'
|
||||||
const cars = reactive([])
|
const cars = reactive([])
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
scrollTop: 0, //tab标题的滚动条位置
|
scrollTop: 0, //tab标题的滚动条位置
|
||||||
@@ -302,9 +303,11 @@
|
|||||||
data.masterId = masterId
|
data.masterId = masterId
|
||||||
const cartRes = await getCart()
|
const cartRes = await getCart()
|
||||||
cars.length = 0
|
cars.length = 0
|
||||||
for (let i in cartRes.records) {
|
const cartArr =getNowCart(cartRes.records)
|
||||||
cars.push(cartRes.records[i])
|
for (let i in cartArr) {
|
||||||
|
cars.push(cartArr[i])
|
||||||
}
|
}
|
||||||
|
|
||||||
const categoryRes = await getCategory()
|
const categoryRes = await getCategory()
|
||||||
const category = categoryRes.content.reduce((prve, cur) => {
|
const category = categoryRes.content.reduce((prve, cur) => {
|
||||||
prve.push({
|
prve.push({
|
||||||
@@ -329,7 +332,7 @@
|
|||||||
|
|
||||||
// 监听选择用户事件
|
// 监听选择用户事件
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const surcharge = ref(null)
|
const surcharge = ref(null)
|
||||||
|
|
||||||
@@ -663,15 +666,15 @@
|
|||||||
onReady(() => {
|
onReady(() => {
|
||||||
getMenuItemTop()
|
getMenuItemTop()
|
||||||
})
|
})
|
||||||
|
|
||||||
let isTabClickOver=true
|
let isTabClickOver = true
|
||||||
// 点击左边的栏目切换
|
// 点击左边的栏目切换
|
||||||
async function swichMenu(index) {
|
async function swichMenu(index) {
|
||||||
if (data.arr.length == 0) {
|
if (data.arr.length == 0) {
|
||||||
await getMenuItemTop();
|
await getMenuItemTop();
|
||||||
}
|
}
|
||||||
if (index == data.current) return;
|
if (index == data.current) return;
|
||||||
isTabClickOver=false;
|
isTabClickOver = false;
|
||||||
data.scrollRightTop = data.oldScrollTop;
|
data.scrollRightTop = data.oldScrollTop;
|
||||||
nextTick(function() {
|
nextTick(function() {
|
||||||
data.scrollRightTop = data.arr[index] + data.topZhanwei;
|
data.scrollRightTop = data.arr[index] + data.topZhanwei;
|
||||||
@@ -717,12 +720,12 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 设置左边菜单的滚动状态
|
// 设置左边菜单的滚动状态
|
||||||
async function leftMenuStatus(index) {
|
async function leftMenuStatus(index) {
|
||||||
if(!isTabClickOver){
|
if (!isTabClickOver) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
data.current = index;
|
data.current = index;
|
||||||
@@ -755,9 +758,9 @@
|
|||||||
}).exec()
|
}).exec()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 右边菜单滚动
|
// 右边菜单滚动
|
||||||
async function rightScroll(e) {
|
async function rightScroll(e) {
|
||||||
data.oldScrollTop = e.detail.scrollTop;
|
data.oldScrollTop = e.detail.scrollTop;
|
||||||
@@ -777,16 +780,17 @@
|
|||||||
let height2 = data.arr[i + 1];
|
let height2 = data.arr[i + 1];
|
||||||
// 如果不存在height2,意味着数据循环已经到了最后一个,设置左边菜单为最后一项即可
|
// 如果不存在height2,意味着数据循环已经到了最后一个,设置左边菜单为最后一项即可
|
||||||
if (!height2 || scrollHeight >= height1 && scrollHeight < height2) {
|
if (!height2 || scrollHeight >= height1 && scrollHeight < height2) {
|
||||||
if(isTabClickOver){
|
if (isTabClickOver) {
|
||||||
leftMenuStatus(i);
|
leftMenuStatus(i);
|
||||||
}else{
|
} else {
|
||||||
isTabClickOver=true
|
isTabClickOver = true
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 10)
|
}, 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
function watchChooseuser() {
|
function watchChooseuser() {
|
||||||
uni.$off('choose-user')
|
uni.$off('choose-user')
|
||||||
uni.$on('choose-user', (user) => {
|
uni.$on('choose-user', (user) => {
|
||||||
@@ -797,14 +801,13 @@
|
|||||||
setUser()
|
setUser()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {})
|
||||||
})
|
onShow(() => {
|
||||||
onShow(()=>{
|
|
||||||
watchChooseuser()
|
watchChooseuser()
|
||||||
})
|
})
|
||||||
onLoad((opt) => {
|
onLoad((opt) => {
|
||||||
console.log(opt)
|
console.log(opt)
|
||||||
Object.assign(data.table,opt)
|
Object.assign(data.table, opt)
|
||||||
if (!opt.tableId) {
|
if (!opt.tableId) {
|
||||||
infoBox.showErrorToast('暂不支持不选择台桌下载,请从桌台点餐')
|
infoBox.showErrorToast('暂不支持不选择台桌下载,请从桌台点餐')
|
||||||
return setTimeout(() => {
|
return setTimeout(() => {
|
||||||
@@ -813,8 +816,6 @@
|
|||||||
}
|
}
|
||||||
init()
|
init()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
36
pagesCreateOrder/order-detail/components/extra.vue
Normal file
36
pagesCreateOrder/order-detail/components/extra.vue
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<template>
|
||||||
|
<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>
|
||||||
|
<my-button plain shape="circle" :width="160" :height="56">退菜</my-button>
|
||||||
|
</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>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
const props = defineProps({
|
||||||
|
data: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {}
|
||||||
|
},
|
||||||
|
table:{
|
||||||
|
type: Object,
|
||||||
|
default: () => {}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const statusMap={
|
||||||
|
unpaid:'未支付'
|
||||||
|
}
|
||||||
|
function returnStatus(status){
|
||||||
|
return statusMap[status]||''
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
</style>
|
||||||
@@ -1,37 +1,48 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="default-box-padding bg-fff border-r-12 u-m-t-20" v-if="data.length">
|
<view class="default-box-padding bg-fff border-r-12 u-m-t-20" v-if="data.length">
|
||||||
<view class="u-font-32">
|
<view class="u-font-32 font-bold">
|
||||||
<text>共</text>
|
<text>共</text>
|
||||||
<text class="color-main font-bold"> {{goodsNumber}}</text>
|
<text class="color-main font-bold"> {{goodsNumber}}</text>
|
||||||
<text>份菜品</text>
|
<text>份菜品</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-m-t-20 list">
|
<view class="u-m-b-20 u-m-t-20" v-for="(order,orderIndex) in data" :key="orderIndex">
|
||||||
<view class="item u-m-b-20" v-for="(item,index) in data" :key="index">
|
<view class="u-font-32"> 第{{ order.placeNum }}次下单
|
||||||
<view class="u-flex u-col-top">
|
</view>
|
||||||
<view>
|
<view class="u-m-t-20 list">
|
||||||
<image class="img" :src="item.coverImg" mode=""></image>
|
<view class="item u-m-b-20" v-for="(item,index) in order.info" :key="index">
|
||||||
</view>
|
<view class="u-flex u-col-top">
|
||||||
<view class="u-p-l-30 u-flex-1">
|
<view>
|
||||||
<view class="u-flex u-row-between u-col-top">
|
<image class="img" :src="item.coverImg" mode=""></image>
|
||||||
<view>{{item.name}}</view>
|
</view>
|
||||||
<view class="u-text-right">
|
<view class="u-p-l-30 u-flex-1">
|
||||||
<view>¥{{item.salePrice}}</view>
|
<view class="u-flex u-row-between u-col-top">
|
||||||
<view class="u-m-t-10 u-font-24">X{{item.number}}</view>
|
|
||||||
|
<view class="u-flex">
|
||||||
|
<view class="tui" v-if="item.status=='return'">
|
||||||
|
已退
|
||||||
|
</view>
|
||||||
|
<view :class="{'line-th':item.status=='return'}">{{item.name}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-text-right">
|
||||||
|
<view>¥{{item.salePrice}}</view>
|
||||||
|
<view v-if="item.status=='return'" class="line-th color-666 u-font-24">¥{{item.salePrice}}</view>
|
||||||
|
<view class="u-m-t-10 u-font-24">X{{item.number}}</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<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>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-flex u-row-right gap-20 u-m-t-20">
|
</view>
|
||||||
<my-button :height="60" color="#333" plain type="cancel" shape="circle">更多操作</my-button>
|
<view class="bg-gray u-p-20 u-m-t-20">
|
||||||
<my-button :width="168" :height="60" plain shape="circle">退菜</my-button>
|
<view>备注</view>
|
||||||
</view>
|
<view class="u-m-t-10">无</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="bg-gray u-p-20 u-m-t-20 ">
|
|
||||||
<view>备注</view>
|
|
||||||
<view class="u-m-t-10">无</view>
|
|
||||||
</view>
|
|
||||||
<view class="u-m-t-40">
|
<view class="u-m-t-40">
|
||||||
<view class="u-flex u-row-between border-bottom u-p-b-20">
|
<view class="u-flex u-row-between border-bottom u-p-b-20">
|
||||||
<view class="tag no-pay">
|
<view class="tag no-pay">
|
||||||
@@ -47,11 +58,11 @@
|
|||||||
<view></view>
|
<view></view>
|
||||||
<view>
|
<view>
|
||||||
<text>总计¥</text>
|
<text>总计¥</text>
|
||||||
<text class="font-bold u-font-32">{{allPrice}}</text>
|
<text class="font-bold u-font-32">{{seatFee*1+allPrice*1}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-m-t-30">
|
<view class="u-m-t-30">
|
||||||
<my-button type="cancel" :color="color.ColorMain">重新打印</my-button>
|
<my-button @tap="printOrder" type="cancel" :color="color.ColorMain">重新打印</my-button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -62,25 +73,42 @@
|
|||||||
computed
|
computed
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
import color from '@/commons/color.js'
|
import color from '@/commons/color.js'
|
||||||
|
const emits=defineEmits(['tuicai'])
|
||||||
|
function tuicai(item,index){
|
||||||
|
emits('tuicai',item,index)
|
||||||
|
}
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
data: {
|
data: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => []
|
default: () => []
|
||||||
|
},
|
||||||
|
seatFee:{
|
||||||
|
type:[String,Number],
|
||||||
|
default:0
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const allPrice = computed(() => {
|
const allPrice = computed(() => {
|
||||||
return props.data.reduce((prve, cur) => {
|
return props.data.reduce((prve, cur) => {
|
||||||
return prve + cur.salePrice * cur.number
|
const curTotal=cur.info.filter(v=>v.isGift !== "true"&& v.status !== "return").reduce((a,b)=>{
|
||||||
|
return a+b.salePrice * b.number
|
||||||
|
},0)
|
||||||
|
return prve + curTotal
|
||||||
}, 0).toFixed(2)
|
}, 0).toFixed(2)
|
||||||
})
|
})
|
||||||
|
|
||||||
const goodsNumber = computed(() => {
|
const goodsNumber = computed(() => {
|
||||||
let result = 0
|
let result = 0
|
||||||
result = props.data.reduce((prve, cur) => {
|
result = props.data.reduce((a, b) => {
|
||||||
return prve + cur.number
|
const bTotal = b.info.reduce((prve, cur) => {
|
||||||
|
return prve + cur.number * 1;
|
||||||
|
}, 0);
|
||||||
|
return a + bTotal
|
||||||
}, 0)
|
}, 0)
|
||||||
return result
|
return result
|
||||||
})
|
})
|
||||||
|
function printOrder(){
|
||||||
|
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@@ -88,9 +116,13 @@
|
|||||||
width: 70rpx;
|
width: 70rpx;
|
||||||
height: 70rpx;
|
height: 70rpx;
|
||||||
}
|
}
|
||||||
.border-bottom{
|
|
||||||
|
.border-bottom {
|
||||||
border-color: rgb(240, 240, 240);
|
border-color: rgb(240, 240, 240);
|
||||||
}
|
}
|
||||||
|
.line-th{
|
||||||
|
text-decoration: line-through;
|
||||||
|
}
|
||||||
.tag {
|
.tag {
|
||||||
padding: 2rpx 8rpx;
|
padding: 2rpx 8rpx;
|
||||||
border-radius: 8rpx;
|
border-radius: 8rpx;
|
||||||
@@ -100,4 +132,13 @@
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.tui{
|
||||||
|
background-color: rgb(239, 239, 239);
|
||||||
|
border-radius: 4rpx;
|
||||||
|
margin-right: 6rpx;
|
||||||
|
color: #666;
|
||||||
|
padding: 0 4rpx;
|
||||||
|
font-size: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="u-flex u-row-between u-m-t-20">
|
<view class="u-flex u-row-between u-m-t-20">
|
||||||
<view>就餐人数</view>
|
<view>就餐人数</view>
|
||||||
<view>1</view>
|
<view>{{seatFee.totalNumber}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-flex u-row-between u-m-t-20">
|
<view class="u-flex u-row-between u-m-t-20">
|
||||||
<view>支付方式</view>
|
<view>支付方式</view>
|
||||||
@@ -26,11 +26,11 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="u-flex u-row-between u-m-t-20">
|
<view class="u-flex u-row-between u-m-t-20">
|
||||||
<view>下单时间</view>
|
<view>下单时间</view>
|
||||||
<view>2024-08-31 15:54:40</view>
|
<view ><up-text v-if="data.createdAt" mode="date" :text="data.createdAt"></up-text></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-flex u-row-between u-m-t-20">
|
<view class="u-flex u-row-between u-m-t-20">
|
||||||
<view>订单编号</view>
|
<view>订单编号</view>
|
||||||
<view>2024083115544056362</view>
|
<view>{{data.orderNo}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-flex u-row-between u-m-t-20">
|
<view class="u-flex u-row-between u-m-t-20">
|
||||||
<view>商家备注</view>
|
<view>商家备注</view>
|
||||||
@@ -40,6 +40,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import orderEnum from '@/commons/orderEnum.js'
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
data: {
|
data: {
|
||||||
type: Object,
|
type: Object,
|
||||||
@@ -48,14 +49,16 @@
|
|||||||
table:{
|
table:{
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {}
|
default: () => {}
|
||||||
|
},
|
||||||
|
seatFee:{
|
||||||
|
type: Object,
|
||||||
|
default: () => {totalNumber:0}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const statusMap={
|
|
||||||
unpaid:'未支付'
|
|
||||||
}
|
|
||||||
function returnStatus(status){
|
function returnStatus(status){
|
||||||
return statusMap[status]||''
|
const item=orderEnum.status.find(v=>v.key==status)
|
||||||
|
return item?item.label:''
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
100
pagesCreateOrder/order-detail/components/tuicai.vue
Normal file
100
pagesCreateOrder/order-detail/components/tuicai.vue
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
<template>
|
||||||
|
<my-model title="退菜" ref="model" @close="onModelClose" @open="onModelOpen">
|
||||||
|
<template #desc>
|
||||||
|
<view class="u-p-30 u-text-left">
|
||||||
|
<view>
|
||||||
|
{{data.name}}
|
||||||
|
</view>
|
||||||
|
<view class="u-flex u-m-t-32">
|
||||||
|
<up-number-box :buttonSize="44" :inputWidth="220" v-model="number"></up-number-box>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-32">
|
||||||
|
<view class="u-font-24">
|
||||||
|
<text class="color-999">退菜理由</text>
|
||||||
|
<text class="color-red">*</text>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex u-flex-wrap u-m-t-24">
|
||||||
|
<view class="u-flex u-m-r-16 u-m-b-16" v-for="(item,index) in tags" :key="index">
|
||||||
|
<up-tag @click="changeTagSel(item)" :text="item.label" plain v-if="item.checked"> </up-tag>
|
||||||
|
<up-tag @click="changeTagSel(item)" borderColor="#E5E5E5" color="#999" :text="item.label" plain v-else> </up-tag>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-24">
|
||||||
|
<up-input placeholder="备注"></up-input>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<template #btn>
|
||||||
|
<view class="u-p-t-18 u-p-l-30 u-p-r-30 u-p-b-30">
|
||||||
|
<my-button box-shadow shape="circle" @tap="confirm">确认退菜</my-button>
|
||||||
|
<view class="u-m-t-10">
|
||||||
|
<my-button @tap="toggleModelShow" shape="circle" bgColor="#fff" type="cancel" box-shadow>取消</my-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
</my-model>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
ref,
|
||||||
|
watch
|
||||||
|
} from 'vue';
|
||||||
|
const props = defineProps({
|
||||||
|
data: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {}
|
||||||
|
},
|
||||||
|
show: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const emits = defineEmits(['update:show','confirm'])
|
||||||
|
let model = ref(null)
|
||||||
|
let modelShow = ref(props.show)
|
||||||
|
let number = ref(1)
|
||||||
|
const tags=ref([{label:"点错",checked:false},{label:"不想要了",checked:false} ,{label:"食材不足",checked:false} ,{label:"等待时间过长",checked:false}])
|
||||||
|
function changeTagSel(item){
|
||||||
|
item.checked=!item.checked
|
||||||
|
}
|
||||||
|
watch(() => props.show, (newval) => {
|
||||||
|
modelShow.value = newval
|
||||||
|
})
|
||||||
|
watch(() => modelShow.value, (newval) => {
|
||||||
|
emits('update:show', newval)
|
||||||
|
if (newval) {
|
||||||
|
open()
|
||||||
|
} else {
|
||||||
|
close()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
function toggleModelShow(show){
|
||||||
|
modelShow.value=show?true:false
|
||||||
|
}
|
||||||
|
|
||||||
|
function onModelClose() {
|
||||||
|
modelShow.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
function onModelOpen() {
|
||||||
|
modelShow.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function open() {
|
||||||
|
model.value.open()
|
||||||
|
}
|
||||||
|
|
||||||
|
function close() {
|
||||||
|
model.value.close()
|
||||||
|
}
|
||||||
|
function confirm(){
|
||||||
|
emits('confirm')
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
</style>
|
||||||
@@ -5,8 +5,10 @@
|
|||||||
<text class="color-666">桌位号:</text>
|
<text class="color-666">桌位号:</text>
|
||||||
<text class="font-bold">{{options.name}}</text>
|
<text class="font-bold">{{options.name}}</text>
|
||||||
</view>
|
</view>
|
||||||
<goods-list :data="orderDetail.goodsList"></goods-list>
|
<goods-list :data="orderDetail.goodsList" :seatFee="orderDetail.seatFee.totalAmount"
|
||||||
<order-vue :data="orderDetail.info" :table="options"></order-vue>
|
@tuicai="onTuiCai"></goods-list>
|
||||||
|
<extra-vue :data="orderDetail.seatFee"></extra-vue>
|
||||||
|
<order-vue :data="orderDetail.info" :table="options" :seatFee="orderDetail.seatFee"></order-vue>
|
||||||
<step-vue></step-vue>
|
<step-vue></step-vue>
|
||||||
<view style="height: 200rpx;"></view>
|
<view style="height: 200rpx;"></view>
|
||||||
<view class="u-fixed bottom bg-fff ">
|
<view class="u-fixed bottom bg-fff ">
|
||||||
@@ -21,6 +23,8 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<tuicai-vue @confirm="tuicaiConfirm" v-model:show="tuicai.show" :data="tuicai.selGoods"></tuicai-vue>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -30,6 +34,8 @@
|
|||||||
import orderVue from './components/order.vue';
|
import orderVue from './components/order.vue';
|
||||||
import goodsList from './components/list.vue';
|
import goodsList from './components/list.vue';
|
||||||
import stepVue from './components/step.vue';
|
import stepVue from './components/step.vue';
|
||||||
|
import extraVue from './components/extra.vue';
|
||||||
|
import tuicaiVue from './components/tuicai.vue';
|
||||||
import go from '@/commons/utils/go.js'
|
import go from '@/commons/utils/go.js'
|
||||||
import {
|
import {
|
||||||
onLoad,
|
onLoad,
|
||||||
@@ -40,6 +46,24 @@
|
|||||||
reactive
|
reactive
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
import OrderDetail from './page.js'
|
import OrderDetail from './page.js'
|
||||||
|
const tuicai = reactive({
|
||||||
|
show: false,
|
||||||
|
selGoods: ''
|
||||||
|
})
|
||||||
|
|
||||||
|
function onTuiCai(goods, index) {
|
||||||
|
tuicai.show = true
|
||||||
|
tuicai.selGoods = goods
|
||||||
|
}
|
||||||
|
|
||||||
|
async function tuicaiConfirm() {
|
||||||
|
const res=await Api.$returnCart({
|
||||||
|
cartId: tuicai.selGoods.id,
|
||||||
|
tableId:options.tableId,
|
||||||
|
})
|
||||||
|
tuicai.selGoods.status='return'
|
||||||
|
tuicai.show = false
|
||||||
|
}
|
||||||
const uiPage = new OrderDetail()
|
const uiPage = new OrderDetail()
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uiPage.setVal('user', {
|
uiPage.setVal('user', {
|
||||||
@@ -50,22 +74,27 @@
|
|||||||
function diancan() {
|
function diancan() {
|
||||||
go.to('PAGES_CREATE_ORDER', {
|
go.to('PAGES_CREATE_ORDER', {
|
||||||
tableId: options.tableId,
|
tableId: options.tableId,
|
||||||
tableName: options.name
|
tableName: options.name,
|
||||||
|
type: 'add'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function toPay() {
|
function toPay() {
|
||||||
go.to('PAGES_CRESATE_ORDER_PAY', {
|
go.to('PAGES_CRESATE_ORDER_PAY', {
|
||||||
...orderDetail.info,
|
|
||||||
tableId: options.tableId,
|
tableId: options.tableId,
|
||||||
tableName: options.name,
|
tableName: options.name,
|
||||||
masterId: options.masterId,
|
masterId: options.masterId,
|
||||||
|
orderId: orderDetail.info.id,
|
||||||
|
discount: 1
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const orderDetail = reactive({
|
const orderDetail = reactive({
|
||||||
goodsList: [],
|
goodsList: [],
|
||||||
info: {}
|
info: {},
|
||||||
|
seatFee: {
|
||||||
|
totalAmount: 0
|
||||||
|
}
|
||||||
})
|
})
|
||||||
const options = reactive({})
|
const options = reactive({})
|
||||||
async function init() {
|
async function init() {
|
||||||
@@ -73,14 +102,16 @@
|
|||||||
masterId
|
masterId
|
||||||
} = await Api.$getMasterId(options)
|
} = await Api.$getMasterId(options)
|
||||||
console.log(masterId);
|
console.log(masterId);
|
||||||
options.masterId=masterId
|
options.masterId = masterId
|
||||||
const {
|
const {
|
||||||
records
|
records,
|
||||||
|
seatFee
|
||||||
} = await Api.getCart({
|
} = await Api.getCart({
|
||||||
...options,
|
...options,
|
||||||
masterId
|
masterId
|
||||||
})
|
})
|
||||||
orderDetail.goodsList = records
|
orderDetail.goodsList = records
|
||||||
|
orderDetail.seatFee = seatFee
|
||||||
const info = await Api.$createOrder({
|
const info = await Api.$createOrder({
|
||||||
masterId,
|
masterId,
|
||||||
vipUserId: '',
|
vipUserId: '',
|
||||||
@@ -91,16 +122,16 @@
|
|||||||
})
|
})
|
||||||
orderDetail.info = info
|
orderDetail.info = info
|
||||||
}
|
}
|
||||||
function watchEmit(){
|
|
||||||
|
function watchEmit() {
|
||||||
uni.$off('orderDetail:update')
|
uni.$off('orderDetail:update')
|
||||||
uni.$once('orderDetail:update',(newval)=>{
|
uni.$once('orderDetail:update', (newval) => {
|
||||||
console.log(newval);
|
console.log(newval);
|
||||||
init()
|
init()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
onShow(()=>{
|
onShow(() => {
|
||||||
watchEmit()
|
watchEmit()
|
||||||
|
|
||||||
})
|
})
|
||||||
onLoad((opt) => {
|
onLoad((opt) => {
|
||||||
Object.assign(options, opt)
|
Object.assign(options, opt)
|
||||||
|
|||||||
@@ -25,32 +25,49 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="bg-fff box-shadow u-p-t-30 u-p-l-50 u-p-r-50 card bottom border-r-12 ">
|
<view class="bg-fff box-shadow u-p-t-30 u-p-l-50 u-p-r-50 card bottom border-r-12 ">
|
||||||
<my-tabs :list="pays.list"></my-tabs>
|
<my-tabs :list="pays.list" v-model="pays.selIndex"></my-tabs>
|
||||||
<view class="list">
|
<template v-if="pays.selIndex==0">
|
||||||
<view class="item" @click="changePayType(index)" v-for="(item,index) in pays.payTypes.list"
|
<view class="list">
|
||||||
:key="index">
|
<view class="item" @click="changePayType(index)" v-for="(item,index) in pays.payTypes.list"
|
||||||
<view class="u-flex u-row-between u-p-t-30 u-p-b-30 border-bottom">
|
:key="index">
|
||||||
<view class="u-flex">
|
<view class="u-flex u-row-between u-p-t-30 u-p-b-30 border-bottom">
|
||||||
<image class="icon" :src="item.icon" mode=""></image>
|
<view class="u-flex">
|
||||||
<text class="u-m-l-10">{{item.payName}}</text>
|
<image class="icon" :src="item.icon" mode=""></image>
|
||||||
</view>
|
<text class="u-m-l-10">{{item.payName}}</text>
|
||||||
<view class="u-flex color-999 u-font-24">
|
</view>
|
||||||
<!-- <view class="u-m-r-20">
|
<view class="u-flex color-999 u-font-24">
|
||||||
<text>余额:</text>
|
<!-- <view class="u-m-r-20">
|
||||||
<text>¥0.00</text>
|
<text>余额:</text>
|
||||||
</view> -->
|
<text>¥0.00</text>
|
||||||
<my-radio @click="changePayType(index)" :modelValue="index==pays.payTypes.selIndex">
|
</view> -->
|
||||||
</my-radio>
|
<my-radio @click="changePayType(index)" :modelValue="index==pays.payTypes.selIndex">
|
||||||
|
</my-radio>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
<view class="u-m-t-60 u-p-b-30">
|
||||||
|
<my-button @click="payOrder">确认付款</my-button>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<view class="">
|
||||||
|
<view class="u-font-32 u-m-t-40 u-text-center">请让顾客使用微信扫码</view>
|
||||||
|
<view class="u-flex u-row-center u-m-t-40">
|
||||||
|
<image style="width: 300rpx;height: 300rpx;" src="@/static/logo.png" mode=""></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<view class="bg-fff box-shadow u-p-t-30 u-p-l-50 u-p-r-50 card top border-r-12 ">
|
||||||
<view class="u-m-t-60 u-p-b-30">
|
|
||||||
<my-button @click="payOrder">确认付款</my-button>
|
|
||||||
</view>
|
</view>
|
||||||
|
<view class="bg-fff box-shadow u-p-t-30 u-p-l-50 u-p-r-50 card bottom border-r-12 ">
|
||||||
|
|
||||||
|
</view>
|
||||||
|
|
||||||
|
|
||||||
<edit-discount title="优惠金额" :ref="setModel" name="editMoney" :price="order.amount"></edit-discount>
|
<edit-discount title="优惠金额" :ref="setModel" name="editMoney" :price="order.amount"></edit-discount>
|
||||||
</view>
|
</view>
|
||||||
@@ -70,6 +87,7 @@
|
|||||||
import editDiscount from '@/pagesCreateOrder/components/edit-discount.vue'
|
import editDiscount from '@/pagesCreateOrder/components/edit-discount.vue'
|
||||||
const pays = reactive({
|
const pays = reactive({
|
||||||
list: ['扫码收款', '二维码收款'],
|
list: ['扫码收款', '二维码收款'],
|
||||||
|
selIndex: 0,
|
||||||
payTypes: {
|
payTypes: {
|
||||||
list: [],
|
list: [],
|
||||||
selIndex: 0
|
selIndex: 0
|
||||||
@@ -97,54 +115,70 @@
|
|||||||
function changePayType(i) {
|
function changePayType(i) {
|
||||||
pays.payTypes.selIndex = i
|
pays.payTypes.selIndex = i
|
||||||
}
|
}
|
||||||
|
//支付成功回调
|
||||||
|
function paySuccess(){
|
||||||
|
infoBox.showToast('支付成功')
|
||||||
|
setTimeout(() => {
|
||||||
|
// uni.$emit('orderDetail:update')
|
||||||
|
uni.navigateBack({delta:2})
|
||||||
|
}, 500)
|
||||||
|
}
|
||||||
async function payOrder() {
|
async function payOrder() {
|
||||||
const payType = pays.payTypes.list[pays.payTypes.selIndex].payType
|
const payType = pays.payTypes.list[pays.payTypes.selIndex].payType
|
||||||
await Api.$payOrder({
|
await Api.$payOrder({
|
||||||
tableId: order.tableId,
|
tableId: order.tableId,
|
||||||
masterId: order.masterId,
|
masterId: order.masterId,
|
||||||
orderId: order.id,
|
orderId: order.id||order.orderId,
|
||||||
payType,
|
payType,
|
||||||
vipUserId: order.userId,
|
vipUserId: order.userId,
|
||||||
discount: 1,
|
discount: 1,
|
||||||
code: ''
|
code: ''
|
||||||
})
|
})
|
||||||
infoBox.showToast('支付成功')
|
paySuccess()
|
||||||
setTimeout(() => {
|
|
||||||
uni.$emit('orderDetail:update')
|
|
||||||
uni.navigateBack()
|
|
||||||
}, 500)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getPayType()
|
getPayType()
|
||||||
})
|
})
|
||||||
const order = reactive({
|
const order = reactive({
|
||||||
amount: 0
|
amount: 0
|
||||||
})
|
})
|
||||||
function saoma(){
|
|
||||||
|
function saomaPay() {
|
||||||
|
const item = pays.payTypes.list[pays.payTypes.selIndex]
|
||||||
uni.scanCode({
|
uni.scanCode({
|
||||||
onlyFromCamera: true,
|
onlyFromCamera: true,
|
||||||
success: function (res) {
|
success:function (res) {
|
||||||
console.log('条码类型:' + res.scanType);
|
console.log('条码类型:' + res.scanType);
|
||||||
console.log('条码内容:' + res.result);
|
console.log('条码内容:' + res.result);
|
||||||
|
Api.$payOrder({
|
||||||
|
"orderId": order.orderId, // 订单id
|
||||||
|
"payType": item.payType, //
|
||||||
|
"discount": order.discount,
|
||||||
|
"code": res.result
|
||||||
|
}).then(res=>{
|
||||||
|
console.log(res);
|
||||||
|
paySuccess()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
watch(() => pays.payTypes.selIndex, (index) => {
|
watch(() => pays.payTypes.selIndex, (newval) => {
|
||||||
const item = pays.payTypes.list[index]
|
const item = pays.payTypes.list[newval]
|
||||||
if (item.payType == "vipPay") {
|
if (item.payType == "vipPay") {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (item.payType == "deposit") {
|
if (item.payType == "deposit") {
|
||||||
//储值卡支付
|
//储值卡支付
|
||||||
return saoma()
|
return saomaPay('deposit')
|
||||||
}
|
}
|
||||||
if (item.payType == "scanCode") {
|
if (item.payType == "scanCode") {
|
||||||
//扫码支付
|
//扫码支付
|
||||||
return saoma()
|
return saomaPay('scanCode')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
onLoad((opt) => {
|
onLoad((opt) => {
|
||||||
|
console.log(opt);
|
||||||
Object.assign(order, opt)
|
Object.assign(order, opt)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
16
pagesCreateOrder/util.js
Normal file
16
pagesCreateOrder/util.js
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import {
|
||||||
|
returnBoolean
|
||||||
|
} from '@/commons/utils/format.js';
|
||||||
|
// 返回购物车未下单的数据
|
||||||
|
export function getNowCart(records) {
|
||||||
|
const nowCart = records.find(v => v.placeNum == 0)
|
||||||
|
const Cart = nowCart ? nowCart.info : []
|
||||||
|
const result = Cart.map(item => {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
isPack: returnBoolean(item.isPack),
|
||||||
|
isGift: returnBoolean(item.isGift)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return result
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user