api/trade.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
pages/commodity-square/commoditySquare.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
pages/order/fillorder.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
pages/order/orderDetail.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
api/trade.js
@@ -328,3 +328,16 @@ needToken: true, }); } /** * 再次购买 添加购物车 * */ export function buyBack(data) { return http.request({ url: '/trade/carts/sku/buyBack', method: Method.POST, needToken: true, data:data }); } 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 } }) //计算两个数组的长度 用于解决瀑布流两边高度不一致问题 //平分给两个数组 const middle = Math.ceil(goodsList.data.result.records.length / 2); const goodsSize = goodsList.data.result.records.length; let middle = Math.ceil(goodsSize / 2); //判断那个集合长度高 重新分配集合数据 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) } 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({ 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;