完成订单详情

This commit is contained in:
wwz
2025-03-13 09:15:51 +08:00
parent 7dde4ed754
commit e6ca187e5a
14 changed files with 219 additions and 176 deletions

View File

@@ -4,9 +4,9 @@
<view class="modal-content">
<view class="input-wrapper">
<input type="number" v-model="inputValue" :min="minValue" :max="maxValue" @input="handleInput"
placeholder="请输入积分" />
:placeholder="instructions" />
</view>
<view class="instructions">{{ instructions }}</view>
<!-- <view class="instructions">{{ instructions }}</view> -->
<up-button type="primary" @click="confirmIntegral" text="确定"></up-button>
<button style="margin-top: 20rpx;" @click="IntegralInputclose">取消</button>
</view>

View File

@@ -162,23 +162,13 @@
</view>
</block>
<block v-else>
<block v-for="(item,index) in listinfo.couponInfoList" :key="index">
<view class="cell-item" v-if="item.type == 1">
<view class="label">优惠券</view>
<view class="val">
<view></view>
<view style="font-size: 28rpx;">-</view>
<view>{{item.discountAmount}}</view>
</view>
</view>
</block>
<view class="cell-item column" v-if="listinfo.couponInfoList.length > 0">
<view class="label">商品券</view>
<view class="cell-item column" v-if="listinfo.discountInfo.length > 0">
<view class="label">优惠折扣</view>
<view class="val column">
<view class="productCoupon" v-for="(item,index) in listinfo.couponInfoList" :key="index">
<view class="productCoupon" v-for="(item,index) in listinfo.discountInfo" :key="index">
<view class="name">{{item.name}}</view>
<view class="num">X{{item.finalUseNum}}</view>
<view class="amount">-{{item.finalDiscountAmount}}</view>
<!-- <view class="num">{{item.amount}}</view> -->
<view class="amount" style="margin-left: 10rpx;">{{item.amount}}</view>
</view>
</view>
</view>
@@ -258,7 +248,7 @@
} from '@/common/api/shop/index.js'
// 定义自定义事件
const emits = defineEmits(['customevent', 'istype']);
const emits = defineEmits(['customevent', 'istype', 'learcoupons']);
// teb 切换送餐和打包
const tebtypeList = reactive([{
@@ -344,6 +334,8 @@
case 'coupon':
// 清空积分
IntegralInputclose()
favorablelist[1].value = ''
emits('learcoupons', 'coupon')
uni.pro.navigateTo('/pages/order/coupon', {
type: "confirm_order_coupon",
shopId: uni.cache.get('orderVIP').shopId,
@@ -356,8 +348,9 @@
// 清空积分
IntegralInputclose()
// 清空优惠卷
props.listinfo.coupondiscountAmount = 0
favorablelist[1].value = ''
favorablelist[0].value = ''
emits('learcoupons', 'product')
uni.pro.navigateTo('/pages/order/coupon', {
type: "confirm_order_product",
shopId: uni.cache.get('orderVIP').shopId,
@@ -369,7 +362,8 @@
case 'points':
if (calcUsablePointsData.usable == 0) {
uni.showToast({
title: '此次订单不可用积分!'
title: calcUsablePointsData.unusableReason,
icon: 'none'
})
return false;
}
@@ -672,7 +666,7 @@
.head {
display: flex;
justify-content: space-between;
padding: 32rpx 0;
// padding: 32rpx 0;
.head_left {
display: flex;

View File

@@ -33,10 +33,10 @@
<!-- #endif -->
</view>
<!-- 先下单后支付 -->
<!-- x详情 -->
<orderInfoAfter ref="orderInfoAfterRef" :rechargeFreeChecked="rechargeFreeChecked" :freeCheck="freeCheck"
:listinfo="listinfo" :orderVIP="orderVIP" :ordershopUserInfo='ordershopUserInfo' @istype="istype"
@clickPointsamount='clickPointsamount'>
@clickPointsamount='clickPointsamount' @learcoupons="learcoupons">
</orderInfoAfter>
<!-- 先支付后下单 -->
@@ -85,8 +85,7 @@
</view>
</view>
<view style="width: 100%;height: 200rpx;"> </view>
<payPassword ref="payPasswordref" :isShow="ispws" @inputComplete="accountPayevent"
:password='payPasswordPassword' @close="ispws = false" />
<payPassword ref="payPasswordref" :isShow="ispws" @inputComplete="accountPayevent" @close="ispws = false" />
</view>
</template>
@@ -159,7 +158,10 @@
Productroll: 0,
coupondiscountAmount: 0,
couponInfoList: '',
pointsDiscountAmount: 0
pointsDiscountAmount: 0,
packFee: 0,
totalPrices: 0,
Seatcharge: 0
})
// 会员信息
@@ -195,24 +197,40 @@
// }
}
// 历史订单
if (listinfo.detailMap) {
let combinedArray = [];
for (const key in listinfo.detailMap) {
if (listinfo.detailMap.hasOwnProperty(key)) {
let subArray = listinfo.detailMap[key];
combinedArray = [...combinedArray, ...subArray]
try {
// 历史订单
if (listinfo.detailMap) {
let combinedArray = [];
for (const key in listinfo.detailMap) {
if (listinfo.detailMap.hasOwnProperty(key)) {
let subArray = listinfo.detailMap[key];
combinedArray = [...combinedArray, ...subArray]
}
}
}
listinfo.combinedArray = combinedArray
setTimeout(async () => {
listinfo.combinedArray = combinedArray
listinfo.packFee = await cartStore.getTotalPackFee(listinfo.combinedArray)
// 计算购物车商品费用
listinfo.totalPrices = await cartStore.getTotalTotalPrices(listinfo.combinedArray)
listinfo.totalPrices = await cartStore.getTotalTotalPrices(listinfo
.combinedArray)
// 餐位费listinfo.seatNum
listinfo.Seatcharge = await cartStore.getTotalSeatcharge(listinfo.seatNum)
})
}
if (listinfo.discountInfo) {
const discountObj = JSON.parse(listinfo.discountInfo);
const tempArray = [];
for (const [key, value] of Object.entries(discountObj)) {
tempArray.push({
name: key,
amount: value
});
}
listinfo.discountInfo = tempArray;
console.log(tempArray)
}
} catch (e) {
}
}
}
@@ -220,8 +238,8 @@
watchEffect(async () => {
if (listinfo.combinedArray.length > 0) {
//总价格
console.log(listinfo.combinedArray, listinfo.packFee, listinfo.totalPrices, listinfo.Seatcharge,
listinfo.Productroll, listinfo.coupondiscountAmount)
// console.log(listinfo.combinedArray, listinfo.packFee, listinfo.totalPrices, listinfo.Seatcharge,
// listinfo.Productroll, listinfo.coupondiscountAmount)
// 打包费packFee 计算购物车商品费用totalPrices 餐位费Seatcharge
let sum = (is_type.value != 0 ? listinfo.packFee : 0) + listinfo.totalPrices + (is_type.value ==
0 ? listinfo.Seatcharge : 0);
@@ -234,7 +252,8 @@
listinfo.totalCost = Math.round(sums * 100) / 100;
// 积分
if (listinfo.totalCost && listinfo.status == 'unpaid') {
await memberPointscalcUsablePoints()
uni.$u.debounce(await memberPointscalcUsablePoints(), 500)
}
}
});
@@ -286,15 +305,6 @@
listinfo.coupondiscountAmount = data.item.discountAmount
uniqueIds.value.push(data.item.id)
orderInfoAfterRef.value.dataprocessing(data)
} else {
if (listinfo.coupondiscountAmount > 0) {
listinfo.coupondiscountAmount = 0
uniqueIds.value.pop()
orderInfoAfterRef.value.dataprocessing({
typeOrder: 1,
item: ''
})
}
}
} else {
// 筛选出商品卷的id
@@ -310,7 +320,17 @@
};
const payPasswordPassword = ref('')
const learcoupons = (data) => {
console.log('qing')
if (data == 'product') {
uniqueIds.value = [] // 筛选出商品卷的id
listinfo.coupondiscountAmount = 0 // 优惠卷减去的金额
listinfo.Productroll = 0 // 商品卷总价价格
} else {
uniqueIds.value = [] // 筛选出商品卷的id
listinfo.coupondiscountAmount = 0 // 优惠卷减去的金额
}
}
// * 去支付
const goToPay = async () => {
@@ -333,7 +353,6 @@
})
} else {
payPasswordPassword.value = ''
ispws.value = true
}
return false
@@ -362,9 +381,7 @@
buyerRemark: '',
returnUrl: ''
})
if (res) {
await orderorderInfo()
}
await orderorderInfo()
}
//002-获取订单可用积分及抵扣金额(支付页面使用)
@@ -414,11 +431,10 @@
buyerRemark: '',
returnUrl: ''
})
await orderorderInfo()
} catch (error) {
//TODO handle the exception
}
payPasswordPassword.value = ''
orderorderInfo()
}
onUnmounted(() => {
@@ -447,7 +463,7 @@
orderVIP.value = res
ordershopUserInfo.value = res.shopInfo
}
await orderorderInfo()
orderorderInfo()
})
</script>
@@ -549,7 +565,7 @@
.head {
display: flex;
justify-content: space-between;
padding: 50rpx 34rpx 32rpx 34rpx;
padding: 50rpx 0 32rpx 0;
border-bottom: 2rpx dashed #E3E3E3;
.head_left {
@@ -653,7 +669,7 @@
}
.item {
margin-bottom: 32rpx;
padding: 32rpx 0 !important;
display: flex;
.cover {}