This commit is contained in:
quantulr
2024-05-17 17:14:40 +08:00
parent 8e5986a8ef
commit e679915b6c
11 changed files with 272 additions and 61 deletions

View File

@ -74,7 +74,8 @@ Page({
this.setData({
goods: goods,
total: total,
numAll: numAll
numAll: numAll,
logistics: goods.logistics ? JSON.parse(goods.logistics) : null
})
if (goods.status == 1) {
this.setData({
@ -150,7 +151,14 @@ Page({
}
})
},
//申请售后
apply: function (e) {
const { id, num, sq, packageId } = e.currentTarget.dataset
console.log(packageId);
wx.navigateTo({
url: '/pages/my/applyAfter_sales/applyAfter_sales?id=' + id + '&num=' + num + '&sq=' + sq + "&packageId=" + packageId,
})
},
countDown() {
let leftoverDayI = this.data.leftoverDayI;
let nowTime = new Date().getTime()
@ -278,7 +286,7 @@ Page({
},
// 评价订单
rate(e){
rate(e) {
wx.navigateTo({
url: '/pages/rate/rate',
})
@ -342,9 +350,9 @@ Page({
})
},
viewLogisticsDetails(e) {
const { logisticsNum, logisticsName } = e.currentTarget.dataset
const { logistics, logisticsName, orderNumber } = e.currentTarget.dataset
wx.navigateTo({
url: `/pages/logistics_details/logistics_details?logisticsNum=${logisticsNum}&logisticsName=${logisticsName}`,
url: `/pages/logistics_details/logistics_details?orderNumber=${orderNumber}&logistics=${logistics}&logisticsName=${logisticsName}`,
})
},
/**

View File

@ -1,3 +1,28 @@
<wxs module="findGoods">
function findGoods(goodsList, id) {
// 初始化一个变量来存储找到的商品
var found = null;
// 遍历商品列表以查找具有指定ID的商品
for (var i = 0; i < goodsList.length; i++) {
if (goodsList[i].id === id) {
found = goodsList[i];
break;
}
}
// 如果找到了商品,返回商品的照片
if (found !== null) {
return found;
}
// 如果没有找到返回undefined
return undefined;
}
module.exports = {
findGoods: findGoods,
}
</wxs>
<!-- 倒计时 -->
<view wx:if='{{goods.status==1}}'>
<view class="djs" wx:if="{{ticker!=''}}">还剩余<text>{{ticker}}</text>订单将自动取消</view>
@ -29,20 +54,46 @@
<view class="address-cont">{{goods.orderAddress}}</view>
</view>
<view class="goods">
<view class="cont display_J_B" wx:for='{{goods.goodsList}}' wx:key='index' data-id='{{item.id}}' catchtap="goodsDetails">
<view class="cont-l">
<image src="{{item.goodsPhoto}}"></image>
</view>
<view class="cont-m">
<view class="name GStitleOne">{{item.goodsName}}</view>
<view class="specs" wx:if="{{goods.orderPayWay!=3}}">规格:{{item.wisdGoodsSpec.specName}}</view>
<view class="price" wx:if="{{goods.orderPayWay!=3}}">
{{goods.orderPayWay!=2?'¥'+item.price:item.price+'积分'}}
<view>
<view wx:if="{{logistics}}">
<view wx:for='{{logistics}}' class="packages" wx:key='id' data-id='{{item.id}}'>
<view style="display:flex; justify-content: space-between;">
<view>
包裹{{index+1}}
</view>
<view class="btn btn-red" data-id='{{goods.id}}' data-num='{{goods.orderNumber}}' data-s='{{goods.status}}' data-sq='2' data-package-id="{{item.id}}" capture-bind:tap="apply">换货申请</view>
</view>
<view class="cont display_J_B" wx:for='{{item.goods}}' wx:key="specId" wx:for-item="goodsItem" catchtap="">
<view class="cont-l">
<image src="{{ findGoods.findGoods(goods.goodsList,goodsItem.id).goodsPhoto }}"></image>
</view>
<view class="cont-m">
<view class="name GStitleOne">{{goodsItem.name}}</view>
<view class="specs" wx:if="{{goods.orderPayWay!=3}}">规格:{{goodsItem.spec}}</view>
<view class="price" wx:if="{{goods.orderPayWay!=3}}">
{{goods.orderPayWay!=2?'¥'+findGoods.findGoods(goods.goodsList,goodsItem.id).price:findGoods.findGoods(goods.goodsList,goodsItem.id).price+'积分'}}
</view>
<view class="price" wx:if="{{goods.orderPayWay==3}}">¥0</view>
</view>
<view class="cont-r">x{{goodsItem.num}}</view>
</view>
<view class="price" wx:if="{{goods.orderPayWay==3}}">¥0</view>
</view>
<view class="cont-r">x{{item.goodsNum}}</view>
</view>
<view class="goods" wx:else>
<view class="cont display_J_B" wx:for='{{goods.goodsList}}' wx:key='index' data-id='{{item.id}}' catchtap="goodsDetails">
<view class="cont-l">
<image src="{{item.goodsPhoto}}"></image>
</view>
<view class="cont-m">
<view class="name GStitleOne">{{item.goodsName}}</view>
<view class="specs" wx:if="{{goods.orderPayWay!=3}}">规格:{{item.wisdGoodsSpec.specName}}</view>
<view class="price" wx:if="{{goods.orderPayWay!=3}}">
{{goods.orderPayWay!=2?'¥'+item.price:item.price+'积分'}}
</view>
<view class="price" wx:if="{{goods.orderPayWay==3}}">¥0</view>
</view>
<view class="cont-r">x{{item.goodsNum}}</view>
</view>
</view>
</view>
@ -146,7 +197,7 @@
<view wx:if="{{!shops}}">
<view class="b-btn display_J_E display_A_C" wx:if="{{goods.status>2&&goods.status<6}}">
<view class="btn" wx:if="{{goods.status==5||goods.status==4}}" catchtap="del">删除订单</view>
<view class="btn" wx:if="{{goods.status==3}}" data-item='{{goods}}' data-logistics-num='{{goods.logisticsNum}}' data-logistics-name="{{goods.logisticsName}}" catchtap="viewLogisticsDetails">物流查询</view>
<view class="btn" wx:if="{{goods.status==3}}" data-item='{{goods}}' data-logistics="{{goods.logistics}}" data-order-number="{{goods.orderNumber}}" data-logistics-name="{{goods.logisticsName}}" catchtap="viewLogisticsDetails">物流查询</view>
<view class="btn btn-red" catchtap="confirm" wx:if="{{goods.status==3}}">确认收货</view>
<view class="btn btn-red" catchtap="rate" wx:if="{{goods.status==4}}">评价</view>
</view>

View File

@ -70,7 +70,13 @@ page {
border-radius: 20rpx;
margin: 30rpx 0;
}
.packages {
width: 690rpx;
padding: 16rpx 30rpx 0;
background-color: #ffffff;
border-radius: 20rpx;
margin: 30rpx 0;
}
.cont {
padding: 30rpx 0;
border-bottom: 1rpx #dcdcdc solid;
@ -282,7 +288,6 @@ page {
background-color: #ffffff;
border-radius: 20rpx;
margin: 30rpx 0;
}
.order {
@ -427,4 +432,4 @@ page {
.djs text {
color: #ff372d;
margin-left: 10rpx;
}
}