多包裹换货

This commit is contained in:
quantulr
2024-05-18 16:20:03 +08:00
parent e679915b6c
commit bfcf9a11b3
6 changed files with 69 additions and 22 deletions

View File

@ -12,6 +12,9 @@ Page({
textarea: '',
textRefund: '',
total: 0,
logistics: null,
isAllRefund: false,
refundPackageGoods: []
},
/**
@ -19,7 +22,7 @@ Page({
*/
onLoad: function (options) {
this.setData({
orderId:options.id,
orderId: options.id,
})
wx.showLoading({
title: '加载中..',
@ -38,9 +41,12 @@ Page({
console.log(res)
wx.hideLoading()
if (res.data.code == 1) {
let goods = res.data.value;
const goods = res.data.value;
this.setData({
goods: goods,
logistics: goods.logistics ? JSON.parse(goods.logistics) : null,
isAllRefund: !!!(goods.logistics ? JSON.parse(goods.logistics) : []).find(el => el.afterSalesStatus),
refundPackage: (goods.logistics ? JSON.parse(goods.logistics) : []).find(el => el.afterSalesStatus) ?? []
})
} else {
wx.showModal({
@ -121,7 +127,7 @@ Page({
return
}
console.log(this.data.textarea)
if(!reg.test(this.data.textarea)){
if (!reg.test(this.data.textarea)) {
wx.showToast({
title: '请填写正确的物流单号',
icon: 'none'
@ -167,7 +173,7 @@ Page({
data: {
orderRefundNumber: this.data.textarea,
orderRefundInstructions: this.data.textarea1,
orderId:parseInt(this.data.orderId),
orderId: parseInt(this.data.orderId),
orderRefundImage: photos,
orderRefundName: this.data.textRefund
},
@ -186,7 +192,7 @@ Page({
}, 1000);
}
})
}else {
} else {
wx.showModal({
title: '获取数据失败!',
content: res.data.message,
@ -201,18 +207,18 @@ Page({
},
//长按删除
delimg(e){
let index= e.currentTarget.dataset.index;
delimg(e) {
let index = e.currentTarget.dataset.index;
wx.showModal({
title: '提示',
content: '是否删除?',
showCancel: true,
success:res=> {
if(res.confirm){
success: res => {
if (res.confirm) {
let photo = this.data.photo;
photo.splice(index, 1);
this.setData({
photo:photo
photo: photo
})
}
},

View File

@ -1,4 +1,29 @@
<view class="goods">
<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="{{isAllRefund}}" class="goods">
<view class="cont display_J_B" wx:for='{{goods.goodsList}}' wx:key='index'>
<view class="cont-l">
<image src="{{item.goodsPhoto}}"></image>
@ -14,6 +39,22 @@
<view class="cont-r">x{{item.goodsNum}}</view>
</view>
</view>
<view wx:else class="goods">
<view class="cont display_J_B" wx:for='{{refundPackage.goods}}' wx:key='index'>
<view class="cont-l">
<image src="{{findGoods.findGoods(goods.goodsList,item.id).goodsPhoto}}"></image>
</view>
<view class="cont-m">
<view class="name GStitleOne">{{item.name}}</view>
<view class="specs" wx:if="{{findGoods.findGoods(goods.goodsList,item.id).orderPayWay!=3}}">规格:{{item.spec}}</view>
<view class="price" wx:if="{{findGoods.findGoods(goods.goodsList,item.id).orderPayWay!=3}}">
{{findGoods.findGoods(goods.goodsList,item.id).orderPayWay!=2?'¥':''}}{{findGoods.findGoods(goods.goodsList,item.id).wisdGoodsSpec.specBulyPrice==null?findGoods.findGoods(goods.goodsList,item.id).wisdGoodsSpec.specPrice:findGoods.findGoods(goods.goodsList,item.id).wisdGoodsSpec.specBulyPrice}}{{findGoods.findGoods(goods.goodsList,item.id).orderPayWay!=2?'':'积分'}}
</view>
<view class="price" wx:if="{{findGoods.findGoods(goods.goodsList,item.id).orderPayWay==3}}">¥0</view>
</view>
<view class="cont-r">x{{item.num}}</view>
</view>
</view>
<view class="aArice display_J_S">
<view class="aArice-l">{{goods.orderRefundType==1?'换货':'退货'}}说明:</view>
<input type="text" placeholder="必填(填写货物的信息)" bindinput="textarea1" value="{{textarea1}}" />