订单详情完善
This commit is contained in:
@@ -1,17 +1,19 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<view class="headStatus"
|
||||
v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'||listinfo.status=='closed'">
|
||||
<view class="headStatus">
|
||||
<view class="status">
|
||||
<up-icon name="checkmark-circle-fill" color="#03C061" size="23"></up-icon>
|
||||
<view class="statusName" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">
|
||||
待支付
|
||||
</view>
|
||||
<view class="statusName" v-if="listinfo.status=='closed'">已完成</view>
|
||||
<up-icon v-if="listinfo.status =='done'||listinfo.status =='unpaid'" name="checkmark-circle-fill"
|
||||
color="#03C061" size="23"></up-icon>
|
||||
<view class="statusName" v-if="listinfo.status == 'unpaid'">待支付</view>
|
||||
<view class="statusName" v-if="listinfo.status=='done'">已完成</view>
|
||||
<view class="statusName" v-if="listinfo.status=='refund'">退单</view>
|
||||
<view class="statusName" v-if="listinfo.status=='part-refund'">部分退单</view>
|
||||
<view class="statusName" v-if="listinfo.status=='cancelled'">取消订单</view>
|
||||
</view>
|
||||
<view class="time" v-if="listinfo.createTime">下单时间:{{ listinfo.createTime }}</view>
|
||||
<view class="time" v-if="listinfo.paidTime && (listinfo.status!='cancelled' ||listinfo.status!='unpaid')">
|
||||
付款时间:{{listinfo.paidTime}}
|
||||
</view>
|
||||
<view class="time" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">
|
||||
下单时间:{{ listinfo.createTime }}</view>
|
||||
<view class="time" v-if="listinfo.status=='closed'">付款时间:{{listinfo.paidTime}}</view>
|
||||
</view>
|
||||
|
||||
<view class="wxQrcode" v-if="shopQrcode">
|
||||
@@ -33,7 +35,8 @@
|
||||
|
||||
<!-- 先下单后支付 -->
|
||||
<orderInfoAfter ref="orderInfoAfterRef" :rechargeFreeChecked="rechargeFreeChecked" :freeCheck="freeCheck"
|
||||
:listinfo="listinfo" :orderVIP="orderVIP" :ordershopUserInfo='ordershopUserInfo' @istype="istype">
|
||||
:listinfo="listinfo" :orderVIP="orderVIP" :ordershopUserInfo='ordershopUserInfo' @istype="istype"
|
||||
@clickPointsamount='clickPointsamount'>
|
||||
</orderInfoAfter>
|
||||
|
||||
<!-- 先支付后下单 -->
|
||||
@@ -60,7 +63,8 @@
|
||||
</block> -->
|
||||
|
||||
<!-- 支付方式 -->
|
||||
<paymentMethodes ref="paymentMethodref" :orderVIP="orderVIP" @groupChange="groupChange">
|
||||
<paymentMethodes ref="paymentMethodref" :orderVIP="orderVIP" @groupChange="groupChange"
|
||||
v-if="listinfo.status == 'unpaid'">
|
||||
</paymentMethodes>
|
||||
<!-- <paymentMethodes ref="paymentMethodes" :rechargeFreeChecked="rechargeFreeChecked"
|
||||
v-if="orderVIP&&listinfo.status == 'unpaid' || listinfo.status == 'paying'" :freeCheck="freeCheck"
|
||||
@@ -81,7 +85,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view style="width: 100%;height: 200rpx;"> </view>
|
||||
<payPassword :isShow="ispws" @inputComplete="accountPayevent" @close="ispws = false" />
|
||||
<payPassword ref="payPasswordref" :isShow="ispws" @inputComplete="accountPayevent" @close="ispws = false" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -103,6 +107,11 @@
|
||||
APIshopUserInfo
|
||||
} from '@/common/api/member.js'
|
||||
|
||||
import {
|
||||
APImemberPointsmyPoints,
|
||||
APImemberPointscalcUsablePoints
|
||||
} from '@/common/api/shop/index.js'
|
||||
|
||||
import {
|
||||
useCartStore
|
||||
} from '@/stores/order.js';
|
||||
@@ -144,8 +153,9 @@
|
||||
const listinfo = reactive({
|
||||
combinedArray: {},
|
||||
Productroll: 0,
|
||||
coupondiscountAmount: "",
|
||||
couponInfoList: ''
|
||||
coupondiscountAmount: 0,
|
||||
couponInfoList: '',
|
||||
pointsDiscountAmount: 0
|
||||
})
|
||||
|
||||
// 会员信息
|
||||
@@ -213,13 +223,15 @@
|
||||
0 ? listinfo.Seatcharge : 0);
|
||||
listinfo.originAmount = Math.round(sum * 100) / 100;
|
||||
|
||||
// 打包费packFee 计算购物车商品费用totalPrices 餐位费Seatcharge 商品卷Productroll 优惠卷coupondiscountAmount
|
||||
// 打包费packFee 计算购物车商品费用totalPrices 餐位费Seatcharge 商品卷Productroll 优惠卷coupondiscountAmount 积分listinfo.pointsDiscountAmount
|
||||
let sums = (is_type.value != 0 ? listinfo.packFee : 0) + listinfo.totalPrices + (is_type.value ==
|
||||
0 ? listinfo.Seatcharge : 0) - (listinfo.Productroll || 0) - (listinfo
|
||||
.coupondiscountAmount || 0);
|
||||
.coupondiscountAmount || 0) - (listinfo.pointsDiscountAmount || 0);
|
||||
listinfo.totalCost = Math.round(sums * 100) / 100;
|
||||
console.log(listinfo.totalCost)
|
||||
// totalCost.value = Math.round(sums * 100) / 100;
|
||||
// 积分
|
||||
if (listinfo.totalCost) {
|
||||
await memberPointscalcUsablePoints()
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -263,13 +275,23 @@
|
||||
|
||||
// 这是优惠卷传的值
|
||||
const handleReturnData = async (data) => {
|
||||
console.log(data)
|
||||
// 这是优惠卷
|
||||
if (data.typeOrder == 1) {
|
||||
// 优惠卷减去的金额
|
||||
listinfo.coupondiscountAmount = data.item.discountAmount
|
||||
uniqueIds.value.push(data.item.id)
|
||||
orderInfoAfterRef.value.dataprocessing(data)
|
||||
if (data.item) {
|
||||
// 优惠卷减去的金额
|
||||
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
|
||||
uniqueIds.value = [...uniqueIds.value, ...new Set(data.map(item => item.id))]
|
||||
@@ -295,7 +317,7 @@
|
||||
orderId: orderId.value,
|
||||
vipPrice: orderVIP.value.isVip == 1 && ordershopUserInfo.value.isMemberPrice == 1 ? 1 :
|
||||
0, //是否使用会员价0否1是
|
||||
allPack: is_type.value == 0 ? 0 : 1, //是否整单打包
|
||||
userAllPack: is_type.value == 0 ? 0 : 1, //是否整单打包
|
||||
seatNum: is_type.value == 0 ? listinfo.seatNum : 0, //用餐人数
|
||||
originAmount: listinfo.originAmount, //订单原金额(包含打包费+餐位费) 不含折扣价格
|
||||
discountRatio: 1, //折扣比例(计算时 向上取整保留 两位小数) 写死1
|
||||
@@ -305,7 +327,7 @@
|
||||
couponList: uniqueIds.value, //用户使用的卡券
|
||||
orderAmount: listinfo.totalCost, // 最中订单金额
|
||||
roundAmount: 0, //抹零金额 减免多少钱
|
||||
pointsDiscountAmount: 0, //积分抵扣金额(tb_points_basic_setting表)
|
||||
pointsDiscountAmount: listinfo.pointsDiscountAmount, //积分抵扣金额(tb_points_basic_setting表)
|
||||
pointsNum: 0, //(扣除各类折扣 enable_deduction后使用)
|
||||
remark: '', //用户备注
|
||||
}
|
||||
@@ -317,22 +339,68 @@
|
||||
})
|
||||
if (res) {
|
||||
await orderorderInfo()
|
||||
// uni.redirectTo({
|
||||
// url: '/order/detail?orderId=' + res.id
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
//002-获取订单可用积分及抵扣金额(支付页面使用)
|
||||
const memberPointscalcUsablePoints = async () => {
|
||||
let res = await APImemberPointscalcUsablePoints({
|
||||
userId: orderVIP.value.id,
|
||||
orderAmount: listinfo.totalCost,
|
||||
})
|
||||
orderInfoAfterRef.value.getCalcUsablePoints(res)
|
||||
}
|
||||
|
||||
//
|
||||
const clickPointsamount = (Pointsamount) => {
|
||||
listinfo.pointsDiscountAmount = Pointsamount
|
||||
}
|
||||
|
||||
const payPasswordref = ref(null)
|
||||
// 余额支付
|
||||
const accountPayevent = async (pwd) => {
|
||||
console.log('输入的密码是:', pwd);
|
||||
ispws.value = false;
|
||||
let checkOrderPay = {
|
||||
userId: uni.cache.get('userInfo').id,
|
||||
orderId: orderId.value,
|
||||
vipPrice: orderVIP.value.isVip == 1 && ordershopUserInfo.value.isMemberPrice == 1 ? 1 :
|
||||
0, //是否使用会员价0否1是
|
||||
userAllPack: is_type.value == 0 ? 0 : 1, //是否整单打包
|
||||
seatNum: is_type.value == 0 ? listinfo.seatNum : 0, //用餐人数
|
||||
originAmount: listinfo.originAmount, //订单原金额(包含打包费+餐位费) 不含折扣价格
|
||||
discountRatio: 1, //折扣比例(计算时 向上取整保留 两位小数) 写死1
|
||||
discountAmount: 0, //手动优惠金额 写死0
|
||||
productCouponDiscountAmount: listinfo.Productroll, //商品优惠券抵扣金额
|
||||
fullCouponDiscountAmount: listinfo.coupondiscountAmount, //满减优惠券抵扣金额
|
||||
couponList: uniqueIds.value, //用户使用的卡券
|
||||
orderAmount: listinfo.totalCost, // 最中订单金额
|
||||
roundAmount: 0, //抹零金额 减免多少钱
|
||||
pointsDiscountAmount: listinfo.pointsDiscountAmount, //积分抵扣金额(tb_points_basic_setting表)
|
||||
pointsNum: 0, //(扣除各类折扣 enable_deduction后使用)
|
||||
remark: '', //用户备注
|
||||
}
|
||||
try {
|
||||
let res = await storeMemberpay.balancePayOrder({
|
||||
checkOrderPay,
|
||||
payType: paymentmethod.payType,
|
||||
pwd: pwd,
|
||||
shopUserId: orderVIP.value.id,
|
||||
buyerRemark: '',
|
||||
returnUrl: ''
|
||||
})
|
||||
await orderorderInfo()
|
||||
} catch (error) {
|
||||
//TODO handle the exception
|
||||
}
|
||||
payPasswordref.value.closeModal()
|
||||
}
|
||||
|
||||
onUnmounted(() => {
|
||||
uni.$off('returnData', handleReturnData);
|
||||
});
|
||||
|
||||
|
||||
onMounted(async () => {
|
||||
// 获取当前页面栈
|
||||
const pages = getCurrentPages();
|
||||
|
||||
Reference in New Issue
Block a user