完善支付页面

parent 05249844
......@@ -151,6 +151,7 @@ import {
previewOrderBasketUpdate,
sgyOrderOrderInfo,
} from '@/api/assistingAgriculture/shop';
import { groupBuyConfirm } from '@/api/confirmOrder';
const imgUrl = import.meta.env.VITE_APP_IMG_URL;
const textInputs = ref('');
const basketIds = ref([]);
......@@ -159,17 +160,27 @@ const changeAddress = ref(false);
const addressParams = ref({});
const showpopup = ref(false);
const outTradeNos = ref(null);
const prodIds = ref(null);
const skuIds = ref(null);
const types = ref('');
const inputLength = computed(() => {
return textInputs.value.length;
});
onLoad((options) => {
const { ids } = options;
const { ids, type, prodId, skuId } = options;
prodIds.value = prodId;
skuIds.value = skuId;
types.value = type;
basketIds.value = ids.split(',');
sgyrddBasketConfirmFn(basketIds.value).then(() => {
useraddrDefaultUserAddrFn().then(() => {
groupBuyUpdateFn();
if (type === 'qg') {
groupBuyConfirmFn(prodId, skuId);
} else {
sgyrddBasketConfirmFn(basketIds.value).then(() => {
useraddrDefaultUserAddrFn().then(() => {
groupBuyUpdateFn();
});
});
});
}
});
onShow(() => {
if (changeAddress.value) {
......@@ -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 sgyrddBasketConfirmFn = (basketIds) => {
return new Promise((resolve, reject) => {
......
......@@ -10,8 +10,8 @@ import { getTokenUser } from '../../api/index';
import { getToken } from '../../utils/auth';
onMounted(async () => {
await signIn();
// if (!getToken()) await signIn2();
// await signIn();
if (!getToken()) await signIn2();
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