代码更新
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
<view style="height: 200rpx;"></view>
|
||||
<view class="u-fixed bottom bg-fff ">
|
||||
<view class="u-flex u-abso">
|
||||
<template v-if="orderDetail.info.useType=='take-out'||!orderDetail.info.tableCode||orderDetail.info.useType=='dine-in-before'">
|
||||
<template v-if="orderDetail.info.dineMode=='take-out'||!orderDetail.info.tableCode||pageData.shopInfo.registerType=='before'">
|
||||
<view class="u-flex-1" v-if="orderDetail.info.status=='unpaid'">
|
||||
<my-button @tap="toPay" borderRadius="100rpx" shape="circle"
|
||||
type="primary">结账</my-button>
|
||||
@@ -41,6 +41,8 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import { reactive, ref } from 'vue';
|
||||
import * as Api from '@/http/yskApi/Instead.js'
|
||||
import userVue from './components/user.vue';
|
||||
import orderVue from './components/order.vue';
|
||||
@@ -48,19 +50,16 @@
|
||||
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 infoBox from '@/commons/utils/infoBox.js'
|
||||
import {hasPermission} from '@/commons/utils/hasPermission.js'
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import {
|
||||
reactive,
|
||||
ref
|
||||
} from 'vue';
|
||||
|
||||
import OrderDetail from './page.js'
|
||||
import { getHistoryOrder, refundOrder,getOrderById } from '@/api/order.js'
|
||||
import { getHistoryOrder, refundOrder,getOrderById,printOrder } from '@/api/order.js'
|
||||
import { shopStaffDetail } from '@/api/staff.js'
|
||||
import { shopUserDetail } from '@/api/shopUser.js'
|
||||
|
||||
import { getShopInfo } from '@/api/shop.js'
|
||||
|
||||
const tuicai = reactive({
|
||||
show: false,
|
||||
@@ -82,9 +81,13 @@
|
||||
amount:'0.00',
|
||||
accountPoints:'0.00'
|
||||
})
|
||||
const pageData = reactive({
|
||||
shopInfo: {},
|
||||
})
|
||||
onLoad((opt) => {
|
||||
Object.assign(options, opt)
|
||||
console.log(options);
|
||||
console.log("opt===",options);
|
||||
getShopInfoData()
|
||||
})
|
||||
onShow(() => {
|
||||
watchEmit()
|
||||
@@ -92,7 +95,14 @@
|
||||
getOrderDetail()
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* 获取店铺信息
|
||||
*/
|
||||
function getShopInfoData () {
|
||||
getShopInfo({id:uni.getStorageSync('shopInfo').id}).then(res=>{
|
||||
pageData.shopInfo = res;
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单详情
|
||||
@@ -101,7 +111,7 @@
|
||||
let res = await getHistoryOrder({orderId: options.id})
|
||||
console.log(res)
|
||||
if(res.userId){
|
||||
shopUserDetail({id:res.userId}).then(res=>{
|
||||
shopUserDetail({userId:res.userId}).then(res=>{
|
||||
if(res){
|
||||
user.value = res
|
||||
}
|
||||
@@ -115,7 +125,7 @@
|
||||
info: value,
|
||||
placeNum: key
|
||||
}))
|
||||
console.log(orderDetail.goodsList);
|
||||
console.log("goodsList===",orderDetail.goodsList);
|
||||
orderDetail.info = res
|
||||
}
|
||||
|
||||
@@ -156,7 +166,7 @@
|
||||
productName,
|
||||
num,
|
||||
number: 0,
|
||||
productSkuName: '',
|
||||
skuName: '',
|
||||
priceAmount,
|
||||
price
|
||||
})
|
||||
@@ -177,28 +187,24 @@
|
||||
getOrderDetail()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function printDishes() {
|
||||
try {
|
||||
const res = await Api.$printDishes({
|
||||
tableId: orderDetail.info.tableId
|
||||
})
|
||||
infoBox.showToast('已发送打印请求')
|
||||
} catch (e) {
|
||||
infoBox.showToast('发送打印请求失败')
|
||||
//TODO handle the exception
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 打印订单
|
||||
*/
|
||||
function onPrintOrder() {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '是否打印当前台桌菜品',
|
||||
success(res) {
|
||||
async success(res) {
|
||||
if (res.confirm) {
|
||||
printDishes()
|
||||
try {
|
||||
const res = await printOrder({
|
||||
id: orderDetail.info.id
|
||||
})
|
||||
infoBox.showToast('已发送打印请求')
|
||||
} catch (e) {
|
||||
infoBox.showToast('发送打印请求失败')
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -211,32 +217,22 @@
|
||||
return
|
||||
}
|
||||
console.log(goods,'debug');
|
||||
const {
|
||||
id,
|
||||
productId,
|
||||
productSkuId,
|
||||
productName,
|
||||
productSkuName,
|
||||
cartId,
|
||||
orderId,
|
||||
num,
|
||||
priceAmount,
|
||||
price,userCouponId
|
||||
} = goods
|
||||
go.to('PAGES_ORDER_TUIKUAN', {
|
||||
id,
|
||||
cartId,
|
||||
orderId,
|
||||
productId,
|
||||
productSkuId,
|
||||
productName,
|
||||
num,
|
||||
number: 0,
|
||||
productSkuName: productSkuName || '',
|
||||
priceAmount:priceAmount?priceAmount:(num*price).toFixed(2),
|
||||
price,
|
||||
userCouponId:userCouponId?userCouponId:''
|
||||
})
|
||||
if (Array.isArray(goods)) {
|
||||
go.to('PAGES_ORDER_TUIKUAN', {
|
||||
goodsList:JSON.stringify(goods)
|
||||
|
||||
})
|
||||
} else {
|
||||
goods.number = 0
|
||||
goods.skuName = goods.skuName || ''
|
||||
goods.priceAmount = goods.priceAmount ? goods.priceAmount : (goods.num*goods.unitPrice).toFixed(2)
|
||||
goods.unitPrice = goods.unitPrice
|
||||
goods.userCouponId = goods.userCouponId ? goods.userCouponId:''
|
||||
go.to('PAGES_ORDER_TUIKUAN', {
|
||||
goodsList:JSON.stringify([goods])
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -256,10 +252,10 @@
|
||||
clearEmit()
|
||||
go.to('PAGES_CREATE_ORDER', {
|
||||
tableId: options.tableId || orderDetail.info.tableId,
|
||||
tableCode: options.tableCode || orderDetail.info.tableCode,
|
||||
name: options.name || orderDetail.info.tableName,
|
||||
masterId:orderDetail.info.masterId,
|
||||
type: 'add',
|
||||
vipUserId:orderDetail.userId?orderDetail.userId:''
|
||||
vipUserId: orderDetail.info.userId?orderDetail.info.userId:''
|
||||
})
|
||||
}
|
||||
|
||||
@@ -272,8 +268,8 @@
|
||||
clearEmit()
|
||||
go.to('PAGES_ORDER_PAY', {
|
||||
tableId: options.tableId|| orderDetail.info.tableId,
|
||||
tableName: options.name,
|
||||
masterId: options.masterId,
|
||||
tableCode: options.tableCode || orderDetail.info.tableCode,
|
||||
tableName: options.name || orderDetail.info.tableName,
|
||||
orderId: orderDetail.info.id,
|
||||
discount: 1,
|
||||
userId
|
||||
|
||||
Reference in New Issue
Block a user