chenrui 2 éve
szülő
commit
28ae80bcf1

+ 9 - 0
src/api/sales.js

@@ -230,3 +230,12 @@ export const updateBatch = (params) => {
     data: params
   })
 }
+
+// 仓库设置
+export const updateWarehouse = (params) => {
+  return axios({
+    url: '/sales/detail/updateWarehouse',
+    method: 'post',
+    data: params
+  })
+}

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

@@ -165,7 +165,7 @@ export const asyncRouterMap = [
                 }
               },
               {
-                path: 'add/:sn/:wSn',
+                path: 'add/:sn',
                 name: 'salesAdd',
                 component: () => import(/* webpackChunkName: "salesManagement" */ '@/views/salesManagement/salesQuery/edit.vue'),
                 meta: {
@@ -176,7 +176,7 @@ export const asyncRouterMap = [
                 }
               },
               {
-                path: 'edit/:sn/:wSn',
+                path: 'edit/:sn',
                 name: 'salesEdit',
                 component: () => import(/* webpackChunkName: "salesManagement" */ '@/views/salesManagement/salesQuery/edit.vue'),
                 meta: {

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

@@ -243,7 +243,7 @@ export default {
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
-        const params = Object.assign(parameter, { salesBillSn: this.bizSn || this.$route.params.sn })
+        const params = Object.assign(parameter, { salesBillSn: this.bizSn || this.$route.params.sn, warehouseSn: this.queryParam.warehouseSn })
         let url = salesDetailAllList
         if (this.detailData && (this.detailData.billStatus == 'WAIT_AUDIT' || this.detailData.billStatus == 'HQ_CHANGE') && this.$hasPermissions('B_salesAudit')) { //  审核,需用到库存
           url = salesDetailAllStockList

+ 38 - 7
src/views/salesManagement/salesQuery/edit.vue

@@ -89,7 +89,7 @@
                         style="margin:0 15px;"
                         type="primary"
                         ghost
-                        id="salesEdit-plDel-btn"> 批量操作 <a-icon type="down" /> </a-button>
+                        id="salesEdit-plDel-btn"> 仓库设置 <a-icon type="down" /> </a-button>
                     </a-dropdown>
                     <a-button
                       type="default"
@@ -216,7 +216,7 @@
     <!-- 导入产品 -->
     <importGuideModal :openModal="openGuideModal" :params="{salesBillSn: $route.params.sn}" @close="closeGuideModel" @ok="hanldeOk" />
     <!-- 仓库设置 -->
-    <setWarehouse :show="openWarehouseModal" @ok="chooseCustomOk" @cancel="openWarehouseModal=false"></setWarehouse>
+    <setWarehouse :show="openWarehouseModal" @ok="chooseWarehouseOk" @cancel="openWarehouseModal=false"></setWarehouse>
     <!-- 价格更新弹窗 -->
     <setPriceModal :show="priceUpdateModal" @ok="updatePrice" @cancel="priceUpdateModal=false"></setPriceModal>
   </div>
@@ -232,7 +232,7 @@ import ImportGuideModal from './importGuideModal.vue'
 import setWarehouse from './setWarehouse.vue'
 import setPriceModal from './setPriceModal.vue'
 import chooseWarehouse from '@/views/common/chooseWarehouse'
-import { salesModify, salesDetailBySn, salesWriteSubmit, getPromoacActiveList, deleteAll, submitCheck, updateBatch } from '@/api/sales'
+import { salesModify, salesDetailBySn, salesWriteSubmit, getPromoacActiveList, deleteAll, submitCheck, updateBatch, updateWarehouse } from '@/api/sales'
 import { salesDetailStockList, salesDetailInsert, salesDetailUpdateQty, salesDetailDel, salesDetailBatchDel, salesDetailDelAll, addPromoGoods, salesBatchInsert } from '@/api/salesDetail'
 export default {
   name: 'SalesEdit',
@@ -279,6 +279,7 @@ export default {
       },
       openGuideModal: false, //  导入产品引导
       queryParam: {
+        warehouseSn: undefined,
         productCode: '',
         productName: ''
       },
@@ -312,6 +313,28 @@ export default {
     }
   },
   methods: {
+    chooseWarehouseOk (sn) {
+      const _this = this
+      const snArr = []
+      _this.rowSelectionInfo.selectedRows.forEach(item => {
+        snArr.push(item.salesBillDetailSn)
+      })
+      const ajax_data = {
+        warehouseSn: sn,
+        salesBillDetailSnList: snArr,
+        salesBillSn: this.$route.params.sn
+      }
+      _this.spinning = true
+      updateWarehouse(ajax_data).then(res => {
+        if (res.status == 200) {
+          _this.openWarehouseModal = false
+          _this.resetSearchForm(true)
+          _this.$refs.promotable.resetCurForm()
+          _this.$message.success(res.message)
+        }
+        _this.spinning = false
+      })
+    },
     // 选择仓库
     handleWarehouse (val) {
       this.warehouseSn = val
@@ -322,7 +345,7 @@ export default {
         warehouseSn: val
       }).then(res => {
         if (res.status == 200) {
-          _this.$refs.partQuery.resetCurForm(val)
+          _this.$refs.partQuery.resetCurForm()
           _this.$refs.table.refresh(true)
           _this.spinning = false
         } else {
@@ -332,8 +355,13 @@ export default {
       })
     },
     handleMenuClick (e) {
+      const _this = this
       if (e.key == 0) { // 仓库设置
-        this.openWarehouseModal = true
+        if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
+          _this.$message.warning('请先选择要设置的产品!')
+        } else {
+          _this.openWarehouseModal = true
+        }
       } else if (e.key == 1) { // 删除已选项
         this.handleBatchDel()
       } else {
@@ -423,12 +451,14 @@ export default {
     chooseResetSearchForm () {
       this.queryParam.productCode = ''
       this.queryParam.productName = ''
+      this.queryParam.warehouseSn = undefined
       this.$refs.table.refresh(true)
     },
     //  重置
     resetSearchForm (flag) {
       this.queryParam.productCode = ''
       this.queryParam.productName = ''
+      this.queryParam.warehouseSn = undefined
       this.$refs.table.refresh(!!flag)
       this.getPromoacActiveList()
       this.getOrderDetail(false)
@@ -512,7 +542,8 @@ export default {
         purchaseBillNo: this.detailData.purchaseBillNo,
         stockSn: row.stockSn,
         promotableFlag: row.isJoinActivityProduct || 0, // 可促销标记 有活动的传1,没活动的传0
-        promotionFlag: promotionFlag // 促销标记 正品传0,促销品传1
+        promotionFlag: promotionFlag, // 促销标记 正品传0,促销品传1
+        warehouseSn: row.warehouseSn
       }).then(res => {
         if (res.status == 200) {
           this.resetSearchForm()
@@ -532,7 +563,7 @@ export default {
         if (res.status == 200) {
           this.detailData = res.data
           if (flag) {
-            this.$refs.partQuery.pageInit(this.detailData && this.detailData.buyerSn || '', this.warehouseSn)
+            this.$refs.partQuery.pageInit(this.detailData && this.detailData.buyerSn || '')
           }
         }
       })

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

@@ -162,8 +162,8 @@
         </template>
         <!-- 出库仓库 -->
         <template slot="warehouseBox" slot-scope="text, record">
-          <div class="warehouse_box" v-if="record.warehouseName && record.warehouseName.length>0">
-            <span v-for="(item,i) in record.warehouseName" :key="i">{{ item }}</span>
+          <div class="warehouse_box" v-if="record.warehouseNameSet && record.warehouseNameSet.length>0">
+            <span v-for="(item,i) in record.warehouseNameSet" :key="i">{{ item }}</span>
           </div>
         </template>
         <!-- 总数量 -->
@@ -437,7 +437,7 @@ export default {
     },
     // 选择客户成功
     chooseCustomOk (data) {
-      this.$router.push({ name: 'salesAdd', params: { sn: data.salesBillSn, wSn: data.warehouseSn } })
+      this.$router.push({ name: 'salesAdd', params: { sn: data.salesBillSn } })
     },
     // 下推
     handleDispatch (row) {
@@ -459,7 +459,7 @@ export default {
     },
     // 编辑
     handleEdit (row) {
-      this.$router.push({ name: 'salesEdit', params: { sn: row.salesBillSn, wSn: row.warehouseSn } })
+      this.$router.push({ name: 'salesEdit', params: { sn: row.salesBillSn } })
     },
     // 删除
     handleDel (row) {

+ 18 - 14
src/views/salesManagement/salesQuery/queryPart.vue

@@ -5,10 +5,10 @@
       <a-form layout="inline" @keyup.enter.native="searchForm">
         <a-row :gutter="15">
           <a-col :md="6" :sm="24">
-              <a-form-item label="出库仓库" prop="warehouseSn" required>
-                <chooseWarehouse ref="warehouse" :allowClear="false" v-model="queryParam.warehouseSn"></chooseWarehouse>
-              </a-form-item>
-            </a-col>
+            <a-form-item label="出库仓库" prop="warehouseSn" required>
+              <chooseWarehouse ref="warehouse" :allowClear="false" v-model="queryParam.warehouseSn" :isDefault="true" @load="loadWarehouse"></chooseWarehouse>
+            </a-form-item>
+          </a-col>
           <a-col :md="6" :sm="24">
             <a-form-item label="产品编码">
               <a-input id="productInfoList-code" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码"/>
@@ -21,10 +21,10 @@
           </a-col>
           <template v-if="advanced">
             <a-col :md="6" :sm="24">
-            <a-form-item label="原厂编码">
-              <a-input id="productInfoList-origCode" v-model.trim="queryParam.productOrigCode" allowClear placeholder="请输入原厂编码"/>
-            </a-form-item>
-          </a-col>
+              <a-form-item label="原厂编码">
+                <a-input id="productInfoList-origCode" v-model.trim="queryParam.productOrigCode" allowClear placeholder="请输入原厂编码"/>
+              </a-form-item>
+            </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="产品品牌">
                 <ProductBrand id="productInfoList-productBrandSn" v-model="queryParam.productBrandSn"></ProductBrand>
@@ -133,6 +133,7 @@ export default {
         productTypeSn3: '', //  产品三级分类
         warehouseSn: undefined
       },
+      defaultWarehouseSn: undefined, // 默认仓库sn
       disabled: false, //  查询、重置按钮是否可操作
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -182,6 +183,10 @@ export default {
     }
   },
   methods: {
+    loadWarehouse (sn) {
+      this.defaultWarehouseSn = sn
+      this.queryParam.warehouseSn = sn
+    },
     // 双击列表
     handleClickRow (record) {
       const _this = this
@@ -199,10 +204,10 @@ export default {
       }
     },
     // 查询
-    searchForm(){
-      if(this.queryParam.warehouseSn){
+    searchForm () {
+      if (this.queryParam.warehouseSn) {
         this.$refs.table.refresh(true)
-      }else{
+      } else {
         this.$message.info('请选择仓库')
       }
     },
@@ -216,16 +221,15 @@ export default {
       this.queryParam.productTypeSn2 = ''
       this.queryParam.productTypeSn3 = ''
       this.productType = []
+      this.queryParam.warehouseSn = this.defaultWarehouseSn
       this.$refs.table.refresh(true)
     },
     pageInit (buyerSn, warehouseSn) {
       this.buyerSn = buyerSn
-      this.queryParam.warehouseSn = warehouseSn
       this.resetSearchForm()
     },
     // 刷新当前页面
-    resetCurForm (warehouseSn) {
-      this.queryParam.warehouseSn = warehouseSn
+    resetCurForm () {
       const _this = this
       _this.$nextTick(() => {
         _this.$refs.table.refresh()

+ 2 - 93
src/views/salesManagement/salesQuery/setWarehouse.vue

@@ -32,11 +32,9 @@
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { VSelect } from '@/components'
-import { dealerRecevieAddrQuery } from '@/api/dealerRecevieAddr'
-import { salesSave } from '@/api/sales'
 import chooseWarehouse from '@/views/common/chooseWarehouse'
 export default {
-  name: 'SalesChooseCustomModal',
+  name: 'SetWarehouse',
   mixins: [commonMixin],
   components: { VSelect, chooseWarehouse },
   props: {
@@ -61,112 +59,23 @@ export default {
     }
   },
   methods: {
-
-    // 客户 change
-    custChange (val) {
-      if (val && val.key) {
-        this.form.buyerSn = val.key || undefined
-        this.form.buyerName = val.name || ''
-        this.$refs.ruleForm.clearValidate()
-        this.getDefaultAddress()
-        if (val.row) {
-          this.form.warehouseSn = val.row.defaultWarehouseSn
-        }
-      } else {
-        this.form.buyerName = ''
-        this.form.buyerSn = undefined
-        this.form.warehouseSn = undefined
-        this.verifyFun(this.addressId)
-      }
-    },
-    //  选择地址
-    handleChoose () {
-      this.openAddrModal = true
-    },
     //  保存
     handleSubmit (e) {
       e.preventDefault()
       const _this = this
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
-          _this.salesSaveFun()
+          _this.$emit('ok', this.form.warehouseSn)
         } else {
           console.log('error submit!!')
           return false
         }
       })
     },
-    // 新建或编辑销售单
-    salesSaveFun () {
-      const _this = this
-      const form = this.form
-      _this.spinning = true
-      salesSave(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()
-          _this.spinning = false
-        } else {
-          _this.spinning = false
-        }
-      })
-    },
     cancel () {
       this.opened = false
       this.$emit('cancel')
       this.$refs.ruleForm.resetFields()
-    },
-    //  地址保存
-    handleOk (data) {
-      this.chooseAddr = (data.consigneeName || '') + '(' + (data.consigneeTel || '-') + ')' + ' ' + (data.address || '')
-      this.addressVal = '更换地址'
-      this.form.shippingAddrProvinceSn = data.provinceSn || ''
-      this.form.shippingAddrProvinceName = data.provinceName || '' // 省
-      this.form.shippingAddrCitySn = data.citySn || ''
-      this.form.shippingAddrCityName = data.cityName || '' // 市
-      this.form.shippingAddrCountySn = data.countySn || ''
-      this.form.shippingAddrCountyName = data.countyName || '' // 区
-      this.form.shippingAddr = data.addr || ''// 详细地址
-      this.form.consigneeTel = data.consigneeTel || '' // 联系电话
-      this.form.consigneeName = data.consigneeName || ''
-      this.addressId = data.id || undefined
-      this.openAddrModal = false
-      // 移除表单项的校验结果
-      this.$refs.ruleForm.clearValidate('consigneeTel')
-    },
-    verifyFun (id) {
-      if (id == this.addressId) {
-        this.chooseAddr = ''
-        this.addressVal = '选择地址'
-        this.form.shippingAddrProvinceSn = ''
-        this.form.shippingAddrProvinceName = ''// 省
-        this.form.shippingAddrCitySn = ''
-        this.form.shippingAddrCityName = '' // 市
-        this.form.shippingAddrCountySn = ''
-        this.form.shippingAddrCountyName = '' // 区
-        this.form.shippingAddr = ''// 详细地址
-        this.form.consigneeTel = '' // 联系电话
-        this.form.consigneeName = ''
-      }
-    },
-    // 获取默认地址
-    getDefaultAddress () {
-      dealerRecevieAddrQuery({ defaultFlag: 1, dealerSn: this.form.buyerSn }).then(res => {
-        if (res.status == 200) {
-          if (res.data.length == 1) {
-            const ret = res.data[0]
-            ret.address = (ret.provinceName ? (ret.provinceName + '-') : '') + (ret.cityName ? (ret.cityName + '-') : '') + (ret.countyName ? (ret.countyName + '-') : '') + ret.addr
-            this.addressId = ret.id || undefined
-            this.handleOk(ret)
-          } else {
-            this.verifyFun(this.addressId)
-          }
-        }
-      })
     }
   },
   watch: {

+ 16 - 7
src/views/salesManagement/waitDispatch/queryPart.vue

@@ -14,7 +14,7 @@
               <a-input id="productInfoList-code" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码"/>
             </a-form-item>
           </a-col>
-          <a-col :md="4" :sm="24">
+          <a-col :md="6" :sm="24">
             <a-form-item label="是否促销品">
               <v-select
                 code="FLAG"
@@ -25,7 +25,7 @@
               ></v-select>
             </a-form-item>
           </a-col>
-          <a-col :md="4" :sm="24">
+          <a-col :md="6" :sm="24">
             <a-form-item label="类型">
               <a-select v-model.trim="queryParam.ptype" :dropdownMatchSelectWidth="false" >
                 <a-select-option value="0">
@@ -43,7 +43,12 @@
               </a-select>
             </a-form-item>
           </a-col>
-          <a-col :md="4" :sm="24" style="margin-bottom: 10px;">
+          <a-col :md="6" :sm="24">
+            <a-form-item label="出库仓库">
+              <chooseWarehouse ref="warehouse" :allowClear="false" v-model="queryParam.warehouseSn"></chooseWarehouse>
+            </a-form-item>
+          </a-col>
+          <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
             <a-button type="primary" class="button-info" @click="$refs.table.refresh(true)" :disabled="disabled" id="productInfoList-refresh">查询</a-button>
             <a-button style="margin-left: 5px" @click="resetSearchForm" id="productInfoList-reset">重置</a-button>
           </a-col>
@@ -54,7 +59,7 @@
     <div class="table-operator">
       <a-button type="primary" :disabled="newLoading" class="button-info" @click="handlePlAdd">批量添加</a-button>
       <a-button type="danger" :disabled="newLoading" class="button-error" @click="handlePlCancel">批量取消</a-button>
-      <a-button type="default" :disabled="newLoading" @click="handleOneDispatch">有货一键下推</a-button>
+      <!-- <a-button type="default" :disabled="newLoading" @click="handleOneDispatch">有货一键下推</a-button> -->
     </div>
     <!-- alert -->
     <a-alert type="info" style="margin-bottom: 10px;" v-if="detailData">
@@ -128,10 +133,11 @@
 import { commonMixin } from '@/utils/mixin'
 import { salesDetailAllStockList } from '@/api/salesDetail'
 import { STable, VSelect } from '@/components'
+import chooseWarehouse from '@/views/common/chooseWarehouse'
 export default {
   name: 'QueryPart',
   mixins: [commonMixin],
-  components: { STable, VSelect },
+  components: { STable, VSelect, chooseWarehouse },
   props: {
     newLoading: Boolean
   },
@@ -156,7 +162,8 @@ export default {
         productTypeSn1: '', //  产品一级分类
         productTypeSn2: '', //  产品二级分类
         productTypeSn3: '', //  产品三级分类
-        salesBillSn: ''
+        salesBillSn: '',
+        warehouseSn: undefined
       },
       disabled: false, //  查询、重置按钮是否可操作
       // 加载数据方法 必须为 Promise 对象
@@ -207,6 +214,7 @@ export default {
         { title: '原厂编码', dataIndex: 'productEntity.origCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
         // { title: '销售价', dataIndex: 'price', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         // { title: '成本价', dataIndex: 'showCost', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '出库仓库', dataIndex: 'warehouseName', width: '8%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '单位', dataIndex: 'productEntity.unit', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '可用库存', dataIndex: 'stockQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '销售数量', dataIndex: 'qty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
@@ -243,6 +251,7 @@ export default {
       this.queryParam.productTypeSn1 = ''
       this.queryParam.productTypeSn2 = ''
       this.queryParam.productTypeSn3 = ''
+      this.queryParam.warehouseSn = undefined
       this.productType = []
       this.$refs.table.refresh(true)
     },
@@ -308,7 +317,7 @@ export default {
         obj.push({
           'cancelQty': item.cancelNums,
           'salesBillDetailSn': item.salesBillDetailSn,
-          "salesBillSn": this.salesBillSn
+          'salesBillSn': this.salesBillSn
         })
       })