【新增】订单:积分选择

pull/68/head
puhui999 2024-08-07 17:36:29 +08:00
parent aaad12c50e
commit a2dec947a2
1 changed files with 25 additions and 6 deletions

View File

@ -41,17 +41,25 @@
</view> </view>
</view> </view>
<!-- TODO 芋艿接入积分 --> <!-- TODO 芋艿接入积分 -->
<!-- TODO puhui999: v-if="state.orderInfo.type === 0 && state.orderPayload.order_type === 'normal'" -->
<!-- TODO puhui999: 没有搞懂 order_type orderInfo.type 的区别和作用暂时不考虑 order_type 条件-->
<view <view
class="order-item ss-flex ss-col-center ss-row-between" class="order-item ss-flex ss-col-center ss-row-between"
v-if="state.orderPayload.order_type === 'score'" v-if="state.orderInfo.type === 0"
> >
<view class="item-title">扣除积分</view> <view class="item-title">积分抵扣</view>
<view class="ss-flex ss-col-center"> <view class="ss-flex ss-col-center">
{{ state.pointStatus ? '剩余积分' : '当前积分' }}
<image <image
:src="sheep.$url.static('/static/img/shop/goods/score1.svg')" :src="sheep.$url.static('/static/img/shop/goods/score1.svg')"
class="score-img" class="score-img"
/> />
<text class="item-value ss-m-r-24">{{ state.orderInfo.score_amount }}</text> <text class="item-value ss-m-r-24">
{{ state.pointStatus ? state.orderInfo.totalPoint - state.orderInfo.usePoint : (state.orderInfo.totalPoint || 0) }}
</text>
<checkbox-group @change="changeIntegral">
<checkbox :checked='state.pointStatus' :disabled="!state.orderInfo.totalPoint || state.orderInfo.totalPoint <= 0" />
</checkbox-group>
</view> </view>
</view> </view>
<view class="order-item ss-flex ss-col-center ss-row-between" v-if='addressState.deliveryType === 1'> <view class="order-item ss-flex ss-col-center ss-row-between" v-if='addressState.deliveryType === 1'>
@ -195,6 +203,8 @@
showCoupon: false, // showCoupon: false, //
couponInfo: [], // couponInfo: [], //
showDiscount: false, // showDiscount: false, //
// ========== ==========
pointStatus: false, //使
}); });
const addressState = ref({ const addressState = ref({
@ -206,6 +216,15 @@
receiverMobile: '', // receiverMobile: '', //
}); });
// ========== ==========
/**
* 使用积分抵扣
*/
const changeIntegral = async () => {
state.pointStatus = !state.pointStatus;
await getOrderInfo();
};
// //
async function onSelectCoupon(couponId) { async function onSelectCoupon(couponId) {
state.orderPayload.couponId = couponId || 0; state.orderPayload.couponId = couponId || 0;
@ -251,7 +270,7 @@
pickUpStoreId: addressState.value.pickUpInfo.id,// pickUpStoreId: addressState.value.pickUpInfo.id,//
receiverName: addressState.value.receiverName,// receiverName: addressState.value.receiverName,//
receiverMobile: addressState.value.receiverMobile,// receiverMobile: addressState.value.receiverMobile,//
pointStatus: false, // TODO pointStatus: state.pointStatus,
combinationActivityId: state.orderPayload.combinationActivityId, combinationActivityId: state.orderPayload.combinationActivityId,
combinationHeadId: state.orderPayload.combinationHeadId, combinationHeadId: state.orderPayload.combinationHeadId,
seckillActivityId: state.orderPayload.seckillActivityId, seckillActivityId: state.orderPayload.seckillActivityId,
@ -281,10 +300,10 @@
pickUpStoreId: addressState.value.pickUpInfo.id,// pickUpStoreId: addressState.value.pickUpInfo.id,//
receiverName: addressState.value.receiverName,// receiverName: addressState.value.receiverName,//
receiverMobile: addressState.value.receiverMobile,// receiverMobile: addressState.value.receiverMobile,//
pointStatus: false, // TODO pointStatus: state.pointStatus,
combinationActivityId: state.orderPayload.combinationActivityId, combinationActivityId: state.orderPayload.combinationActivityId,
combinationHeadId: state.orderPayload.combinationHeadId, combinationHeadId: state.orderPayload.combinationHeadId,
seckillActivityId: state.orderPayload.seckillActivityId seckillActivityId: state.orderPayload.seckillActivityId,
}); });
if (code !== 0) { if (code !== 0) {
return; return;