切换公司逻辑完善
This commit is contained in:
@@ -6,7 +6,9 @@
|
||||
</view>
|
||||
|
||||
<scroll-view class='scroll-view'>
|
||||
<view class='c-flex-column' v-for='(item, index) in groupbuyList' :key='index'>
|
||||
<!-- <u-list class='scroll-view' :border='false' @scrolltolower='loadMore'>-->
|
||||
<!-- <u-list-item v-for='(item,index) in groupbuyList' :key='index'>-->
|
||||
<view class='c-flex-column' v-for='(item,index) in groupbuyList' :key='index'>
|
||||
<view class='item c-flex-row' @click.stop='goPath(`/pages/common/groupbuy/detail?id=${item.id}`)'>
|
||||
<image class='goods-image' :src='JSON.parse(item.content)[0].images' />
|
||||
<view class='c-flex-column' style='flex: 1'>
|
||||
@@ -27,6 +29,8 @@
|
||||
</view>
|
||||
<view class='divider' style='margin: 0 30rpx' />
|
||||
</view>
|
||||
<!-- </u-list-item>-->
|
||||
<!-- </u-list>-->
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -39,6 +43,7 @@ import { goPath } from '@/utils';
|
||||
|
||||
const tabIndex = ref(0);
|
||||
const groupbuyList = ref([]);
|
||||
const currentPageNum = ref(1);
|
||||
|
||||
onLoad((e) => {
|
||||
fetchData();
|
||||
@@ -48,9 +53,12 @@ watch(() => tabIndex.value, () => {
|
||||
fetchData();
|
||||
});
|
||||
|
||||
const fetchData = async () => {
|
||||
const fetchData = async (refresh: boolean = true) => {
|
||||
if(!refresh) {
|
||||
currentPageNum.value += 1;
|
||||
}
|
||||
const { list } = await getGroupBuyList({
|
||||
pageNum: 1,
|
||||
pageNum: currentPageNum.value,
|
||||
pageSize: 100,
|
||||
obj: {
|
||||
status: tabIndex.value
|
||||
@@ -58,6 +66,10 @@ const fetchData = async () => {
|
||||
});
|
||||
groupbuyList.value = list;
|
||||
};
|
||||
|
||||
const loadMore = () => {
|
||||
fetchData(false);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
|
@@ -27,15 +27,15 @@
|
||||
|
||||
<view class='bottom-view c-flex-row'>
|
||||
<sqb-pay @bindnavigateTo='navigateTo'
|
||||
:return_url='payParams.return_url'
|
||||
:total_amount='payParams.total_amount'
|
||||
:terminal_sn='payParams.terminal_sn'
|
||||
:client_sn='payParams.client_sn'
|
||||
:subject='payParams.subject'
|
||||
:subject_img='payParams.subject_img '
|
||||
:merchant_name='payParams.merchant_name'
|
||||
:notify_url='payParams.notify_url'
|
||||
:sign='payParams.sign'>
|
||||
:return_url='buildSqbParams.return_url'
|
||||
:total_amount='buildSqbParams.total_amount'
|
||||
:terminal_sn='buildSqbParams.terminal_sn'
|
||||
:client_sn='buildSqbParams.client_sn'
|
||||
:subject='buildSqbParams.subject'
|
||||
:subject_img='buildSqbParams.subject_img '
|
||||
:merchant_name='buildSqbParams.merchant_name'
|
||||
:notify_url='buildSqbParams.notify_url'
|
||||
:sign='buildSqbParams.sign'>
|
||||
<button class='confirm-button' @click='payment'>支付</button>
|
||||
</sqb-pay>
|
||||
</view>
|
||||
@@ -54,34 +54,15 @@ const userState = useUserStore();
|
||||
const { terminalInfo } = storeToRefs(userState);
|
||||
|
||||
const orderBean = ref<OrderBean>();
|
||||
const payParams = ref({
|
||||
return_url: '',
|
||||
total_amount: '',
|
||||
client_sn: '',
|
||||
terminal_sn: '',
|
||||
subject: '',
|
||||
subject_img: '',
|
||||
merchant_name: '',
|
||||
notify_url: '',
|
||||
sign: ''
|
||||
});
|
||||
|
||||
onLoad((e: any) => {
|
||||
orderBean.value = JSON.parse(decodeURIComponent(e?.orderBean));
|
||||
|
||||
let signParams = buildSignParams.value;
|
||||
const signStr = parseParameter(signParams) + '&key=' + terminalInfo.value.terminalKey;
|
||||
const sign = hexMD5(signStr).toUpperCase();
|
||||
payParams.value = {
|
||||
...signParams,
|
||||
sign: sign
|
||||
};
|
||||
});
|
||||
|
||||
const buildSignParams = computed(() => {
|
||||
return sortASCII({
|
||||
const buildSqbParams = computed(() => {
|
||||
const params = sortASCII({
|
||||
client_sn: orderBean.value?.id || '',
|
||||
return_url: '/pages/payResult/index',
|
||||
return_url: '/pages/common/payresult/index',
|
||||
total_amount: ((orderBean.value?.totalPrice || 0) * 100).toString(),
|
||||
terminal_sn: terminalInfo.value.terminalSn,
|
||||
subject: '商品团购券',
|
||||
@@ -89,6 +70,11 @@ const buildSignParams = computed(() => {
|
||||
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) => {
|
||||
@@ -105,7 +91,7 @@ const navigateTo = (e: any) => {
|
||||
const payment = () => {
|
||||
const params = {
|
||||
'id': orderBean.value?.id,
|
||||
'orderSn': buildSignParams.value.client_sn,
|
||||
'orderSn': buildSqbParams.value.client_sn,
|
||||
'terminal_key': terminalInfo.value.terminalKey,
|
||||
'terminal_sn': terminalInfo.value.terminalSn
|
||||
};
|
||||
|
11
src/pages/common/payresult/index.vue
Normal file
11
src/pages/common/payresult/index.vue
Normal file
@@ -0,0 +1,11 @@
|
||||
<template>
|
||||
<text>支付成功</text>
|
||||
</template>
|
||||
|
||||
<script lang='ts' setup>
|
||||
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
|
||||
</style>
|
Reference in New Issue
Block a user