瀏覽代碼

Merge branch 'develop_szhj07' of http://git.chelingzhu.com/jianguan-web/qpls-md-html into develop_szhj07

chenrui 2 年之前
父節點
當前提交
f5b6bf22d9

+ 1 - 1
public/version.json

@@ -1,5 +1,5 @@
 {
   "message": "发现有新版本发布,确定更新系统?",
   "vendorJsVersion": "",
-  "version": 1667982251869
+  "version": 1668076357699
 }

+ 8 - 0
src/api/salesDetail.js

@@ -19,6 +19,14 @@ export const salesDetailInsert = (params) => {
     method: 'post'
   })
 }
+// 批量新增
+export const salesDetailInsertBatch = (params) => {
+  return axios({
+    url: '/salesDetail/insertBatch',
+    data: params,
+    method: 'post'
+  })
+}
 //  销售详情 修改价格
 export const salesDetailUpdatePrice = (params) => {
   return axios({

+ 8 - 0
src/api/shelf.js

@@ -19,6 +19,14 @@ export const shelfDetail = (params) => {
     method: 'post'
   })
 }
+// 查询客户关联的货架
+export const queryByCustomerSn = (params) => {
+  return axios({
+    url: `/shelf/queryByCustomerSn/${params.sn}`,
+    data: params,
+    method: 'post'
+  })
+}
 //待补货产品列表
 export const queryListForReplenish = (params) => {
   return axios({

+ 17 - 0
src/api/shelfReplenish.js

@@ -147,3 +147,20 @@ export const shelfReplenishTaskInsertBill = (params) => {
     method: 'post'
   })
 }
+
+// 待补货产品 
+export const queryWaitReplenish = (params) => {
+  return axios({
+    url: '/shelfProduct/queryWaitReplenish',
+    data: params,
+    method: 'post'
+  })
+}
+// 货架产品
+export const queryShelfProduct = (params) => {
+  return axios({
+    url: '/shelfProduct/queryShelfProduct',
+    data: params,
+    method: 'post'
+  })
+}

+ 7 - 2
src/views/numsGoodsShelves/replenishmentManagement/detailModal.vue

@@ -155,8 +155,13 @@ export default {
     },
     // 生成销售单
     createSales () {
-      createSalesBill().then(res => {
-
+      this.spinning = true
+      createSalesBill({ replenishBillSn: this.nowData.replenishBillSn }).then(res => {
+        if (res.status == 200) {
+          this.$message.info(res.message)
+          this.getSalesOrder()
+        }
+        this.spinning = false
       })
     },
     pageInit () {

+ 16 - 9
src/views/numsGoodsShelves/replenishmentManagement/outWarehousingModal.vue

@@ -12,27 +12,34 @@
       <a-form-model
         id="replenishmentManagement-outWarehousing-form"
         ref="ruleForm"
-        layout="inline"
         :model="form"
         :rules="rules"
         style="margin-bottom: 10px;" >
         <a-row :gutter="15">
-          <a-col :md="12" :sm="24">
-            <a-form-model-item label="补货单号">{{ basicInfoData && basicInfoData.replenishBillNo || '--' }}</a-form-model-item>
+          <a-col :span="12">
+            <a-form-model-item style="margin-bottom: 0;" label="补货单号" :labelCol="{ span: 6}" :wrapperCol="{ span: 16 }">{{ basicInfoData && basicInfoData.replenishBillNo || '--' }}</a-form-model-item>
           </a-col>
-          <a-col :md="12" :sm="24">
-            <a-form-model-item label="创建时间">{{ basicInfoData && basicInfoData.createDate || '--' }}</a-form-model-item>
+          <a-col :span="12">
+            <a-form-model-item style="margin-bottom: 0;" label="创建时间" :labelCol="{ span: 6}" :wrapperCol="{ span: 16 }">{{ basicInfoData && basicInfoData.createDate || '--' }}</a-form-model-item>
           </a-col>
-          <!-- <a-col :md="12" :sm="24">
+          <!-- <a-col :span="12">
             <a-form-model-item label="配送方式" prop="dispatchType" style="margin: 0;">
               <a-radio-group v-model="form.dispatchType">
                 <a-radio v-for="(item,index) in dispatchTypeList" :key="index" :value="item.code">{{ item.dispName }}</a-radio>
               </a-radio-group>
             </a-form-model-item>
           </a-col> -->
-          <a-col :md="24" :sm="24">
-            <a-form-model-item label="出库备注">
-              <a-input id="replenishmentManagement-outWarehousing-remarks" :maxLength="100" v-model.trim="form.remarks" allowClear placeholder="请输入出库备注(最多100字符)"/>
+        </a-row>
+        <a-row :gutter="15">
+          <a-col :span="24">
+            <a-form-model-item style="margin-bottom: 0;" label="出库备注" :labelCol="{ span: 3 }" :wrapperCol="{ span: 20 }">
+              <a-input
+                type="textarea"
+                id="replenishmentManagement-outWarehousing-remarks"
+                :maxLength="100"
+                v-model.trim="form.remarks"
+                allowClear
+                placeholder="请输入出库备注(最多100字符)"/>
             </a-form-model-item>
           </a-col>
         </a-row>

+ 7 - 1
src/views/numsGoodsShelves/shelfSet/addHwModal.vue

@@ -140,6 +140,9 @@ export default {
       this.form.price = obj && obj.row && obj.row.price || ''
       this.form.cost = obj && obj.row && obj.row.cost || ''
       this.productName = obj && obj.row && obj.row.name || ''
+      this.form.oldPrice = obj && obj.row && obj.row.price || ''
+      this.form.oldCost = obj && obj.row && obj.row.cost || ''
+      this.form.oldMaxQty = ''
     },
     placeCodeBlur (v) {
     	this.$nextTick(() => {
@@ -165,7 +168,10 @@ export default {
               productCode: form.productCode,
               price: form.price,
               cost: form.cost,
-              maxQty: form.maxQty
+              maxQty: form.maxQty,
+              oldPrice: form.oldPrice,
+              oldCost: form.oldCost,
+              oldMaxQty: form.oldMaxQty
             }
           }
           // 开始提交数据

+ 6 - 0
src/views/numsGoodsShelves/shelfSet/bindProductModal.vue

@@ -136,6 +136,8 @@ export default {
       this.form.productCode = obj && obj.row && obj.row.code || ''
       this.form.price = obj && obj.row && obj.row.price || ''
       this.form.cost = obj && obj.row && obj.row.cost || ''
+      this.form.oldPrice = obj && obj.row && obj.row.price || ''
+      this.form.oldCost = obj && obj.row && obj.row.cost || ''
       this.productName = obj && obj.row && obj.row.name || ''
       this.$refs.ruleForm.validate()
     },
@@ -145,6 +147,7 @@ export default {
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
           const form = JSON.parse(JSON.stringify(_this.form))
+          form.shelfSn = _this.nowData && _this.nowData.shelfSn
           form.shelfPlaceSn = _this.nowData && _this.nowData.shelfPlaceSn
           if (this.type != 'bind') { // 修改信息、更换产品
             form.shelfProductSn = _this.nowData && _this.nowData.shelfProductApiEntity && _this.nowData.shelfProductApiEntity.shelfProductSn
@@ -181,6 +184,9 @@ export default {
           this.form.price = res.data.price
           this.form.cost = res.data.cost
           this.form.maxQty = res.data.maxQty
+          this.form.oldPrice = res.data.price
+          this.form.oldCost = res.data.cost
+          this.form.oldMaxQty = res.data.maxQty
         } else {
           this.productInfo = null
           this.$refs.ruleForm.resetFields()

+ 129 - 50
src/views/salesManagement/salesQuery/chooseShelfProduct.vue

@@ -10,7 +10,7 @@
     width="80%">
     <a-spin :spinning="spinning" tip="Loading...">
       <a-tabs>
-        <a-tab-pane key="1" tab="待补货产品" force-render>
+        <a-tab-pane :defaultActiveKey="curTab" v-model="curTab" :key="1" tab="待补货产品">
           <!-- 搜索条件 -->
           <div class="table-page-search-wrapper">
             <a-form-model
@@ -19,7 +19,7 @@
               layout="inline"
               :model="queryParam"
               @keyup.enter.native="$refs.table.refresh(true)" >
-              <a-row :gutter="5">
+              <a-row :gutter="15">
                 <a-col :md="4" :sm="24">
                   <a-form-model-item label="产品编码">
                     <a-input id="chooseShelf-code" ref="searchProductCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码"/>
@@ -30,17 +30,17 @@
                     <a-input id="chooseShelf-name" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
                   </a-form-model-item>
                 </a-col>
-                <a-col :md="4" :sm="24">
+                <a-col :md="6" :sm="24">
                   <a-form-model-item label="产品分类">
                     <ProductType id="chooseShelf-productType" :isDealer="true" @change="changeProductType" v-model="productType"></ProductType>
                   </a-form-model-item>
                 </a-col>
                 <a-col :md="6" :sm="24">
                   <a-form-model-item label="库存情况">
-                    <a-checkbox-group :options="options" @change="onStockChange" />
+                    <a-checkbox-group v-model.trim="queryParam.stockStateList" :options="options" />
                   </a-form-model-item>
                 </a-col>
-                <a-col :md="6" :sm="12" style="margin-bottom: 10px;">
+                <a-col :md="4" :sm="12" style="margin-bottom: 10px;">
                   <a-button type="primary" @click="$refs.table.refresh(true)" id="chooseShelf-refresh">查询</a-button>
                   <a-button style="margin-left: 5px" @click="resetSearchForm" id="chooseShelf-reset">重置</a-button>
                 </a-col>
@@ -50,8 +50,8 @@
           <div class="chooseShelf-modal-table">
             <div class="table-operator">
               <div>
-                <a-button type="primary" class="button-error">批量添加</a-button>
-                <span v-if="selectTotal">已选{{ selectTotal }}项</span>
+                <a-button type="primary" @click="handlePlAdd">批量添加</a-button>
+                <span style="margin-left: 10px;" v-if="selectTotal">已选{{ selectTotal }}项</span>
               </div>
               <div>
                 <a-icon type="info-circle" />
@@ -64,18 +64,63 @@
               ref="table"
               size="small"
               :rowKey="(record) => record.id"
-              :row-selection="{columnWidth: 40}"
+              :row-selection="{columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: record.includeFlag == 1 } })}"
               @rowSelection="rowSelectionFun"
               :columns="columns"
               :data="loadData"
               :scroll="{ y: 450 }"
-              :defaultLoadData="false"
               :showPagination="false"
               bordered>
+              <!-- 售价 -->
+              <template slot="salePrice" slot-scope="text, record">
+                <div style="display: flex;align-items: center;" @dblclick.stop>
+                  <a-input-number
+                    size="small"
+                    v-model="record.price"
+                    :precision="2"
+                    :min="0"
+                    :max="999999"
+                    style="width: 100%;"
+                    placeholder="请输入" />
+                  <span style="color: red;margin: 0 2px;font-size: 14px;" v-if="record.origSalePriceFlag == 1">原</span>
+                  <span v-else>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
+                </div>
+              </template>
+              <!-- 销售数量 -->
+              <template slot="nums" slot-scope="text, record">
+                <div @dblclick.stop>
+                  <a-input-number
+                    size="small"
+                    v-model="record.salesNums"
+                    :precision="0"
+                    :min="0"
+                    :max="999999"
+                    style="width: 100%;"
+                    placeholder="请输入" />
+                </div>
+              </template>
+              <!-- 操作 -->
+              <template slot="action" slot-scope="text, record">
+                <a-button
+                  size="small"
+                  type="link"
+                  class="button-primary"
+                  @click.stop="handleAdd(record)"
+                  v-if="record.includeFlag != 1"
+                  id="productInfoList-edit-btn">添加</a-button>
+                <span style="color:#999;" v-else>已添加</span>
+                <a-button
+                  size="small"
+                  type="link"
+                  class="button-primary"
+                  @click.stop="handleDetail(record)"
+                  id="productInfoList-detail-btn"
+                  style="margin-left: 5px;">销售记录</a-button>
+              </template>
             </s-table>
           </div>
         </a-tab-pane>
-        <a-tab-pane key="2" tab="全部货架产品" force-render>
+        <a-tab-pane :key="2" tab="全部货架产品">
           <!-- 搜索条件 -->
           <div class="table-page-search-wrapper">
             <a-form-model
@@ -84,18 +129,18 @@
               layout="inline"
               :model="queryParam1"
               @keyup.enter.native="$refs.table1.refresh(true)" >
-              <a-row :gutter="5">
-                <a-col :md="4" :sm="24">
+              <a-row :gutter="15">
+                <a-col :md="6" :sm="24">
                   <a-form-model-item label="产品编码">
                     <a-input id="chooseShelf-code1" v-model.trim="queryParam1.productCode" allowClear placeholder="请输入产品编码"/>
                   </a-form-model-item>
                 </a-col>
-                <a-col :md="4" :sm="24">
+                <a-col :md="6" :sm="24">
                   <a-form-model-item label="产品名称">
                     <a-input id="chooseShelf-name1" v-model.trim="queryParam1.productName" allowClear placeholder="请输入产品名称"/>
                   </a-form-model-item>
                 </a-col>
-                <a-col :md="4" :sm="24">
+                <a-col :md="6" :sm="24">
                   <a-form-model-item label="产品分类">
                     <ProductType id="chooseShelf-productType1" :isDealer="true" @change="changeProductType1" v-model="productType1"></ProductType>
                   </a-form-model-item>
@@ -117,7 +162,6 @@
               :columns="columns1"
               :data="loadData1"
               :scroll="{ y: 450 }"
-              :defaultLoadData="false"
               :showPagination="false"
               bordered>
             </s-table>
@@ -125,6 +169,8 @@
         </a-tab-pane>
       </a-tabs>
     </a-spin>
+    <!-- 销售记录 -->
+    <product-salesRecord-modal ref="salseRecord" :openModal="showRecord" @close="showRecord=false" />
   </a-modal>
 </template>
 
@@ -132,10 +178,11 @@
 import { commonMixin } from '@/utils/mixin'
 import { STable } from '@/components'
 import ProductType from '../../common/productType.js'
-import { stockOutDetailList } from '@/api/stockOut'
+import productSalesRecordModal from './productSalesRecordModal.vue'
+import { queryWaitReplenish, queryShelfProduct } from '@/api/shelfReplenish'
 export default {
   name: 'OutinDetailModal',
-  components: { STable, ProductType },
+  components: { STable, ProductType, productSalesRecordModal },
   mixins: [commonMixin],
   props: {
     openModal: {
@@ -154,31 +201,41 @@ export default {
     return {
       spinning: false,
       advanced: false,
+      showRecord: false,
       isShow: this.openModal, //  是否打开弹框
       options: [
-        { label: '库存充足', value: '1' },
-        { label: '部分缺货', value: '2' },
-        { label: '全部缺货', value: '3' }
+        { label: '库存充足', value: 'stockEnough' },
+        { label: '部分缺货', value: 'portionStockout' },
+        { label: '全部缺货', value: 'allStockout' }
       ],
+      curTab: 1,
       productType: [],
       queryParam: {
         productCode: '', //  产品编码
         productName: '', //  产品名称
         productTypeSn1: '', //  产品一级分类
         productTypeSn2: '', //  产品二级分类
-        productTypeSn3: '' //  产品三级分类
+        productTypeSn3: '', //  产品三级分类
+        stockStateList: []
       },
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.spinning = true
-        return stockOutDetailList(Object.assign(parameter, this.queryParam)).then(res => {
+        this.queryParam.shelfSn = this.baseData.shelfSn
+        this.queryParam.customerSn = this.baseData.customerSn
+        this.queryParam.salePriceType = this.baseData.salePriceType
+        this.queryParam.salesBillSn = this.baseData.salesBillSn
+
+        return queryWaitReplenish(Object.assign(parameter, this.queryParam)).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
             const no = 0
             for (var i = 0; i < data.length; i++) {
+              data[i] = data[i].shelfProductApi
               data[i].no = no + i + 1
-              data[i].totalCost = Number(data[i].putCost * data[i].outQty).toFixed(2)
+              data[i].salesNums = data[i].replenishBillWaitQty
+              data[i].putCost = data[i].cost
             }
           }
           this.spinning = false
@@ -198,14 +255,17 @@ export default {
       // 加载数据方法 必须为 Promise 对象
       loadData1: parameter => {
         this.spinning = true
-        return stockOutDetailList(Object.assign(parameter, this.queryParam1)).then(res => {
+        this.queryParam1.shelfSn = this.baseData.shelfSn
+        this.queryParam1.customerSn = this.baseData.customerSn
+        this.queryParam1.salePriceType = this.baseData.salePriceType
+        this.queryParam1.salesBillSn = this.baseData.salesBillSn
+        return queryShelfProduct(Object.assign(parameter, this.queryParam1)).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
             const no = 0
             for (var i = 0; i < data.length; i++) {
               data[i].no = no + i + 1
-              data[i].totalCost = Number(data[i].putCost * data[i].outQty).toFixed(2)
             }
           }
           this.spinning = false
@@ -224,35 +284,34 @@ export default {
     columns () {
       const arr = [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '库存批次', dataIndex: 'stockBatchNo', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '入库类型', dataIndex: 'putBizTypeDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '仓库', dataIndex: 'warehouseName', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '仓位', dataIndex: 'warehouseLocationName', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        // { title: '成本价', dataIndex: 'putCost', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '本次出库数量', dataIndex: 'outQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
-        // { title: '成本小计', dataIndex: 'totalCost', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
+        { title: '货位号', dataIndex: 'shelfPlaceCode', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'productCode', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '最大库容', dataIndex: 'maxQty', 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 : '--') } },
+        { title: '补货在途', dataIndex: 'replenishBillQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '调回在途', dataIndex: 'recallBillQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '待补货数量', dataIndex: 'replenishBillWaitQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '门店库存数量', dataIndex: 'qplsStockQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '单位', dataIndex: 'productUnit', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '售价', dataIndex: 'price', scopedSlots: { customRender: 'salePrice' }, width: '8%', align: 'center' },
+        { title: '销售数量', dataIndex: 'salesNums', scopedSlots: { customRender: 'nums' }, width: '8%', align: 'center' },
+        { title: '操作', dataIndex: 'action', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
       ]
-      if (this.$hasPermissions('M_ShowAllCost')) {
-        arr.splice(5, 0, { title: '成本价', dataIndex: 'putCost', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
-        arr.splice(7, 0, { title: '成本小计', dataIndex: 'totalCost', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
-      }
       return arr
     },
     columns1 () {
       const arr = [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '库存批次', dataIndex: 'stockBatchNo', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '入库类型', dataIndex: 'putBizTypeDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '仓库', dataIndex: 'warehouseName', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '仓位', dataIndex: 'warehouseLocationName', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        // { title: '成本价', dataIndex: 'putCost', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '本次出库数量', dataIndex: 'outQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
-        // { title: '成本小计', dataIndex: 'totalCost', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
+        { title: '货位号', dataIndex: 'shelfPlaceCode', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'productCode', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', width: '25%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '最大库容', dataIndex: 'maxQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '货架库存', dataIndex: 'qty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '补货在途', dataIndex: 'replenishBillQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '调回在途', dataIndex: 'recallBillQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '单位', dataIndex: 'productUnit', width: '10%', align: 'center', customRender: function (text) { return text || '--' } }
       ]
-      if (this.$hasPermissions('M_ShowAllCost')) {
-        arr.splice(5, 0, { title: '成本价', dataIndex: 'putCost', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
-        arr.splice(7, 0, { title: '成本小计', dataIndex: 'totalCost', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
-      }
       return arr
     }
   },
@@ -260,6 +319,11 @@ export default {
     cansel () {
       this.isShow = false
     },
+    // 销售记录
+    handleDetail (row) {
+      this.showRecord = true
+      this.$refs.salseRecord.getDetail(this.baseData.customerSn, row.productSn, row)
+    },
     // 表格选中项
     rowSelectionFun (obj) {
       this.rowSelectionInfo = obj || null
@@ -270,8 +334,17 @@ export default {
       this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
       this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
     },
-    onStockChange (val) {
-      console.log(val)
+    // 添加
+    handleAdd (row) {
+      this.$emit('add', row)
+    },
+    // 批量添加
+    handlePlAdd () {
+      if (this.selectTotal) {
+        this.$emit('plAdd', this.rowSelectionInfo && this.rowSelectionInfo.selectedRows || [])
+      } else {
+        this.$message.info('请选择产品')
+      }
     },
     resetSearchForm () {
       this.queryParam.productCode = ''
@@ -280,9 +353,15 @@ export default {
       this.queryParam.productTypeSn2 = ''
       this.queryParam.productTypeSn3 = ''
       this.productType = []
+      this.queryParam.stockStateList = []
       this.$refs.ruleForm.resetFields()
+      this.$refs.table.clearSelected()
       this.$refs.table.refresh(true)
     },
+    reload () {
+      this.$refs.table.clearSelected()
+      this.$refs.table.refresh()
+    },
     // ---------- 全部产品----------
     //  产品分类  change
     changeProductType1 (val, opt) {
@@ -312,7 +391,7 @@ export default {
         this.$emit('close')
       } else {
         this.$nextTick(() => {
-          this.$refs.table.refresh(true)
+          this.curTab = 1
         })
       }
     }

+ 58 - 5
src/views/salesManagement/salesQuery/edit.vue

@@ -107,6 +107,7 @@
                   id="salesEdit-import">导入产品</a-button>
                 <a-button
                   type="default"
+                  v-if="shelfInfo&&shelfInfo.state=='ENABLE'"
                   @click="showShelfModal=true"
                   id="salesEdit-shelf">货架产品</a-button>
                 <a-button
@@ -138,6 +139,11 @@
               <span style="margin-right: 5px;">实际总成本</span> <a-icon type="question-circle" />
             </a-tooltip>
           </div>
+          <!-- 产品名称 -->
+          <template slot="productName" slot-scope="text, record">
+            <a-tag color="blue" v-if="record.shelfPlaceCode">{{ record.shelfPlaceCode }}</a-tag>
+            <span>{{ text }}</span>
+          </template>
           <!-- 产品编码 -->
           <template slot="productCode" slot-scope="text, record">
             <div v-if="detailData">
@@ -208,7 +214,14 @@
     <!-- 出库明细 -->
     <outInDetialModal ref="outInDetialModal" outBizType="SALES" :openModal="showOutInModal" @close="showOutInModal=false"></outInDetialModal>
     <!-- 选择货架产品 -->
-    <chooseShelfProduct ref="chooseShelfProduct" :baseData="detailData" :openModal="showShelfModal" @close="showShelfModal=false"></chooseShelfProduct>
+    <chooseShelfProduct
+      v-if="showShelfModal"
+      ref="chooseShelfProduct"
+      @add="insterProduct"
+      @plAdd="plInsterProduct"
+      :baseData="shelfInfo"
+      :openModal="showShelfModal"
+      @close="showShelfModal=false"></chooseShelfProduct>
   </div>
 </template>
 <script>
@@ -220,8 +233,9 @@ import chooseCustomModal from './chooseCustomModal.vue'
 import importGuideModal from './importGuideModal.vue'
 import settleModal from '@/views/financialManagement/settleModal/settleModal.vue'
 import { stockByProductSn } from '@/api/stock'
+import { queryByCustomerSn } from '@/api/shelf'
 import { salesDetail, salesWriteSubmit, salesWriteDiscount, salesDetailPrint, salesDetailExport, salesDel } from '@/api/sales'
-import { salesDetailList, salesDetailInsert, salesDetailUpdatePrice, salesDetailUpdateQty, salesDetailDel, salesDetailDelAll, salesDetailInsertImport } from '@/api/salesDetail'
+import { salesDetailList, salesDetailInsert, salesDetailInsertBatch, salesDetailUpdatePrice, salesDetailUpdateQty, salesDetailDel, salesDetailDelAll, salesDetailInsertImport } from '@/api/salesDetail'
 import outInDetialModal from '@/views/common/outInDetialModal.vue'
 import chooseShelfProduct from './chooseShelfProduct.vue'
 import Print from '@/views/common/print.vue'
@@ -276,7 +290,8 @@ export default {
         })
       },
       printerType: 'NEEDLE', //  打印机类型
-      isCosts: false // 是否显示成本价
+      isCosts: false, // 是否显示成本价
+      shelfInfo: null // 是否有货架
     }
   },
   computed: {
@@ -292,7 +307,7 @@ export default {
       const arr = [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
         { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: '13%', scopedSlots: { customRender: 'productCode' }, align: 'center' },
-        { title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '13%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '13%', align: 'center', scopedSlots: { customRender: 'productName' }, ellipsis: true },
         { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '品牌', dataIndex: 'dealerProductEntity.productBrandName', width: '8%', align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
         // { title: '仓库', dataIndex: 'warehouseEntity.name', width: '8%', align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
@@ -567,7 +582,7 @@ export default {
       if (this.dataSource && this.dataSource.length > 0) {
         const hasRow = this.dataSource.find(item => item.productSn == row.productSn)
         if (hasRow) {
-          // this.$message.info('该产品已在当前销售单中存在!')
+          this.$message.info('该产品已在当前销售单中存在!')
           this.productForm = {
             productName: '',
             productCode: hasRow.dealerProductEntity && hasRow.dealerProductEntity.code || '',
@@ -639,11 +654,40 @@ export default {
           // this.resetSearchForm(true)  //  不刷新库存
           this.$refs.table.refresh(true)
           this.getOrderDetail(false)
+          if (this.showShelfModal) {
+            this.$refs.chooseShelfProduct.reload()
+          }
         }
         this.isInster = false
         // this.spinning = false
       })
     },
+    // 批量添加接口
+    plInsterProduct (list) {
+      const params = []
+      list.map(item => {
+        params.push({
+          buyerSn: this.detailData.buyerSn,
+          productSn: item.productSn,
+          cost: item.putCost,
+          price: item.price,
+          qty: item.salesNums,
+          salesBillSn: this.detailData.salesBillSn,
+          salesBillNo: this.detailData.salesBillNo,
+          stockSn: item.stockSn
+        })
+      })
+      this.$message.loading('正在批量添加产品...', 1)
+      salesDetailInsertBatch(params).then(res => {
+        if (res.status == 200) {
+          this.$refs.table.refresh(true)
+          this.getOrderDetail(false)
+          if (this.showShelfModal) {
+            this.$refs.chooseShelfProduct.reload()
+          }
+        }
+      })
+    },
     //  销售单详情
     getOrderDetail (flag) {
       salesDetail({ id: this.$route.params.id }).then(res => {
@@ -654,10 +698,19 @@ export default {
             const buyerSn = (vm.detailData && vm.detailData.buyerSn && vm.detailData.sourceType && vm.detailData.sourceType == 'PURCHASE') ? '' : vm.detailData.buyerSn
             const priceType = vm.$route.params.priceType
             vm.$refs.partQuery.pageInit(buyerSn, priceType, vm.salesBillSn)
+            // 查询关联的客户
+            if (vm.detailData && vm.detailData.buyerSn) {
+              this.getShelfQueryByCustomer()
+            }
           }
         }
       })
     },
+    getShelfQueryByCustomer () {
+      queryByCustomerSn({ sn: this.detailData.buyerSn }).then(res => {
+        this.shelfInfo = Object.assign(res.data, { salePriceType: this.$route.params.priceType, salesBillSn: this.salesBillSn })
+      })
+    },
     // 提交销售单
     handleSubmit (params) {
       this.spinning = true

+ 1 - 1
vue.config.js

@@ -211,7 +211,7 @@ const vueConfig = {
     // If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
     proxy: {
       '/api': {
-        target: 'http://192.168.0.182:8503/qpls-md',
+        target: 'http://192.168.0.215:8503/qpls-md',
         // target: 'http://p.iscm.360arrow.com/qpls-md',
         // ws: false,
         ws: true,