chenrui 4 years ago
parent
commit
19b5224fb1

+ 62 - 55
src/views/salesManagement/salesQuery/chooseCustomModal.vue

@@ -146,6 +146,13 @@
             </a-select>
           </a-form-model-item>
         </a-col>
+        <a-col :span="8">
+          <a-form-model-item label="铺货出库" prop="salesman">
+            <a-select id="chooseCustom-salesman" v-model="form.salesman" 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-row :gutter="15">
         <a-col :span="8">
@@ -174,6 +181,7 @@
 </template>
 
 <script>
+import { getArea } from '@/api/data'
 export default {
   name: 'ChooseCustomModal',
   props: {
@@ -199,9 +207,9 @@ export default {
         contactName: '', //  联系人
         contactPhone: '', //  联系电话
         remarks: '', //  备注
-        priceType: '', //  价格类型
-        payType: '', // 支付方式
-        payment: '' // 收款方式
+        priceType: undefined, //  价格类型
+        payType: undefined, // 支付方式
+        payment: undefined // 收款方式
       },
       rules: {
         name: [
@@ -241,58 +249,6 @@ export default {
     }
   },
   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()
@@ -320,11 +276,62 @@ export default {
       this.opened = false
       this.$refs.ruleForm.resetFields()
       this.$emit('cancel')
+    },
+    // 获取城市列表
+    getCityList (val) {
+      this.addrCityList = []
+      this.addrDistrictList = []
+      this.form.cityCode = undefined
+      this.form.districtCode = undefined
+      this.form.address = ''
+      this.getArea('city', val)
+    },
+    // 获取区县列表
+    getAreaList (val) {
+      this.addrDistrictList = []
+      this.form.districtCode = undefined
+      this.form.address = ''
+      this.getArea('district', val)
+    },
+    // 区县变更
+    areaCharged (val) {
+      this.form.address = ''
+    },
+    //  省/市/区
+    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 = []
+          }
+        }
+      })
     }
   },
   watch: {
     show (newValue, oldValue) {
       this.opened = newValue
+      if (newValue) {
+        this.getArea('province')
+      }
     }
   }
 }

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

@@ -172,7 +172,7 @@ export default {
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
         { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center' },
         { title: '销售单号', dataIndex: 'salesBillNo', width: 140, align: 'center' },
-        { title: '采购单号', dataIndex: 'purchaseBillNo', width: 140, align: 'center' },
+        { title: '采购单号', dataIndex: 'purchaseBillNo', 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 : '--') } },