更换正式环境,测试修改

This commit is contained in:
GaoHao
2025-03-25 21:49:33 +08:00
parent f01bc839f7
commit 7fe5d028e4
71 changed files with 930 additions and 2016 deletions

View File

@@ -23,7 +23,7 @@
<view class=" u-font-24 u-m-t-12 u-flex">
<view class=" u-flex">
<text class="">挂账额度</text>
<text class="color-main">{{item.creditAmount}}</text>
<text class="color-main">{{item.remainingAmount}}</text>
</view>
<view class="u-m-l-30 u-flex">
<text class="">账户余额</text>

View File

@@ -80,17 +80,20 @@
</view>
<view class="u-text-right u-m-t-28">
<template v-if="item.refundNum>0||item.returnNum>0">
<!-- <view>{{mathFloorPrice( - mathFloorPrice(parseFloat(item.returnNum*item.unitPrice),item) - mathFloorPrice(parseFloat(item.refundNum*item.unitPrice),item))}}</view> -->
<view>{{mathFloorPrice( parseFloat(mathFloorPrice(item.num*item.unitPrice),item) - (parseFloat(mathFloorPrice(item.returnNum*item.unitPrice,item)) + parseFloat(mathFloorPrice(item.refundNum*item.unitPrice,item))))}}</view>
<view>{{mathFloorPrice( parseFloat(mathFloorPrice(item.num*item.unitPrice,item)) - (parseFloat(mathFloorPrice(item.returnNum*item.unitPrice,item)) + parseFloat(mathFloorPrice(item.refundNum*item.unitPrice,item))))}}</view>
<view class="line-th color-666 ">{{returnTotalMoney(item)}}</view>
</template>
<template v-else-if="item.userCouponId">
<view>0.00</view>
<template v-else-if="item.couponNum > 0">
<view>{{mathFloorPrice((item.num-item.couponNum)*item.unitPrice,item)}}</view>
<view class="line-th color-666 ">{{returnTotalMoney(item)}}</view>
</template>
<template v-else-if="item.discountSaleAmount > 0">
<view>{{mathFloorPrice(item.num*item.discountSaleAmount,item)}}</view>
<view class="line-th color-666 ">{{returnTotalMoney(item)}}</view>
</template>
<template v-else-if="isVip == 1">
<view>{{item.num*item.memberPrice}}</view>
<view class="line-th color-666 ">{{item.num*item.price}}</view>
<view>{{mathFloorPrice(item.num*item.memberPrice,item)}}</view>
<view class="line-th color-666 ">{{returnTotalMoney(item)}}</view>
</template>
<template v-else>
<template v-if="returnCanTuiMoney(item)*1!=returnTotalMoney(item)*1">
@@ -206,7 +209,7 @@
</view>
<view class="u-m-t-24">
<view class="u-m-t-24" v-if="orderInfo.status == 'unpaid'||orderInfo.status == 'done'">
<my-button @tap="printOrder" type="cancel" :color="color.ColorMain">重新打印</my-button>
</view>
</view>
@@ -374,12 +377,13 @@
* 总优惠金额
*/
const discountsPrice = computed(() => {
// 满减券优惠
let fullCouponDiscountAmount = props.orderInfo.fullCouponDiscountAmount
let fullCouponDiscountAmount = props.orderInfo.status == 'done' ? props.orderInfo.fullCouponDiscountAmount : 0
// 商品券优惠
let productCouponDiscountAmount = props.orderInfo.productCouponDiscountAmount
let productCouponDiscountAmount = props.orderInfo.status == 'done' ? props.orderInfo.productCouponDiscountAmount : 0
// 积分抵扣优惠
let pointsDiscountAmount = props.orderInfo.pointsDiscountAmount
let pointsDiscountAmount = props.orderInfo.status == 'done' ? props.orderInfo.pointsDiscountAmount : 0
return (parseFloat(vipDiscountPrice.value) + parseFloat(discountSaleAmount.value) + discountAmount.value + fullCouponDiscountAmount + productCouponDiscountAmount + pointsDiscountAmount).toFixed(2)
})
@@ -394,14 +398,13 @@
let memberPrice = cur.memberPrice ? cur.memberPrice : cur.price
let tPrice = (isVip.value ? memberPrice : cur.price)
tPrice = cur.memberPrice != cur.unitPrice&& cur.price != cur.unitPrice ? cur.unitPrice : tPrice
console.log(tPrice)
let Total = Math.floor(tPrice * cur.num * 100) / 100
return prve + Total - (cur.returnNum*tPrice) - (cur.refundNum*cur.unitPrice)
}, 0)
return a + curTotal
}, 0)
console.log("菜品金额==",goodsPrice)
// console.log("菜品金额==",goodsPrice)
return goodsPrice.toFixed(2)
})
@@ -495,7 +498,7 @@
function returnTotalMoney(item) {
return (Math.floor(item.num*item.unitPrice*100)/100).toFixed(2)
return (Math.floor(item.num*item.price*100)/100).toFixed(2)
}
function returnCanTuiMoney(item) {
// if (props.orderInfo.status == 'unpaid') {
@@ -566,7 +569,7 @@
obj.number = '0.00'
obj.skuName = obj.skuName || ''
obj.unitPrice = obj.unitPrice
obj.num = obj.num - obj.returnNum - obj.refundNum
obj.num = obj.num - obj.returnNum - obj.refundNum - obj.couponNum
obj.priceAmount = mathFloorPrice(obj.num*obj.unitPrice ,obj)
})
arr = [...arr,...infoLit]

View File

@@ -173,11 +173,11 @@
}
let par = {
orderId: props.data.orderId,
refundAmount: number.value*props.data.unitPrice,
refundAmount: number.value * props.data.unitPrice,
refundReason: note,
refundDetails: [{
id: props.data.id,
returnAmount: number.value*props.data.unitPrice,
returnAmount: number.value * props.data.unitPrice,
num: number.value,
}],
}

View File

@@ -85,7 +85,6 @@
})
onLoad((opt) => {
Object.assign(options, opt)
console.log("opt===",options);
getShopInfoData()
})
onShow(() => {
@@ -109,24 +108,27 @@
*/
async function getOrderDetail () {
let res = await getHistoryOrder({orderId: options.id})
console.log("订单详情===",res)
// console.log("订单详情===",res)
if(res.userId){
shopUserDetail({userId:res.userId}).then(res=>{
if(res){
user.value = res
}
})
let resUser = await shopUserDetail({userId:res.userId})
user.value = resUser
}
orderDetail.seatFee = {
seatNum: res.seatNum,
seatAmount: res.seatAmount,
}
orderDetail.goodsList = Object.entries(res.detailMap).map(([key, value]) => ({
info: value,
placeNum: key
}))
orderDetail.goodsList.map(item=>{
item.info.map(item=>{
item.unitPrice = uni.$utils.isGoodsPrice(item,user.value)
})
})
orderDetail.info = res
console.log("orderDetail===",orderDetail);
}
function onSeatFeeTuicai(seatFee) {
@@ -195,7 +197,9 @@
if (res.confirm) {
try {
const res = await printOrder({
id: orderDetail.info.id
id: orderDetail.info.id,
type: orderDetail.info.status == 'unpaid' ? 1 : 0
})
infoBox.showToast('已发送打印请求')
} catch (e) {
@@ -213,6 +217,7 @@
return
}
if (Array.isArray(goods)) {
go.to('PAGES_ORDER_TUIKUAN', {
orderInfo: JSON.stringify(orderDetail.info),
goodsList:JSON.stringify(goods)
@@ -221,8 +226,9 @@
} 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.priceAmount = goods.priceAmount ? goods.priceAmount : (goods.num*uni.$utils.isGoodsPrice(goods,user.value)).toFixed(2)
console.log(goods)
goods.unitPrice = uni.$utils.isGoodsPrice(goods,user.value)
goods.userCouponId = goods.userCouponId ? goods.userCouponId:''
go.to('PAGES_ORDER_TUIKUAN', {
orderInfo: JSON.stringify(orderDetail.info),

View File

@@ -40,20 +40,9 @@
</view>
<view class="u-flex u-flex-1 u-row-right" style="align-items: center;">
<view style="margin-right: 10rpx;">×{{item.num}}</view>
<template v-if="item.userCouponId">
<view class="u-text-right u-relative" :style="computedPriceStyle()">
<text class="line-th">{{item.payAmount}}</text>
<view class="u-absolute" style="bottom: 100%;right: 0;">
0
</view>
</view>
</template>
<template v-else>
<view class="u-text-right u-relative" :style="computedPriceStyle()">
<text>{{item.payAmount}}</text>
</view>
</template>
<view class="u-text-right u-relative" :style="computedPriceStyle()">
<text>{{item.unitPrice}}</text>
</view>
</view>
</view>
@@ -98,9 +87,9 @@
<view class="u-m-t-32">
<view class="u-flex u-row-right">
<text>总计</text>
<text class="font-bold u-font-32">{{data.originAmount}}</text>
<text class="font-bold u-font-32">{{originAmount.toFixed(2)}}</text>
</view>
<view class="u-flex u-row-right u-m-t-24">
<view class="u-flex u-row-right u-m-t-24" v-if="data.status == 'unpaid'||data.status == 'done'">
<view class="print" @click.stop="print(item)">重新打印</view>
</view>
</view>
@@ -137,7 +126,7 @@
let $goodsMap = {}
let goosZhonglei = ref(0)
let goodsNumber = ref(0)
let originAmount = ref(0)
const priceSize = 9
let minWidth=ref(36)
@@ -158,6 +147,7 @@
$goodsMap[goods.productId] = goods.num * 1
goosZhonglei.value += 1
}
originAmount.value += goods.unitPrice
}
}
goodsMapInit()

View File

@@ -94,7 +94,8 @@
if (res.confirm) {
try{
const res= await printOrder({
id :item.id
id :item.id,
type: item.status == 'unpaid' ? 1 : 0
})
infoBox.showToast('已发送打印请求')
}catch(e){

View File

@@ -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'

View File

@@ -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)
}

View File

@@ -73,10 +73,8 @@
{{ item.useRestrictions }}
</view>
</view>
<view class="right u-flex u-flex-col u-col-bottom u-row-center">
<view class="u-flex ">
<view class="use-btn" @click.stop="toEmitChooseQuan(item)">去使用</view>
</view>
<view class="right u-flex u-flex-col u-col-bottom u-row-center" style="flex-shrink: 1;">
<view class="use-btn" @click.stop="toEmitChooseQuan(item)" style="flex-shrink: 1;">去使用</view>
</view>
</view>
@@ -142,7 +140,8 @@
returnCoupCanUse,
returnCouponAllPrice,
returnProductCoupon,
returnCanUseFullReductionCoupon
returnCanUseFullReductionCoupon,
returnProductAllCoup
} from '../quan_util.js'
import { getHistoryOrder } from '@/http/api/order.js'
import { shopUserDetail } from '@/http/api/shopUser.js'
@@ -227,13 +226,12 @@
})
pageData.order = await getHistoryOrder({orderId:option.orderId})
console.log(pageData.order);
const res = await getFindCoupon({
shopUserId: option.shopUserId,
type: pageData.types.sel+1
})
let fullReductionCoupon = res.filter(v => v.type == 1)
let productCoupon = res.filter(v => v.type == 2)
let fullReductionCoupon = res ? res.filter(v => v.type == 1) : []
let productCoupon = res ? res.filter(v => v.type == 2) : []
canDikouGoodsArr = returnNewGoodsList(pageData.order.detailMap || [])
fullReductionCoupon = fullReductionCoupon.map((v) => {
@@ -259,7 +257,6 @@
// .filter((v) => v.use);
pageData.fullReductionCoupon = fullReductionCoupon
pageData.productCoupon = productCoupon
console.log(res)
pageData.hasAjax = true;
}
@@ -316,8 +313,6 @@
const goodsQuan = pageData.productCoupon.filter(v => v.checked)
let coupArr = [...goodsQuan, item]
const payPrice = option.orderPrice - returnCouponAllPrice(coupArr, canDikouGoodsArr, pageData.user)
console.log(payPrice)
if (payPrice<=0) {
modal.content = '选择该商品券后支付金额将为0继续选择将取消选择的满减券'
modal.cancelText = '取消'
@@ -333,7 +328,7 @@
return
}
}
console.log(2)
item.checked = !item.checked
const CheckedArr = pageData.productCoupon.filter(v => v.checked)
if (CheckedArr.length <= 0) {
@@ -569,7 +564,6 @@
&.goods {
.right {
background-color: #fff;
position: initial;
.use-btn {
padding: 10rpx 40rpx;

View File

@@ -1,5 +1,5 @@
export function isTui(item) {
console.log("isTui",item.status);
// console.log("isTui",item.status);
return item.status == 'return' || item.status == 'refund' || item.status == 'refunding'
}
//是否使用会员价
@@ -22,11 +22,7 @@ export function returnProductCouponPrice(coup, goodsArr, vipUser) {
//返回新的商品列表,过滤掉退菜的,退单的商品
export function returnNewGoodsList(arr) {
let goods_list = []
Object.values(arr).forEach(item=>{
goods_list = [...goods_list,...item]
})
return goods_list.filter(v => !isTui(v))
return uni.$utils.objToArrary(arr).filter(v => !isTui(v))
}
//根据当前购物车商品以及数量,已选券对应商品数量,判断该商品券是否可用
export function returnCoupCanUse(goodsArr = [], coup, selCoupArr = []) {
@@ -38,10 +34,10 @@ export function returnCoupCanUse(goodsArr = [], coup, selCoupArr = []) {
return false
}
const findGoodsTotalNumber = findGoods.reduce((prve, cur) => {
return prve + cur.num * 1
return prve + cur.num
}, 0)
const selCoupNumber = selCoupArr.filter(v => v.proId == coup.proId).reduce((prve, cur) => {
return prve + cur.num * 1
return prve + 1
}, 0)
if (selCoupNumber >= findGoodsTotalNumber) {
return false
@@ -59,9 +55,10 @@ export function returnProductCoupon(coup, goodsArr, vipUser, selCoupArr = []) {
use: false
}
}
const memberPrice = item.memberPrice ? item.memberPrice : item.price;
const price = item ? (isUseVipPrice(vipUser,item) ? memberPrice : item.price) : 0;
const discountAmount = (price * coup.num).toFixed(2)
let memberPrice = item.memberPrice ? item.memberPrice : item.price;
let price = item ? (isUseVipPrice(vipUser,item) ? memberPrice : item.price) : 0;
price = item.discountSaleAmount ? item.discountSaleAmount : price
const discountAmount = (price * 1).toFixed(2)
// const canUse = !coup.use ? false : (discountAmount > 0 && returnCoupCanUse(goodsArr, coup, selCoupArr))
// const canUse=discountAmount>0
@@ -90,9 +87,10 @@ export function returnProductAllCoup(coupArr, goodsArr, vipUser) {
}
//返回商品实际支付价格
export function returnProductPayPrice(goods,vipUser){
let memberPrice = goods.memberPrice ? goods.memberPrice : goods.unitPrice;
let price = isUseVipPrice(vipUser,goods) ? memberPrice : goods.unitPrice;
price = goods.memberPrice != goods.unitPrice&& goods.price != goods.unitPrice ? goods.unitPrice : price
console.log(goods)
let memberPrice = goods.memberPrice ? goods.memberPrice : goods.price;
let price = isUseVipPrice(vipUser,goods) ? memberPrice : goods.price;
price = goods.discountSaleAmount ? goods.discountSaleAmount : price
return price
}
//返回商品券抵扣的商品价格
@@ -129,11 +127,7 @@ export function returnProCoupStartIndex(coupArr,index){
}
//返回商品数量从0到n每一个对应的价格对照表
export function returnGoodsPayPriceMap(goodsArr){
let goods_arr = []
Object.values(goodsArr).forEach(item=>{
goods_arr = [...goods_arr,...Object.values(item)]
})
return goods_arr.reduce((prve,cur)=>{
return goodsArr.reduce((prve,cur)=>{
if(!prve.hasOwnProperty(cur.productId)){
prve[cur.productId]=[]
}

View File

@@ -0,0 +1,77 @@
<template>
<uni-popup ref="popup" type="top" mask-background-color="rgba(0,0,0,.5)" :safe-area="false">
<view class="card-wrapper">
<image class="icon-close" src="/static/iconImg/icon-x.svg" mode="scaleToFill" @tap="close" />
<view class="title">请输入支付密码</view>
<view class="sub-title">退款</view>
<view class="refund-money">{{ vdata.refundAmount }}</view>
<JPasswordInput v-if="vdata.isShowPwdInput" margin="0 50rpx" :focus="true" ref="pwdInput" @inputChange="inputChange" />
</view>
</uni-popup>
</template>
<script setup>
import { onMounted, reactive, ref, nextTick } from 'vue'
const vdata = reactive({
refundAmount: 0,
isShowPwdInput: false,
})
const proms = {}
const popup = ref(null)
const pwdInput = ref(null)
const open = (money, callBack) => {
vdata.refundAmount = money
vdata.callBack = callBack
popup.value.open()
vdata.isShowPwdInput = false
nextTick(() => {
vdata.isShowPwdInput = true
})
}
const close = () => {
popup.value.close()
vdata.isShowPwdInput = false
}
// 输入框 e 输入的数字
const inputChange = (e) => {
if (e.length >= 6) return vdata.callBack(e)
}
const clearInput = () => pwdInput.value.clearInput()
defineExpose({ open, clearInput, close })
</script>
<style lang="scss" scoped>
.card-wrapper {
margin: 0 50rpx;
padding-bottom: 50rpx;
margin-top: 162rpx;
background-color: $J-bg-ff;
border-radius: $J-b-r32;
.icon-close {
padding: 30rpx;
width: 60rpx;
height: 60rpx;
}
.title {
text-align: center;
font-size: 30rpx;
font-weight: 500;
}
.sub-title {
margin-top: 40rpx;
margin-bottom: 20rpx;
text-align: center;
font-size: 30rpx;
color: #808080;
}
.refund-money {
margin-bottom: 70rpx;
text-align: center;
font-size: 50rpx;
font-weight: 500;
}
}
</style>

View File

@@ -39,7 +39,7 @@
<view class="u-flex u-m-l-32 u-col-center">
<up-icon @click="changeItem(item,-1)" :size="20" name="minus-circle"></up-icon>
<view class="u-m-l-28 u-m-r-28">{{item.number}}</view>
<up-icon @click="changeItem(item,1)" :color="color.ColorMain" :size="20"
<up-icon @click="changeItem(item,1)" :color="$utils.ColorMain" :size="20"
name="plus-circle-fill"></up-icon>
</view>
</view>
@@ -93,8 +93,9 @@
<view style="height: 200rpx;"></view>
<view class="fixed-b">
<up-button text="确认退款" @click="tuikuanConfirm" shape="circle" type="primary" size="large"
:color="color.ColorMain"></up-button>
:color="$utils.ColorMain"></up-button>
</view>
<confirmRefundPopup ref="refundPopup" />
</view>
</template>
@@ -102,8 +103,8 @@
<script setup>
import { computed, reactive, ref, watch } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import color from '@/commons/color.js';
import infoBox from '@/commons/utils/infoBox.js';
import confirmRefundPopup from './components/confirmRefundPopup.vue';
import {hasPermission} from '@/commons/utils/hasPermission.js'
import { refundOrder } from '@/http/api/order.js'
import { mathFloorPrice } from '@/commons/utils/goodsUtil.js'
@@ -132,10 +133,11 @@
totalAmount: 0
}
})
const refundPopup = ref(null);
onLoad((opt) => {
orderDetail.info = JSON.parse(opt.orderInfo)
orderDetail.goodsList = JSON.parse(opt.goodsList)
console.log(orderDetail)
option.productId = orderDetail.goodsList[0].productId
option.orderId = orderDetail.goodsList[0].orderId
})
@@ -251,22 +253,23 @@
/**
* 确认退款
*/
let params;
async function tuikuanConfirm() {
const canTuikuan=await hasPermission('允许退款')
if(!canTuikuan){
return infoBox.showToast('您没有退款权限')
return uni.$utils.showToast('您没有退款权限')
}
if (pageData.tabsIndex != 2&&tuikuanNumber.value <= 0) {
return infoBox.showToast('退款商品数量不能为0')
return uni.$utils.showToast('退款商品数量不能为0')
}
const selTag=tuikuan.list[tuikuan.sel]
const noteResult=`${selTag?selTag:''}${note.value?(','+note.value):''}`
if (!noteResult) {
return infoBox.showToast('请输入或选择退款原因!')
return uni.$utils.showToast('请输入或选择退款原因!')
}
let params = {
params = {
orderId: option.orderId,
refundReason: noteResult,
refundDetails: orderDetail.goodsList.filter(v=>v.number*1).map(v=>{
@@ -285,10 +288,21 @@
params.refundAmount = pageData.tabsIndex == 1 ? alltuikuanPrice.value : tuikuanPrice.value
}
if ( pageData.tabsIndex == 2 && params.refundAmount > orderDetail.info.payAmount){
return infoBox.showToast('退款金额不能大于付款金额!')
return uni.$utils.showToast('退款金额不能大于付款金额!')
}
if( uni.getStorageSync("shopInfo").isReturnPwd == 1){
refundPopup.value.open(params.refundAmount, refundPost);
return;
}
refundPost()
}
async function refundPost (payPassword) {
if( payPassword ){
params.pwd = payPassword
}
await refundOrder(params)
infoBox.showToast('退款请求提交成功')
uni.$utils.showToast('退款请求提交成功')
setTimeout(()=>{
uni.navigateBack({delta:1})
},500)