1
This commit is contained in:
@ -94,13 +94,13 @@
|
|||||||
"privacy": {
|
"privacy": {
|
||||||
"usePrivacyCheck": true,
|
"usePrivacyCheck": true,
|
||||||
"requiredPrivateInfos": ["makePhoneCall"]
|
"requiredPrivateInfos": ["makePhoneCall"]
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"plugins": {
|
"plugins": {
|
||||||
"lifeServicePlugin": {
|
"lifeServicePlugin": {
|
||||||
"version": "*",
|
"version": "*",
|
||||||
"provider": "tta5a3d31e3aecfb9b11"
|
"provider": "tta5a3d31e3aecfb9b11"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"mp-qq" : {
|
"mp-qq" : {
|
||||||
|
|||||||
@ -160,6 +160,8 @@ export default {
|
|||||||
imgPrefix,
|
imgPrefix,
|
||||||
WeChat: undefined,
|
WeChat: undefined,
|
||||||
wallet: "2",
|
wallet: "2",
|
||||||
|
orderId: "",
|
||||||
|
outOrderNo: "",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -222,31 +224,27 @@ export default {
|
|||||||
id: Number(this.orderData[0].goods_id),
|
id: Number(this.orderData[0].goods_id),
|
||||||
};
|
};
|
||||||
|
|
||||||
// console.log(this.orderData,'???')
|
|
||||||
createCartOrder(params)
|
createCartOrder(params)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const plugin = tt.requirePlugin("tta5a3d31e3aecfb9b11");
|
uni.hideLoading();
|
||||||
|
|
||||||
|
// Check if tt and requirePlugin are available
|
||||||
|
if (typeof tt !== 'undefined' && tt.requirePlugin) {
|
||||||
|
try {
|
||||||
|
const plugin = tt.requirePlugin("lifeServicePlugin");
|
||||||
|
if (plugin && plugin.createOrder) {
|
||||||
plugin.createOrder({
|
plugin.createOrder({
|
||||||
goodsList: [
|
skuList: res.data.skuList,
|
||||||
{
|
payment: res.data.payment,
|
||||||
quantity: 10, // 购买数量 必填
|
|
||||||
price: 1, // 商品价格 必填
|
|
||||||
goodsName: "测试商品", // 商品名称 必填
|
|
||||||
goodsPhoto:"https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic.ibaotu.com%2Fgif%2F19%2F48%2F47%2F76Z888piCd6W.gif%21fwpaa50%2Ffw%2F700&refer=http%3A%2F%2Fpic.ibaotu.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1644654365&t=5fc9b5fdad0a16264a9a9c09c14b3af9", // 商品图片链接 必填
|
|
||||||
goodsId: "123", // 商品ID 必填(请务必使用小程序商品)
|
|
||||||
goodsType: 2, // 商品类型 必填
|
|
||||||
},
|
|
||||||
],
|
|
||||||
payment: {
|
|
||||||
totalAmount: 10, // 订单总价 必填
|
|
||||||
},
|
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
const { orderId, outOrderNo } = res;
|
const { orderId, outOrderNo } = res;
|
||||||
console.log("success res", res);
|
console.log("success res", res);
|
||||||
console.log("orderId", orderId, "outOrderNo", outOrderNo);
|
console.log("orderId", orderId, "outOrderNo", outOrderNo);
|
||||||
this.setData({ orderId, outOrderNo });
|
// Update data the Vue way
|
||||||
|
this.orderId = orderId;
|
||||||
|
this.outOrderNo = outOrderNo;
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url:"/pages/client/order/list",
|
url: "/pages/client/order/list",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
fail: (res) => {
|
fail: (res) => {
|
||||||
@ -259,12 +257,45 @@ export default {
|
|||||||
console.log("支付失败", errNo, errMsg, orderId, outOrderNo);
|
console.log("支付失败", errNo, errMsg, orderId, outOrderNo);
|
||||||
}
|
}
|
||||||
console.log(errNo, errMsg);
|
console.log(errNo, errMsg);
|
||||||
|
uni.showToast({
|
||||||
|
title: errMsg || '支付失败',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
console.error('Plugin or createOrder method not found');
|
||||||
|
uni.showToast({
|
||||||
|
title: '支付插件初始化失败',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error requiring plugin:', error);
|
||||||
|
uni.showToast({
|
||||||
|
title: '支付插件加载失败',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log('TikTok Mini Program environment not detected');
|
||||||
|
uni.showToast({
|
||||||
|
title: '请在抖音小程序中打开',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
resolve();
|
resolve();
|
||||||
})
|
})
|
||||||
.catch((err) => {});
|
.catch((err) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
console.error('createCartOrder error:', err);
|
||||||
|
uni.showToast({
|
||||||
|
title: '创建订单失败',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
reject(err);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user