完善支付页面

parent 05249844
...@@ -151,6 +151,7 @@ import { ...@@ -151,6 +151,7 @@ import {
previewOrderBasketUpdate, previewOrderBasketUpdate,
sgyOrderOrderInfo, sgyOrderOrderInfo,
} from '@/api/assistingAgriculture/shop'; } from '@/api/assistingAgriculture/shop';
import { groupBuyConfirm } from '@/api/confirmOrder';
const imgUrl = import.meta.env.VITE_APP_IMG_URL; const imgUrl = import.meta.env.VITE_APP_IMG_URL;
const textInputs = ref(''); const textInputs = ref('');
const basketIds = ref([]); const basketIds = ref([]);
...@@ -159,17 +160,27 @@ const changeAddress = ref(false); ...@@ -159,17 +160,27 @@ const changeAddress = ref(false);
const addressParams = ref({}); const addressParams = ref({});
const showpopup = ref(false); const showpopup = ref(false);
const outTradeNos = ref(null); const outTradeNos = ref(null);
const prodIds = ref(null);
const skuIds = ref(null);
const types = ref('');
const inputLength = computed(() => { const inputLength = computed(() => {
return textInputs.value.length; return textInputs.value.length;
}); });
onLoad((options) => { onLoad((options) => {
const { ids } = options; const { ids, type, prodId, skuId } = options;
prodIds.value = prodId;
skuIds.value = skuId;
types.value = type;
basketIds.value = ids.split(','); basketIds.value = ids.split(',');
if (type === 'qg') {
groupBuyConfirmFn(prodId, skuId);
} else {
sgyrddBasketConfirmFn(basketIds.value).then(() => { sgyrddBasketConfirmFn(basketIds.value).then(() => {
useraddrDefaultUserAddrFn().then(() => { useraddrDefaultUserAddrFn().then(() => {
groupBuyUpdateFn(); groupBuyUpdateFn();
}); });
}); });
}
}); });
onShow(() => { onShow(() => {
if (changeAddress.value) { if (changeAddress.value) {
...@@ -211,6 +222,21 @@ onShow(() => { ...@@ -211,6 +222,21 @@ onShow(() => {
} }
}); });
function groupBuyConfirmFn(prodId, skuId) {
return new Promise((resolve, reject) => {
groupBuyConfirm({ prodId, skuId }).then((res) => {
if (res.code === 0) {
res.data.orderItems[0].pic = imgUrl + res.data.orderItems[0].pic;
orderInfo.value = res.data;
resolve(res.data.shopId);
} else {
wx.showToast({
title: res.msg,
});
}
});
});
}
const orderInfo = ref({}); const orderInfo = ref({});
const sgyrddBasketConfirmFn = (basketIds) => { const sgyrddBasketConfirmFn = (basketIds) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
......
...@@ -10,8 +10,8 @@ import { getTokenUser } from '../../api/index'; ...@@ -10,8 +10,8 @@ import { getTokenUser } from '../../api/index';
import { getToken } from '../../utils/auth'; import { getToken } from '../../utils/auth';
onMounted(async () => { onMounted(async () => {
await signIn(); // await signIn();
// if (!getToken()) await signIn2(); if (!getToken()) await signIn2();
xma.reLaunch({ url: '/pages/index/index' }); xma.reLaunch({ url: '/pages/index/index' });
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment