修复购买微信团购券不到帐问题
This commit is contained in:
@@ -29,3 +29,5 @@ export const progress = (data: any) => post<any>({ url: 'wechat/coupons/group/pa
|
|||||||
|
|
||||||
export const pay = (data: any) => post<any>({ url: 'wechat/coupons/group/pay', data });
|
export const pay = (data: any) => post<any>({ url: 'wechat/coupons/group/pay', data });
|
||||||
|
|
||||||
|
export const couponPay = (data: any) => post<any>({ url: 'wechat/coupons/pay', data });
|
||||||
|
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
</swiper>
|
</swiper>
|
||||||
<view class='indicator'>
|
<view class='indicator'>
|
||||||
<text>{{ swiperIndex + 1 }}</text>
|
<text>{{ swiperIndex + 1 }}</text>
|
||||||
<text>/{{ bannerList.length }}</text>
|
<text>/{{ bannerList?.length || 0 }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class='countdown c-flex-row'>
|
<view class='countdown c-flex-row'>
|
||||||
@@ -112,7 +112,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 商品详情跟团记录 -->
|
<!-- 商品详情跟团记录 -->
|
||||||
<view class='card-view record-container' v-if='recordList&&recordList.length>0'>
|
<view class='card-view record-container' v-if='recordList&&(recordList?.length||0)>0'>
|
||||||
<text class='card-view-title'>跟团记录</text>
|
<text class='card-view-title'>跟团记录</text>
|
||||||
<u-list :list='recordList' :border='false' @scrolltolower='loadMore'>
|
<u-list :list='recordList' :border='false' @scrolltolower='loadMore'>
|
||||||
<u-list-item v-for='(item,index) in recordList' :key='index'>
|
<u-list-item v-for='(item,index) in recordList' :key='index'>
|
||||||
@@ -241,7 +241,7 @@ const isEnded = () => {
|
|||||||
const getStockColorCount = computed(() => {
|
const getStockColorCount = computed(() => {
|
||||||
const list = Array.from(new Set(groupBuyBean.value?.goods?.stocks?.map(item => item.colorName)))
|
const list = Array.from(new Set(groupBuyBean.value?.goods?.stocks?.map(item => item.colorName)))
|
||||||
.map(colorName => groupBuyBean.value?.goods?.stocks?.find(item => item.colorName === colorName)!);
|
.map(colorName => groupBuyBean.value?.goods?.stocks?.find(item => item.colorName === colorName)!);
|
||||||
return list.length;
|
return (list?.length)||0;
|
||||||
});
|
});
|
||||||
|
|
||||||
const fetchRecommendList = async () => {
|
const fetchRecommendList = async () => {
|
||||||
|
@@ -80,7 +80,7 @@ const buildSqbParams = computed(() => {
|
|||||||
|
|
||||||
const navigateTo = (e: any) => {
|
const navigateTo = (e: any) => {
|
||||||
handlePayResult(orderBean.value?.id, e, {
|
handlePayResult(orderBean.value?.id, e, {
|
||||||
onSuccess: () => {
|
onSuccess: (options:any) => {
|
||||||
showToast('支付成功', {
|
showToast('支付成功', {
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
complete: () => {
|
complete: () => {
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
<view class='content'>
|
<view class='content'>
|
||||||
<view class='card-view' style='justify-content: flex-start'>
|
<view class='card-view' style='justify-content: flex-start'>
|
||||||
<view class='c-flex-row' style='align-items: center;flex: 1'>
|
<view class='c-flex-row' style='align-items: center;flex: 1'>
|
||||||
<image class='goods-image' :src='imageList[0]||defaultImage' />
|
<image class='goods-image' :src='imageList?.length>0?imageList[0]:defaultImage' />
|
||||||
<view class='c-flex-column' style='margin-left: 10rpx;flex: 1'>
|
<view class='c-flex-column' style='margin-left: 10rpx;flex: 1'>
|
||||||
<text class='goods-name'>{{ groupBuyBean?.name || groupBuyBean?.title }}</text>
|
<text class='goods-name'>{{ groupBuyBean?.name || groupBuyBean?.title }}</text>
|
||||||
<text class='date'>{{ groupBuyBean?.startDate }}至{{ groupBuyBean?.endDate }}</text>
|
<text class='date'>{{ groupBuyBean?.startDate }}至{{ groupBuyBean?.endDate }}</text>
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang='ts' setup>
|
<script lang='ts' setup>
|
||||||
import { preOrder } from '@/api/groupbuy';
|
import { couponPay, preOrder } from '@/api/groupbuy';
|
||||||
import { OrderBean } from '@/api/order/types';
|
import { OrderBean } from '@/api/order/types';
|
||||||
import { parseParameter, showToast, sortASCII } from '@/utils';
|
import { parseParameter, showToast, sortASCII } from '@/utils';
|
||||||
import { hexMD5 } from '@/utils/common/md5';
|
import { hexMD5 } from '@/utils/common/md5';
|
||||||
@@ -67,10 +67,22 @@ const orderBean = ref<OrderBean>();
|
|||||||
const goodsCount = ref(1);
|
const goodsCount = ref(1);
|
||||||
|
|
||||||
onLoad((e: any) => {
|
onLoad((e: any) => {
|
||||||
|
getApp().globalData?.logger?.info('order-coupon-confirm ', e);
|
||||||
|
try {
|
||||||
groupBuyBean.value = JSON.parse(decodeURIComponent(e?.bean));
|
groupBuyBean.value = JSON.parse(decodeURIComponent(e?.bean));
|
||||||
|
getApp().globalData?.logger?.info('order-coupon-confirm: groupBuyBean', groupBuyBean.value);
|
||||||
|
if(groupBuyBean.value) {
|
||||||
imageList.value = groupBuyBean.value?.image?.split(',');
|
imageList.value = groupBuyBean.value?.image?.split(',');
|
||||||
|
getApp().globalData?.logger?.info('order-coupon-confirm: imageList', imageList.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
getApp().globalData?.logger?.info('order-coupon-confirm: userInfo', userInfo.value);
|
||||||
|
getApp().globalData?.logger?.info('order-coupon-confirm: terminalInfo', terminalInfo.value);
|
||||||
|
|
||||||
createOrder();
|
createOrder();
|
||||||
|
} catch (e) {
|
||||||
|
getApp().globalData?.logger?.error('order-coupon-confirm: exception ', e);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const countChange = (isPlus: boolean) => {
|
const countChange = (isPlus: boolean) => {
|
||||||
@@ -96,25 +108,33 @@ const buildSqbParams = computed(() => {
|
|||||||
client_sn: orderBean.value?.id || '',
|
client_sn: orderBean.value?.id || '',
|
||||||
return_url: '/pages/common/payresult/index',
|
return_url: '/pages/common/payresult/index',
|
||||||
total_amount: Number(((totalPrice.value || 0) * 100).toFixed(2)),
|
total_amount: Number(((totalPrice.value || 0) * 100).toFixed(2)),
|
||||||
terminal_sn: terminalInfo.value.terminalSn,
|
terminal_sn: terminalInfo.value?.terminalSn,
|
||||||
subject: '商品团购券',
|
subject: groupBuyBean.value?.name || '商品团购券',
|
||||||
subject_img: imageList.value[0] || '',
|
subject_img: (imageList.value?.length > 0 && imageList.value[0]) || '',
|
||||||
merchant_name: terminalInfo.value.companyName,
|
merchant_name: terminalInfo.value?.companyName,
|
||||||
notify_url: 'https://www.baidu.com'
|
notify_url: 'https://www.baidu.com'
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...params,
|
...params,
|
||||||
sign: hexMD5(parseParameter(params) + '&key=' + terminalInfo.value.terminalKey).toUpperCase()
|
sign: hexMD5(parseParameter(params) + '&key=' + terminalInfo.value?.terminalKey).toUpperCase()
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
const navigateTo = (e: any) => {
|
const navigateTo = (e: any) => {
|
||||||
handlePayResult(orderBean.value?.id, e, {
|
handlePayResult(orderBean.value?.id, e, {
|
||||||
onSuccess: () => {
|
onSuccess: (options: any) => {
|
||||||
showToast('支付成功', {
|
showToast('支付成功', {
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
complete: () => {
|
complete: () => {
|
||||||
|
// delete orderBean.value && orderBean.value!.createTime;
|
||||||
|
couponPay({
|
||||||
|
...orderBean.value,
|
||||||
|
payResult: JSON.stringify(options),
|
||||||
|
status: 2
|
||||||
|
}).then(res => {
|
||||||
|
uni.navigateBack();
|
||||||
|
});
|
||||||
uni.navigateBack();
|
uni.navigateBack();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -129,19 +149,24 @@ const createOrder = () => {
|
|||||||
num: goodsCount.value,
|
num: goodsCount.value,
|
||||||
memberId: userInfo.value.id,
|
memberId: userInfo.value.id,
|
||||||
payBo: {
|
payBo: {
|
||||||
terminal_sn: terminalInfo.value.terminalSn,
|
terminal_sn: terminalInfo.value?.terminalSn,
|
||||||
terminal_key: terminalInfo.value.terminalKey,
|
terminal_key: terminalInfo.value?.terminalKey,
|
||||||
merchant_name: userInfo.value.companyName,
|
merchant_name: userInfo.value.companyName,
|
||||||
total_amount: totalPrice.value,
|
total_amount: totalPrice.value,
|
||||||
subject: groupBuyBean.value?.name || '微信团购券',
|
subject: groupBuyBean.value?.name || '微信团购券',
|
||||||
description: groupBuyBean.value?.title || '微信团购券',
|
description: groupBuyBean.value?.title || '微信团购券',
|
||||||
subject_img: imageList.value[0] || '',
|
subject_img: (imageList.value?.length > 0 && imageList.value[0]) || '',
|
||||||
device_id: groupBuyBean.value?.creatorId,
|
device_id: groupBuyBean.value?.creatorId,
|
||||||
return_url: '/pages/payResult/index'
|
return_url: '/pages/payResult/index'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
preOrder(params).then(res => {
|
preOrder(params).then(res => {
|
||||||
orderBean.value = res as any;
|
orderBean.value = res as any;
|
||||||
|
if(orderBean.value) {
|
||||||
|
orderBean.value!.clientSn = res?.id;
|
||||||
|
}
|
||||||
|
}).catch(err => {
|
||||||
|
getApp().globalData?.logger?.error('order-coupon-confirm: preOrder exception ', err);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -87,7 +87,7 @@ const submenuList = [
|
|||||||
icon: assetsUrl('ic_register_gift2.png'),
|
icon: assetsUrl('ic_register_gift2.png'),
|
||||||
path: '/pages/common/register/reward'
|
path: '/pages/common/register/reward'
|
||||||
// path: '/pages/common/groupbuy/detail?shareId=1797548579864748033'
|
// path: '/pages/common/groupbuy/detail?shareId=1797548579864748033'
|
||||||
// path: '/pages/coupons/ticketsBuy/ticketsBuy?couponsId=1746159008308854786'
|
// path: '/pages/coupons/ticketsBuy/ticketsBuy?couponsId=1800381015472513026'
|
||||||
//1799264392762138626
|
//1799264392762138626
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@@ -188,12 +188,12 @@ const confirmCoupon = (item: CouponBean) => {
|
|||||||
};
|
};
|
||||||
const navigateTo = (e: any) => {
|
const navigateTo = (e: any) => {
|
||||||
handlePayResult(orderBean.value?.id, e, {
|
handlePayResult(orderBean.value?.id, e, {
|
||||||
onSuccess: () => {
|
onSuccess: (options:any) => {
|
||||||
console.log('pay success');
|
console.log('pay success');
|
||||||
payment();
|
payment();
|
||||||
},
|
},
|
||||||
onFailure: () => {
|
onFailure: (e:any) => {
|
||||||
console.error('pay onFailure');
|
console.error('pay onFailure ',e);
|
||||||
if(orderBean.value?.id) {
|
if(orderBean.value?.id) {
|
||||||
orderBean.value.id = '';
|
orderBean.value.id = '';
|
||||||
}
|
}
|
||||||
|
@@ -80,7 +80,7 @@ defineProps({
|
|||||||
position: relative;
|
position: relative;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
margin-left: 60rpx;
|
margin-left: 70rpx;
|
||||||
|
|
||||||
text:nth-of-type(1) {
|
text:nth-of-type(1) {
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
|
@@ -178,7 +178,7 @@ const buildSqbParams = computed(() => {
|
|||||||
|
|
||||||
const navigateTo = (e: any) => {
|
const navigateTo = (e: any) => {
|
||||||
handlePayResult(orderBean.value?.order.id, e, {
|
handlePayResult(orderBean.value?.order.id, e, {
|
||||||
onSuccess: () => {
|
onSuccess: (options:any) => {
|
||||||
fetchData(orderBean.value?.order.id || '');
|
fetchData(orderBean.value?.order.id || '');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -120,7 +120,7 @@ const buildSqbParams = computed(() => {
|
|||||||
|
|
||||||
const navigateTo = (e: any) => {
|
const navigateTo = (e: any) => {
|
||||||
handlePayResult(preRechargeOrderId.value, e, {
|
handlePayResult(preRechargeOrderId.value, e, {
|
||||||
onSuccess: async () => {
|
onSuccess: async (options: any) => {
|
||||||
await goRecharge();
|
await goRecharge();
|
||||||
await userState.setUserInfo({
|
await userState.setUserInfo({
|
||||||
...userInfo.value,
|
...userInfo.value,
|
||||||
@@ -128,7 +128,7 @@ const navigateTo = (e: any) => {
|
|||||||
});
|
});
|
||||||
await uni.navigateBack();
|
await uni.navigateBack();
|
||||||
},
|
},
|
||||||
onFailure: () => {
|
onFailure: (e: any) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@@ -33,9 +33,10 @@ export const handlePayResult = (orderId: string | undefined, e: any, { onSuccess
|
|||||||
const str = url.split('?')[1];
|
const str = url.split('?')[1];
|
||||||
const resultObj = JSON.parse(str.replaceAll('result=', ''));
|
const resultObj = JSON.parse(str.replaceAll('result=', ''));
|
||||||
|
|
||||||
|
getApp().globalData?.logger?.info('pay reuslt : ', orderId, resultObj);
|
||||||
if(resultObj?.is_success === true) {
|
if(resultObj?.is_success === true) {
|
||||||
if(onSuccess) {
|
if(onSuccess) {
|
||||||
onSuccess();
|
onSuccess(resultObj);
|
||||||
} else {
|
} else {
|
||||||
showToast('支付成功', {
|
showToast('支付成功', {
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
@@ -45,14 +46,18 @@ export const handlePayResult = (orderId: string | undefined, e: any, { onSuccess
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
getApp().globalData?.logger?.error('pay failure :', resultObj);
|
||||||
if(onFailure) {
|
if(onFailure) {
|
||||||
onFailure();
|
onFailure();
|
||||||
}
|
} else {
|
||||||
const msg = resultObj?.error_message || '支付失败';
|
const msg = resultObj?.error_message || '支付失败';
|
||||||
showToast(msg, {
|
showToast(msg, {
|
||||||
complete: () => {
|
complete: () => {
|
||||||
|
setTimeout(() => {
|
||||||
uni.navigateBack();
|
uni.navigateBack();
|
||||||
|
}, 1500);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user