切换公司逻辑完善
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<view class='content'>
|
||||
<view class='content' v-if='companyConfigInfo.mallopen==0'>
|
||||
<view class='search-view'>
|
||||
<view class='search-input' @click.stop='goPath("/pages/mall/subs/search/index")'>
|
||||
<image :src=' assetsUrl("ic_search.png")'></image>
|
||||
@@ -34,6 +34,9 @@
|
||||
<text v-if='shoppingCartList.length>0'>{{ shoppingCartList?.length }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class='content' v-else style='align-items: center;justify-content:center;'>
|
||||
<image :src='assetsUrl("bg_mall_close.png")' style='width: 200rpx; height: 200rpx;' />
|
||||
</view>
|
||||
<sku-dialog ref='skuDialogRef' />
|
||||
</template>
|
||||
|
||||
@@ -44,7 +47,10 @@ import { goLogin, goPath, isLogin } from '@/utils';
|
||||
import { getCategoryList, getGoodsList } from '@/api/goods';
|
||||
import { CategoryBean, GoodsBean } from '@/api/goods/types';
|
||||
import useShoppingCartStore from '@/store/modules/shoppingcart';
|
||||
import { useUserStore } from '@/store';
|
||||
|
||||
const userStore = useUserStore();
|
||||
const { userInfo, companyConfigInfo } = storeToRefs(userStore);
|
||||
const shoppingCartStore = useShoppingCartStore();
|
||||
const { shoppingCartList } = storeToRefs(shoppingCartStore);
|
||||
|
||||
@@ -59,6 +65,15 @@ onLoad(() => {
|
||||
return;
|
||||
}
|
||||
|
||||
userStore.$onAction(({ name, after }) => {
|
||||
after(() => {
|
||||
//更新用户信息
|
||||
if(name === 'setUserInfo') {
|
||||
fetchCategoryList();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
fetchCategoryList();
|
||||
});
|
||||
|
||||
|
@@ -61,9 +61,9 @@
|
||||
<text class='card-view-title'>商品总价</text>
|
||||
<text class='card-view-value'>¥{{ orderBean?.totalPrice || 0 }}</text>
|
||||
</view>
|
||||
<view class='c-flex-row'>
|
||||
<view class='c-flex-row' style='display: none'>
|
||||
<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' @click.stop='showCouponDialog'>
|
||||
<text class='card-view-title'>优惠券
|
||||
@@ -95,15 +95,15 @@
|
||||
<text>合计</text>
|
||||
<text>¥{{ orderBean?.totalPrice || 0 }}</text>
|
||||
<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-order' @click='payment'>确认订单</button>
|
||||
</sqb-pay>
|
||||
</view>
|
||||
@@ -134,28 +134,16 @@ const tabIndex = ref(0);
|
||||
|
||||
const checkedCoupon = ref<CouponBean>();
|
||||
|
||||
const payParams = ref({
|
||||
return_url: '',
|
||||
total_amount: '',
|
||||
client_sn: '',
|
||||
terminal_sn: '',
|
||||
subject: '',
|
||||
subject_img: '',
|
||||
merchant_name: '',
|
||||
notify_url: '',
|
||||
sign: ''
|
||||
});
|
||||
|
||||
const orderBean = ref<OrderBean>();
|
||||
|
||||
onLoad((e) => {
|
||||
orderBean.value = JSON.parse(decodeURIComponent(e?.orderBean));
|
||||
});
|
||||
|
||||
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: orderBean?.value?.orderGoods[0].name,
|
||||
@@ -163,6 +151,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 changePayment = () => {
|
||||
@@ -216,17 +209,18 @@ const payment = async () => {
|
||||
}
|
||||
))
|
||||
};
|
||||
console.log('----------->>>>>params ', buildSqbParams.value);
|
||||
|
||||
const result = await orderCreate(params);
|
||||
orderBean.value!.id = result.id;
|
||||
|
||||
let signParams = buildSignParams.value;
|
||||
const signStr = parseParameter(signParams) + '&key=' + terminalInfo.value.terminalKey;
|
||||
const sign = hexMD5(signStr).toUpperCase();
|
||||
payParams.value = {
|
||||
...signParams,
|
||||
sign: sign
|
||||
};
|
||||
// let signParams = buildSignParams.value;
|
||||
// const signStr = parseParameter(signParams) + '&key=' + terminalInfo.value.terminalKey;
|
||||
// const sign = hexMD5(signStr).toUpperCase();
|
||||
// payParams.value = {
|
||||
// ...signParams,
|
||||
// sign: sign
|
||||
// };
|
||||
|
||||
uni.hideLoading();
|
||||
};
|
||||
|
Reference in New Issue
Block a user