chenrui 3 سال پیش
والد
کامیت
6ac5a179e3

+ 7 - 0
src/api/purchase.js

@@ -133,3 +133,10 @@ export const purchaseDetailPrint = params => {
     responseType: 'blob'
   })
 }
+export const purchaseTargetList = (params) => {
+  return axios({
+    url: '/purchaseTarget/queryList',
+    data: params,
+    method: 'post'
+  })
+}

+ 2 - 2
src/config/router.config.js

@@ -431,7 +431,7 @@ export const asyncRouterMap = [
                 }
               },
               {
-                path: 'add/:id/:sn',
+                path: 'add/:id/:sn/:name',
                 name: 'purchaseReturnAdd',
                 component: () => import(/* webpackChunkName: "shop" */ '@/views/purchasingManagement/purchaseReturn/edit.vue'),
                 meta: {
@@ -442,7 +442,7 @@ export const asyncRouterMap = [
                 }
               },
               {
-                path: 'edit/:id/:sn',
+                path: 'edit/:id/:sn/:name',
                 name: 'purchaseReturnEdit',
                 component: () => import(/* webpackChunkName: "shop" */ '@/views/purchasingManagement/purchaseReturn/edit.vue'),
                 meta: {

+ 2 - 2
src/views/financialManagement/warehousingAudit/detail.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="warehousingAuditDetail-wrap">
-	  <a-spin :spinning="spinning" tip="Loading...">
+    <a-spin :spinning="spinning" tip="Loading...">
       <a-page-header :ghost="false" :backIcon="false" class="warehousingAuditDetail-cont" >
         <!-- 自定义的二级文字标题 -->
         <template slot="subTitle">
@@ -22,7 +22,7 @@
         <a-collapse :activeKey="['1']">
           <a-collapse-panel key="1" header="基础信息">
             <a-descriptions :column="3" v-if="basicInfoData">
-              <a-descriptions-item label="供应商">{{ basicInfoData&&basicInfoData.dealerName ? basicInfoData.dealerName : '--' }}</a-descriptions-item>
+              <a-descriptions-item label="供应商">{{ basicInfoData&&basicInfoData.purchaseTargetName ? basicInfoData.purchaseTargetName : '--' }}</a-descriptions-item>
               <a-descriptions-item label="入库时间">{{ basicInfoData&&basicInfoData.stockPutTime ? basicInfoData.stockPutTime : '--' }}</a-descriptions-item>
               <a-descriptions-item label="采购单号">{{ basicInfoData&&basicInfoData.purchaseBillNo ? basicInfoData.purchaseBillNo : '--' }}</a-descriptions-item>
             </a-descriptions>

+ 20 - 23
src/views/purchasingManagement/purchaseOrder/basicInfoModal.vue

@@ -16,14 +16,13 @@
         :rules="rules"
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol" >
-        <a-form-model-item label="供应商" prop="purchaseTragetType">
+        <a-form-model-item label="供应商" prop="purchaseTargetSn">
           <a-radio-group
             name="radioGroup"
-            v-model="form.purchaseTragetType"
+            v-model="form.purchaseTargetSn"
             @change="tragetTypeChange"
-            id="purchaseOrder-basicInfo-purchaseTragetType" >
-            <a-radio value="HQ" class="radio-s">箭冠营销中心</a-radio>
-            <a-radio value="HU" class="radio-s" v-if="purchaseTragetType&&purchaseTragetType.dealerSn">{{ purchaseTragetType.dealerName }}</a-radio>
+            id="purchaseOrder-basicInfo-purchaseTargetSn" >
+            <a-radio v-for="item in purchaseTragetType" :key="item.purchaseTargetSn" :value="item.purchaseTargetSn" class="radio-s">{{ item.purchaseTargetName }}</a-radio>
           </a-radio-group>
         </a-form-model-item>
         <a-form-model-item label="支付方式" prop="settleStyleSn">
@@ -54,7 +53,7 @@ import { VSelect } from '@/components'
 import chooseAddressModal from './receivingAddress/chooseAddressModal.vue'
 import { settleStyleQueryAll } from '@/api/settleStyle'
 import { shippingAddressQuery } from '@/api/shippingAddress'
-import { purchaseSave, getParentDealer } from '@/api/purchase'
+import { purchaseSave, purchaseTargetList } from '@/api/purchase'
 export default {
   name: 'BasicInfoModal',
   components: { VSelect, chooseAddressModal },
@@ -75,7 +74,7 @@ export default {
         wrapperCol: { span: 18 }
       },
       form: {
-        purchaseTragetType: '', // 供应商
+        purchaseTargetType: '', // 供应商
         shippingAddressProvinceName: '', // 省
         shippingAddressCityName: '', // 市
         shippingAddressCountyName: '', // 区
@@ -83,20 +82,18 @@ export default {
         consigneeTel: '', // 联系电话
         consigneeName: '', // 联系人名称
         settleStyleSn: undefined, //  支付方式
-        dealerSn: '',
-        dealerName: ''
+        purchaseTargetSn: undefined,
+        purchaseTargetName: ''
       },
       rules: {
-        purchaseTragetType: [
+        purchaseTargetSn: [
           { required: true, message: '请选择供应商', trigger: 'change' }
         ],
         settleStyleSn: [
           { required: true, message: '请选择支付方式', trigger: 'change' }
         ]
       },
-      purchaseTragetType: {
-        dealerName: ''
-      },
+      purchaseTragetType: [],
       addressVal: '选择地址', //  选择地址/更换地址
       chooseAddr: '', //  当前已选地址信息
       openAddrModal: false // 选择地址弹框是否显示
@@ -113,17 +110,17 @@ export default {
       this.form.shippingAddress = ''// 详细地址
       this.form.consigneeTel = '' // 联系电话
       this.form.consigneeName = ''
-      this.form.dealerSn = ''
-      this.form.dealerName = ''
+      this.form.purchaseTargetType = ''
+      this.form.purchaseTargetSn = undefined
+      this.form.purchaseTargetName = ''
     },
     // 供应商change
     tragetTypeChange (e) {
-      if (e.target.value == 'HQ') { //  总部
-        this.form.dealerSn = ''
-        this.form.dealerName = '箭冠营销中心'
-      } else if (e.target.value == 'HU') { //  上级
-        this.form.dealerSn = this.purchaseTragetType.dealerSn
-        this.form.dealerName = this.purchaseTragetType.dealerName
+      const val = e.target.value
+      const ind = this.purchaseTragetType.findIndex(item => item.purchaseTargetSn == val)
+      if (ind != -1) {
+        this.form.purchaseTargetType = this.purchaseTragetType[ind].purchaseTargetType
+        this.form.purchaseTargetName = this.purchaseTragetType[ind].purchaseTargetName
       }
     },
     //  保存
@@ -187,11 +184,11 @@ export default {
       })
     },
     getParentDealer () {
-      getParentDealer({}).then(res => {
+      purchaseTargetList({}).then(res => {
         if (res.status == 200) {
           this.purchaseTragetType = res.data
         } else {
-          this.purchaseTragetType = { dealerName: '' }
+          this.purchaseTragetType = []
         }
       })
     },

+ 1 - 1
src/views/purchasingManagement/purchaseOrder/detail.vue

@@ -24,7 +24,7 @@
         <a-collapse :activeKey="['1']">
           <a-collapse-panel key="1" header="基础信息">
             <a-descriptions :column="3">
-              <a-descriptions-item label="供应商">{{ (detail&&detail.dealerName) || '--' }}</a-descriptions-item>
+              <a-descriptions-item label="供应商">{{ (detail&&detail.purchaseTargetName) || '--' }}</a-descriptions-item>
               <a-descriptions-item label="支付方式">{{ detail&&detail.settleStyleEntity.name }}</a-descriptions-item>
               <a-descriptions-item label="采购员工">{{ detail&&detail.operatorName }}</a-descriptions-item>
               <a-descriptions-item label="收货人">{{ detail&&detail.consigneeName }}<span v-if="detail&&detail.consigneeTel">({{ detail&&detail.consigneeTel }})</span></a-descriptions-item>

+ 1 - 1
src/views/purchasingManagement/purchaseOrder/edit.vue

@@ -33,7 +33,7 @@
                 @click.stop="handleEditInfo" />
             </template>
             <a-descriptions :column="2">
-              <a-descriptions-item label="供应商">{{ detail&&detail.dealerName }}</a-descriptions-item>
+              <a-descriptions-item label="供应商">{{ detail&&detail.purchaseTargetName }}</a-descriptions-item>
               <a-descriptions-item label="支付方式">{{ detail&&detail.settleStyleEntity.name }}</a-descriptions-item>
               <a-descriptions-item label="收货人">{{ detail&&detail.consigneeName }}({{ detail&&detail.consigneeTel }})</a-descriptions-item>
               <a-descriptions-item label="收货地址">

+ 22 - 14
src/views/purchasingManagement/purchaseOrder/list.vue

@@ -17,14 +17,15 @@
           <a-col :md="6" :sm="24">
             <a-form-item label="供应商" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
               <a-select
-                id="purchaseOrderList-dealerSn"
+                id="purchaseOrderList-purchaseTargetSn"
                 placeholder="请选择供应商"
                 allowClear
-                v-model="queryParam.dealerSn"
+                v-model="queryParam.purchaseTargetSn"
                 :showSearch="true"
                 option-filter-prop="children"
-                :filter-option="filterOption">
-                <a-select-option v-for="item in supplierList" :key="item.dealerSn" :value="item.dealerSn">{{ item.dealerName }}</a-select-option>
+                :filter-option="filterOption"
+                @change="tragetTypeChange">
+                <a-select-option v-for="item in supplierList" :key="item.purchaseTargetSn" :value="item.purchaseTargetSn">{{ item.purchaseTargetName }}</a-select-option>
               </a-select>
             </a-form-item>
           </a-col>
@@ -128,7 +129,7 @@
 import { STable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
 import basicInfoModal from './basicInfoModal.vue'
-import { purchaseList, purchaseDel, purchaseCount, getParentDealer } from '@/api/purchase'
+import { purchaseList, purchaseDel, purchaseCount, purchaseTargetList } from '@/api/purchase'
 export default {
   components: { STable, VSelect, basicInfoModal, rangeDate },
   data () {
@@ -141,7 +142,8 @@ export default {
       // 查询参数
       queryParam: {
         purchaseBillNo: '',
-        dealerSn: undefined,
+        purchaseTargetSn: undefined,
+        purchaseTargetType: undefined,
         billStatus: undefined,
         financialStatus: undefined,
         beginDate: '',
@@ -158,7 +160,7 @@ export default {
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
         { title: '采购单号', scopedSlots: { customRender: 'purchaseBillNo' }, width: 220, align: 'center' },
         { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '供应商', dataIndex: 'dealerName', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '供应商', dataIndex: 'purchaseTargetName', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品款数', dataIndex: 'totalCategory', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '采购数量', dataIndex: 'totalQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '采购金额(¥)', dataIndex: 'discountedAmount', width: 115, align: 'center', customRender: function (text) { return '¥' + (text || 0) } },
@@ -192,6 +194,13 @@ export default {
         this.totalData = res.data || null
       })
     },
+    // 供应商change
+    tragetTypeChange (val) {
+      const ind = this.supplierList.findIndex(item => item.purchaseTargetSn == val)
+      if (ind != -1) {
+        this.queryParam.purchaseTargetType = this.supplierList[ind].purchaseTargetType
+      }
+    },
     //  时间  change
     dateChange (date) {
       this.queryParam.beginDate = date[0]
@@ -243,7 +252,8 @@ export default {
       this.queryParam.endDate = ''
       this.queryParam.orderBundleNo = ''
       this.queryParam.purchaseBillNo = ''
-      this.queryParam.dealerSn = ''
+      this.queryParam.purchaseTargetSn = undefined
+      this.queryParam.purchaseTargetType = undefined
       this.queryParam.billStatus = undefined
       this.queryParam.financialStatus = undefined
       this.$refs.table.refresh(true)
@@ -255,13 +265,11 @@ export default {
     },
     // 获取供应商数据
     getSupperList () {
-      this.supplierList = [{ dealerSn: '1', dealerName: '箭冠营销中心' }]
-      getParentDealer({}).then(res => {
+      purchaseTargetList({}).then(res => {
         if (res.status == 200) {
-          this.purchaseTragetType = res.data
-          if (res.data) {
-            this.supplierList.push({ dealerSn: res.data.dealerSn, dealerName: res.data.dealerName })
-          }
+          this.supplierList = res.data
+        } else {
+          this.supplierList = []
         }
       })
     }

+ 2 - 2
src/views/purchasingManagement/purchaseReturn/detail.vue

@@ -23,7 +23,7 @@
       <a-collapse :activeKey="['1']">
         <a-collapse-panel key="1" header="基础信息">
           <a-descriptions :column="3" v-if="basicInfoData">
-            <a-descriptions-item label="客户名称">{{ basicInfoData.supplierName || '--' }}</a-descriptions-item>
+            <a-descriptions-item label="客户名称">{{ basicInfoData.returnTargetName || '--' }}</a-descriptions-item>
             <a-descriptions-item label="采退单号">{{ basicInfoData.purchaseReturnNo || '--' }}</a-descriptions-item>
             <a-descriptions-item label="创建时间">{{ basicInfoData.createDate || '--' }}</a-descriptions-item>
             <a-descriptions-item label="退货数量">{{ basicInfoData.totalQty || basicInfoData.totalQty==0 ? basicInfoData.totalQty : '--' }}</a-descriptions-item>
@@ -117,7 +117,7 @@ export default {
     },
     //  编辑
     handleEdit () {
-      this.$router.push({ path: `/purchasingManagement/purchaseReturn/edit/${this.basicInfoData.id}/${this.basicInfoData.purchaseReturnSn}` })
+      this.$router.push({ path: `/purchasingManagement/purchaseReturn/edit/${this.basicInfoData.id}/${this.basicInfoData.purchaseReturnSn}/${this.basicInfoData.returnTargetName}` })
     }
   },
   beforeRouteEnter (to, from, next) {

+ 4 - 4
src/views/purchasingManagement/purchaseReturn/edit.vue

@@ -1,11 +1,11 @@
 <template>
   <div class="purchaseReturnEdit-wrap">
-	  <a-spin :spinning="spinning" tip="Loading...">
+    <a-spin :spinning="spinning" tip="Loading...">
       <a-page-header :ghost="false" :backIcon="false" class="purchaseReturnEdit-back" >
         <!-- 自定义的二级文字标题 -->
         <template slot="subTitle">
           <a id="purchaseReturnEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
-          <span style="margin: 0 15px;color: #666;">供应商名称:箭冠营销总部</span>
+          <span style="margin: 0 15px;color: #666;">供应商名称:{{ $route.params.name }}</span>
         </template>
       </a-page-header>
       <!-- 选择产品 -->
@@ -248,7 +248,7 @@ export default {
           this.getPurchaseBillDetailList()
           this.getChooseProductList()
           this.spinning = false
-        }else{
+        } else {
           this.spinning = false
         }
       })
@@ -305,7 +305,7 @@ export default {
             _this.handleBack()
             _this.spinning = false
           }, 1000)
-        }else{
+        } else {
           _this.spinning = false
         }
       })

+ 32 - 5
src/views/purchasingManagement/purchaseReturn/list.vue

@@ -97,6 +97,7 @@
 <script>
 import { STable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
+import { purchaseTargetList } from '@/api/purchase'
 import { purchaseReturnList, purchaseReturnSave, purchaseReturnDel } from '@/api/purchaseReturn'
 export default {
   components: { STable, VSelect, rangeDate },
@@ -137,7 +138,8 @@ export default {
           this.disabled = false
           return data
         })
-      }
+      },
+      purchaseTragetType: []
     }
   },
   methods: {
@@ -180,23 +182,48 @@ export default {
     handleEdit (row) {
       const _this = this
       if (row) { //  编辑
-        _this.$router.push({ path: `/purchasingManagement/purchaseReturn/edit/${row.id}/${row.purchaseReturnSn}` })
+        _this.$router.push({ path: `/purchasingManagement/purchaseReturn/edit/${row.id}/${row.purchaseReturnSn}/${row.returnTargetName}` })
       } else { //  新增
+        let content
+        if (this.purchaseTragetType.length > 0) {
+          content = '退货供应商:' + this.purchaseTragetType[0].purchaseTargetName
+        } else {
+          content = '退货供应商:--'
+        }
         this.$confirm({
           title: '提示',
-          content: '退货供应商:箭冠营销总部',
+          content: content,
           centered: true,
           onOk () {
-            purchaseReturnSave({}).then(res => {
+            const params = {
+              returnTargetSn: _this.purchaseTragetType[0].purchaseTargetSn,
+              returnTargetName: _this.purchaseTragetType[0].purchaseTargetName,
+              returnTargetType: _this.purchaseTragetType[0].purchaseTargetType
+            }
+            purchaseReturnSave(params).then(res => {
               if (res.status == 200) {
                 const data = res.data
-                _this.$router.push({ path: `/purchasingManagement/purchaseReturn/add/${data.id}/${data.purchaseReturnSn}` })
+                _this.$router.push({ path: `/purchasingManagement/purchaseReturn/add/${data.id}/${data.purchaseReturnSn}/${data.returnTargetName}` })
               }
             })
           }
         })
       }
+    },
+    getParentDealer () {
+      purchaseTargetList({ purchaseTargetType: 'SUPPLIER_SYS' }).then(res => {
+        if (res.status == 200) {
+          this.purchaseTragetType = res.data
+        } else {
+          this.purchaseTragetType = []
+        }
+      })
     }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {
+      vm.getParentDealer()
+    })
   }
 }
 </script>