功能完善
This commit is contained in:
@@ -111,7 +111,7 @@
|
|||||||
:merchant_name='buildSqbParams.merchant_name'
|
:merchant_name='buildSqbParams.merchant_name'
|
||||||
:notify_url='buildSqbParams.notify_url'
|
:notify_url='buildSqbParams.notify_url'
|
||||||
:sign='buildSqbParams.sign'>
|
:sign='buildSqbParams.sign'>
|
||||||
<button class='confirm-order' @click='payment'>确认订单</button>
|
<button class='confirm-order' @click='createOrder'>确认订单</button>
|
||||||
</sqb-pay>
|
</sqb-pay>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -146,6 +146,7 @@ const orderBean = ref<OrderBean>();
|
|||||||
|
|
||||||
onLoad((e) => {
|
onLoad((e) => {
|
||||||
orderBean.value = JSON.parse(decodeURIComponent(e?.orderBean));
|
orderBean.value = JSON.parse(decodeURIComponent(e?.orderBean));
|
||||||
|
createOrder();
|
||||||
});
|
});
|
||||||
|
|
||||||
const buildSqbParams = computed(() => {
|
const buildSqbParams = computed(() => {
|
||||||
@@ -178,18 +179,18 @@ const confirmCoupon = (item: CouponBean) => {
|
|||||||
checkedCoupon.value = item;
|
checkedCoupon.value = item;
|
||||||
};
|
};
|
||||||
const navigateTo = (e: any) => {
|
const navigateTo = (e: any) => {
|
||||||
console.log('--------------_>>>>>>navigateTo ', e);
|
|
||||||
handlePayResult(orderBean.value?.id, e, {
|
handlePayResult(orderBean.value?.id, e, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
// pay({
|
console.log('pay success');
|
||||||
// 'orderId': orderBean.value?.order.id,
|
payment();
|
||||||
// 'result': 'xxx'
|
},
|
||||||
// });
|
onFailure: () => {
|
||||||
|
console.error('pay onFailure');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const payment = async () => {
|
const createOrder = async () => {
|
||||||
await uni.showLoading();
|
await uni.showLoading();
|
||||||
const params = {
|
const params = {
|
||||||
// 'discount': 0,
|
// 'discount': 0,
|
||||||
@@ -200,7 +201,7 @@ const payment = async () => {
|
|||||||
// 'allowIntegral': 0,
|
// 'allowIntegral': 0,
|
||||||
// 'produceIntegralNumber': 0,
|
// 'produceIntegralNumber': 0,
|
||||||
'remark': orderBean.value?.remark,
|
'remark': orderBean.value?.remark,
|
||||||
'address': JSON.stringify(deliveryAddress.value),
|
// 'address': JSON.stringify(deliveryAddress.value),
|
||||||
'orderGoods': orderBean?.value?.orderGoods?.map(item => (
|
'orderGoods': orderBean?.value?.orderGoods?.map(item => (
|
||||||
{
|
{
|
||||||
'goodsId': item.id,
|
'goodsId': item.id,
|
||||||
@@ -217,12 +218,14 @@ const payment = async () => {
|
|||||||
}
|
}
|
||||||
))
|
))
|
||||||
};
|
};
|
||||||
console.log('----------->>>>>params ', buildSqbParams.value);
|
|
||||||
|
|
||||||
const result = await orderCreate(params);
|
const result = await orderCreate(params);
|
||||||
orderBean.value!.id = result.id;
|
orderBean.value!.id = result.id;
|
||||||
|
uni.hideLoading();
|
||||||
|
};
|
||||||
|
|
||||||
|
const payment = async () => {
|
||||||
|
await uni.showLoading();
|
||||||
const paymentList = await getPaymentList(orderBean.value?.id || '');
|
const paymentList = await getPaymentList(orderBean.value?.id || '');
|
||||||
console.log('----------->>>>>orderBean.value ', orderBean.value);
|
|
||||||
const paymentParams = {
|
const paymentParams = {
|
||||||
orderId: orderBean?.value?.id,
|
orderId: orderBean?.value?.id,
|
||||||
produceIntegralNumber: Math.round((orderBean?.value?.totalPrice || 0) + (orderBean?.value?.useGold || 0)),
|
produceIntegralNumber: Math.round((orderBean?.value?.totalPrice || 0) + (orderBean?.value?.useGold || 0)),
|
||||||
@@ -238,7 +241,6 @@ const payment = async () => {
|
|||||||
};
|
};
|
||||||
await overPayment(paymentParams);
|
await overPayment(paymentParams);
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@@ -37,7 +37,7 @@
|
|||||||
:merchant_name='buildSqbParams.merchant_name'
|
:merchant_name='buildSqbParams.merchant_name'
|
||||||
:notify_url='buildSqbParams.notify_url'
|
:notify_url='buildSqbParams.notify_url'
|
||||||
:sign='buildSqbParams.sign'>
|
:sign='buildSqbParams.sign'>
|
||||||
<button class='primary-button' @click='goRecharge'>充值</button>
|
<button class='primary-button'>充值</button>
|
||||||
</sqb-pay>
|
</sqb-pay>
|
||||||
<!-- </payment-button>-->
|
<!-- </payment-button>-->
|
||||||
</view>
|
</view>
|
||||||
@@ -68,7 +68,7 @@ const preRechargeOrderId = ref();
|
|||||||
onLoad(async () => {
|
onLoad(async () => {
|
||||||
const { ruleitems } = await getRechargeList();
|
const { ruleitems } = await getRechargeList();
|
||||||
rechargeItems.value = ruleitems;
|
rechargeItems.value = ruleitems;
|
||||||
change(0);
|
await change(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
const change = async (index: number) => {
|
const change = async (index: number) => {
|
||||||
@@ -96,10 +96,17 @@ const buildSqbParams = computed(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const navigateTo = (e: any) => {
|
const navigateTo = (e: any) => {
|
||||||
console.log('--------------_>>>>>>navigateTo ', e);
|
|
||||||
handlePayResult(preRechargeOrderId.value, e, {
|
handlePayResult(preRechargeOrderId.value, e, {
|
||||||
onSuccess: () => {
|
onSuccess: async () => {
|
||||||
console.log('---------->>> recharge success ');
|
console.log('---------->>> recharge success ');
|
||||||
|
await goRecharge();
|
||||||
|
await userState.setUserInfo({
|
||||||
|
...userInfo.value,
|
||||||
|
balance: Number(userInfo.value.balance) + Number(rechargeItems.value[currentIndex.value].rechargeamount) + Number(rechargeItems.value[currentIndex.value]?.rewardamount)
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onFailure: () => {
|
||||||
|
console.log('---------->>> recharge failure ');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -109,7 +116,7 @@ const goRecharge = async () => {
|
|||||||
const result = await recharge({
|
const result = await recharge({
|
||||||
itemid: rechargeItems.value[currentIndex.value].itemid
|
itemid: rechargeItems.value[currentIndex.value].itemid
|
||||||
});
|
});
|
||||||
console.log('---------->>> recharge result ', result);
|
console.log('platform recharge result ', result);
|
||||||
|
|
||||||
await rechargeVerify({
|
await rechargeVerify({
|
||||||
payid: preRechargeOrderId.value
|
payid: preRechargeOrderId.value
|
||||||
|
Reference in New Issue
Block a user