lilei %!s(int64=4) %!d(string=hai) anos
pai
achega
5e307aa5e9

+ 8 - 3
src/views/common/custList.vue

@@ -18,7 +18,7 @@
 </template>
 <script>
 import debounce from 'lodash/debounce'
-import { dealerQueryList } from '@/api/dealer'
+import { dealerQueryList, dealerFindUpdateInfoBySn } from '@/api/dealer'
 export default {
   props: {
   },
@@ -53,11 +53,16 @@ export default {
         data: [],
         fetching: false
       })
-      const row = this.data.find(item => item.dealerSn == value.key)
-      this.$emit('change', value, row)
+      this.$emit('change', value)
     },
     resetForm () {
       this.dealerName = []
+    },
+    // 查询详细
+    getDetail (sn) {
+      dealerFindUpdateInfoBySn({ sn: sn }).then(res => {
+        this.$emit('dealerDetail', res.data || null)
+      })
     }
   }
 }

+ 46 - 223
src/views/salesManagement/salesReturn/chooseCustomModal.vue

@@ -19,70 +19,25 @@
     >
       <a-row :gutter="15">
         <a-col :span="8">
-          <a-form-model-item label="客户名称" prop="buyerSn">
-            <custList id="chooseCustom-buyerSn" ref="custList" @change="custChange"></custList>
+          <a-form-model-item label="客户名称" required>
+            <custList id="chooseCustom-dealerName" ref="custList" @dealerDetail="dealerDetail" @change="custChange"></custList>
           </a-form-model-item>
         </a-col>
       </a-row>
       <a-row :gutter="15">
-        <a-col :span="16">
-          <a-form-model-item label="客户地址" required style="margin: 0;" :labelCol="{ span: 4 }" :wrapperCol="{ span: 20 }">
-            <a-row :gutter="15">
-              <!-- 客户地址 -->
-              <a-col span="8">
-                <a-form-model-item prop="provinceSn">
-                  <a-select id="chooseCustom-provinceSn" @change="getCityList" v-model="form.provinceSn" placeholder="请选择省">
-                    <a-select-option v-for="item in addrProvinceList" :value="item.id" :key="item.id + 'a'">{{ item.name }}</a-select-option>
-                  </a-select>
-                </a-form-model-item>
-              </a-col>
-              <a-col span="8">
-                <a-form-model-item prop="citySn">
-                  <a-select id="chooseCustom-citySn" @change="getAreaList" v-model="form.citySn" placeholder="请选择市">
-                    <a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
-                  </a-select>
-                </a-form-model-item>
-              </a-col>
-              <a-col span="8">
-                <a-form-model-item prop="countySn">
-                  <a-select id="chooseCustom-countySn" @change="areaCharged" v-model="form.countySn" placeholder="请选择区/县">
-                    <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
-                  </a-select>
-                </a-form-model-item>
-              </a-col>
-            </a-row>
-          </a-form-model-item>
-        </a-col>
         <a-col :span="8">
-          <a-form-model-item label="" prop="customerAddr">
-            <a-input
-              id="chooseCustom-customerAddr"
-              :maxLength="60"
-              v-model="form.customerAddr"
-              placeholder="请输入详细地址(最多60个字符)"
-              allowClear />
+          <a-form-model-item label="联系人">
+            {{ form.contact || '--' }}
           </a-form-model-item>
         </a-col>
-      </a-row>
-      <a-row :gutter="15">
-        <a-col :span="8">
-          <a-form-model-item label="联系人" prop="consigneeName">
-            <a-input
-              id="chooseCustom-consigneeName"
-              :maxLength="30"
-              v-model="form.consigneeName"
-              placeholder="请输入联系人(最多30个字符)"
-              allowClear />
+        <a-col :span="6">
+          <a-form-model-item label="联系手机">
+            {{ form.contactMobile || '--' }}
           </a-form-model-item>
         </a-col>
-        <a-col :span="8">
-          <a-form-model-item label="联系电话" prop="consigneeTel">
-            <a-input
-              id="chooseCustom-consigneeTel"
-              :maxLength="30"
-              v-model="form.consigneeTel"
-              placeholder="请输入联系电话(最多30个字符)"
-              allowClear />
+        <a-col :span="10">
+          <a-form-model-item label="客户地址">
+            {{ form.provinceName }} - {{ form.cityName }} - {{ form.districtName }} {{ form.address }}
           </a-form-model-item>
         </a-col>
       </a-row>
@@ -101,23 +56,11 @@
         <a-button @click="cancel" style="margin-left: 15px" id="chooseCustom-btn-back">取消</a-button>
       </a-form-model-item>
     </a-form-model>
-    <!-- 新增客户 -->
-    <a-modal
-      v-model="isNewCust"
-      title="新增客户"
-      centered
-      width="60%"
-      :maskClosable="false"
-      @cancel="cancelNewCust"
-      :footer="null"
-    >
-    </a-modal>
   </a-modal>
 </template>
 
 <script>
-import { getArea } from '@/api/data'
-import { salesReturnSave } from '@/api/salesReturn'
+import { salesReturnInsert } from '@/api/salesReturn'
 import { VSelect } from '@/components'
 import custList from '@/views/common/custList.vue'
 export default {
@@ -135,107 +78,49 @@ export default {
         labelCol: { span: 8 },
         wrapperCol: { span: 16 }
       },
-      buyerSnBak: '', // 更改前客户sn备份
       form: {
-        buyerName: '', // 客户名称
-        buyerSn: undefined, // 客户sn
-        consigneeTel: '', //  联系电话
-        consigneeName: '', //  联系人
-        priceType: '', // 价格类型
-        provinceSn: undefined, //  省
+        dealerName: '', // 客户名称
+        dealerSn: '', // 客户sn
+        contactMobile: '', //  联系电话
+        contact: '', //  联系人
+        provinceSn: '', //  省
         provinceName: '',
-        citySn: undefined, // 市
+        citySn: '', // 市
         cityName: '',
-        countySn: undefined, // 区
-        countyName: '',
-        customerAddr: '', //  详细地址
+        districtSn: '', // 区
+        districtName: '',
+        address: '', //  详细地址
         grabFlag: '1' // 是否抓单
       },
-      rules: {
-        buyerSn: [
-          { required: true, message: '请选择客户', trigger: ['change', 'blur'] }
-        ],
-        consigneeTel: [
-          { required: true, message: '请输入联系电话', trigger: 'blur' }
-        ],
-        provinceSn: [
-          { required: true, message: '请选择省', trigger: 'change' }
-        ],
-        citySn: [
-          { required: true, message: '请选择市', trigger: 'change' }
-        ],
-        countySn: [
-          { required: true, message: '请选择区/县', trigger: 'change' }
-        ],
-        customerAddr: [
-          { required: true, message: '请输入详细地址', trigger: 'blur' }
-        ],
-        grabFlag: [
-          { required: true, message: '请选择是否铺货出库', trigger: 'change' }
-        ]
-      },
-      addrProvinceList: [], //  省下拉
-      addrCityList: [], //  市下拉
-      addrDistrictList: [], //  区下拉
-      custId: undefined, // 客户id
-      interId: null
+      rules: {}
     }
   },
   methods: {
-    custChange (val, row) {
-      console.log(val, row)
+    custChange (val) {
       this.form.buyerSn = val.key
+      this.$refs.custList.getDetail(val.key)
     },
     //  获取详情
-    getDetail () {
-      custFindById({ id: this.custId }).then(res => {
-        const data = res.data
-        if (res.status == 200 && data) {
-          if (data.provinceSn) { this.getArea('city', data.provinceSn) }
-          if (data.citySn) { this.getArea('district', data.citySn) }
-          this.form = Object.assign(this.form, {
-            buyerName: data.customerName, // 客户名称
-            buyerSn: data.customerSn, // 客户sn
-            consigneeTel: data.contactTel, //  联系电话
-            consigneeName: data.contactName, //  联系人
-            provinceSn: data.provinceSn, //  省
-            provinceName: data.provinceName,
-            priceType: data.priceType,
-            citySn: data.citySn, // 市
-            cityName: data.cityName,
-            countySn: data.countySn, // 区
-            countyName: data.countyName,
-            customerAddr: data.customerAddr, //  详细地址
-            fax: data.fax //  客户传真
-          })
-        } else {
-          this.$message.error('获取客户信息失败')
-          this.$refs.ruleForm.resetFields()
-        }
-        this.$refs.ruleForm.clearValidate()
-      })
-    },
-    // 保存客户信息
-    handleSaveCust () {
-      const params = {
-        customerName: this.form.buyerName,
-        customerSn: this.form.buyerSn,
-        contactTel: this.form.consigneeTel, //  联系电话
-        contactName: this.form.consigneeName, //  联系人
-        provinceSn: this.form.provinceSn, //  省
-        provinceName: this.form.provinceName,
-        priceType: this.form.priceType,
-        citySn: this.form.citySn, // 市
-        cityName: this.form.cityName,
-        countySn: this.form.countySn, // 区
-        countyName: this.form.countyName,
-        customerAddr: this.form.customerAddr //  详细地址
+    dealerDetail (data) {
+      console.log(data)
+      if (data) {
+        this.form = Object.assign(this.form, {
+          dealerName: data.dealerName, // 客户名称
+          dealerSn: data.dealerSn, // 客户sn
+          contactMobile: data.contactMobile, //  联系电话
+          contact: data.contact, //  联系人
+          provinceSn: data.provinceSn, //  省
+          provinceName: data.provinceName,
+          citySn: data.citySn, // 市
+          cityName: data.cityName,
+          districtSn: data.districtSn, // 区
+          districtName: data.districtName,
+          address: data.address //  详细地址
+        })
+      } else {
+        this.$message.error('获取客户信息失败')
+        this.$refs.ruleForm.resetFields()
       }
-      updateByCustomerSn(params).then(res => {
-        if (res.status != 200) {
-          this.$message.error(res.message)
-        }
-      })
     },
     //  保存
     handleSubmit (e) {
@@ -243,11 +128,11 @@ export default {
       const _this = this
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
-          // 保存客户信息
-          _this.handleSaveCust()
           // 保存销售单
-          if (_this.form.buyerSn) {
+          if (_this.form.dealerSn) {
             _this.salesSaveFun()
+          } else {
+            _this.$message.info('请选择客户')
           }
         } else {
           console.log('error submit!!')
@@ -260,7 +145,7 @@ export default {
       const _this = this
       const form = this.form
       console.log(form, 'save data')
-      salesReturnSave(form).then(res => {
+      salesReturnInsert(form).then(res => {
         if (res.status == 200) {
           _this.$message.success(res.message)
           _this.$emit('ok', res.data)
@@ -272,74 +157,12 @@ export default {
       this.opened = false
       this.$refs.ruleForm.resetFields()
       this.$emit('cancel')
-    },
-    // 获取城市列表
-    getCityList (val) {
-      console.log(val, '-------------')
-      this.addrCityList = []
-      this.addrDistrictList = []
-      this.form.citySn = undefined
-      this.form.cityName = ''
-      this.form.countySn = undefined
-      this.form.countyName = ''
-      this.form.customerAddr = ''
-      this.form.countyName = this.addrProvinceList.find(item => item.id == val).name
-      this.getArea('city', val)
-    },
-    // 获取区县列表
-    getAreaList (val) {
-      this.addrDistrictList = []
-      this.form.countySn = undefined
-      this.form.countyName = ''
-      this.form.customerAddr = ''
-      this.form.cityName = this.addrCityList.find(item => item.id == val).name
-      this.getArea('district', val)
-    },
-    // 区县变更
-    areaCharged (val) {
-      this.form.customerAddr = ''
-      this.form.countyName = this.addrDistrictList.find(item => item.id == val).name
-    },
-    //  省/市/区
-    getArea (type, sn) {
-      let params
-      if (type == 'province') {
-        params = { level: '1' }
-      } else {
-        params = { psn: sn }
-      }
-      getArea(params).then(res => {
-        if (res.status == 200) {
-          if (type == 'province') {
-            this.addrProvinceList = res.data || []
-          } else if (type == 'city') {
-            this.addrCityList = res.data || []
-          } else if (type == 'district') {
-            this.addrDistrictList = res.data || []
-          }
-        } else {
-          if (type == 'province') {
-            this.addrProvinceList = []
-          } else if (type == 'city') {
-            this.addrCityList = []
-          } else if (type == 'district') {
-            this.addrDistrictList = []
-          }
-        }
-      })
-    },
-    filterOption (input, option) {
-      return (
-        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
-      )
     }
   },
   watch: {
     show (newValue, oldValue) {
       this.opened = newValue
       if (newValue) {
-        this.getArea('province')
-        this.getCustAllList()
       }
     }
   }

+ 10 - 10
src/views/salesManagement/salesReturn/list.vue

@@ -51,9 +51,9 @@
             <a-col :md="6" :sm="24">
               <a-form-item label="财务状态">
                 <v-select
-                  v-model="queryParam.settleState"
-                  ref="settleState"
-                  id="salesManagementList-settleState"
+                  v-model="queryParam.financialStatus"
+                  ref="financialStatus"
+                  id="salesManagementList-financialStatus"
                   code="FINANCIAL_STATUS"
                   placeholder="请选择财务状态"
                   allowClear></v-select>
@@ -101,8 +101,8 @@
         <span style="color: #ed1c24;cursor: pointer;" @click="handleDetail(record)">{{ record.salesReturnBillNo }}</span>
       </template>
       <!-- 财务状态 -->
-      <template slot="settleState" slot-scope="text, record">
-        <a-badge :color="text=='FINISH'?'#87d068':'gold'" :text="record.settleStateDictValue" />
+      <template slot="financialStatus" slot-scope="text, record">
+        <a-badge :color="text=='FINISH'?'#87d068':'gold'" :text="record.financialStatusDictValue" />
       </template>
       <!-- 操作 -->
       <template slot="action" slot-scope="text, record">
@@ -164,7 +164,7 @@ export default {
         buyerSn: undefined, //  客户名称
         salesReturnBillNo: undefined, //  总部销退单号
         billStatus: undefined, // 业务状态
-        settleState: undefined, // 财务状态
+        financialStatus: undefined, // 财务状态
         beginDate: undefined,
         endDate: undefined,
         auditBeginDate: undefined,
@@ -186,7 +186,7 @@ export default {
         { title: '是否抓单', dataIndex: 'grabFlag', width: 100, align: 'center', customRender: function (text) { return ['否', '是'][text] } },
         { title: '审核时间', dataIndex: 'auditTime', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '业务状态', dataIndex: 'billStatusDictValue', width: 110, align: 'center' },
-        { title: '财务状态', dataIndex: 'settleStateDictValue', scopedSlots: { customRender: 'settleState' }, width: 110, align: 'center' },
+        { title: '财务状态', dataIndex: 'financialStatusDictValue', scopedSlots: { customRender: 'financialStatus' }, width: 110, align: 'center' },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: 220, align: 'center', fixed: 'right' }
       ],
       // 加载数据方法 必须为 Promise 对象
@@ -242,11 +242,11 @@ export default {
     // 编辑
     handleEdit (row) {
       console.log(row)
-      this.$router.push({ name: row.grabFlag == 1 ? 'salesReturnGrabEdit' : 'salesReturnEdit', params: { id: row.id, sn: row.salesReturnSn, buyerSn: row.buyerSn } })
+      this.$router.push({ name: row.grabFlag == 1 ? 'salesReturnGrabEdit' : 'salesReturnEdit', params: { sn: row.salesReturnBillNo, buyerSn: row.buyerSn } })
     },
     // 详情
     handleDetail (row) {
-      this.$router.push({ name: 'salesReturnDetail', params: { id: row.id, sn: row.salesReturnSn } })
+      this.$router.push({ name: 'salesReturnDetail', params: { sn: row.salesReturnBillNo } })
     },
     // 删除
     handleDel (row) {
@@ -289,7 +289,7 @@ export default {
       this.$refs.custList.resetForm()
       this.queryParam.salesReturnBillNo = ''
       this.queryParam.billStatus = undefined
-      this.queryParam.settleState = undefined
+      this.queryParam.financialStatus = undefined
       this.queryParam.beginDate = undefined
       this.endDate = undefined
       this.auditBeginDate = undefined

+ 2 - 2
src/views/salesManagement/salesReturn/queryPart.vue

@@ -77,7 +77,7 @@
 </template>
 
 <script>
-import { salesReturnProductList } from '@/api/salesReturn'
+import { salesReturnProductList, salesQueryByReturn } from '@/api/salesReturn'
 import { querySumByProductLocation } from '@/api/stock'
 import { STable, VSelect } from '@/components'
 import moment from 'moment'
@@ -123,7 +123,7 @@ export default {
           this.queryParam.beginDate = undefined
           this.queryParam.endDate = undefined
         }
-        const fun = [querySumByProductLocation, salesReturnProductList]
+        const fun = [salesQueryByReturn, salesReturnProductList]
         if (this.grabFlag == 0) {
           this.queryParam.salePriceType = this.priceType
         }

+ 1 - 14
src/views/salesManagement/salesReturn/salesReturnGrabEdit.vue

@@ -151,8 +151,6 @@
           id="salesReturn-handleSubmit">提交</a-button>
       </div>
     </a-affix>
-    <!-- 选择客户弹框 -->
-    <choose-custom-modal :show="openModal" @ok="chooseCustomOk" @cancel="openModal=false"></choose-custom-modal>
   </div>
 </template>
 
@@ -160,7 +158,6 @@
 import { STable, VSelect } from '@/components'
 import queryPart from './queryPart.vue'
 import EditableCell from '@/views/common/editInput.js'
-import chooseCustomModal from './chooseCustomModal.vue'
 import { warehouseCascadeList } from '@/api/warehouse'
 import { salesReturnDetail, salesReturnQueryCount, salesReturnDetailList, salesReturnDiscount, salesReturnDelAll, salesReturnDetailDel, salesReturnSaveProduct, salesReturnSubmit } from '@/api/salesReturn'
 export default {
@@ -169,8 +166,7 @@ export default {
     STable,
     VSelect,
     queryPart,
-    EditableCell,
-    chooseCustomModal
+    EditableCell
   },
   data () {
     return {
@@ -178,7 +174,6 @@ export default {
       orderSn: null,
       buyerSn: null,
       disabled: false,
-      openModal: false,
       isInster: false, // 是否正在添加产品
       ordeDetail: { discountAmount: 0 },
       delLoading: false,
@@ -305,13 +300,6 @@ export default {
     handleBack () {
       this.$router.push({ name: 'salesReturnList' })
     },
-    // 选择客户成功
-    chooseCustomOk (data) {
-
-    },
-    handleEditCustom () {
-      this.openModal = true
-    },
     onCellChange (id, key, value) {
       const chooseLoadData = [...this.chooseLoadData]
       const row = chooseLoadData.find(item => item.id === id)
@@ -494,7 +482,6 @@ export default {
     }
   },
   mounted () {
-    this.orderId = this.$route.params.id
     this.orderSn = this.$route.params.sn
     this.buyerSn = this.$route.params.buyerSn
     this.getOrderDetail()