From 6e7d6621f688614cb6548469c3fb46942ba2f4d3 Mon Sep 17 00:00:00 2001 From: jiazhipeng Date: Tue, 17 Jun 2025 11:38:46 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E6=8F=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/cart/cart.vue | 10 ++- static/js/request.js | 7 +- subPackages/food/order.vue | 2 +- subPackages/techan/index.vue | 8 ++- subPackages/techan/order.vue | 93 +++++++++++++------------- subPackages/techan/selfPickUpPoint.vue | 69 +++++++++---------- subPackages/ticket/order.vue | 2 +- 7 files changed, 100 insertions(+), 91 deletions(-) diff --git a/pages/cart/cart.vue b/pages/cart/cart.vue index 815b055..7fbcf26 100644 --- a/pages/cart/cart.vue +++ b/pages/cart/cart.vue @@ -17,9 +17,17 @@ }, onLoad() { + }, + onShow() { + }, methods: { - + getShoppingList () { + + }, + }, + onReachBottom() { + } } diff --git a/static/js/request.js b/static/js/request.js index fb0f3a1..fabbb23 100644 --- a/static/js/request.js +++ b/static/js/request.js @@ -2,8 +2,8 @@ import Vue from 'vue'; import store from '@/store'; // 定义 API URL -// const DEV_API_URL = 'https://api.cloud.sz-trip.com'; -const DEV_API_URL = 'https://swsz.api.js-dyyj.com'; +const DEV_API_URL = 'https://api.cloud.sz-trip.com'; +// const DEV_API_URL = 'https://swsz.api.js-dyyj.com' const PROD_API_URL = 'https://swsz.api.js-dyyj.com'; const NEWAPIURL = process.env.NODE_ENV === 'development' ? DEV_API_URL : PROD_API_URL; @@ -40,7 +40,8 @@ Vue.prototype.NEWAPIURL = '/api'; // #endif Vue.prototype.Post = (params = {}, apiurl) => { - const token = getToken() ; + const token = getToken() || '0caa10fc-6d65-4d9c-8e57-b344be3fc526'; + // const token = getToken() || 'a090644d-2bdb-4807-833b-bb5bc2182ac5' if (token) { params.token = token; } diff --git a/subPackages/food/order.vue b/subPackages/food/order.vue index 4ce4c77..de56d4d 100644 --- a/subPackages/food/order.vue +++ b/subPackages/food/order.vue @@ -241,7 +241,7 @@ let data = { product_list: goods, - coupon_id: this.coupon ? this.coupon.id : "", + coupon_id: this.coupon ? this.coupon.id : null, } console.log('data数据',data); this.Post({ diff --git a/subPackages/techan/index.vue b/subPackages/techan/index.vue index 810f55c..a11f44b 100644 --- a/subPackages/techan/index.vue +++ b/subPackages/techan/index.vue @@ -26,7 +26,7 @@ - 展开 + 展开 @@ -34,7 +34,7 @@ - 综合 + 综合 销量 @@ -230,7 +230,7 @@ statusBarHeight: 0, headImg: "https://cgc.js-dyyj.com/uploads/20250513/f8b255f965efcd71b6843e4b72c3f1f3.png", - type_pid: 646, + type_pid: 20, typeParam: [], typeIndex: 0, list:[], @@ -582,6 +582,8 @@ width: 67rpx; background: #EDF5DC; padding: 24rpx 20rpx; + text-align: center; + line-height: 1.2; } .goods-container{ diff --git a/subPackages/techan/order.vue b/subPackages/techan/order.vue index 6d9d148..55c1663 100644 --- a/subPackages/techan/order.vue +++ b/subPackages/techan/order.vue @@ -46,7 +46,7 @@ 自提点 - {{info.pickupAddress.extract_name||'选择提货地址'}} + {{info.pickupAddress.title||'选择提货地址'}} @@ -97,7 +97,7 @@ 订单备注: - + @@ -196,7 +196,6 @@ export default { post: 0, flag: true, - remark: '', coupon: "", allprice: 0, @@ -251,6 +250,7 @@ export default { v.pickupAddress = {} // 自提信息 v.contacts = null // 收货地址 v.post = null // 运费信息 + v.remark = "" }) this.orderList = orderList @@ -261,6 +261,7 @@ export default { changeUserPost (item,value) { console.log(item) item.is_user_post = value + this.getPost() }, goOrderCoupon () { @@ -308,32 +309,32 @@ export default { }); }, getPost() { + let _this = this let tempList = [] this.orderList.forEach(v=>{ - if( v.sInfo.contacts && v.is_user_post == 1) { + if( v.contacts && v.is_user_post == 1) { tempList.push(v) } }) let param = [] tempList.forEach(v=>{ - param.push({specifications_id: v.sInfo.id, num: v.sInfo.buyNum, consignee_id:v.contacts.id}) + param.push({sku_id: v.sInfo.id, num: v.sInfo.buyNum, consignee_id:v.contacts.id}) }) let data = JSON.stringify(param); // console.log(data); this.flag = false; - this.Post({ data: data }, '/api/order/getNewPost').then(res => { + + Promise.all(param.map(v=>_this.Post({...v},"/api/order/get_post_price"))).then(res=>{ if (res) { + console.log("promise" ,res) for(let i=0;i{ - console.log(err,'aaaaaaa'); - this.flag = true; - }); + }).finally(()=>{this.flag = true;}) }, plus(sku) { @@ -374,7 +375,7 @@ export default { this.selectInfo.contacts = item if (this.flag) { - // this.getPost(); + this.getPost(); } this.$refs.addressPopup.close(); }, @@ -443,57 +444,52 @@ export default { }, // 预定 order() { - if (this.info.is_user_post == 1 || this.info.is_user_post == 3) { - console.log(this.info.is_user_post) - if (this.info.is_user_post == 1 && !this.contacts) { - uni.showToast({ - title: '请选择收货地址', - icon: 'none' - }); - return; + let goods = []; + for(let info of this.orderList) { + let param = { + type: info.pInfo.type, + product_id: info.pInfo.id, + sku_id: info.sInfo.id, + product_num: info.sInfo.buyNum, + remark: info.remark } - - if (this.info.is_user_post == 2) { + if (info.is_user_post == 1) { + if(!info.contacts) { + uni.showToast({ + title: '请选择收货地址', + icon: 'none' + }); + return; + } else { + param.use_type = 1 + param.post = info.contacts.id + } + } + if (info.is_user_post == 2) { if (!this.pickupAddress.id) { uni.showToast({title: '请选择自提点',icon: 'none'}); return; + } else { + param.use_type = 2 + param.pickup_shop_id = info.pickupAddress.id + param.pickup_shop_info = info.pickupAddress } } + goods.push(param) } - let goods = []; - this.info.goods.forEach(v=>{ - let goodsItem = { - specifications_id: v.skuInfo.id, - num: v.skuInfo.buyNum, - - }; - - if (this.info.is_user_post == 2) { - goodsItem.extract_id = this.pickupAddress.id; - } else if (this.info.is_user_post == 1){ - goodsItem.consignee_id = this.contacts.id - } - goods.push(goodsItem); - }) - - let data = { - goods: goods, - coupon: this.coupon ? this.coupon.id : "", - remark: this.remark, - is_post: this.info.is_user_post, + product_list: goods, + coupon_id: this.coupon ? this.coupon.id : null, }; this.Post( { method: 'POST', data: JSON.stringify(data) }, - '/api/order/place' + '/api/order/create' ).then(res => { - uni.removeStorageSync('teChanOrder') - uni.removeStorageSync('teChanInfo') if (res.code == 1) { this.Post( { @@ -532,7 +528,8 @@ export default { getDataByConnect(data) { if (data.msgType == "updatePickUpPoint") { - let tempData = this.orderList.find(v=>v.sInfo.id == data.data.goodsId) + let tempData = this.orderList.find(v=>v.pInfo.id == data.data.pInfoId) + console.log(tempData) if (tempData) { tempData.pickupAddress = data.data.selectItem } diff --git a/subPackages/techan/selfPickUpPoint.vue b/subPackages/techan/selfPickUpPoint.vue index bbf25bb..86d2478 100644 --- a/subPackages/techan/selfPickUpPoint.vue +++ b/subPackages/techan/selfPickUpPoint.vue @@ -2,19 +2,17 @@ - - {{item.extract_name}} - - - 地址:{{item.detail_addr}} + + {{item.title}} + 营业时间:{{item.remark}} + 地址:{{item.address}} - - - - + + + + + 距离{{item.distance.toFixed(2)}}km - 去这里 - @@ -23,11 +21,11 @@ 暂无自提点地址 - + @@ -62,8 +60,8 @@ // this.getLocation() let param = { product_id: this.goodsId, - lon: uni.getStorageSync('location').lon || '', - lat: uni.getStorageSync('location').lat || '', + lon: uni.getStorageSync('location').lon || '36', + lat: uni.getStorageSync('location').lat || '29', } this.Post(param, "/api/product/getDeliverShop").then(res => { if (res) { @@ -87,8 +85,8 @@ selectPoint (item) { this.selectItem = item // 返回上一个页面并带回selectItem - uni.$emit("updateDataByConnect", {msgType:'updatePickUpPoint',data:{selectItem: this.selectItem, skuId: this.goodsId}}) - uni.navigateBack() + // uni.$emit("updateDataByConnect", {msgType:'updatePickUpPoint',data:{selectItem: this.selectItem, skuId: this.goodsId}}) + // uni.navigateBack() }, goMap (item) { @@ -109,7 +107,7 @@ return; } // 返回上一个页面并带回selectItem - uni.$emit("updateDataByConnect", {msgType:'updatePickUpPoint',data:{selectItem: this.selectItem, skuId: this.goodsId}}) + uni.$emit("updateDataByConnect", {msgType:'updatePickUpPoint',data:{selectItem: this.selectItem, pInfoId: this.goodsId}}) uni.navigateBack() } }, @@ -136,12 +134,14 @@ } .item-bg{ width: 697rpx; - height: 160rpx; + min-height: 160rpx; background: #FFFFFF; border-radius: 13rpx; margin: 0 auto; margin-bottom: 28rpx; - padding: 2rpx; + &.active{ + border:1px solid #6A8A2D; + } } .item { @@ -159,6 +159,9 @@ display: flex; flex-direction: column; justify-content: space-between; + font-weight: 500; + font-size: 27rpx; + color: #999999; } .item-point-guide{ width:140rpx; @@ -176,23 +179,14 @@ height: 33rpx; } } - .item-bg.active{ - background: #515150; - } .name { display: flex; font-size: 31rpx; font-weight: bold; color: #333333; - height: 42rpx; - } - .addressStr{ - display: flex; - font-size: 27rpx; - color: #999999; - padding-top: 10rpx; } + .no-data { width: 100%; height: 100vh; @@ -231,9 +225,9 @@ .addBox{ margin: 0 auto; width: 697rpx; - height: 80rpx; - background: linear-gradient(90deg, #F84A56, #FF9834); - border-radius: 40rpx; + height: 73rpx; + background: #6A8A2D; + border-radius: 11rpx; font-size: 36rpx; font-family: PingFang SC; font-weight: 500; @@ -242,5 +236,12 @@ text-align: center; } } - + .distance{ + font-weight: 500; + font-size: 24rpx; + color: #6A8A2D; + text-align: center; + padding-top: 11rpx; + word-wrap: break-all; + } diff --git a/subPackages/ticket/order.vue b/subPackages/ticket/order.vue index c05c810..5c81801 100644 --- a/subPackages/ticket/order.vue +++ b/subPackages/ticket/order.vue @@ -423,7 +423,7 @@ let data = { product_list: goods, - coupon_id: this.coupon ? this.coupon.id : "", + coupon_id: this.coupon ? this.coupon.id : null, } console.log('data数据',data); this.Post({