瀏覽代碼

采购退货

lilei 4 年之前
父節點
當前提交
ae0a496505

+ 1 - 1
src/views/salesManagement/salesQuery/detail.vue

@@ -2,7 +2,7 @@
   <div class="salesDetail-wrap">
     <a-page-header :ghost="false" :backIcon="false" class="salesDetail-cont">
       <template slot="subTitle">
-        <a href="javascript:;" @click="handleBack"><a-icon type="left"></a-icon>返回列表</a>
+        <a href="javascript:;" @click="handleBack"><a-icon type="left"></a-icon> 返回列表</a>
       </template>
       <template slot="extra">
         <span>打印字段:</span>

+ 0 - 287
src/views/salesManagement/salesReturn/chooseCustom.vue

@@ -1,287 +0,0 @@
-<template>
-  <a-modal
-    v-model="opened"
-    title="选择客户"
-    centered
-    :maskClosable="false"
-    :confirmLoading="confirmLoading"
-    width="80%"
-    :footer="null"
-    @cancel="cancel"
-  >
-    <a-form-model
-      id="chooseCustom-form"
-      ref="ruleForm"
-      :model="form"
-      :rules="rules"
-      :label-col="formItemLayout.labelCol"
-      :wrapper-col="formItemLayout.wrapperCol"
-    >
-      <a-row :gutter="15">
-        <a-col :span="8">
-          <a-form-model-item label="客户名称" prop="name">
-            <a-input
-              id="chooseCustom-name"
-              :maxLength="30"
-              v-model="form.name"
-              placeholder="请输入客户名称(最多30个字符)"
-              allowClear />
-          </a-form-model-item>
-        </a-col>
-        <a-col :span="8">
-          <a-form-model-item>
-            (未搜索到客户时为新增客户)
-          </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="provinceCode">
-                  <a-select id="chooseCustom-provinceCode" @change="getCityList" v-model="form.provinceCode" 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="cityCode">
-                  <a-select id="chooseCustom-cityCode" @change="getAreaList" v-model="form.cityCode" 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="districtCode">
-                  <a-select id="chooseCustom-districtCode" @change="areaCharged" v-model="form.districtCode" 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 prop="address">
-            <a-input
-              id="chooseCustom-address"
-              :maxLength="60"
-              v-model="form.address"
-              placeholder="请输入详细地址(最多60个字符)"
-              allowClear />
-          </a-form-model-item>
-        </a-col>
-      </a-row>
-      <a-row :gutter="15">
-        <a-col :span="8">
-          <a-form-model-item label="联系人" prop="contacts">
-            <a-input
-              id="chooseCustom-contacts"
-              :maxLength="30"
-              v-model="form.contacts"
-              placeholder="请输入联系人(最多30个字符)"
-              allowClear />
-          </a-form-model-item>
-        </a-col>
-        <a-col :span="8">
-          <a-form-model-item label="联系电话" prop="customerPhone">
-            <a-input
-              id="chooseCustom-customerPhone"
-              :maxLength="11"
-              v-model="form.customerPhone"
-              placeholder="请输入联系电话(最多11个字符)"
-              allowClear />
-          </a-form-model-item>
-        </a-col>
-      </a-row>
-      <a-row :gutter="15">
-        <a-col :span="8">
-          <a-form-model-item label="是否抓单" prop="shipping">
-            <v-select
-              v-model="form.iszd"
-              ref="iszd"
-              id="salesReturn-iszd"
-              code="FLAG"
-              placeholder="请选择是否抓单"
-              allowClear></v-select>
-          </a-form-model-item>
-        </a-col>
-        <a-col :span="8">
-          <a-form-model-item label="开单人">
-            王明
-          </a-form-model-item>
-        </a-col>
-      </a-row>
-      <a-form-model-item :wrapper-col="{ span: 12, offset: 6 }" style="text-align: center;">
-        <a-button type="primary" :loading="confirmLoading" @click="handleSubmit" id="chooseCustom-btn-submit">保存</a-button>
-        <a-button @click="cancel" style="margin-left: 15px" id="chooseCustom-btn-back">取消</a-button>
-      </a-form-model-item>
-    </a-form-model>
-  </a-modal>
-</template>
-
-<script>
-import { VSelect } from '@/components'
-export default {
-  name: 'ChooseCustom',
-  components: {
-    VSelect
-  },
-  props: {
-    show: [Boolean]
-  },
-  data () {
-    return {
-      opened: this.show,
-      confirmLoading: false,
-      formItemLayout: {
-        labelCol: { span: 8 },
-        wrapperCol: { span: 16 }
-      },
-      form: {
-        name: '', // 客户名称
-        provinceCode: undefined, //  省
-        provinceName: '',
-        cityCode: undefined, // 市
-        cityName: '',
-        districtCode: undefined, // 区
-        districtName: '',
-        address: '', //  详细地址
-        contactName: '', //  联系人
-        contactPhone: '', //  联系电话
-        remarks: '', //  备注
-        priceType: '', //  价格类型
-        payType: '', // 支付方式
-        payment: '' // 收款方式
-      },
-      rules: {
-        name: [
-          { required: true, message: '请输入客户名称', trigger: 'blur' }
-        ],
-        provinceCode: [
-          { required: true, message: '请选择省', trigger: 'change' }
-        ],
-        cityCode: [
-          { required: true, message: '请选择市', trigger: 'change' }
-        ],
-        districtCode: [
-          { required: true, message: '请选择区/县', trigger: 'change' }
-        ],
-        address: [
-          { required: true, message: '请输入详细地址', trigger: 'blur' }
-        ],
-        contactName: [
-          { required: true, message: '请输入联系人', trigger: 'blur' }
-        ],
-        contactPhone: [
-          { required: true, message: '请输入联系人电话', trigger: 'blur' }
-        ],
-        priceType: [
-          { required: true, message: '请选择价格类型', trigger: 'change' }
-        ],
-        payType: [
-          { required: true, message: '请选择支付方式', trigger: 'change' }
-        ],
-        payment: [
-          { required: true, message: '请选择收款方式', trigger: 'change' }
-        ]
-      },
-      addrProvinceList: [], //  省下拉
-      addrCityList: [], //  市下拉
-      addrDistrictList: [] //  区下拉
-    }
-  },
-  methods: {
-    // 获取省列表'
-    getProvinceList () {
-      getProvince().then(res => {
-        if (res.status == 200) {
-          this.addrProvinceList = res.data || []
-        } else {
-          this.addrProvinceList = []
-        }
-      })
-    },
-    // 获取城市列表
-    getCityList (val) {
-      this.addrCityList = []
-      this.addrDistrictList = []
-      this.form.cityCode = undefined
-      this.form.districtCode = undefined
-      this.form.address = ''
-      this.getCityListRequest(val)
-    },
-    getCityListRequest (val) {
-      getCityByPro({
-        id: val
-      }).then(res => {
-        if (res.status == 200) {
-          this.addrCityList = res.data || []
-        } else {
-          this.addrCityList = []
-        }
-      })
-    },
-    // 获取区县列表
-    getAreaList (val) {
-      this.addrDistrictList = []
-      this.form.districtCode = undefined
-      this.form.address = ''
-      this.getAreaListRequest(val)
-    },
-    getAreaListRequest (val) {
-      getDistrictByCity({
-        id: val
-      }).then(res => {
-        if (res.status == 200) {
-          this.addrDistrictList = res.data || []
-        } else {
-          this.addrDistrictList = []
-        }
-      })
-    },
-    // 区县变更
-    areaCharged (val) {
-      this.form.address = ''
-    },
-    //  保存
-    handleSubmit (e) {
-      e.preventDefault()
-      const _this = this
-      this.$emit('ok', { id: 1000, customName: '车领主常青二路店' })
-      this.cancel()
-      // this.$refs.ruleForm.validate(valid => {
-      //   if (valid) {
-      //     const form = values.form
-      //     form.desc = _this.form.desc
-      //     form.id = this.isEdit ? this.$route.params.id : null
-      //     console.log(form,'-----提交信息')
-      //     // goodsSave(form).then(res => {
-      //     //   if (res.status == 200) {
-      //     //     _this.$message.success(res.message)
-      //     //   }
-      //     // })
-      //   } else {
-      //     console.log('error submit!!')
-      //     return false
-      //   }
-      // })
-    },
-    cancel () {
-      this.opened = false
-      this.$refs.ruleForm.resetFields()
-      this.$emit('cancel')
-    }
-  },
-  watch: {
-    show (newValue, oldValue) {
-      this.opened = newValue
-    }
-  }
-}
-</script>
-
-<style>
-</style>

+ 476 - 0
src/views/salesManagement/salesReturn/chooseCustomModal.vue

@@ -0,0 +1,476 @@
+<template>
+  <a-modal
+    v-model="opened"
+    :title="title"
+    centered
+    :maskClosable="false"
+    :confirmLoading="confirmLoading"
+    width="80%"
+    :footer="null"
+    @cancel="cancel"
+  >
+    <a-form-model
+      id="chooseCustom-form"
+      ref="ruleForm"
+      :model="form"
+      :rules="rules"
+      :label-col="formItemLayout.labelCol"
+      :wrapper-col="formItemLayout.wrapperCol"
+    >
+      <a-row :gutter="15">
+        <a-col :span="8">
+          <a-form-model-item label="客户名称" prop="buyerSn">
+            <a-select
+              id="chooseCustom-buyerSn"
+              show-search
+              placeholder="请选择客户"
+              v-model="form.buyerSn"
+              :filter-option="filterOption"
+              @change="custChange">
+              <a-select-option v-for="item in custAllList" :key="item.id" :value="item.customerSn">{{ item.customerName }}</a-select-option>
+            </a-select>
+          </a-form-model-item>
+        </a-col>
+        <a-col :span="16">
+          <a-form-model-item>
+            <a-button type="primary" class="button-primary" @click="openNewCust" icon="plus">新增</a-button>
+            (点击新增按钮新增客户)
+          </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="shippingAddressProvinceSn">
+                  <a-select id="chooseCustom-provinceSn" @change="getCityList" v-model="form.shippingAddressProvinceSn" 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="shippingAddressCitySn">
+                  <a-select id="chooseCustom-citySn" @change="getAreaList" v-model="form.shippingAddressCitySn" 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="shippingAddressCountySn">
+                  <a-select id="chooseCustom-countySn" @change="areaCharged" v-model="form.shippingAddressCountySn" 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="shippingAddress">
+            <a-input
+              id="chooseCustom-shippingAddress"
+              :maxLength="60"
+              v-model="form.shippingAddress"
+              placeholder="请输入详细地址(最多60个字符)"
+              allowClear />
+          </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-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-form-model-item>
+        </a-col>
+      </a-row>
+      <a-row :gutter="15">
+        <a-col :span="8">
+          <a-form-model-item label="是否抓单" prop="grabFlag">
+            <v-select code="FLAG" id="chooseCustom-grabFlag" v-model="form.grabFlag" allowClear placeholder="请选择"></v-select>
+          </a-form-model-item>
+        </a-col>
+        <a-col :span="8">
+          <a-form-model-item label="开单人">{{ $store.state.user.info.userNameCN }}</a-form-model-item>
+        </a-col>
+      </a-row>
+      <a-row :gutter="15">
+        <a-col :span="8">
+          <a-form-model-item label="备注" prop="remarks">
+            <a-input
+              id="chooseCustom-remarks"
+              type="textarea"
+              :maxLength="100"
+              v-model="form.remarks"
+              placeholder="请输入联系电话(最多100个字符)"
+              allowClear />
+          </a-form-model-item>
+        </a-col>
+      </a-row>
+      <a-form-model-item :wrapper-col="{ span: 12, offset: 6 }" style="text-align: center;">
+        <a-button type="primary" :loading="confirmLoading" @click="handleSubmit" id="chooseCustom-btn-submit">保存</a-button>
+        <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"
+      :footer="null"
+    >
+      <CustomerManagementEdit ref="newCust" model="modal" @ok="newCustFun"></CustomerManagementEdit>
+    </a-modal>
+  </a-modal>
+</template>
+
+<script>
+import { getArea } from '@/api/data'
+import { custAllList, custFindById, updateByCustomerSn } from '@/api/customer'
+import { salesReturnSave } from '@/api/salesReturn'
+import { getUserAllList } from '@/api/power-user'
+import { settleStyleQueryAll } from '@/api/settleStyle'
+import { VSelect } from '@/components'
+import CustomerManagementEdit from '@/views/customerManagement/customerInfo/edit.vue'
+export default {
+  name: 'ChooseCustomModal',
+  components: { VSelect, CustomerManagementEdit },
+  props: {
+    show: [Boolean]
+  },
+  data () {
+    return {
+      opened: this.show,
+      title: '选择客户',
+      confirmLoading: false,
+      formItemLayout: {
+        labelCol: { span: 8 },
+        wrapperCol: { span: 16 }
+      },
+      buyerSnBak: '', // 更改前客户sn备份
+      form: {
+        buyerName: '', // 客户名称
+        buyerSn: undefined, // 客户sn
+        consigneeTel: '', //  联系电话
+        consigneeName: '', //  联系人
+        shippingAddressProvinceSn: undefined, //  省
+        shippingAddressProvinceName: '',
+        shippingAddressCitySn: undefined, // 市
+        shippingAddressCityName: '',
+        shippingAddressCountySn: undefined, // 区
+        shippingAddressCountyName: '',
+        shippingAddress: '', //  详细地址
+        grabFlag: '1', // 是否抓单
+        salesTragetType: 'C',
+        remarks: '' //  备注
+      },
+      rules: {
+        buyerSn: [
+          { required: true, message: '请选择客户', trigger: ['change', 'blur'] }
+        ],
+        consigneeTel: [
+          { required: true, message: '请输入联系电话', trigger: 'blur' }
+        ],
+        shippingAddressProvinceSn: [
+          { required: true, message: '请选择省', trigger: 'change' }
+        ],
+        shippingAddressCitySn: [
+          { required: true, message: '请选择市', trigger: 'change' }
+        ],
+        shippingAddressCountySn: [
+          { required: true, message: '请选择区/县', trigger: 'change' }
+        ],
+        shippingAddress: [
+          { required: true, message: '请输入详细地址', trigger: 'blur' }
+        ],
+        grabFlag: [
+          { required: true, message: '请选择是否铺货出库', trigger: 'change' }
+        ]
+      },
+      custAllList: [], //  客户 下拉数据
+      addrProvinceList: [], //  省下拉
+      addrCityList: [], //  市下拉
+      addrDistrictList: [], //  区下拉
+      custId: undefined, // 客户id
+      isEdit: false, //  是否编辑状态
+      isChangeCust: false, // 是否更换客户
+      interId: null,
+      isNewCust: false // 是否新增客户
+    }
+  },
+  methods: {
+    openNewCust () {
+      this.isNewCust = true
+      setTimeout(() => {
+        this.$refs.newCust.getBaseData()
+      }, 500)
+    },
+    // 新建客户
+    newCustFun (data) {
+      console.log(data, this.isEdit)
+      this.isNewCust = false
+      // 更新客户信息
+      this.custAllList.unshift(data)
+      setTimeout(() => {
+        this.custChange(data.customerSn)
+      }, 300)
+    },
+    // 业务员
+    salesManChange (id) {
+      this.form.salesManName = this.userList.find(item => item.id == id).name
+    },
+    // 客户 change
+    custChange (val) {
+      console.log(val, 'custChange')
+      const _this = this
+      const cust = this.custAllList.find(item => item.customerSn == val)
+      // 编辑
+      if (this.isEdit) {
+        this.$confirm({
+          title: '提示',
+          content: '更换客户后信息需要重新完善,确认要更换吗?',
+          centered: true,
+          onOk () {
+            _this.custId = cust.id
+            _this.form.buyerName = cust.customerName
+            _this.getDetail()
+          },
+          onCancel () {
+            _this.form.buyerSn = _this.buyerSnBak
+          }
+        })
+      } else {
+        _this.custId = cust.id
+        _this.form.buyerName = cust.customerName
+        _this.getDetail()
+      }
+    },
+    // 编辑客户信息
+    editCust (data) {
+      console.log(data)
+      this.title = '编辑客户信息'
+      this.isEdit = true
+      if (data.shippingAddressProvinceSn) { this.getArea('city', data.shippingAddressProvinceSn) }
+      if (data.shippingAddressCitySn) { this.getArea('district', data.shippingAddressCitySn) }
+      this.form = Object.assign(this.form, data)
+      this.buyerSnBak = this.form.buyerSn
+    },
+    //  获取详情
+    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, //  联系人
+            shippingAddressProvinceSn: data.provinceSn, //  省
+            shippingAddressProvinceName: data.provinceName,
+            shippingAddressCitySn: data.citySn, // 市
+            shippingAddressCityName: data.cityName,
+            shippingAddressCountySn: data.countySn, // 区
+            shippingAddressCountyName: data.countyName,
+            shippingAddress: data.customerAddr, //  详细地址
+            fax: data.fax, //  客户传真
+            dispatchType: data.dispatchType, //  配送方式
+            satelliteFlag: data.satelliteFlag, //  是否卫星仓客户
+            priceType: data.priceType, //  价格类型
+            settleStyleSn: data.settleStyleSn //  收款方式
+          })
+        } 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.shippingAddressProvinceSn, //  省
+        provinceName: this.form.shippingAddressProvinceName,
+        citySn: this.form.shippingAddressCitySn, // 市
+        cityName: this.form.shippingAddressCityName,
+        countySn: this.form.shippingAddressCountySn, // 区
+        countyName: this.form.shippingAddressCountyName,
+        customerAddr: this.form.shippingAddress, //  详细地址
+        dispatchType: this.form.dispatchType, //  配送方式
+        priceType: this.form.priceType, //  价格类型
+        settleStyleSn: this.form.settleStyleSn //  收款方式
+      }
+      updateByCustomerSn(params).then(res => {
+        if (res.status != 200) {
+          this.$message.error(res.message)
+        }
+      })
+    },
+    //  保存
+    handleSubmit (e) {
+      e.preventDefault()
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          // 保存客户信息
+          _this.handleSaveCust()
+          // 保存销售单
+          if (_this.form.buyerSn) {
+            _this.salesSaveFun()
+          }
+        } else {
+          console.log('error submit!!')
+          return false
+        }
+      })
+    },
+    // 新建或编辑销售单
+    salesSaveFun () {
+      const _this = this
+      const form = this.form
+      console.log(form, 'save data')
+      salesReturnSave(form).then(res => {
+        if (res.status == 200) {
+          _this.$message.success(res.message)
+          _this.$emit('ok', res.data)
+          if (_this.form.id) {
+            _this.$emit('updateData')
+          }
+          _this.cancel()
+        }
+      })
+    },
+    cancel () {
+      this.opened = false
+      this.$refs.ruleForm.resetFields()
+      this.$emit('cancel')
+    },
+    // 客户无分页列表数据
+    getCustAllList () {
+      const _this = this
+      custAllList().then(res => {
+        if (res.status == 200) {
+          _this.custAllList = res.data || []
+        } else {
+          _this.custAllList = []
+        }
+      })
+    },
+    // 获取业务员列表数据
+    getUserAllList () {
+      getUserAllList({}).then(res => {
+        if (res.status == 200) {
+          this.userList = res.data || []
+        } else {
+          this.userList = []
+        }
+      })
+    },
+    // 获取城市列表
+    getCityList (val) {
+      console.log(val, '-------------')
+      this.addrCityList = []
+      this.addrDistrictList = []
+      this.form.shippingAddressCitySn = undefined
+      this.form.shippingAddressCityName = ''
+      this.form.shippingAddressCountySn = undefined
+      this.form.shippingAddressCountyName = ''
+      this.form.shippingAddress = ''
+      this.form.shippingAddressCountyName = this.addrProvinceList.find(item => item.id == val).name
+      this.getArea('city', val)
+    },
+    // 获取区县列表
+    getAreaList (val) {
+      this.addrDistrictList = []
+      this.form.shippingAddressCountySn = undefined
+      this.form.shippingAddressCountyName = ''
+      this.form.shippingAddress = ''
+      this.form.shippingAddressCityName = this.addrCityList.find(item => item.id == val).name
+      this.getArea('district', val)
+    },
+    // 区县变更
+    areaCharged (val) {
+      this.form.shippingAddress = ''
+      this.form.shippingAddressCountyName = 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
+      )
+    },
+    // 获取收款方式
+    getSettleStyle () {
+      settleStyleQueryAll().then(res => {
+        if (res.status == 200) {
+          this.settleStyleList = res.data
+        }
+      })
+    }
+  },
+  watch: {
+    show (newValue, oldValue) {
+      this.opened = newValue
+      if (newValue) {
+        this.getArea('province')
+        this.getCustAllList()
+        this.getUserAllList()
+        this.getSettleStyle()
+      }
+    }
+  }
+}
+</script>
+
+<style>
+</style>

+ 6 - 8
src/views/salesManagement/salesReturn/detail.vue

@@ -1,8 +1,8 @@
 <template>
   <div class="salesReturnDetail-wrap">
-    <a-page-header :ghost="false" @back="handleBack" class="salesReturnDetail-cont">
+    <a-page-header :ghost="false" :backIcon="false" class="salesReturnDetail-cont">
       <template slot="subTitle">
-        <a href="javascript:;" @click="handleBack">返回列表</a>
+        <a href="javascript:;" @click="handleBack"><a-icon type="left"></a-icon> 返回列表</a>
       </template>
       <template slot="extra">
         <a-button key="3" id="salesReturnDetail-preview-btn">打印预览</a-button>
@@ -15,15 +15,13 @@
       <a-collapse :activeKey="['1']">
         <a-collapse-panel key="1" header="基础信息">
           <a-descriptions size="small" :column="3" v-if="detailData">
-            <a-descriptions-item label="客户名称">{{ detailData.dealerName || '--' }}</a-descriptions-item>
+            <a-descriptions-item label="客户名称">{{ detailData.buyerName || '--' }}</a-descriptions-item>
             <a-descriptions-item label="客户地址">{{ detailData.provinceName || '--' }}{{ detailData.cityName || '--' }}{{ detailData.countyName || '--' }}{{ detailData.customerAddr || '--' }}</a-descriptions-item>
-            <a-descriptions-item label="支付方式">{{ detailData.payType || '--' }}</a-descriptions-item>
-            <a-descriptions-item label="收款方式">{{ detailData.settleStyleSn || '--' }}</a-descriptions-item>
             <a-descriptions-item label="联系电话">{{ detailData.contactTel || '--' }}</a-descriptions-item>
             <a-descriptions-item label="备注">{{ detailData.remarks || '--' }}</a-descriptions-item>
             <a-descriptions-item label="退货单号">{{ detailData.salesReturnNo || '--' }}</a-descriptions-item>
-            <a-descriptions-item label="业务状态">{{ detailData.state || '--' }}</a-descriptions-item>
-            <a-descriptions-item label="财务状态">{{ detailData.settleState || '--' }}</a-descriptions-item>
+            <a-descriptions-item label="业务状态">{{ detailData.billStatusDictValue || '--' }}</a-descriptions-item>
+            <a-descriptions-item label="财务状态">{{ detailData.financialStatusDictValue || '--' }}</a-descriptions-item>
           </a-descriptions>
         </a-collapse-panel>
       </a-collapse>
@@ -106,7 +104,7 @@ export default {
   methods: {
     //  返回
     handleBack () {
-      this.$router.push({ path: '/salesManagement/salesReturn/list' })
+      this.$router.push({ name: 'salesReturnList' })
     },
     //  详情
     getDetail () {

+ 40 - 37
src/views/salesManagement/salesReturn/list.vue

@@ -1,5 +1,6 @@
 <template>
   <a-card size="small" :bordered="false" class="salesReturn-wrap">
+    <!-- 搜索条件 -->
     <div class="table-page-search-wrapper">
       <a-form layout="inline">
         <a-row :gutter="15">
@@ -9,7 +10,7 @@
                 style="width:100%"
                 id="salesReturn-creatDate"
                 :disabledDate="disabledDate"
-                v-model="time"
+                v-model="createDate"
                 :format="dateFormat"
                 :placeholder="['开始时间', '结束时间']" />
             </a-form-item>
@@ -28,10 +29,10 @@
           <a-col :md="6" :sm="24">
             <a-form-item label="客户名称" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
               <a-select
-                id="salesReturn-dealerName"
+                id="salesReturn-buyerName"
                 placeholder="请选择客户"
                 allowClear
-                v-model="queryParam.dealerName"
+                v-model="queryParam.buyerName"
                 :showSearch="true"
                 option-filter-prop="children"
                 :filter-option="filterOption">
@@ -42,16 +43,16 @@
           <template v-if="advanced">
             <a-col :md="6" :sm="24">
               <a-form-item label="退货单号">
-                <a-input id="salesReturn-salesReturnNo" v-model.trim="queryParam.salesReturnNo" allowClear placeholder="请输入销售单号"/>
+                <a-input id="salesReturn-salesReturnNo" v-model.trim="queryParam.salesReturnNo" allowClear placeholder="请输入退货单号"/>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="业务状态">
                 <v-select
-                  v-model="queryParam.auditStatus"
-                  ref="auditStatus"
-                  id="salesManagementList-auditStatus"
-                  code="PAYMENT_TYPE"
+                  v-model="queryParam.billStatus"
+                  ref="billStatus"
+                  id="salesManagementList-billStatus"
+                  code="SALES_BILL_STATUS"
                   placeholder="请选择业务状态"
                   allowClear></v-select>
               </a-form-item>
@@ -62,7 +63,7 @@
                   v-model="queryParam.financialStatus"
                   ref="financialStatus"
                   id="salesManagementList-financialStatus"
-                  code="PAYMENT_TYPE"
+                  code="FINANCIAL_STATUS"
                   placeholder="请选择财务状态"
                   allowClear></v-select>
               </a-form-item>
@@ -99,13 +100,13 @@
       :data="loadData"
       :scroll="{ x: 1590 }"
       bordered>
-      <!-- 业务/审核状态 -->
-      <template slot="auditStatus" slot-scope="text, record">
-        <a-tag :color="record.state=='FINISH'?'green':'red'" >{{ record.state=='FINISH'? '待备货审核': '待单据审核' }}</a-tag>
+      <!-- 单号 -->
+      <template slot="salesReturnNo" slot-scope="text, record">
+        <span style="color: #ed1c24;cursor: pointer;" @click="handleDetail(record)">{{ record.salesReturnNo }}</span>
       </template>
       <!-- 财务状态 -->
       <template slot="financialStatus" slot-scope="text, record">
-        <a-tag :color="record.state==1?'green':'red'" >{{ record.state==1? '待提交': '待单据审核' }}</a-tag>
+        <a-badge :color="text=='FINISH'?'#87d068':'gold'" :text="record.financialStatusDictValue" />
       </template>
       <!-- 操作 -->
       <template slot="action" slot-scope="text, record">
@@ -119,21 +120,21 @@
       </template>
     </s-table>
     <!-- 选择客户弹框 -->
-    <chooseCustom :show="openModal" @ok="chooseCustomOk" @cancel="openModal=false"></chooseCustom>
+    <choose-custom-modal :show="openModal" @ok="handleEdit" @cancel="openModal=false"></choose-custom-modal>
   </a-card>
 </template>
 
 <script>
 import { STable, VSelect } from '@/components'
-import chooseCustom from './chooseCustom.vue'
+import chooseCustomModal from './chooseCustomModal.vue'
 import { custAllList } from '@/api/customer'
-import { salesReturnList } from '@/api/salesReturn'
+import { salesReturnList, salesReturnDel } from '@/api/salesReturn'
 export default {
   name: 'TableList',
   components: {
     STable,
     VSelect,
-    chooseCustom
+    chooseCustomModal
   },
   data () {
     return {
@@ -141,7 +142,7 @@ export default {
       advanced: false,
       disabled: false, //  查询、重置按钮是否可操作
       dateFormat: 'YYYY-MM-DD',
-      time: [], //  创建时间
+      createDate: [], //  创建时间
       examineTime: [], //  审核时间
       openModal: false, // 选择客户弹框是否显示
       custAllList: [], //  客户下拉数据
@@ -154,15 +155,15 @@ export default {
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
         { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center' },
-        { title: '销售退货单号', dataIndex: 'salesReturnNo', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '客户名称', dataIndex: 'dealerName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '销售退货单号', scopedSlots: { customRender: 'salesReturnNo' }, width: 140, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '客户名称', dataIndex: 'buyerName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { 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: 'totalCelQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '退款总金额', dataIndex: 'totalAmount', width: 110, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { 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: '业务状态', scopedSlots: { customRender: 'auditStatus' }, width: 110, align: 'center' },
-        { title: '财务状态', scopedSlots: { customRender: 'financialStatus' }, width: 110, align: 'center' },
+        { title: '业务状态', dataIndex: 'billStatusDictValue', width: 110, align: 'center' },
+        { title: '财务状态', dataIndex: 'financialStatus', scopedSlots: { customRender: 'financialStatus' }, width: 110, align: 'center' },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: 220, align: 'center', fixed: 'right' }
       ],
       // 加载数据方法 必须为 Promise 对象
@@ -188,17 +189,19 @@ export default {
     handleAdd () {
       this.openModal = true
     },
-    // 选择客户成功
-    chooseCustomOk (data) {
-      this.$router.push({ name: 'salesReturnNew' })
+    // 编辑
+    handleEdit (row) {
+      if (row.grabFlag) {
+        // 抓单
+        this.$router.push({ name: 'salesReturnGrabEdit', params: { id: row.id, sn: row.salesReturnSn } })
+      } else {
+        // 不抓单
+        this.$router.push({ name: 'salesReturnEdit', params: { id: row.id, sn: row.salesReturnSn } })
+      }
     },
     // 详情
     handleDetail (row) {
-      this.$router.push({ path: `/salesManagement/salesReturn/detail/${row.id}/${row.salesReturnSn}` })
-    },
-    // 编辑
-    handleEdit (row) {
-      this.$router.push({ path: `/salesManagement/salesReturn/edit/${row.id}` })
+      this.$router.push({ name: 'salesReturnDetail', params: { id: row.id, sn: row.salesReturnSn } })
     },
     // 删除
     handleDel (row) {
@@ -208,12 +211,12 @@ export default {
         content: '确认要删除吗?',
         centered: true,
         onOk () {
-          // salesDel({ id: row.id }).then(res => {
-          //   if (res.status == 200) {
-          //     _this.$message.success(res.message)
-          //     _this.$refs.table.refresh()
-          //   }
-          // })
+          salesReturnDel({ id: row.id }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
+            }
+          })
         }
       })
     },

+ 261 - 0
src/views/salesManagement/salesReturn/salesReturnEdit.vue

@@ -0,0 +1,261 @@
+<template>
+  <div>
+    <a-affix :target="() => this.$refs.container">
+      <a-page-header
+        :ghost="false"
+        @back="() => $router.go(-1)"
+      >
+        <template slot="subTitle">
+          <a href="javascript:;" @click="() => $router.go(-1)">客户名称:车领主常青二路店</a>
+          <a-button size="small" @click="handleEditCustom" style="margin-left:50px" key="0">
+            编辑
+          </a-button>
+        </template>
+        <template slot="extra">
+          <a-button key="2">
+            打印预览
+          </a-button>
+          <a-button key="1" type="primary">
+            快速打印
+          </a-button>
+        </template>
+      </a-page-header>
+    </a-affix>
+
+    <a-card size="small" :bordered="false" class="pages-wrap">
+      <!-- 查询配件列表 -->
+      <queryPart></queryPart>
+    </a-card>
+    <a-card size="small" :bordered="false" class="pages-wrap">
+      <!-- alert -->
+      <a-alert style="margin-bottom: 15px;" type="info">
+        <div slot="message">
+          <span>退货总金额:15;</span>
+          <span>总款数:6;</span>
+          <span>总数量:3;</span>
+          <span>废品总数量:7;</span>
+        </div>
+      </a-alert>
+      <!-- 查询条件 -->
+      <a-row :gutter="15">
+        <a-col :span="18">
+          <a-form-model layout="inline" :model="productForm" @submit="handleSearch">
+            <a-form-model-item label="产品编码">
+              <a-input v-model="productForm.productNo" placeholder="输入产品编码" />
+            </a-form-model-item>
+            <a-form-model-item label="产品名称">
+              <a-input v-model="productForm.productName" placeholder="输入产品名称" />
+            </a-form-model-item>
+            <a-form-model-item>
+              <a-button type="primary">
+                查询
+              </a-button>
+              <a-button style="margin-left: 10px;">
+                重置
+              </a-button>
+            </a-form-model-item>
+          </a-form-model>
+        </a-col>
+        <a-col :span="6">
+          <div style="float:right;overflow: hidden;">
+            <a-button id="salesNew-dru">导入明细</a-button>
+            <a-button type="primary" style="margin-left: 15px" id="salesNew-del-all">整单删除</a-button>
+          </div>
+        </a-col>
+      </a-row>
+      <!-- 已选配件列表 -->
+      <s-table
+        class="sTable"
+        ref="table"
+        size="default"
+        :rowKey="(record) => record.id"
+        :columns="columns"
+        :data="loadData"
+        :scroll="{ x: 1500, y: 300 }"
+        bordered>
+        <!-- 本次退货数量 -->
+        <template slot="returnNums" slot-scope="text, record">
+          <editable-cell :text="text" :step="0.1" @change="onCellChange(record.id, 'returnNums', $event)" />
+        </template>
+        <!-- 废品数量 -->
+        <template slot="fpNums" slot-scope="text, record">
+          <editable-cell :text="text" :precision="0" @change="onCellChange(record.id, 'fpNums', $event)" />
+        </template>
+        <template slot="cangku" slot-scope="text, record">
+          <a-select :value="text" style="width: 100%">
+            <a-select-option value="jack">
+              默认仓库
+            </a-select-option>
+            <a-select-option value="lucy">
+              Lucy
+            </a-select-option>
+          </a-select>
+        </template>
+        <template slot="cangwei" slot-scope="text, record">
+          <a-select :value="text" style="width: 100%">
+            <a-select-option value="jack">
+              默认仓位
+            </a-select-option>
+            <a-select-option value="lucy">
+              Lucy
+            </a-select-option>
+          </a-select>
+        </template>
+        <!-- 操作 -->
+        <template slot="action" slot-scope="text, record">
+          <a-button type="primary" size="small" @click="handleDel(record)">删除</a-button>
+        </template>
+      </s-table>
+    </a-card>
+    <!-- 选择客户弹框 -->
+    <choose-custom-modal :show="openModal" @ok="chooseCustomOk" @cancel="openModal=false"></choose-custom-modal>
+  </div>
+</template>
+
+<script>
+import { STable, VSelect } from '@/components'
+import queryPart from './queryPart.vue'
+import EditableCell from '@/views/common/editInput.js'
+import chooseCustomModal from './chooseCustomModal.vue'
+import { salesReturnDetailList } from '@/api/salesReturnDetail'
+export default {
+  name: 'SalesDetail',
+  components: {
+    STable,
+    VSelect,
+    queryPart,
+    EditableCell,
+    chooseCustomModal
+  },
+  data () {
+    return {
+      disabled: false,
+      openModal: false,
+      dataSource: [],
+      productForm: {
+        productNo: '',
+        productName: ''
+      },
+      // 表头
+      columns: [
+        {
+          title: '序号',
+          dataIndex: 'no',
+          align: 'center',
+          width: 100
+        },
+        {
+          title: '产品编码',
+          dataIndex: 'productNo',
+          align: 'center'
+        },
+        {
+          title: '产品名称',
+          dataIndex: 'productName',
+          align: 'center'
+        },
+        {
+          title: '原厂编码',
+          dataIndex: 'ycNo',
+          align: 'center'
+        },
+        {
+          title: '售价',
+          dataIndex: 'price',
+          align: 'center',
+          width: 150,
+          scopedSlots: { customRender: 'price' }
+        },
+        {
+          title: '单位',
+          dataIndex: 'dw',
+          align: 'center'
+        },
+        {
+          title: '仓库',
+          dataIndex: 'cangku',
+          align: 'center',
+          scopedSlots: { customRender: 'cangku' },
+          width: 150
+        },
+        {
+          title: '仓位',
+          dataIndex: 'cangwei',
+          align: 'center',
+          scopedSlots: { customRender: 'cangwei' },
+          width: 150
+        },
+        {
+          title: '退货数量',
+          dataIndex: 'returnNums',
+          align: 'center',
+          width: 150,
+          scopedSlots: { customRender: 'returnNums' }
+        },
+        {
+          title: '废品数量',
+          dataIndex: 'returnNums',
+          align: 'center',
+          width: 150,
+          scopedSlots: { customRender: 'fpNums' }
+        },
+        {
+          title: '退货金额小计',
+          dataIndex: 'xj',
+          align: 'center'
+        },
+        {
+          title: '折后金额小计',
+          dataIndex: 'zhxj',
+          align: 'center'
+        },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center' }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        return salesReturnDetailList(Object.assign(parameter, this.queryParam)).then(res => {
+          const data = res.data
+          const no = (data.pageNo - 1) * data.pageSize
+          for (var i = 0; i < data.list.length; i++) {
+            data.list[i].no = no + i + 1
+          }
+          this.disabled = false
+          return data
+        })
+      }
+    }
+  },
+  methods: {
+    onCellChange (key, dataIndex, value) {
+      console.log(key, dataIndex, value)
+      console.log(this.dataSource)
+      const dataSource = [...this.dataSource]
+      const target = dataSource.find(item => item.id === key)
+      if (target) {
+        target[dataIndex] = Number(value)
+        this.dataSource = dataSource
+      }
+    },
+    handleSearch () {
+
+    },
+    // 选择客户成功
+    chooseCustomOk (data) {
+
+    },
+    handleEditCustom () {
+      this.openModal = true
+    }
+  }
+}
+</script>
+
+<style lang="less">
+  .pages-wrap{
+    margin-top: 15px;
+    .sTable{
+      margin-top: 15px;
+    }
+  }
+</style>

+ 3 - 3
src/views/salesManagement/salesReturn/salesReturnNew.vue → src/views/salesManagement/salesReturn/salesReturnGrabEdit.vue

@@ -108,7 +108,7 @@
       </s-table>
     </a-card>
     <!-- 选择客户弹框 -->
-    <chooseCustom :show="openModal" @ok="chooseCustomOk" @cancel="openModal=false"></chooseCustom>
+    <choose-custom-modal :show="openModal" @ok="chooseCustomOk" @cancel="openModal=false"></choose-custom-modal>
   </div>
 </template>
 
@@ -116,7 +116,7 @@
 import { STable, VSelect } from '@/components'
 import queryPart from './queryPart.vue'
 import EditableCell from '@/views/common/editInput.js'
-import chooseCustom from './chooseCustom.vue'
+import chooseCustomModal from './chooseCustomModal.vue'
 export default {
   name: 'SalesDetail',
   components: {
@@ -124,7 +124,7 @@ export default {
     VSelect,
     queryPart,
     EditableCell,
-    chooseCustom
+    chooseCustomModal
   },
   data () {
     return {