From 0b8ee272d9119dcb304a15da86fd69a18ee6930d Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期二, 24 六月 2025 18:42:12 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev
---
pages/order/orderDetail.vue | 27 +++++++++++++
api/trade.js | 13 ++++++
pages/commodity-square/commoditySquare.vue | 52 ++++++++++++++++++++++++-
pages/order/fillorder.vue | 10 ----
4 files changed, 89 insertions(+), 13 deletions(-)
diff --git a/api/trade.js b/api/trade.js
index 5d2b1a7..1985f4b 100644
--- a/api/trade.js
+++ b/api/trade.js
@@ -327,4 +327,17 @@
method: Method.GET,
needToken: true,
});
+}
+
+/**
+ * 鍐嶆璐拱 娣诲姞璐墿杞�
+ *
+ */
+export function buyBack(data) {
+ return http.request({
+ url: '/trade/carts/sku/buyBack',
+ method: Method.POST,
+ needToken: true,
+ data:data
+ });
}
\ No newline at end of file
diff --git a/pages/commodity-square/commoditySquare.vue b/pages/commodity-square/commoditySquare.vue
index 2fdf32b..6226f83 100644
--- a/pages/commodity-square/commoditySquare.vue
+++ b/pages/commodity-square/commoditySquare.vue
@@ -75,6 +75,9 @@
export default {
data() {
return {
+ //璁板綍涓ゅ垪楂樺害
+ listHeight1: 0,
+ listHeight2: 0,
//鏄惁鏄剧ず鎵撳紑宸︿晶寮圭獥
showLeft: false,
//鍟嗗搧瀵艰埅鍒嗙被
@@ -106,6 +109,8 @@
this.getGoodsParam.categoryId = ''
this.goodsList1 = []
this.goodsList2 = []
+ this.listHeight1 = 0;
+ this.listHeight2 = 0;
await this.getgoodsData();
},
confirm() {},
@@ -126,9 +131,24 @@
const height = e.detail.height;
this[arrName][index].width = 310 + 'rpx';
//璁$畻瀹介珮姣�
- const videoHeight = 310 / (wight / height)
- this[arrName][index].height = Math.floor(videoHeight) + 'rpx';
+ const videoHeight = Math.floor(310 / (wight / height))
+ this[arrName][index].height = videoHeight + 'rpx';
this[arrName][index].show = true;
+ //璁$畻闆嗗悎楂樺害
+ if (arrName === 'goodsList2') {
+ if (videoHeight > 300) {
+ this.listHeight2 += videoHeight;
+ } else if (videoHeight < 300) {
+ this.listHeight2 -= videoHeight;
+ }
+ }
+ if (arrName === 'goodsList1') {
+ if (videoHeight > 300) {
+ this.listHeight1 += videoHeight;
+ } else if (videoHeight < 300) {
+ this.listHeight1 -= videoHeight;
+ }
+ }
console.log(this[arrName][index].width, this[arrName][index].height)
this.flushDom = new Date();
},
@@ -158,11 +178,35 @@
item.goodsVideo = stsUrl + '/' + item.goodsVideo
}
})
+ //璁$畻涓や釜鏁扮粍鐨勯暱搴� 鐢ㄤ簬瑙e喅鐎戝竷娴佷袱杈归珮搴︿笉涓�鑷撮棶棰�
//骞冲垎缁欎袱涓暟缁�
- const middle = Math.ceil(goodsList.data.result.records.length / 2);
+ const goodsSize = goodsList.data.result.records.length;
+ let middle = Math.ceil(goodsSize / 2);
+ //鍒ゆ柇閭d釜闆嗗悎闀垮害楂� 閲嶆柊鍒嗛厤闆嗗悎鏁版嵁
+ const diffHeight = this.listHeight1 - this.listHeight2;
+ //list1闀垮害澶т簬list2
+ if (diffHeight > 0) {
+ const needCount = Math.floor(diffHeight / 300)
+ if (needCount > 6) {
+ middle = 0;
+ } else {
+ middle -= needCount;
+ }
+ } else if(diffHeight < 0) {
+ const needCount = Math.abs(Math.floor(diffHeight / 300))
+ if (needCount > 6) {
+ middle += 6
+ } else {
+ middle = needCount;
+ }
+ }
this.goodsList1 = [...this.goodsList1, ...goodsList.data.result.records.slice(0, middle)];
this.goodsList2 = [...this.goodsList2, ...goodsList.data.result.records.slice(middle)];
this.maxPages = goodsList.data.result.pages
+
+ // if(this.listHeight1===0||this.listHeight2===0)}
+ this.listHeight1 += middle * 300;
+ this.listHeight2 += (goodsSize - middle) * 300
},
async chooseCategory(id) {
this.canLoadMore = false;
@@ -172,6 +216,8 @@
this.getGoodsParam.pageNumber = 1
this.goodsList1 = [];
this.goodsList2 = [];
+ this.listHeight1 = 0;
+ this.listHeight2 = 0;
await this.getgoodsData();
console.log(this.maxPages)
}
diff --git a/pages/order/fillorder.vue b/pages/order/fillorder.vue
index 802a719..251f7e7 100644
--- a/pages/order/fillorder.vue
+++ b/pages/order/fillorder.vue
@@ -379,7 +379,7 @@
<div class="tabbar-right">鎻愪氦璁㈠崟</div>
<!-- #endif -->
<!-- #ifdef MP-WEIXIN -->
- <div class="tabbar-right">寰俊鏀粯</div>
+ <div class="tabbar-right">绔嬪嵆鏀粯</div>
<!-- #endif -->
</div>
</div>
@@ -705,17 +705,9 @@
url: "/pages/order/myOrder?status=0",
});
} else {
- //娉ㄩ噴鎺夌洿鎺ヨ皟鍙栧井淇℃敮浠� 璧版敹閾跺彴鏀粯
- // // #ifdef MP-WEIXIN
- // // 寰俊灏忕▼搴忎腑鐐瑰嚮鍒涘缓璁㈠崟鐩存帴寮�濮嬫敮浠�
- // this.pay(res.data.result.sn);
- // // #endif
-
- // // #ifndef MP-WEIXIN
this.navigateTo(
`/pages/cart/payment/payOrder?trade_sn=${res.data.result.sn}`
);
- // // #endif
}
} else {
uni.showToast({
diff --git a/pages/order/orderDetail.vue b/pages/order/orderDetail.vue
index 1e09c58..8da6992 100644
--- a/pages/order/orderDetail.vue
+++ b/pages/order/orderDetail.vue
@@ -149,6 +149,9 @@
@click="ByUserMessage(order)">鏌ョ湅鎷煎洟淇℃伅</view>
<view class="customer-service"
@click="contact(order.storeId)">鑱旂郴瀹㈡湇</view>
+ <view class="customer-service" v-if="order.orderStatus==='COMPLETED'"
+ @click="buyBack"
+ >鍐嶆潵涓�鍗�</view>
</view>
</view>
</view>
@@ -261,7 +264,7 @@
<script>
import '@/components/uview-components/uview-ui'
-import { getExpress, getPackage } from "@/api/trade.js";
+import { getExpress, getPackage ,buyBack} from "@/api/trade.js";
import { cancelOrder, confirmReceipt, getOrderDetail } from "@/api/order.js";
import shares from "@/components/m-share/index"; //鍒嗕韩
@@ -320,6 +323,8 @@
rogShow: false,
reason: "",
orderPackage:"",
+ //鍟嗗搧淇℃伅鍐嶆潵涓�鍗曚娇鐢�
+ skuList:[],
};
},
onLoad(options) {
@@ -390,11 +395,31 @@
this.orderGoodsList[0].goodsId,
});
},
+ //鍐嶆潵涓�鍗�
+ buyBack(){
+ console.log(JSON.stringify(this.skuList))
+ buyBack(this.skuList).then(res=>{
+ console.log('------------------->',res)
+ if(res.data.code==200){
+ uni.navigateTo({
+ url: "/pages/order/fillorder?way=CART"
+ })
+ }
+ })
+
+ },
async loadData(sn) {
uni.showLoading({
title: "鍔犺浇涓�",
});
+ // 灏嗗啀娆¤喘涔板晢鍝佺疆绌洪噸鏂拌幏鍙�
+ this.skuList = []
getOrderDetail(sn).then((res) => {
+ this.skuList = res.data.result.orderItems.map(item=>{
+ return{
+ skuId:item.skuId,
+ num:item.num}
+ })
const order = res.data.result;
this.order = order.order;
this.orderGoodsList = order.orderItems;
--
Gitblit v1.8.0