切换公司逻辑完善
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<scroll-view scroll-y>
|
||||
<view class='content'>
|
||||
<view class='countdown c-flex-row'>
|
||||
<view class='countdown c-flex-row' v-if='orderBean?.order.payStatus==1'>
|
||||
<image :src='assetsUrl("ic_order.png")' />
|
||||
<view class='c-flex-column'>
|
||||
<text>
|
||||
@@ -66,13 +66,13 @@
|
||||
</view>
|
||||
<view class='c-flex-row'>
|
||||
<text class='card-view-title'>运费</text>
|
||||
<text class='card-view-value'>¥8</text>
|
||||
<text class='card-view-value'>¥0</text>
|
||||
</view>
|
||||
<view class='c-flex-row'>
|
||||
<text class='card-view-title'>优惠券
|
||||
<text style='font-size: 22rpx;color: #F32B2B;'>已选最大优惠</text>
|
||||
</text>
|
||||
<text class='card-view-value' style='color: #F32B2B;margin: 0'>-¥{{orderBean?.order?.reducePrice}}
|
||||
<text class='card-view-value' style='color: #F32B2B;margin: 0'>-¥{{ orderBean?.order?.reducePrice }}
|
||||
</text>
|
||||
</view>
|
||||
<view class='divider' />
|
||||
@@ -93,9 +93,19 @@
|
||||
<text>下单时间:{{ orderBean?.order?.createTime }}</text>
|
||||
</view>
|
||||
|
||||
<view class='bottom-action-view c-flex-row'>
|
||||
<view class='bottom-action-view c-flex-row' v-if='orderBean?.order.payStatus==1'>
|
||||
<text @click.stop='cancel'>取消订单</text>
|
||||
<text @click.stop='payment'>立即支付</text>
|
||||
<sqb-pay @bindnavigateTo='navigateTo'
|
||||
:return_url='buildSqbParams.return_url'
|
||||
:total_amount='buildSqbParams.total_amount'
|
||||
:terminal_sn='buildSqbParams.terminal_sn'
|
||||
:client_sn='buildSqbParams.client_sn'
|
||||
:subject='buildSqbParams.subject'
|
||||
:merchant_name='buildSqbParams.merchant_name'
|
||||
:notify_url='buildSqbParams.notify_url'
|
||||
:sign='buildSqbParams.sign'>
|
||||
<button @click='payment'>立即支付</button>
|
||||
</sqb-pay>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
@@ -105,6 +115,12 @@
|
||||
import { assetsUrl } from '@/utils/assets';
|
||||
import { getOrderDetail } from '@/api/order';
|
||||
import { OrderBean } from '@/api/order/types';
|
||||
import { parseParameter, sortASCII } from '@/utils';
|
||||
import { hexMD5 } from '@/utils/common/md5';
|
||||
import { useUserStore } from '@/store';
|
||||
|
||||
const userState = useUserStore();
|
||||
const { terminalInfo } = storeToRefs(userState);
|
||||
|
||||
const orderBean = ref<{
|
||||
order: OrderBean,
|
||||
@@ -113,13 +129,43 @@ const orderBean = ref<{
|
||||
}>();
|
||||
|
||||
onLoad(async (e: any) => {
|
||||
await uni.showLoading();
|
||||
orderBean.value = await getOrderDetail(e.orderId);
|
||||
uni.hideLoading();
|
||||
});
|
||||
|
||||
const buildSqbParams = computed(() => {
|
||||
const params = sortASCII({
|
||||
client_sn: orderBean.value?.order?.id || '',
|
||||
return_url: '/pages/common/payresult/index',
|
||||
total_amount: ((orderBean.value?.order?.totalPrice || 0) * 100).toString(),
|
||||
terminal_sn: terminalInfo.value.terminalSn,
|
||||
subject: '商品支付',
|
||||
merchant_name: terminalInfo.value.companyName,
|
||||
notify_url: 'https://www.baidu.com'
|
||||
}, true);
|
||||
return {
|
||||
...params,
|
||||
sign: hexMD5(parseParameter(params) + '&key=' + terminalInfo.value.terminalKey).toUpperCase()
|
||||
};
|
||||
});
|
||||
|
||||
const navigateTo = (e: any) => {
|
||||
console.log('--------------_>>>>>>navigateTo ', e);
|
||||
uni.redirectTo({
|
||||
url: e.detail.url,
|
||||
fail(e) {
|
||||
uni.showToast({
|
||||
title: '支付失败'
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const cancel = () => {
|
||||
};
|
||||
const payment = () => {
|
||||
|
||||
console.log(buildSqbParams.value);
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -334,6 +380,7 @@ const payment = () => {
|
||||
.bottom-action-view {
|
||||
background: #FFFFFF;
|
||||
position: fixed;
|
||||
height: 80rpx;
|
||||
justify-content: flex-end;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
@@ -350,11 +397,12 @@ const payment = () => {
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
text:nth-of-type(2) {
|
||||
padding: 17rpx 45rpx;
|
||||
sqb-pay button {
|
||||
padding: 0 45rpx;
|
||||
border-radius: 50rpx;
|
||||
border: 1rpx solid #F32B2B;
|
||||
font-weight: bold;
|
||||
background: #FFFFFF;
|
||||
font-size: 30rpx;
|
||||
color: #F32B2B;
|
||||
}
|
||||
|
Reference in New Issue
Block a user