From 41f6f612fa03925fa8a8403c658675473de4d0e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=9D=E5=BF=83?= <13773726377@163.com> Date: Tue, 7 Apr 2026 17:51:16 +0800 Subject: [PATCH] 1 --- src/api/url.js | 2 +- src/manifest.json | 47 ++++--- src/pages/client/home/index.vue | 2 +- .../client/order/components/GoodInfo.vue | 4 +- .../client/order/components/OrderItem.vue | 2 +- src/pages/client/order/create.vue | 128 ++++++++++++++---- src/pages/client/order/details.vue | 10 +- src/pages/client/shop/index.vue | 100 +++++++++++--- 8 files changed, 213 insertions(+), 82 deletions(-) diff --git a/src/api/url.js b/src/api/url.js index 6afdf04..42ff842 100644 --- a/src/api/url.js +++ b/src/api/url.js @@ -236,7 +236,7 @@ export const CREATE_CART_ORDER = "/douyin/goods/order/create"; // 订单支付 export const PAY_ORDER_NEW = "/ttpay/jsapi"; // 订单列表 -export const SHOP_ORDER_LIST = "/product/order/list"; +export const SHOP_ORDER_LIST = "/douyin/goods/order/list"; // 订单详情 export const SHOP_ORDER_DETAILS = "/product/order/show"; // 取消订单 diff --git a/src/manifest.json b/src/manifest.json index 86924ed..60f389e 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -78,31 +78,30 @@ "mp-baidu" : { "usingComponents" : true }, - "mp-toutiao": { - "usingComponents": true, - "appid": "tte57093cd7a7fbf2401", - "libVersion": "2.0.0", - "setting": { - "urlCheck": false, - "minified": true, - "postcss": true, - "es6": true, - "minifyJS": true, - "minifyWXML": true, - "minifyWXSS": true + "mp-toutiao" : { + "usingComponents" : true, + "appid" : "tte57093cd7a7fbf2401", + "libVersion" : "2.0.0", + "setting" : { + "urlCheck" : false, + "minified" : true, + "postcss" : true, + "es6" : true, + "minifyJS" : true, + "minifyWXML" : true, + "minifyWXSS" : true + }, + "privacy" : { + "usePrivacyCheck" : true, + "requiredPrivateInfos" : [ "makePhoneCall" ] + }, + "plugins" : { + "lifeServicePlugin" : { + "version" : "*", + "provider" : "tta5a3d31e3aecfb9b11" + } + } }, - "privacy": { - "usePrivacyCheck": true, - "requiredPrivateInfos": ["makePhoneCall"] - }, - "plugins": { - "lifeServicePlugin": { - "version": "*", - "provider": "tta5a3d31e3aecfb9b11" - } - } - }, - "mp-qq" : { "usingComponents" : true } diff --git a/src/pages/client/home/index.vue b/src/pages/client/home/index.vue index 4973b81..26c2a45 100644 --- a/src/pages/client/home/index.vue +++ b/src/pages/client/home/index.vue @@ -396,7 +396,7 @@ export default { flex-direction: row; justify-content: flex-start; align-items: flex-start; - margin-top: 16rpx; + margin-top: 40rpx; .goods-list-item { flex: 1; diff --git a/src/pages/client/order/components/GoodInfo.vue b/src/pages/client/order/components/GoodInfo.vue index 8854adf..80ff4da 100644 --- a/src/pages/client/order/components/GoodInfo.vue +++ b/src/pages/client/order/components/GoodInfo.vue @@ -4,7 +4,7 @@ - {{ data[0].product_name || "" }} + {{ data[0].goods_name || "" }} ¥{{ data[0].goods_price || actual_price }} @@ -24,7 +24,7 @@ ¥{{ actual_price }} - 共{{ goodsImgs.length }}件 + 共1件 diff --git a/src/pages/client/order/components/OrderItem.vue b/src/pages/client/order/components/OrderItem.vue index e8a9ca6..e33bf12 100644 --- a/src/pages/client/order/components/OrderItem.vue +++ b/src/pages/client/order/components/OrderItem.vue @@ -44,7 +44,7 @@ - + 随车订单 diff --git a/src/pages/client/order/create.vue b/src/pages/client/order/create.vue index d1d3455..9c2e686 100644 --- a/src/pages/client/order/create.vue +++ b/src/pages/client/order/create.vue @@ -197,24 +197,29 @@ export default { eventChannel.on("createOrder", (data) => { // Helper function to extract first image from image_list const extractFirstImage = (imageList) => { - if (!imageList) return ''; + if (!imageList) return ""; try { - const parsedList = typeof imageList === 'string' ? JSON.parse(imageList) : imageList; + const parsedList = + typeof imageList === "string" ? JSON.parse(imageList) : imageList; if (Array.isArray(parsedList) && parsedList.length > 0) { - return parsedList[0].url || parsedList[0] || ''; + return parsedList[0].url || parsedList[0] || ""; } } catch (e) { - console.error('Error parsing image_list:', e); + console.error("Error parsing image_list:", e); } - return ''; + return ""; }; - this.orderData = (data?.goodList || []).map(item => { + this.orderData = (data?.goodList || []).map((item) => { // Check if product_pic is actually an image_list that needs parsing let processedItem = { ...item }; if (processedItem.product_pic) { // If product_pic looks like an array or JSON string, try to parse it - if (typeof processedItem.product_pic === 'string' && (processedItem.product_pic.startsWith('[') || processedItem.product_pic.startsWith('{'))) { + if ( + typeof processedItem.product_pic === "string" && + (processedItem.product_pic.startsWith("[") || + processedItem.product_pic.startsWith("{")) + ) { const extractedUrl = extractFirstImage(processedItem.product_pic); if (extractedUrl) { processedItem.product_pic = extractedUrl; @@ -228,7 +233,7 @@ export default { } return processedItem; }); - + this.payPrice = this.orderData.reduce( (sum, item) => sum + @@ -260,16 +265,78 @@ export default { createCartOrder(params) .then((res) => { uni.hideLoading(); - + // Check if tt and requirePlugin are available - if (typeof tt !== 'undefined' && tt.requirePlugin) { + if (typeof tt !== "undefined" && tt.requirePlugin) { try { const plugin = tt.requirePlugin("lifeServicePlugin"); if (plugin && plugin.createOrder) { + // let res1 = { + // data: { + // businessLine: 1, + // skuList: [ + // { + // quantity: 1, + // skuId: "1861281775887367", + // skuType: 1, + // price: 12000, + // goodsInfo: { + // goodsName: + // "狗狗移动上门赛级洗护| 狗狗洗澡| 体重【5-10kg】", + // goodsPhoto: + // "https://static.wagoo.pet/statics/dog5to10base.png", + // goodsId: "7625864573682075667", + // goodsType: 1, + // }, + // }, + // ], + // bookInfo: { + // itemBookInfoList: [ + // { + // poiId: "7620725019240319028", + // shopName: "WAGOO·上海市", + // outShopId: "life_7620725019240319028", + // goodsId: "7625864573682075667", + // bookStartTime: 1775613600000, + // bookEndTime: 1775622600000, + // }, + // ], + // }, + // payment: { + // totalAmount: 12000, + // }, + // contactInfo: { + // phoneNumber: "13773726377", + // contactName: "老王", + // }, + // storeInfo: { + // storeName: "WAGOO·上海市", + // }, + // callbackData: { + // douyin_product_id: "7625864573682075667", + // douyin_sku_id: "1861281775887367", + // goods_id: 183, + // order_date: "2026-04-08", + // period_id: 1, + // test: 999999, + // }, + // tradeOption: { + // life_trade_flag: 1, + // }, + // }, + // }; + // console.log(res.data,'???') plugin.createOrder({ skuList: res.data.skuList, + bookInfo: res.data.bookInfo, + contactInfo: res.data.contactInfo, + callbackData: res.data.callbackData, + storeInfo: res.data.storeInfo, + tradeOption: res.data.tradeOption, payment: res.data.payment, - bookInfo:res.data.bookInfo, + // callbackData:res.data.callbackData, + // tradeOption:res.data.tradeOption, + // goodsList:res.data.goodsList, success: (res) => { const { orderId, outOrderNo } = res; console.log("success res", res); @@ -283,39 +350,46 @@ export default { }, fail: (res) => { console.log("fail res", res); - const { orderId, outOrderNo, errNo, errMsg, errLogId } = res; + const { orderId, outOrderNo, errNo, errMsg, errLogId } = + res; if (errLogId) { console.log("预下单失败", errNo, errMsg, errLogId); } if (orderId || outOrderNo) { - console.log("支付失败", errNo, errMsg, orderId, outOrderNo); + console.log( + "支付失败", + errNo, + errMsg, + orderId, + outOrderNo + ); } console.log(errNo, errMsg); uni.showToast({ - title: errMsg || '支付失败', - icon: 'none' + title: errMsg || "支付失败", + icon: "none", }); }, }); } else { - console.error('Plugin or createOrder method not found'); + console.error("Plugin or createOrder method not found"); uni.showToast({ - title: '支付插件初始化失败', - icon: 'none' + title: "支付插件初始化失败", + icon: "none", }); } } catch (error) { - console.error('Error requiring plugin:', error); + console.error("Error requiring plugin:", error); uni.showToast({ - title: '支付插件加载失败', - icon: 'none' + title: "支付插件加载失败", + icon: "none", }); } } else { - console.log('TikTok Mini Program environment not detected'); + console.log("TikTok Mini Program environment not detected"); uni.showToast({ - title: '请在抖音小程序中打开', - icon: 'none' + title: "请在抖音小程序中打开", + icon: "none", }); } @@ -323,10 +397,10 @@ export default { }) .catch((err) => { uni.hideLoading(); - console.error('createCartOrder error:', err); + console.error("createCartOrder error:", err); uni.showToast({ - title: '创建订单失败', - icon: 'none' + title: "创建订单失败", + icon: "none", }); reject(err); }); diff --git a/src/pages/client/order/details.vue b/src/pages/client/order/details.vue index 14082c7..b192a0d 100644 --- a/src/pages/client/order/details.vue +++ b/src/pages/client/order/details.vue @@ -271,11 +271,11 @@ :order-status="1" :refund-total-amount="Math.round((orderData.actual_price || 0) * 100)" :apply-refund-params="{ - reasonCode: [410], - note: '用户申请退款', - applySource: 101, - afterSaleType: 3, - needRefundPackFee: true + reasonCode: [410], + note: '用户申请退款', + applySource: 101, + afterSaleType: 3, + needRefundPackFee: true }" style="width:280rpx;height:100rpx;text-align:center;line-height: 100rpx;" @refund="handleRefundSuccess" diff --git a/src/pages/client/shop/index.vue b/src/pages/client/shop/index.vue index 8f2f401..27da5f6 100644 --- a/src/pages/client/shop/index.vue +++ b/src/pages/client/shop/index.vue @@ -56,14 +56,24 @@ @scrolltolower="onLoadMore" > - + + + + + + @@ -98,7 +108,7 @@