snow 2 years ago
parent
commit
f0c0e554ea

+ 46 - 40
src/views/sellOut/sellAfterApply/components/supplier_exam.vue

@@ -14,7 +14,7 @@
         <el-input v-model="formData.contactor" />
       </el-form-item>
       <el-form-item label="联系电话" prop="mobile">
-        <el-input v-model="formData.mobile" />
+        <el-input v-model="formData.mobile" max-length="11" />
       </el-form-item>
       <el-form-item label="退货地址" prop="addr_code">
         <select-area
@@ -26,35 +26,41 @@
         />
       </el-form-item>
     </template>
+
+    <el-form-item>
+      <div style="width:100%;display:flex;justify-content:flex-end">
+        <el-button type="primary" @click="submit">提交</el-button>
+      </div>
+    </el-form-item>
   </el-form>
 </template>
 <script>
 import { isMobile } from '@/utils/validate'
 
+const validatename = (rule, value, callback) => {
+  if (value === '') {
+    callback(new Error('收件人不能为空!'))
+  } else {
+    callback()
+  }
+}
+const validatemobile = (rule, value, callback) => {
+  if (value === '') {
+    callback(new Error('手机号不能为空!'))
+  } else {
+    if (!isMobile(value)) {
+      callback(new Error('手机号格式不正确!'))
+    } else {
+      callback()
+    }
+  }
+}
+
 export default {
   name: 'SupplierExam',
   mixins: [],
   props: [],
   data() {
-    const validatename = (rule, value, callback) => {
-      if (value === '') {
-        callback(new Error('收件人不能为空!'))
-      } else {
-        callback()
-      }
-    }
-    const validatemobile = (rule, value, callback) => {
-      if (value === '') {
-        callback(new Error('手机号不能为空!'))
-      } else {
-        if (!isMobile(value)) {
-          callback(new Error('手机号格式不正确!'))
-        } else {
-          callback()
-        }
-      }
-    }
-
     return {
       formData: {
         status: '4',
@@ -66,10 +72,7 @@ export default {
       statusOptions: [
         { value: '4', label: '通过' }, // -> 待客户退货
         { value: '2', label: '驳回' } // -> 待采购审核
-      ],
-      rules: {
-
-      }
+      ]
     }
   },
   computed: {
@@ -77,8 +80,9 @@ export default {
       return this.formData.status === '4'
     },
     rules() {
-      return (
-        { status: [
+      const { status } = this.formData
+      return ({
+        status: [
           {
             required: true,
             trigger: 'change',
@@ -87,7 +91,7 @@ export default {
         ],
         remark: [
           {
-            required: true,
+            required: status === '2',
             trigger: 'change',
             message: '请输入备注'
           }
@@ -113,19 +117,8 @@ export default {
             trigger: 'change',
             message: '请选择省市区'
           }
-        ] }
-      )
-    }
-  },
-  watch: {
-    'formData.status'(newVal) {
-      const newData = {
-        required: newVal === '2',
-        trigger: 'change',
-        message: '请选择审核状态'
-      }
-
-      console.log(this.rules)
+        ]
+      })
     }
   },
   mounted() {
@@ -134,6 +127,19 @@ export default {
     addr_selectChange(e) {
       this.formData.addr_code = e || []
       this.$refs.formRef.validateField('addr_code')
+    },
+    submit() {
+      this.$refs.formRef.validate(isValid => {
+        if (!isValid) return
+        const { addr_code } = this.formData
+
+        const params = {
+          ...this.formData,
+          addr_code: addr_code ? addr_code.join(',') : ''
+        }
+
+        this.$emit('changeStatus', params)
+      })
     }
   }
 }

+ 19 - 1
src/views/sellOut/sellAfterApply/detail.vue

@@ -94,7 +94,7 @@
             </el-collapse-item>
 
             <el-collapse-item title="供应商审核" name="4">
-              <supplier-exam />
+              <supplier-exam @changeStatus="handleSupplierExam" />
             </el-collapse-item>
             
             <el-collapse-item
@@ -256,6 +256,24 @@ export default {
     this.initData();
   },
   methods: {
+    async handleSupplierExam(data){
+      let res = await asyncRequest.status({
+        ...data,
+        returnCode: this.code
+      });
+      
+      if (res && res.code === 0) {
+        this.$notify.success({
+          title: "修改成功!",
+          message: "",
+        });
+        await this.initData();
+      } else if (res && res.code >= 100 && res.code <= 104) {
+        await this.logout();
+      } else {
+        this.$message.warning(res.message);
+      }
+    },
     getNewTime() {
       this.newTime = new Date().valueOf();
     },

+ 166 - 0
src/views/supplierSellOut/sellAfterApply/components/supplier_exam.vue

@@ -0,0 +1,166 @@
+<template>
+  <el-form ref="formRef" class="supplier-form" size="mini" label-width="80px" :model="formData" :rules="rules">
+    <el-form-item label="审核状态" prop="status">
+      <el-select v-model="formData.status" style="width:100%">
+        <el-option v-for="opt in statusOptions" :key="opt.value" :value="opt.value" :label="opt.label" />
+      </el-select>
+    </el-form-item>
+    <el-form-item label="审核备注" prop="remark">
+      <el-input v-model="formData.remark" />
+    </el-form-item>
+
+    <template v-if="displayExpressField">
+      <el-form-item label="收货人" prop="contactor">
+        <el-input v-model="formData.contactor" />
+      </el-form-item>
+      <el-form-item label="联系电话" prop="mobile">
+        <el-input v-model="formData.mobile" max-length="11" />
+      </el-form-item>
+      <el-form-item label="退货地址" prop="addr_code">
+        <select-area
+          :placeholder="'省/市/区'"
+          :value="formData.addr_code"
+          :is-detail="true"
+          :size="'mini'"
+          @selectChange="addr_selectChange"
+        />
+      </el-form-item>
+
+      <el-form-item prop="addr" label="详细地址">
+        <el-input v-model="formData.addr" placeholder="详细地址" />
+      </el-form-item>
+    </template>
+
+    <el-form-item>
+      <div style="width:100%;display:flex;justify-content:flex-end">
+        <el-button type="primary" @click="submit">提交</el-button>
+      </div>
+    </el-form-item>
+  </el-form>
+</template>
+<script>
+import { isMobile } from '@/utils/validate'
+
+const validatename = (rule, value, callback) => {
+  if (value === '') {
+    callback(new Error('收件人不能为空!'))
+  } else {
+    callback()
+  }
+}
+const validatemobile = (rule, value, callback) => {
+  if (value === '') {
+    callback(new Error('手机号不能为空!'))
+  } else {
+    if (!isMobile(value)) {
+      callback(new Error('手机号格式不正确!'))
+    } else {
+      callback()
+    }
+  }
+}
+
+export default {
+  name: 'SupplierExam',
+  mixins: [],
+  props: [],
+  data() {
+    return {
+      formData: {
+        status: '4',
+        remark: '',
+        contactor: '',
+        mobile: '',
+        addr_code: '',
+        addr: ''
+      },
+      statusOptions: [
+        { value: '4', label: '通过' }, // -> 待客户退货
+        { value: '2', label: '驳回' } // -> 待采购审核
+      ]
+    }
+  },
+  computed: {
+    displayExpressField() {
+      return this.formData.status === '4'
+    },
+    rules() {
+      const { status } = this.formData
+      return ({
+        addr: [
+          {
+            required: true,
+            trigger: 'change',
+            message: '想输入详细地址'
+          }
+        ],
+        status: [
+          {
+            required: true,
+            trigger: 'change',
+            message: '请选择审核状态'
+          }
+        ],
+        remark: [
+          {
+            required: status === '2',
+            trigger: 'change',
+            message: '请输入备注'
+          }
+        ],
+        contactor: [
+          {
+            required: true,
+            trigger: 'blur',
+            validator: validatename
+          }
+        ],
+        mobile: [
+          {
+            required: true,
+            trigger: 'blur',
+            validator: validatemobile
+          }
+        ],
+        addr_code: [
+          {
+            type: 'array',
+            required: true,
+            trigger: 'change',
+            message: '请选择省市区'
+          }
+        ]
+      })
+    }
+  },
+  mounted() {
+  },
+  methods: {
+    addr_selectChange(e) {
+      this.formData.addr_code = e || []
+      this.$refs.formRef.validateField('addr_code')
+    },
+    submit() {
+      this.$refs.formRef.validate(isValid => {
+        if (!isValid) return
+        const { addr_code } = this.formData
+
+        const params = {
+          ...this.formData,
+          addr_code: addr_code ? addr_code.join(',') : ''
+        }
+
+        this.$emit('changeStatus', params)
+      })
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.supplier-form{
+  ::v-deep(.el-form-item){
+    width: 400px;
+  }
+}
+</style>

+ 41 - 4
src/views/supplierSellOut/sellAfterApply/detail.vue

@@ -78,6 +78,7 @@
                 :spucode="sitem.good_code"
               />
             </el-collapse-item>
+
             <el-collapse-item
               title="业务审核"
               name="3"
@@ -91,7 +92,16 @@
                 @searchChange="examForm"
               />
             </el-collapse-item>
-            <el-collapse-item
+
+            <el-collapse-item label="待采购审核" v-if="status + '' === '2'">
+              <purchase-exam />
+            </el-collapse-item>
+
+            <el-collapse-item title="供应商审核" name="4" v-if="status=== '9'">
+              <supplier-exam @changeStatus="handleSupplierExam" />
+            </el-collapse-item>
+            
+            <!-- <el-collapse-item
               title="采购审核"
               name="4"
               v-if="
@@ -109,7 +119,12 @@
                 v-if="newTime != ''"
                 @refresh="initData"
               />
-            </el-collapse-item>
+            </el-collapse-item> -->
+
+            <!-- <el-collapse-item>
+              <supplier-exam />
+            </el-collapse-item> -->
+
             <el-collapse-item
               title="设置退货仓库"
               name="4"
@@ -154,13 +169,16 @@ import asyncRequest from "@/apis/service/sellOut/sellAfterApply";
 import ExpressFeedback from "./components/express_feedback";
 import { sellshowColumns } from "./columns";
 import purchaseExam from "./components/purchase_exam";
+import SupplierExam from "./components/supplier_exam.vue";
 import { xs_order_type_options } from "@/assets/js/statusList";
+
 export default {
   name: "sellAfterApplyDetail",
   mixins: [mixinPage, resToken],
   components: {
+    SupplierExam,
     purchaseExam,
-    ExpressFeedback,
+    ExpressFeedback
   },
   computed: {
     powers() {
@@ -242,6 +260,24 @@ export default {
     this.initData();
   },
   methods: {
+    async handleSupplierExam(data){
+      let res = await asyncRequest.status({
+        ...data,
+        returnCode: this.code
+      });
+      
+      if (res && res.code === 0) {
+        this.$notify.success({
+          title: "修改成功!",
+          message: "",
+        });
+        await this.initData();
+      } else if (res && res.code >= 100 && res.code <= 104) {
+        await this.logout();
+      } else {
+        this.$message.warning(res.message);
+      }
+    },
     getNewTime() {
       this.newTime = new Date().valueOf();
     },
@@ -266,7 +302,8 @@ export default {
     async examForm(e) {
       console.log(e);
       if (!this.loading) {
-        let type = e.state + '' === "1" ? "2" : "6";
+        //通过为9「待供应商审核」,不通过为6「业务已驳回」
+        let type = e.state + '' === "1" ? "9" : "6";
         let message = e.state + '' === "1" ? "提交业务审核" : "提交业务审核";
         await this.statusConfirm(type, message, e.remark);
       }

+ 26 - 10
src/views/supplierSellOut/sellAfterApply/index.vue

@@ -132,11 +132,9 @@
                       label="销售订单编号"
                       value="sellOrderNum"
                     ></el-option>
-
                     <el-option label="商品编号" value="goodsNum"></el-option>
                     <el-option label="商品名称" value="goodsName"></el-option>
                     <el-option label="申请人部门" value="company_name"></el-option>
-                    
                     <el-option label="申请人" value="applyer"></el-option>
                   </el-select>
                   <el-button
@@ -206,7 +204,7 @@
             <i
               class="el-icon-view tb-icon"
               @click="
-                routeGoto('sellAfterApplyDetail', { id: scope.row.returnCode })
+                routeGoto('supplierSellAfterApplyDetail', { id: scope.row.returnCode })
               "
             ></i>
           </el-tooltip>
@@ -221,15 +219,13 @@
    <script>
 import mixinPage from "@/mixins/elPaginationHandle";
 import resToken from "@/mixins/resToken";
-
 import asyncRequest from "@/apis/service/sellOut/sellAfterApply";
 import { columns } from "./columns";
 import { mapGetters } from "vuex";
 
 export default {
-  name: "supplierSellAfterApply",
+  name: "sellAfterApply",
   mixins: [mixinPage, resToken],
-
   computed: {
     ...mapGetters(["tablebtnSize", "searchSize", "size"]),
     powers() {
@@ -259,24 +255,44 @@ export default {
       sitem: null,
       // 收到货状态
       status1Options: [
+        // { id: "1", label: "待业务审核" },
+        // { id: "2", label: "待采购审核" },
+        // { id: "3", label: "待设置仓库" },
+        // { id: "4", label: "待客户退货" },
+        // { id: "5", label: "售后已完成" },
+        // { id: "6", label: "业务已驳回" },
+        // { id: "7", label: "采购已驳回" },
+        // { id: "8", label: "申请已取消" },
         { id: "1", label: "待业务审核" },
         { id: "2", label: "待采购审核" },
-        { id: "3", label: "待设置仓库" },
+        { id: "3", label: "待设置仓库" }, // 废弃
         { id: "4", label: "待客户退货" },
         { id: "5", label: "售后已完成" },
         { id: "6", label: "业务已驳回" },
-        { id: "7", label: "采购已驳回" },
+        { id: "7", label: "采购已驳回" }, // 废弃
         { id: "8", label: "申请已取消" },
+        { id: "9", label: "供应商审核" },
+        { id: "10", label: "业务公司修改待供应商确认" }
       ],
        // 未收到货状态
       status2Options: [
+        // { id: "1", label: "待业务审核" },
+        // { id: "2", label: "待采购审核" },
+        // { id: "3", label: "待同意退货" },
+        // { id: "5", label: "售后已完成" },
+        // { id: "6", label: "业务已驳回" },
+        // { id: "7", label: "采购已驳回" },
+        // { id: "8", label: "申请已取消" },
         { id: "1", label: "待业务审核" },
         { id: "2", label: "待采购审核" },
-        { id: "3", label: "待同意退货" },
+        { id: "3", label: "待设置仓库" }, // 废弃
+        { id: "4", label: "待客户退货" },
         { id: "5", label: "售后已完成" },
         { id: "6", label: "业务已驳回" },
-        { id: "7", label: "采购已驳回" },
+        { id: "7", label: "采购已驳回" }, // 废弃
         { id: "8", label: "申请已取消" },
+        { id: "9", label: "供应商审核" },
+        { id: "10", label: "业务公司修改待供应商确认" }
       ],
       loading: false,
       showModel: false,