Selaa lähdekoodia

退货物流接口对接

wenjie 1 kuukausi sitten
vanhempi
commit
ae9628ae0b

+ 12 - 2
pages/DetailsOfRefund/DetailsOfRefund.js

@@ -11,6 +11,8 @@ Page({
     showView: true, //隐藏是展示
     applyTime: '', //申请时间
     applyType: 1, //申请类型:1,仅退款,2退款退货
+    dvyType: 1, //配送类型 1:快递 2:自提 3:及时配送
+    isReturnLogistics: false, //配送类型 1:快递 2:自提 3:及时配送
     goodsNum: '', //退货数量
     handelTime: '', //卖家处理时间
     orderAmount: '', //订单总金额
@@ -39,6 +41,7 @@ Page({
     shopName: '', //店铺名称
     refundScore: 0, // 退款积分
     photoFiles:[],
+    refundPhotoFiles:[],//退货物流图片
     addCarshow: false,
     selectTimeshow: false,
     flowShow: false,
@@ -131,12 +134,18 @@ Page({
           item.pic=img[0]
         })
         let photoFiles = []
+        let refundPhotoFiles = []
         if(res.photoFiles){
           photoFiles = res.photoFiles.split(',')
         }
+        if(res.refundDelivery.imgs){
+          refundPhotoFiles = res.refundDelivery.imgs.split(',')
+        }
         ths.setData({
           applyTime: res.applyTime, //申请时间
           applyType: res.applyType, //申请类型:1,仅退款,2退款退货
+          dvyType: res.dvyType, //配送类型 1:快递 2:自提 3:及时配送
+          isReturnLogistics: res.isReturnLogistics, //配送类型 1:快递 2:自提 3:及时配送
           goodsNum: res.goodsNum, //退货数量
           handelTime: res.handelTime, //卖家处理时间
           orderAmount: res.orderAmount, //订单总金额
@@ -157,6 +166,7 @@ Page({
           rejectMessage: res.rejectMessage, //拒绝理由
           buyerReason: res.buyerReason, //退款原因
           photoFiles, //图片
+          refundPhotoFiles,//退款图片
           shopName: res.shopName,
           refundScore: res.refundScore, // 退款积分
           payer: res.refundDelivery.payer,//运费承担方
@@ -313,9 +323,9 @@ Page({
    */
   writeInfo(e){
     var refundSn = e.currentTarget.dataset.refundsn;
-    console.log(e.currentTarget.dataset.refundsn)
+    var type = e.currentTarget.dataset.type;
     wx.navigateTo({
-      url: '/pages/writeReturnLogistics/writeReturnLogistics?refundSn=' + refundSn,
+      url: `/pages/writeReturnLogistics/writeReturnLogistics?refundSn=${refundSn}&shopId=${this.data.refundDelivery.shopId}&type=${type}`,
     })
   },
   

+ 20 - 3
pages/DetailsOfRefund/DetailsOfRefund.wxml

@@ -14,7 +14,7 @@
     </view>
   </view>
 
-  <view class="write-info box" wx:if="{{returnMoneySts == 65&&applyType == 2}}">
+  <view class="write-info box" wx:if="{{returnMoneySts == 65&&applyType == 2&&dvyType==3&&!isReturnLogistics}}">
     <view class="sub-title">配送信息</view>
     <view class="form-box">
       <view class="form-item">
@@ -56,14 +56,15 @@
     <view class="btn">提交</view>
   </view>
 
-  <view class="write-info-box box">
+  <!-- <view class="write-info-box box" wx:if="{{applyType == 2&&!isReturnLogistics}}"> -->
+  <view class="write-info-box box" wx:if="{{returnMoneySts == 65&&applyType == 2&&dvyType==1&&!isReturnLogistics}}">
     <view class="sub-title">退货方式</view>
     <view class="btn-box">
       <view class="text-box">
         <view class="title">自行寄回商品</view>
         <view class="desc">寄出后请填写快递单号</view>
       </view>
-      <view class="btn" bind:tap="writeInfo" data-refundsn="{{refundSn}}">填写快递信息</view>
+      <view class="btn" bind:tap="writeInfo" data-refundsn="{{refundSn}}"  data-type="add">填写快递信息</view>
     </view>
     <view class="shop-info">
       <view class="sub-title">退货地址</view>
@@ -74,6 +75,22 @@
       <view class="address">贵州省-贵阳市-观山湖区富力中心A座3401</view>
     </view>
   
+  </view>
+  <!-- 已填写 -->
+  <!-- <view class="write-info-box box" wx:if="{{applyType == 2&&isReturnLogistics}}"> -->
+  <view class="write-info-box box" wx:if="{{returnMoneySts == 65&&applyType == 2&&dvyType==1&&isReturnLogistics}}">
+    <view class="title-box">
+      <view class="sub-title">退货方式</view>
+      <view class="edit" bind:tap="writeInfo" data-refundsn="{{refundSn}}" data-type="edit">修改</view>
+    </view>
+    <view class="text-item">自行寄回商品</view>
+    <view class="text-item">快递单号:{{refundDelivery.deyNu}}</view>
+    <view class="text-item">快递公司:{{refundDelivery.deyName}}</view>
+    <view class="text-item">凭证:</view>
+    <view class="img-box" wx:if="{{refundPhotoFiles.length}}">
+      <image class="img" wx:for="{{refundPhotoFiles}}" src="{{item}}" mode="aspectFill"/>
+    </view>
+    
   </view>
 
   <!-- <view class="oprate-box box">

+ 25 - 0
pages/DetailsOfRefund/DetailsOfRefund.wxss

@@ -109,6 +109,31 @@
 .DetailsOfRefund .write-info-box{
   padding: 28rpx 24rpx;
 }
+.DetailsOfRefund .write-info-box .title-box{
+  display: flex;
+  justify-content: space-between;
+}
+.DetailsOfRefund .write-info-box .title-box .edit{
+  font-size: 28rpx;
+  color: #42D86F;
+}
+.DetailsOfRefund .write-info-box .text-item{
+  font-size: 28rpx;
+  color: #222222;
+  margin-bottom: 20rpx;
+}
+.DetailsOfRefund .write-info-box .img-box{
+  display: flex;
+  flex-wrap: nowrap;
+  overflow: auto;
+}
+.DetailsOfRefund .write-info-box .img{
+  width: 120rpx;
+  height: 120rpx;
+  border-radius: 32rpx 32rpx 32rpx 32rpx;
+  margin-right: 16rpx;
+  flex-shrink: 0;
+}
 .DetailsOfRefund .write-info-box .sub-title{
   font-weight: bold;
   font-size: 32rpx;

+ 1 - 2
pages/order-detail/order-detail.wxml

@@ -58,8 +58,7 @@
           申请售后
         </view>
       </view>
-      <!-- <view class="item" wx:if="{{status == 80}}" bind:tap="goWrite"> -->
-      <view class="item" bind:tap="goWrite">
+      <view class="item" wx:if="{{status == 80}}" bind:tap="goWrite">
         <image class="icon" src="../../images/icon/write.png" mode=""/>
         <view class="label">
           评价晒单

+ 51 - 8
pages/writeReturnLogistics/writeReturnLogistics.js

@@ -15,7 +15,10 @@ Page({
     imgs: [],  //图片凭证
     mobile: '', //手机号码
     refundSn: '',  //退款编号名称
+    shopId: '',  //店铺id
     senderRemarks: '', //备注信息
+    type:'',//编辑模式
+    editData:null
   },
 
   /**
@@ -54,22 +57,25 @@ Page({
     } else {
       var pics = '';
       this.data.imgs.forEach(function (item) {
-        pics += item.path + ',';
+        // pics += item.path + ',';
+        pics += item.url + ',';
       });
       if (pics != '') {
         pics = pics.substring(0, pics.length - 1)
       }
       var parmas = {
-        url: "/p/orderRefund/submitExpress",
-        method: "POST",
+        url:this.data.type == 'edit'?"/refund/delivery/update": "/refund/delivery/save",
+        method: this.data.type == 'edit'?"PUT":"POST",
         data: {
-          expressId: this.data.deliveryList[this.data.expressId].dvyId,  //物流公司id
-          expressName: this.data.deliveryList[this.data.expressId].dvyName,  //物流公司名称
-          expressNo: this.data.expressNo,  //物流单号
+          shopId:this.data.shopId,
+          deyId: this.data.deliveryList[this.data.expressId].dvyId,  //物流公司id
+          deyName: this.data.deliveryList[this.data.expressId].dvyName,  //物流公司名称
+          deyNu: this.data.expressNo,  //物流单号
           imgs: pics,  //图片凭证
-          mobile: this.data.mobile, //手机号码
+          senderMobile: this.data.mobile, //手机号码
           refundSn: this.data.refundSn,  //退款编号名称
           senderRemarks: this.data.senderRemarks, //备注信息
+          userId:wx.getStorageSync("loginResult").userId
         },
         callBack: (res) => {
           wx.hideLoading();
@@ -147,11 +153,15 @@ Page({
    */
   onLoad: function (options) {
     this.setData({
-      refundSn: options.refundSn
+      refundSn: options.refundSn,
+      shopId: options.shopId,
+      type:options.type,
     });
     this.loadDeliveryData();
+   
   },
 
+  //获取物流公司列表
   loadDeliveryData(){
     wx.showLoading();
     http.request({
@@ -164,10 +174,43 @@ Page({
           deliveryList:res
         });
           console.log(res)
+          if(this.data.type == 'edit'){
+            this.getByRefundSn()
+          }
       }
     });
     console.log(this.data.deliveryList)
   },
+  /**
+   * 
+   * 获取退货物流信息
+   */
+  getByRefundSn(){
+    var parmas = {
+      url: `/refund/delivery/getByRefundSn/${this.data.refundSn}`,
+      method: "GET",
+      data: {},
+      callBack: (res) => {
+        let imgs = res.imgs.split(',').map(i=>{
+          return {url:i,path:i}
+        })
+
+        let expressId = 0
+        this.data.deliveryList.forEach((i,d)=>{
+          if(i.dvyId == res.deyId){
+            expressId = d
+          }
+        })
+        this.setData({
+          expressId,
+          expressNo:res.deyNu,
+          imgs,
+          senderRemarks:res.senderRemarks,
+        })
+      }
+    };
+    http.request(parmas);
+  },
 
   /**
    * 生命周期函数--监听页面初次渲染完成