完善小程序

This commit is contained in:
wwz
2025-03-18 18:29:34 +08:00
parent fc957feb72
commit 9da31e2faa
19 changed files with 594 additions and 352 deletions

View File

@@ -2,13 +2,13 @@
<view class="integral-modal" v-if="visible">
<view class="modal-mask" @click="closeModal"></view>
<view class="modal-content">
<view class="input-wrapper">
<view class="input-wrapper" style="padding-bottom: 100px;">
<input type="number" v-model="inputValue" :min="minValue" :max="maxValue" @input="handleInput"
:placeholder="instructions" />
</view>
<!-- <view class="instructions">{{ instructions }}</view> -->
<up-button type="primary" @click="confirmIntegral" text="确定"></up-button>
<button style="margin-top: 20rpx;" @click="IntegralInputclose">取消</button>
<up-button style="margin-top: 20rpx;" @click="IntegralInputclose">取消</up-button>
</view>
</view>
</template>
@@ -72,7 +72,6 @@
// 确认积分并返回值给父组件
const confirmIntegral = () => {
console.log(inputValue.value, 444)
if (inputValue.value < props.minValue || inputValue.value > props.maxValue) {
uni.showToast({
title: '输入的积分值不在有效范围内',
@@ -138,7 +137,7 @@
justify-content: center;
align-items: center;
background-color: #fff;
padding: 20px;
padding: 20rpx 20rpx;
box-sizing: border-box;
border-top-left-radius: 10px;
border-top-right-radius: 10px;

View File

@@ -94,7 +94,7 @@
<view class="val">
<view></view>
<view style="font-size: 28rpx;"></view>
<view>{{listinfo.packFee}}</view>
<view>{{listinfo.packFeess}}</view>
</view>
</view>
@@ -295,7 +295,17 @@
},
listinfo: {
type: Object
type: Object,
default: {
combinedArray: {},
Productroll: 0,
coupondiscountAmount: 0,
couponInfoList: '',
pointsDiscountAmount: 0,
packFeess: 0,
totalPrices: 0,
Seatcharge: 0
}
},
orderVIP: {
@@ -359,6 +369,7 @@
})
break;
case 'points':
IntegralInputclose()
if (calcUsablePointsData.usable == 0) {
uni.showToast({
title: calcUsablePointsData.unusableReason,
@@ -384,7 +395,7 @@
calcUsablePointsData.integral = integral
props.listinfo.pointsDiscountAmount = await APImemberPointscalcDeductionAmount({
points: integral,
userId: props.orderVIP.id,
shopUserId: props.orderVIP.id,
orderAmount: props.listinfo.totalCost
})
emits('clickPointsamount', props.listinfo.pointsDiscountAmount);

View File

@@ -8,7 +8,7 @@
<view class="containertopboxitemleft_one" v-if="Orderinfo.typeOrder == 1"
:class="Orderinfo.typeOrder == 1 ?'':'containertopboxitemleft_ones'">
<block v-if="item.type == 2">
<text>{{item.num || 0}}</text>
<text>1</text>
<text style="font-size: 28rpx;margin-left: 6rpx;"></text>
</block>
<block v-else>

View File

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

View File

@@ -71,7 +71,7 @@
</view>
</view>
<view class="shop-amount">
<text class="orderAmount">{{item.orderAmount}}</text>
<text class="orderAmount">{{item.status == 'unpaid'?item.originAmount:item.orderAmount}}</text>
<text class="totalNumber">{{item.goods.length}}</text>
</view>
</view>