Jelajahi Sumber

Merge branch 'master' of ssh://gogs.zfire.top:2222/zfire-front/recycle-mobile

* 'master' of ssh://gogs.zfire.top:2222/zfire-front/recycle-mobile:
  feat:售后
Moss 1 tahun lalu
induk
melakukan
04c5edf616
2 mengubah file dengan 94 tambahan dan 24 penghapusan
  1. 26 0
      src/components/zj-upload/index.vue
  2. 68 24
      src/pages/mine/myBuy/return.vue

+ 26 - 0
src/components/zj-upload/index.vue

@@ -59,6 +59,28 @@ export default {
     }
   },
   methods: {
+     // 检查文件类型
+    checkFileType(url) {
+      if (!url) return ''
+      const fileSuffix = url.substring(url.lastIndexOf('.') + 1)
+
+      if (['jpg', 'jpeg', 'png'].includes(fileSuffix)) {
+        return 'image'
+      } else if (['doc', 'docx', 'dot', 'wps', 'wpt'].includes(fileSuffix)) {
+        return 'word'
+      } else if (['xls', 'xlsx', 'xlt', 'et', 'ett'].includes(fileSuffix)) {
+        return 'excel'
+      } else if (['ppt', 'pptx', 'dps', 'dpt', 'pot', 'pps'].includes(fileSuffix)) {
+        return 'ppt'
+      } else if (['pdf'].includes(fileSuffix)) {
+        return 'pdf'
+      } else if (['zip', 'rar', 'gz', 'apk'].includes(fileSuffix)) {
+        return 'file'
+      }
+      {
+        return 'pdf'
+      }
+    },
     
     setFileVal(arr) {
       return arr.map(item => {
@@ -76,6 +98,10 @@ export default {
       uni.chooseImage({
         count: this.count === 0 ? 0 : this.count - this.files.length,
         success: async res => {
+          let pathType =  this.checkFileType(res.tempFiles[0].name)
+          if(pathType !== 'image'){
+            return this.$toast('当前格式仅支持jpg, jpeg, png,请检查')
+          }
           //  #ifdef H5
           uploadImgs(res.tempFiles[0]).then(res=>{
             this.files.push({

+ 68 - 24
src/pages/mine/myBuy/return.vue

@@ -1,4 +1,5 @@
 <template>
+  <!-- #ifdef H5 -->
   <zj-page-layout
     :hasFooter="true"
     :isScroll="true"
@@ -26,14 +27,14 @@
     <view class="form-container">
       <view class="title">退货信息填写</view>
       <view class="radio">
-        <view class="label">选择类型</view>
-        <u-radio-group v-model="formdata.applyType" placement="row">
+        <view class="label"><text style="color: red">*</text>选择类型</view>
+        <u-radio-group :disabled="showDisable" v-model="formdata.applyType" placement="row">
           <u-radio label="仅退款" activeColor="#01C30B" name="REFUND"></u-radio>
         </u-radio-group>
       </view>
       <view class="content">
-        <view class="label">退货原因</view>
-        <u--textarea v-model="formdata.applyNote" placeholder="请输入内容"></u--textarea>
+        <view class="label"><text style="color: red">*</text>退货原因</view>
+        <u--textarea :disabled="showDisable" v-model="formdata.applyNote" placeholder="请输入内容"></u--textarea>
       </view>
       <view class="content">
         <view class="label">上传图片(最多9张)</view>
@@ -42,42 +43,64 @@
       <zj-upload key="cp" @getFiles="getFiles" :fileList="fileList" :count="9" />
     </view>
 
-    <view class="form-container">
+    <view v-if="['AFTER_WAIT', 'REFUND', 'NO_REFUND'].indexOf(form.status)" class="form-container">
       <view class="title">处理结果</view>
       <view class="row">
-        <view class="label">处理状态</view>
-        <view class="value">已处理</view>
+        <view class="label">处理状态:</view>
+        <view class="value">{{
+          form.status === 'REFUND' || form.status === 'NO_REFUND' ? '已处理' : '待平台处理中'
+        }}</view>
       </view>
       <view class="row">
         <view class="label">处理结果</view>
-        <view class="value">同意退款</view>
+        <view class="value">{{
+          form.status === 'REFUND' ? '退款成功' : form.status === 'NO_REFUND' ? '不退款' : ''
+        }}</view>
       </view>
       <view class="row">
         <view class="label">退款金额</view>
-        <view class="value">¥1200.00</view>
+        <view class="value">¥{{ form.refundPrice }}</view>
       </view>
       <view class="row">
         <view class="label">备注信息</view>
-        <view class="value">备注信息备注信息备注信息备注信息备注信息备注信息备注信息备注信息备注信息</view>
+        <view class="value">{{ form.refundRemark }}</view>
       </view>
     </view>
 
     <template slot="footer">
       <view class="bottom-container">
-        <u-button text="提交申请" type="primary" shape="circle"></u-button>
+        <u-button v-if="showDisable" @click="back" text="返回" type="primary" shape="circle"></u-button>
+        <u-button v-else :disabled="disabled" @click="apply" text="提交申请" type="primary" shape="circle"></u-button>
       </view>
     </template>
   </zj-page-layout>
+  <!-- #endif -->
+  <!-- #ifndef H5 -->
+  <web-view :src="webViewHref(`/pages/mine/myBuy/return`, pam)"></web-view>
+  <!-- #endif -->
 </template>
 
 <script>
 import zjUpload from '@/components/zj-upload/index.vue'
 export default {
+  // #ifndef H5
+  data() {
+    return {
+      pam: {}
+    }
+  },
+
+  onLoad(pam) {
+    this.pam = pam
+  },
+  // #endif
+  // #ifdef H5
   components: {
     zjUpload
   },
   data() {
     return {
+      disabled: false,
       type: 1,
       content: '',
       refresherTriggered: false,
@@ -88,8 +111,10 @@ export default {
         applyType: 'REFUND',
         applyNote: ''
       },
+      showDisable: false,
       fileList: [],
-      fileurl: []
+      fileurl: [],
+      orderId: ''
     }
   },
   onLoad({ orderId }) {
@@ -99,34 +124,52 @@ export default {
     this.getDetail()
   },
   methods: {
+    back() {
+      uni.navigateBack()
+    },
     getFiles(value) {
-      this.fileurl = []
-      value.forEach(v => {
-        this.fileurl.push({
-          imgUrl: v
-        })
-      })
+      this.fileurl = value
     },
     //
     apply() {
+      if (!this.formdata.applyNote) {
+        this.$toast('缺少必要参数,请检查')
+        return
+      }
+      this.disabled = true
       let params = {
         ...this.formdata,
+        orderId: this.orderId,
         refundFile: this.fileurl.toString()
       }
-      this.$api
-        .postJson('/refundOrder/apply', params)
-        .then(res => {
-        })
-        .catch(err => {})
+      this.$toast('申请成功')
+      setTimeout(() => {
+        this.$api
+          .postJson('/refundOrder/apply', params)
+          .then(res => {
+            this.disabled = false
+            this.$navToPage(
+              {
+                url: '/pages/mine/myBuy/list'
+              },
+              'redirectTo'
+            )
+          })
+          .catch(err => {})
+      }, 1000)
     },
     //
     getDetail() {
       this.$api
-        .postJson('/orderPay/detail', {
+        .postJson('/refundOrder/detail', {
           orderId: this.orderId
         })
         .then(res => {
           this.form = res.data
+          this.fileList = res.data.orderRefundFileList.map(v => v.imgUrl)
+          if (['AFTER_WAIT', 'REFUND', 'NO_REFUND'].indexOf(res.data.status) !== -1) {
+            this.showDisable = true
+          }
         })
         .catch(err => {})
     },
@@ -135,6 +178,7 @@ export default {
       // this.getDetail()
     }
   }
+  // #endif
 }
 </script>