更换正式环境,测试修改
This commit is contained in:
@@ -38,12 +38,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
nextTick,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import { reactive, nextTick, ref, watch } from 'vue';
|
||||
import myModel from '@/components/my-components/my-model.vue'
|
||||
import myButton from '@/components/my-components/my-button.vue'
|
||||
import myTabs from '@/components/my-components/my-tabs.vue'
|
||||
|
||||
@@ -35,6 +35,14 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="border-bottom-dashed u-p-b-30 u-p-t-30" v-if="discountSaleAmount*1>0">
|
||||
<view class="u-flex u-p-l-24 u-p-r-24 u-row-between ">
|
||||
<view>单品打折优惠</view>
|
||||
<view class="color-red">
|
||||
-¥{{discountSaleAmount}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="border-bottom-dashed u-p-b-30 u-p-t-30">
|
||||
<view class="u-flex u-p-l-24 u-p-r-24 u-row-between " @click="toQuan">
|
||||
@@ -99,7 +107,7 @@
|
||||
<text class="u-m-l-10 no-wrap">{{item.payName}}</text>
|
||||
</view>
|
||||
<view class="u-flex color-999 u-font-24">
|
||||
<view class="u-m-r-20" v-if="item.payType=='virtual'&&pageData.buyer.id"
|
||||
<view class="u-m-r-20" v-if="item.payType=='arrears'&&pageData.buyer.id"
|
||||
@click.stop="chooseBuyer">
|
||||
<view>
|
||||
<text>挂账人:</text>
|
||||
@@ -107,7 +115,7 @@
|
||||
</view>
|
||||
<view>
|
||||
<text>挂账额度:</text>
|
||||
<text>¥{{pageData.buyer.creditAmount||'0'}}</text>
|
||||
<text>¥{{pageData.buyer.remainingAmount||'0'}}</text>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
@@ -224,7 +232,7 @@
|
||||
|
||||
<edit-discount :nowPrice="order.orderAmount-productCouponDiscountAmount-fullCouponDiscountAmount"
|
||||
@confirm="editDiscountConfirm" title="优惠金额" :ref="setModel" name="editMoney"
|
||||
:price="payPrice-productCouponDiscountAmount" :discount="discount.discount"></edit-discount>
|
||||
:price="payPrice" :discount="discount.discount"></edit-discount>
|
||||
|
||||
<up-modal :title="modal.title" :content="modal.content" :show="modal.show" :confirmText="modal.confirmText"
|
||||
:cancelText="modal.cancelText" showCancelButton closeOnClickOverlay @confirm="confirmModelConfirm"
|
||||
@@ -237,7 +245,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, onMounted, watch, ref, onBeforeUnmount, computed } from 'vue';
|
||||
import { reactive, onMounted, watch, ref, onBeforeUnmount, computed, inject } from 'vue';
|
||||
import { onLoad, onBackPress, onShow } from '@dcloudio/uni-app'
|
||||
import go from '@/commons/utils/go.js'
|
||||
|
||||
@@ -259,7 +267,7 @@
|
||||
import { scanPay,microPay,cashPay,vipPay,creditPay,getOrderPayUrl,queryOrderStatus } from '@/http/api/pay.js'
|
||||
import { calcUsablePoints,calcDeductionAmount,payedDeductPoints,consumeAwardPoints } from '@/http/api/points.js'
|
||||
|
||||
|
||||
const websocketUtil = inject('websocketUtil'); // 注入 WebSocket 工具类实例
|
||||
const modal = reactive({
|
||||
title: '提示',
|
||||
cancelText: '取消',
|
||||
@@ -323,7 +331,6 @@
|
||||
watchChooseQuan()
|
||||
})
|
||||
onLoad(async (opt) => {
|
||||
console.log(opt);
|
||||
Object.assign(order, opt)
|
||||
getPayType()
|
||||
init()
|
||||
@@ -345,17 +352,13 @@
|
||||
// 获取订单详情
|
||||
const orderRes = await getHistoryOrder({orderId:order.orderId})
|
||||
Object.assign(order, orderRes)
|
||||
$goodsPayPriceMap = returnGoodsPayPriceMap(order.detailMap)
|
||||
pageData.goodsList = [];
|
||||
Object.values(orderRes.detailMap).forEach(item=>{
|
||||
pageData.goodsList = [...pageData.goodsList,...item]
|
||||
})
|
||||
pageData.goodsList = uni.$utils.objToArrary(orderRes.detailMap)
|
||||
$goodsPayPriceMap = returnGoodsPayPriceMap(pageData.goodsList)
|
||||
|
||||
// console.log("order===",order)
|
||||
// console.log("pageData.user===",pageData.user)
|
||||
// 获取用户信息
|
||||
console.log("order===",order)
|
||||
console.log("pageData.user===",pageData.user)
|
||||
if (order.userId||pageData.user.userId) {
|
||||
|
||||
shopUserDetail({
|
||||
userId: order.userId || pageData.user.userId
|
||||
}).then(res => {
|
||||
@@ -366,7 +369,6 @@
|
||||
}
|
||||
})
|
||||
}
|
||||
console.log("order==",order)
|
||||
pageData.seatNum = order.seatNum;
|
||||
}
|
||||
|
||||
@@ -395,7 +397,7 @@
|
||||
console.log(b)
|
||||
return a + ((b.packAmount||0)*b.packNumber).toFixed(2)*1
|
||||
}, 0)
|
||||
console.log(price)
|
||||
// console.log("菜品打包费===",price)
|
||||
return price
|
||||
}
|
||||
})
|
||||
@@ -404,7 +406,7 @@
|
||||
* 桌位费
|
||||
*/
|
||||
const tableFee = computed(() => {
|
||||
console.log("桌位费===", order.seatNum > 0 ? order.seatNum*pageData.shopInfo.tableFee : 0)
|
||||
// console.log("桌位费===", order.seatNum > 0 ? order.seatNum*pageData.shopInfo.tableFee : 0)
|
||||
return order.seatNum > 0 ? order.seatNum*pageData.shopInfo.tableFee : 0
|
||||
})
|
||||
|
||||
@@ -416,7 +418,7 @@
|
||||
let goodsPrice = pageData.goodsList.filter(v => v.price != 0 && v.status !== "return").reduce((a, b) => {
|
||||
return a + parseFloat(mathFloorPrice(b.num * b.price,b))
|
||||
}, 0)
|
||||
console.log("菜品原金额===",goodsPrice)
|
||||
// console.log("菜品原金额===",goodsPrice)
|
||||
return (parseFloat(goodsPrice) + parseFloat(tableFee.value) + parseFloat(packAmount.value)).toFixed(2)
|
||||
}
|
||||
})
|
||||
@@ -426,10 +428,10 @@
|
||||
let goodsPrice = pageData.goodsList.filter(v => v.price != 0 && v.status !== "return").reduce((a, b) => {
|
||||
let memberPrice = b.memberPrice ? b.memberPrice : b.price
|
||||
let tPrice = (isVip.value ? memberPrice : b.price)
|
||||
tPrice = b.memberPrice != b.unitPrice&& b.price != b.unitPrice ? b.unitPrice : tPrice
|
||||
return a + parseFloat(mathFloorPrice(b.num * tPrice,b) - mathFloorPrice(b.returnNum*tPrice,b) - mathFloorPrice(b.refundNum*b.unitPrice,b))
|
||||
tPrice = (b.discountSaleAmount ? b.discountSaleAmount : tPrice )
|
||||
return a + parseFloat(mathFloorPrice(b.num * tPrice,b)*1 - mathFloorPrice(b.returnNum*tPrice,b)*1 - mathFloorPrice(b.refundNum*tPrice,b)*1)
|
||||
}, 0)
|
||||
console.log("减去退款退费的菜品金额===",goodsPrice)
|
||||
// console.log("减去退款退费的菜品金额===",goodsPrice)
|
||||
return (goodsPrice + tableFee.value + packAmount.value).toFixed(2)
|
||||
}
|
||||
})
|
||||
@@ -457,7 +459,8 @@
|
||||
let price = pageData.goodsList.filter(v => v.discountSaleAmount > 0 && v.status !== "return").reduce((a, b) => {
|
||||
return a + ((b.num * b.price) - (b.num * b.discountSaleAmount))
|
||||
}, 0)
|
||||
return price
|
||||
// console.log("单品折扣金额====",price)
|
||||
return price.toFixed(2)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -466,7 +469,7 @@
|
||||
*/
|
||||
const fullCouponDiscountAmount = computed(() => {
|
||||
return pays.quan.filter(v => v.type == 1).reduce((prve, cur) => {
|
||||
console.log("优惠券金额",prve + cur.discountAmount * 1)
|
||||
// console.log("优惠券金额",prve + cur.discountAmount * 1)
|
||||
return prve + cur.discountAmount * 1
|
||||
}, 0)
|
||||
})
|
||||
@@ -493,15 +496,15 @@
|
||||
* 支付金额
|
||||
*/
|
||||
const payPrice = computed(() => {
|
||||
console.log("newOriginPrice===",newOriginPrice.value)
|
||||
console.log("vipDiscount===",vipDiscount.value)
|
||||
console.log("productCouponDiscountAmount===",productCouponDiscountAmount.value)
|
||||
console.log("discount===",discount.value)
|
||||
console.log("fullCouponDiscountAmount===",fullCouponDiscountAmount.value)
|
||||
console.log("accountPoints===",accountPoints)
|
||||
// console.log("newOriginPrice===",newOriginPrice.value)
|
||||
// console.log("vipDiscount===",vipDiscount.value)
|
||||
// console.log("productCouponDiscountAmount===",productCouponDiscountAmount.value)
|
||||
// console.log("discount===",discount.value)
|
||||
// console.log("fullCouponDiscountAmount===",fullCouponDiscountAmount.value)
|
||||
// console.log("accountPoints===",accountPoints)
|
||||
let total = (newOriginPrice.value*1) - productCouponDiscountAmount.value - discount
|
||||
.value - fullCouponDiscountAmount.value - accountPoints.price * (accountPoints.sel ? 1 : 0)
|
||||
console.log("payPrice===",total)
|
||||
// console.log("支付金额===",total)
|
||||
return (total < 0 ? 0 : total).toFixed(2)
|
||||
})
|
||||
|
||||
@@ -509,8 +512,7 @@
|
||||
* 积分使用前金额
|
||||
*/
|
||||
const orderAmount = computed(() => {
|
||||
let total = (newOriginPrice.value*1) - (vipDiscount.value*1) - productCouponDiscountAmount.value - discount
|
||||
.value - fullCouponDiscountAmount.value
|
||||
let total = (newOriginPrice.value*1) - productCouponDiscountAmount.value - discount.value - fullCouponDiscountAmount.value
|
||||
console.log(total)
|
||||
return (total < 0 ? 0 : total).toFixed(2)
|
||||
})
|
||||
@@ -527,7 +529,9 @@
|
||||
})
|
||||
watch(() => payPrice.value, (newval) => {
|
||||
if( pageData.payUrlShow){
|
||||
getPayUrl()
|
||||
setTimeout(()=>{
|
||||
getPayUrl()
|
||||
})
|
||||
}
|
||||
if (newval <= 0) {
|
||||
const arr = ['cash', 'member-account']
|
||||
@@ -577,7 +581,7 @@
|
||||
originAmount: originPrice.value, //订单原金额(包含打包费+餐位费) 不含折扣价格
|
||||
orderAmount: payPrice.value, // 订单金额
|
||||
seatNum: pageData.seatNum, // 用餐人数
|
||||
discountAmount: discount.value, // 手动优惠金额
|
||||
discountAmount: discount.value.toFixed(2), // 手动优惠金额
|
||||
fullCouponDiscountAmount: fullCouponDiscountAmount.value, // 满减金额
|
||||
productCouponDiscountAmount: productCouponDiscountAmount.value,
|
||||
vipPrice: vipDiscount.value != 0 ? 1: 0, // 是否使用会员价
|
||||
@@ -654,7 +658,7 @@
|
||||
if(!goods)return;
|
||||
let memberPrice = goods.memberPrice ? goods.memberPrice : goods.price
|
||||
tPrice = (isVip.value ? memberPrice : goods.price)
|
||||
tPrice = goods.memberPrice != goods.unitPrice&& goods.price != goods.unitPrice ? goods.unitPrice : tPrice
|
||||
tPrice = goods.discountSaleAmount ? goods.discountSaleAmount : tPrice
|
||||
item.discountAmount = tPrice
|
||||
})
|
||||
|
||||
@@ -662,18 +666,11 @@
|
||||
productCoup = [];
|
||||
}
|
||||
// productCoup = productCoup.filter(v => v.number >= 1)
|
||||
pays.quan = [...setmanjianCoup, ...productCoup,...setproductCoup]
|
||||
pays.quan = [...manjianCoup, ...productCoup]
|
||||
console.log("优惠券2===",pays.quan)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除优惠券
|
||||
* @param {Object} i
|
||||
*/
|
||||
function delQuan(i) {
|
||||
pays.quan.splice(i, 1)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 积分选择
|
||||
@@ -701,7 +698,6 @@
|
||||
if (!order.userId&&!pageData.user.userId) {
|
||||
return
|
||||
}
|
||||
console.log("calcUsablePoints",pageData.user)
|
||||
const res = await calcUsablePoints({
|
||||
shopUserId: pageData.user.id,
|
||||
orderAmount: payPrice.value
|
||||
@@ -716,9 +712,10 @@
|
||||
accountPoints.price = 0
|
||||
return ''
|
||||
}
|
||||
console.log(payPrice.value)
|
||||
const res = await calcDeductionAmount({
|
||||
shopUserId: pageData.user.id,
|
||||
orderAmount: payPrice.value,
|
||||
orderAmount: orderAmount.value,
|
||||
points: accountPoints.num
|
||||
})
|
||||
if (res) {
|
||||
@@ -751,7 +748,7 @@
|
||||
go.to('PAGES_ORDER_QUAN', {
|
||||
orderId: order.id,
|
||||
shopUserId: pageData.user.id,
|
||||
orderPrice: (payPrice.value * 1).toFixed(2)
|
||||
orderPrice: (payPrice.value * 1 + coupAllPrice.value * 1).toFixed(2)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -786,6 +783,16 @@
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除优惠券
|
||||
* @param {Object} i
|
||||
*/
|
||||
function delQuan(i) {
|
||||
pays.quan.splice(i, 1)
|
||||
discount.discount = 100
|
||||
discount.value = 0
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择用户
|
||||
*/
|
||||
@@ -802,6 +809,8 @@
|
||||
console.log(data);
|
||||
pageData.user = data
|
||||
pays.quan = []
|
||||
discount.discount = 100
|
||||
discount.value = 0
|
||||
init()
|
||||
})
|
||||
}
|
||||
@@ -819,7 +828,6 @@
|
||||
function watchChoosebuyer() {
|
||||
uni.$off('choose-buyer')
|
||||
uni.$on('choose-buyer', (data) => {
|
||||
console.log(data);
|
||||
pageData.buyer = data
|
||||
})
|
||||
}
|
||||
@@ -830,13 +838,11 @@
|
||||
* @param {Object} form
|
||||
*/
|
||||
function editDiscountConfirm(form) {
|
||||
console.log(form);
|
||||
accountPoints.sel = false
|
||||
Object.assign(discount, {
|
||||
...form,
|
||||
value: form.price - form.currentPrice
|
||||
})
|
||||
console.log(discount.discount);
|
||||
const fullCoupon = pays.quan.find(v => v.type == 1)
|
||||
if (fullCoupon && form.currentPrice < fullCoupon.fullAmount) {
|
||||
modal.content = '改价后价格不满足满减券最低满减需求' + fullCoupon.fullAmount + '元'
|
||||
@@ -845,7 +851,7 @@
|
||||
modal.cancelText = '取消改价'
|
||||
modal.confirmText = '删除满减券'
|
||||
}
|
||||
getPayUrl()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -858,12 +864,10 @@
|
||||
return uni.$utils.showToast(item.payName + '不可用')
|
||||
}
|
||||
pays.payTypes.selIndex = i
|
||||
console.log(item.payType)
|
||||
console.log(pageData.user.id)
|
||||
if (item.payType == 'member-account' && !pageData.user.id) {
|
||||
chooseUser()
|
||||
}
|
||||
if (item.payType == 'virtual' && !pageData.buyer.id) {
|
||||
if (item.payType == 'arrears' && !pageData.buyer.id) {
|
||||
chooseBuyer()
|
||||
}
|
||||
|
||||
@@ -894,19 +898,17 @@
|
||||
}
|
||||
function payOrderClick() {
|
||||
const payType = pays.payTypes.list[pays.payTypes.selIndex].payType
|
||||
console.log(payType);
|
||||
if (payType == 'scanCode' || payType == 'deposit') {
|
||||
return saomaPay(payType)
|
||||
}
|
||||
if (payType == 'cash' && payPrice.value * 1 > 0) {
|
||||
return cashConfirmShow()
|
||||
}
|
||||
if (payType == 'virtual') {
|
||||
// return cashConfirmShow()
|
||||
if (payType == 'arrears' && pageData.buyer.remainingAmount < payPrice.value * 1 ) {
|
||||
return uni.$utils.showToast('挂账额度不足')
|
||||
}
|
||||
if (payType == 'member-account' && pageData.user.amount * 1 < payPrice.value * 1) {
|
||||
uni.$utils.showToast('余额不足')
|
||||
return
|
||||
return uni.$utils.showToast('余额不足')
|
||||
}
|
||||
if (payStatus) {
|
||||
return uni.$utils.showToast(tipsMap[payStatus])
|
||||
@@ -939,7 +941,7 @@
|
||||
if( order.userId||pageData.user.userId ){
|
||||
params.checkOrderPay.userId = order.userId||pageData.user.userId
|
||||
}
|
||||
if( payType == 'virtual' ){
|
||||
if( payType == 'arrears' ){
|
||||
params.creditBuyerId = pageData.buyer.id
|
||||
}
|
||||
|
||||
@@ -953,7 +955,7 @@
|
||||
if (payType == 'cash') {
|
||||
await cashPay(params)
|
||||
}
|
||||
if (payType == 'virtual') {
|
||||
if (payType == 'arrears') {
|
||||
await creditPay(params)
|
||||
}
|
||||
if( payType == 'member-account' || payType == 'deposit' ) {
|
||||
@@ -984,6 +986,10 @@
|
||||
console.log(res)
|
||||
},1000)
|
||||
}
|
||||
if( error.code == 701 ){
|
||||
uni.removeStorageSync("table_code")
|
||||
uni.navigateBack()
|
||||
}
|
||||
payStatus = '';
|
||||
return false;
|
||||
}
|
||||
@@ -1005,6 +1011,13 @@
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
})
|
||||
websocketUtil.send(JSON.stringify({
|
||||
type:'onboc',
|
||||
account: uni.getStorageSync("iToken").loginId,
|
||||
shop_id: uni.getStorageSync("shopInfo").id,
|
||||
operate_type:'cleanup',
|
||||
table_code: order.tableCode,
|
||||
}))
|
||||
}, 1500)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user