完善小程序
This commit is contained in:
@@ -123,6 +123,11 @@
|
||||
|
||||
const storeMemberpay = Memberpay();
|
||||
|
||||
import {
|
||||
productStore
|
||||
} from '@/stores/user.js';
|
||||
const storeuser = productStore();
|
||||
|
||||
import payPassword from '@/components/payPassword.vue'
|
||||
import orderInfoAfter from './components/orderInfoAfter.vue'
|
||||
// import orderInfoBefore from '../components/orderInfoBefore.vue'
|
||||
@@ -136,9 +141,7 @@
|
||||
const ispws = ref(false)
|
||||
|
||||
// 商品订单会员
|
||||
const ordershopUserInfo = ref({
|
||||
isTableFee: 0
|
||||
})
|
||||
const ordershopUserInfo = ref(uni.cache.get('ordershopUserInfo'))
|
||||
|
||||
// 是否显示商家二维码信息
|
||||
try {
|
||||
@@ -155,15 +158,14 @@
|
||||
combinedArray: {},
|
||||
Productroll: 0,
|
||||
coupondiscountAmount: 0,
|
||||
couponInfoList: '',
|
||||
pointsDiscountAmount: 0,
|
||||
packFee: 0,
|
||||
packFeess: 0,
|
||||
totalPrices: 0,
|
||||
Seatcharge: 0
|
||||
})
|
||||
|
||||
// 会员信息
|
||||
const orderVIP = ref()
|
||||
const orderVIP = ref(uni.cache.get('orderVIP'))
|
||||
|
||||
//判断是否是打包商品
|
||||
const is_type = ref(0)
|
||||
@@ -190,9 +192,6 @@
|
||||
orderId: orderId.value
|
||||
})
|
||||
} catch (error) {}
|
||||
// if (listinfo.couponInfoList) {
|
||||
// listinfo.couponInfoList = JSON.parse(listinfo.couponInfoList)
|
||||
// }
|
||||
}
|
||||
// 历史订单
|
||||
if (listinfo.detailMap) {
|
||||
@@ -204,7 +203,7 @@
|
||||
}
|
||||
}
|
||||
listinfo.combinedArray = combinedArray
|
||||
listinfo.packFee = await cartStore.getTotalPackFee(listinfo.combinedArray)
|
||||
listinfo.packFeess = await cartStore.getTotalPackFee(listinfo.combinedArray)
|
||||
// 计算购物车商品费用
|
||||
listinfo.totalPrices = await cartStore.getTotalTotalPrices(listinfo
|
||||
.combinedArray)
|
||||
@@ -231,24 +230,24 @@
|
||||
watchEffect(async () => {
|
||||
if (listinfo.combinedArray.length > 0) {
|
||||
//总价格
|
||||
// console.log(listinfo.combinedArray, listinfo.packFee, listinfo.totalPrices, listinfo.Seatcharge,
|
||||
// console.log(listinfo.combinedArray, listinfo.packFeess, listinfo.totalPrices, listinfo.Seatcharge,
|
||||
// listinfo.Productroll, listinfo.coupondiscountAmount)
|
||||
// 打包费packFee 计算购物车商品费用totalPrices 餐位费Seatcharge
|
||||
// 打包费packFeess 计算购物车商品费用totalPrices 餐位费Seatcharge
|
||||
try {
|
||||
let sum = (is_type.value != 0 ? listinfo.packFee : 0) + listinfo.totalPrices + (is_type
|
||||
let sum = (is_type.value != 0 ? listinfo.packFeess : 0) + listinfo.totalPrices + (is_type
|
||||
.value ==
|
||||
0 ? listinfo.Seatcharge : 0);
|
||||
listinfo.originAmount = Math.round(sum * 100) / 100;
|
||||
|
||||
// 打包费packFee 计算购物车商品费用totalPrices 餐位费Seatcharge 商品卷Productroll 优惠卷coupondiscountAmount 积分listinfo.pointsDiscountAmount
|
||||
let sums = (is_type.value != 0 ? listinfo.packFee : 0) + listinfo.totalPrices + (is_type
|
||||
// 打包费packFeess 计算购物车商品费用totalPrices 餐位费Seatcharge 商品卷Productroll 优惠卷coupondiscountAmount 积分listinfo.pointsDiscountAmount
|
||||
let sums = (is_type.value != 0 ? listinfo.packFeess : 0) + listinfo.totalPrices + (is_type
|
||||
.value ==
|
||||
0 ? listinfo.Seatcharge : 0) - (listinfo.Productroll || 0) - (listinfo
|
||||
.coupondiscountAmount || 0) - (listinfo.pointsDiscountAmount || 0);
|
||||
listinfo.totalCost = Math.round(sums * 100) / 100;
|
||||
// 积分
|
||||
if (listinfo.totalCost && listinfo.status == 'unpaid') {
|
||||
uni.$u.debounce(await memberPointscalcUsablePoints(), 500)
|
||||
uni.$u.debounce(memberPointscalcUsablePoints, 500)
|
||||
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -271,9 +270,9 @@
|
||||
|
||||
// 支付方式切换
|
||||
const paymentmethod = reactive({
|
||||
radiovalue: 1,
|
||||
paymentBtnText: "余额支付",
|
||||
payType: 'accountPay'
|
||||
radiovalue: 2,
|
||||
paymentBtnText: "微信支付",
|
||||
payType: 'wechatPay'
|
||||
})
|
||||
|
||||
const groupChange = async (e) => {
|
||||
@@ -349,7 +348,21 @@
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
} else if (orderVIP.value.payPwd == '') {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您还未设置支付密码,是否去设置?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.pro.navigateTo('user/member/setPassword', {
|
||||
shopId: orderVIP.value.shopId,
|
||||
type: 'detail'
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
ispws.value = true
|
||||
@@ -374,19 +387,23 @@
|
||||
pointsNum: 0, //(扣除各类折扣 enable_deduction后使用)
|
||||
remark: '', //用户备注
|
||||
}
|
||||
let res = await storeMemberpay.actionsltPayOrder({
|
||||
checkOrderPay,
|
||||
payType: paymentmethod.payType,
|
||||
buyerRemark: '',
|
||||
returnUrl: ''
|
||||
})
|
||||
await orderorderInfo()
|
||||
try {
|
||||
await storeMemberpay.actionsltPayOrder({
|
||||
checkOrderPay,
|
||||
payType: paymentmethod.payType,
|
||||
buyerRemark: '',
|
||||
returnUrl: ''
|
||||
})
|
||||
} catch (error) {
|
||||
//TODO handle the exception
|
||||
}
|
||||
orderorderInfo()
|
||||
}
|
||||
|
||||
//002-获取订单可用积分及抵扣金额(支付页面使用)
|
||||
const memberPointscalcUsablePoints = async () => {
|
||||
let res = await APImemberPointscalcUsablePoints({
|
||||
userId: orderVIP.value.id,
|
||||
shopUserId: orderVIP.value.id,
|
||||
orderAmount: listinfo.totalCost,
|
||||
})
|
||||
orderInfoAfterRef.value.getCalcUsablePoints(res)
|
||||
@@ -433,7 +450,7 @@
|
||||
} catch (error) {
|
||||
//TODO handle the exception
|
||||
}
|
||||
await orderorderInfo()
|
||||
orderorderInfo()
|
||||
}
|
||||
|
||||
onUnmounted(() => {
|
||||
@@ -453,14 +470,19 @@
|
||||
// 每次进来全局更新shopId
|
||||
uni.cache.set('shopId', options.shopId, 30)
|
||||
uni.$on('returnData', handleReturnData);
|
||||
// let res = await APIshopUserInfo({
|
||||
// shopId: options.shopId
|
||||
// })
|
||||
// uni.cache.set('orderVIP', res)
|
||||
// uni.cache.set('ordershopUserInfo', res.shopInfo)
|
||||
// orderVIP.value = res
|
||||
// ordershopUserInfo.value = res.shopInfo
|
||||
}
|
||||
try {
|
||||
// * 获取会员信息
|
||||
let res = await APIshopUserInfo({
|
||||
shopId: options.shopId
|
||||
})
|
||||
uni.cache.set('orderVIP', res)
|
||||
uni.cache.set('ordershopUserInfo', res.shopInfo)
|
||||
orderVIP.value = res
|
||||
ordershopUserInfo.value = res.shopInfo
|
||||
await storeuser.actionsproductqueryProduct()
|
||||
} catch (error) {
|
||||
//TODO handle the exception
|
||||
}
|
||||
orderorderInfo()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user