Browse Source

Merge branch 'develop_yh43' of http://git.chelingzhu.com/jianguan-web/jg-ocs-html into develop_yh43

chenrui 11 months ago
parent
commit
7ce01c02a4

+ 16 - 0
src/api/salesNew.js

@@ -22,6 +22,22 @@ export const salesList = (params) => {
         }
     })
 }
+// 是否已转采购单
+export const getCreatePurchaseFlag = (params) => {
+    return axios({
+        url: `/sales/getCreatePurchaseFlag`,
+        data: params,
+        method: 'post'
+    })
+}
+// 转采购单
+export const allCreatePurchase = (params) => {
+    return axios({
+        url: `/sales/allCreatePurchase`,
+        data: params,
+        method: 'post'
+    })
+}
 //  销售 待转费用单列表  有分页
 export const salesConvertExpenseList = (params) => {
     const url = `/salesPromo/queryBatchConvertExpenseAccountPage/${params.pageNo}/${params.pageSize}`

+ 1 - 1
src/views/salesManagement/salesQueryNew/comps/productList.vue

@@ -83,7 +83,7 @@
             class="button-info"
             @click="showSearchBox=!showSearchBox" ><a-icon :type="showSearchBox?'close':'search'"/> 筛选</a-button>
           <!-- // 操作按钮 -->
-          <a-button type="link" class="button-info" @click="searchThreeStock" id="salesEdit-updateStock"><a-icon type="redo"/>第三方库存</a-button>
+          <!-- <a-button type="link" class="button-info" @click="searchThreeStock" id="salesEdit-updateStock"><a-icon type="redo"/>第三方库存</a-button> -->
           <a-dropdown>
             <a-menu slot="overlay" @click="handleMenuClick" :id="'salesEdit-menu-'+id">
               <a-menu-item key="3" :disabled="disablePromo" :id="'salesEdit-menu-3'+id">

+ 2 - 1
src/views/salesManagement/salesQueryNew/comps/productNormalList.vue

@@ -32,6 +32,7 @@
           <a-col :md="4" :sm="24" style="margin-bottom: 10px;">
             <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="salesEdit-refresh">查询</a-button>
             <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="salesEdit-reset">重置</a-button>
+            <a-button style="margin-left: 15px" type="primary" class="button-info" @click="searchThreeStock" id="salesEdit-updateStock">第三方库存</a-button>
           </a-col>
         </a-row>
       </a-form>
@@ -43,7 +44,6 @@
           <span v-if="selectTotal" style="margin-right:5px;">已选{{ selectTotal }}项</span>
         </a-col>
         <a-col :md="16" :sm="24" style="text-align:right;">
-          <a-button type="link" class="button-info" @click="searchThreeStock" id="salesEdit-updateStock"><a-icon type="redo"/>第三方库存</a-button>
           <a-dropdown>
             <a-menu slot="overlay" @click="handleMenuClick">
               <a-menu-item key="3" id="salesEdit-pl-3">
@@ -338,6 +338,7 @@ export default {
     // 查询第三方库存
     searchThreeStock () {
       this.showStockCol = true
+      this.$emit('allThreeStock')
     },
     // 获取统计
     getCount () {

+ 12 - 0
src/views/salesManagement/salesQueryNew/edit.vue

@@ -38,6 +38,7 @@
             ref="productNormalList"
             @insterOk="insterActiveOk"
             @openCpModal="openProductModal"
+            @allThreeStock="searchAllThreeStock"
             :showTotal="showTotal"
             :detailData="detailData"
             :warehouseSn="warehouseSn"
@@ -271,6 +272,17 @@ export default {
         }
       }, 50)
     },
+    // 刷新所有第三方库存
+    searchAllThreeStock () {
+      const activeList = this.activeList
+      // 刷新所有活动产品列表
+      activeList.map(item => {
+        item.isActive = true
+        const row = this.$refs['productList-' + item.promoRuleSn][0]
+        row && row.searchThreeStock()
+      })
+      activeList.splice()
+    },
     // 刷新所有表格数据
     updateAllTable (flag) {
       const activeList = this.activeList.filter(item => item.isActive)

+ 339 - 335
src/views/salesManagement/waitDispatchNew/detailProductList.vue

@@ -1,360 +1,364 @@
 <template>
-    <div class="productInfoList-wrap">
-      <!-- alert -->
-      <div style="margin-bottom: 10px;display: flex;align-items: center;" v-if="!showEmpty">
-        <div style="display: flex;align-items: center;">
-          <a-button type="danger" :disabled="newLoading" @click="delSalerDetailAll">批量删除</a-button>
-          <span style="margin-left: 10px;" v-if="selectedRowKeys.length">已选 {{ selectedRowKeys.length }} 项</span>
-        </div>
-        <div style="padding-left: 20px;">
-          <slot name="total"></slot>
-        </div>
+  <div class="productInfoList-wrap">
+    <!-- alert -->
+    <div style="margin-bottom: 10px;display: flex;align-items: center;" v-if="!showEmpty">
+      <div style="display: flex;align-items: center;">
+        <a-button id="dispatch-delAll" type="danger" :disabled="newLoading" @click="delSalerDetailAll">批量删除</a-button>
+        <span style="margin-left: 10px;" v-if="selectedRowKeys.length">已选 {{ selectedRowKeys.length }} 项</span>
+      </div>
+      <div style="padding-left: 20px;">
+        <slot name="total"></slot>
       </div>
-
-      <a-spin :spinning="spinning" tip="Loading...">
-          <ve-table
-                border-y
-                v-show="!showEmpty"
-                :scroll-width="0"
-                :max-height="tableHeight"
-                :show-header="showTableHead"
-                :row-style-option="{clickHighlight: true}"
-                :cellSelectionOption="{enable: false}"
-                :virtual-scroll-option="{enable: true}"
-                :columns="columns"
-                :table-data="dataSource"
-                row-key-field-name="id"
-                :cell-style-option="cellStyleOption"
-                :cell-span-option="cellSpanOption"
-                :checkbox-option="checkboxOption"
-              />
-          <div v-show="showEmpty" class="empty-data"><a-empty description="暂无产品" :image="simpleImage"/></div>
-      </a-spin>
-  
     </div>
-  </template>
-  
-  <script>
-  import { commonMixin } from '@/utils/mixin'
-  import { deleteBatch, waitDispatchDetailAllList, updateQty } from '@/api/waitDispatchDetail'
-  import { Empty } from 'ant-design-vue';
-  import { STable, VSelect } from '@/components'
-  import chooseWarehouse from '@/views/common/chooseWarehouse'
-  export default {
-    name: 'DetailProductList',
-    mixins: [commonMixin],
-    components: { STable, VSelect, chooseWarehouse },
-    props: {
-      newLoading: {
-          type: Boolean,
-          default: false
-      },
-      maxHeight:{
-            type: [String,Number],
-            default: '300'
-          },
-      showHeader: {
-          type: Boolean,
-          default: true
-      }
+
+    <a-spin :spinning="spinning" tip="Loading...">
+      <ve-table
+        border-y
+        v-show="!showEmpty"
+        :scroll-width="0"
+        :max-height="tableHeight"
+        :show-header="showTableHead"
+        :row-style-option="{clickHighlight: true}"
+        :cellSelectionOption="{enable: false}"
+        :virtual-scroll-option="{enable: true}"
+        :columns="columns"
+        :table-data="dataSource"
+        row-key-field-name="id"
+        :cell-style-option="cellStyleOption"
+        :cell-span-option="cellSpanOption"
+        :checkbox-option="checkboxOption"
+      />
+      <div v-show="showEmpty" class="empty-data"><a-empty description="暂无产品" :image="simpleImage"/></div>
+    </a-spin>
+
+  </div>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { deleteBatch, waitDispatchDetailAllList, updateQty } from '@/api/waitDispatchDetail'
+import { Empty } from 'ant-design-vue'
+import { STable, VSelect } from '@/components'
+import chooseWarehouse from '@/views/common/chooseWarehouse'
+export default {
+  name: 'DetailProductList',
+  mixins: [commonMixin],
+  components: { STable, VSelect, chooseWarehouse },
+  props: {
+    newLoading: {
+      type: Boolean,
+      default: false
     },
-    data () {
+    maxHeight: { // 表格高度
+      type: [String, Number],
+      default: '300'
+    },
+    showHeader: { // 是否显示表格头部
+      type: Boolean,
+      default: true
+    }
+  },
+  data () {
+    return {
+      productForm: {
+        dispatchBillSn: '' // 下推单sn
+      },
+      disabled: false, //  查询、重置按钮是否可操作
+      spinning: false,
+      simpleImage: Empty.PRESENTED_IMAGE_SIMPLE, // 无数据图片
+      dataSource: [], // 原始数据
+      tableHeight: this.maxHeight, // 表格高度
+      cellStyleOption: {
+        bodyCellClass: ({ row, column, rowIndex }) => {
+          if (row.id.indexOf('promo-') >= 0 && column.field === 'no') {
+            return 'table-body-cell-no'
+          }
+        }
+      },
+      // 可拖曳调整列宽
+      columnWidthResizeOption: {
+        enable: true,
+        minWidth: 50
+      },
+      cellSpanOption: {
+        bodyCellSpan: this.bodyCellSpan
+      },
+      showEmpty: false, // 是否显示暂无数据
+      showTableHead: true, // 是否显示表格头部
+      disableSelectedRowKeys: [], // 禁用的行
+      selectedRowKeys: [], // 已选行
+      detailData: null, // 详情数据
+      activeList: [] // 参与活动列表
+    }
+  },
+  computed: {
+    // 表格复选框设置
+    checkboxOption () {
       return {
-        productForm: {
-            dispatchBillSn: ''
-        },
-        disabled: false, //  查询、重置按钮是否可操作
-        spinning: false,
-        simpleImage: Empty.PRESENTED_IMAGE_SIMPLE,
-        dataSource: [],
-        tableHeight: this.maxHeight,
-        cellStyleOption: {
-          bodyCellClass: ({ row, column, rowIndex }) => {
-              if (row.id.indexOf('promo-')>=0 && column.field === "no") {
-                  return "table-body-cell-no";
-              }
-          },
+        disableSelectedRowKeys: this.disableSelectedRowKeys,
+        selectedRowKeys: this.selectedRowKeys,
+        // 行选择改变事件
+        selectedRowChange: ({ row, isSelected, selectedRowKeys }) => {
+          this.selectedRowChange({ row, isSelected, selectedRowKeys })
         },
-        columnWidthResizeOption: {
-            // default false
-            enable: true,
-            // column resize min width
-            minWidth: 50
-        },
-        cellSpanOption: {
-            bodyCellSpan: this.bodyCellSpan,
-        },
-        showEmpty: false,
-        showTableHead: true,
-        disableSelectedRowKeys: [],
-        selectedRowKeys: [],
-        detailData: null,
-        activeList: []
+        // 全选改变事件
+        selectedAllChange: ({ isSelected, selectedRowKeys }) => {
+          this.selectedAllChange({ isSelected, selectedRowKeys })
+        }
       }
     },
-    computed: {
-      checkboxOption () {
-        return {
-            disableSelectedRowKeys: this.disableSelectedRowKeys,
-            selectedRowKeys: this.selectedRowKeys,
-            // 行选择改变事件
-            selectedRowChange: ({ row, isSelected, selectedRowKeys }) => {
-              this.selectedRowChange({ row, isSelected, selectedRowKeys })
-            },
-            // 全选改变事件
-            selectedAllChange: ({ isSelected, selectedRowKeys }) => {
-              this.selectedAllChange({ isSelected, selectedRowKeys })
-            },
+    columns () {
+      const _this = this
+      // 价格
+      const priceFormat = function (data) {
+        return _this.toThousands(data) || '--'
+      }
+      // 数字
+      const numsFormat = function (data) {
+        return data || data == 0 ? data : '--'
+      }
+      // 单号
+      const codeFormat = function (record, data, h) {
+        let ftext = ''
+        let fcolor = ''
+        if (record.promotionFlag == 'GIFT') {
+          ftext = '促'
+          fcolor = '#52c41a'
         }
-      },
-      columns () {
-        const _this = this
-        const priceFormat = function(data){
-          return _this.toThousands(data) || '--'
+        if (record.promotionFlag == 'GATE') {
+          ftext = '槛'
+          fcolor = '#108ee9'
         }
-        const numsFormat = function(data){
-          return data || data == 0 ? data : '--'
+
+        return (
+          <div>
+            <span style="padding-right: 15px;">{data}</span>
+            {ftext ? (<a-badge count={ftext} number-style={{ backgroundColor: fcolor, zoom: '80%' }}></a-badge>) : ''}
+            {Number(record.stockQty || 0) < Number(record.unpushedQty || 0) ? (<a-badge count="缺" number-style={{ zoom: '80%' }}></a-badge>) : ''}
+          </div>
+        )
+      }
+      // 输入框
+      const inputFormat = function (record, data, h) {
+        if (record.surplusQty > 0) {
+          return (
+            <div>
+              <a-input-number
+                id={'dispatch-qty-' + record.productSn}
+                size="small"
+                value={record.qty}
+                onChange={e => record.qty = e}
+                onBlur={e => _this.cancelNumsChange(e, record)}
+                precision={0}
+                min={1}
+                max={record.surplusQty}
+                style="width: 100%;"
+                placeholder="请输入" />
+            </div>
+          )
         }
-        const codeFormat = function(record,data,h){
-          let ftext = ''
-          let fcolor = ''
-          if(record.promotionFlag == 'GIFT'){
-            ftext = '促'
-            fcolor = '#52c41a'
-          }
-          if(record.promotionFlag == 'GATE'){
-            ftext = '槛'
-            fcolor = '#108ee9'
-          }
-           
+        return '--'
+      }
+      // 操作按钮
+      const actionFormat = function (record, data, h) {
+        if (record.surplusQty > 0) {
           return (
-                  <div>
-                      <span style="padding-right: 15px;">{data}</span>
-                      {ftext?(<a-badge count={ftext} number-style={{ backgroundColor: fcolor, zoom:'80%' }}></a-badge>):''}
-                      {Number(record.stockQty||0) < Number(record.unpushedQty||0)?(<a-badge count="缺" number-style={{ zoom:'80%' }}></a-badge>):''}
-                  </div>
-              )
+            <div>
+              <a-button
+                id={'dispatch-delBtn-' + record.productSn}
+                size="small"
+                type="link"
+                class="button-error"
+                onClick={() => _this.handleDel(record)}
+              >删除</a-button>
+            </div>
+          )
         }
-        // 输入框
-        const inputFormat = function(record,data,h) {
-          if(record.surplusQty>0){
-            return (
-              <div>
-                <a-input-number
-                  size="small"
-                  value={record.qty}
-                  onChange={e => record.qty = e}
-                  onBlur={e => _this.cancelNumsChange(e,record)}
-                  precision={0}
-                  min={1}
-                  max={record.surplusQty}
-                  style="width: 100%;"
-                  placeholder="请输入" />
-              </div>
-            )
+        return '--'
+      }
+
+      const arr = [
+        { title: '', field: '', key: 'acheck', width: 60, type: 'checkbox', align: 'center' },
+        { title: '序号', field: 'no', key: 'a', width: 60, align: 'center', operationColumn: false },
+        { title: '产品编码', field: 'productCode', key: 'b', align: 'left', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return codeFormat(row, row[column.field], h) } },
+        { title: '出库仓库', field: 'warehouseName', key: 'e', width: 150, align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } },
+        { title: '待下推数量', field: 'surplusQty', key: 'o', width: 150, align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field]) } },
+        { title: '本次下推数', field: 'qty', key: 'r', width: 150, align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return inputFormat(row, row[column.field], h) } },
+        { title: '单位', field: 'productOrigUnit', width: 100, key: 'i', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } },
+        { title: '操作', field: 'action', width: 100, key: 's', align: 'center', fixed: 'right', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return actionFormat(row, row[column.field], h) } }
+      ]
+
+      if (this.detailData && this.detailData.promoFlag == 1) {
+        arr.splice(2, 0, { title: '活动规则', field: 'prompName', key: 'm', align: 'center', operationColumn: false })
+        arr.splice(3, 0, { title: '产品名称', field: 'productName', key: 'c', align: 'left', operationColumn: false, ellipsis: { showTitle: true }, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } })
+      } else {
+        arr.splice(2, 0, { title: '产品名称', field: 'productName', key: 'c', align: 'left', operationColumn: false, ellipsis: { showTitle: true }, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } })
+      }
+
+      return arr
+    }
+  },
+  methods: {
+    // 合并活动分类单元格
+    bodyCellSpan ({ row, column, rowIndex }) {
+      if (row.id.indexOf('promo-') >= 0) {
+        if (column.field == 'no') {
+          return {
+            rowspan: 1,
+            colspan: 17
           }
-          return '--'
-        }
-        // 操作按钮
-        const actionFormat = function(record,data,h) {
-          if(record.surplusQty>0){
-            return (
-              <div>
-                 <a-button
-                  size="small"
-                  type="link"
-                  class="button-error"
-                  onClick={()=>_this.handleDel(record)}
-                  >删除</a-button>
-              </div>
-            )
+        } else {
+          return {
+            rowspan: 0,
+            colspan: 0
           }
-          return '--'
         }
-
-        let arr= [
-              { title: "", field: "", key: "acheck", width: 60, type: "checkbox", align: "center" },
-              { title: '序号', field: 'no',key: "a", width: 60, align: 'center', operationColumn: false },
-              { title: '产品编码', field: 'productCode',key: "b", align: 'left',operationColumn: false,renderBodyCell: ({ row, column, rowIndex }, h) => { return codeFormat(row,row[column.field],h)} },
-              { title: '出库仓库', field: 'warehouseName',key: "e",width: 150, align: 'center',operationColumn: false,renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'}},
-              { title: '待下推数量', field: 'surplusQty', key: "o",width: 150, align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} },
-              { title: '本次下推数', field: 'qty', key: "r",width: 150, align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return inputFormat(row,row[column.field],h)} },
-              { title: '单位', field: 'productOrigUnit',width: 100,key: "i", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'}},
-              { title: '操作', field: 'action', width: 100, key: "s", align: 'center',fixed: 'right',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return actionFormat(row,row[column.field],h)} }
-          ]
-        
-        if(this.detailData && this.detailData.promoFlag==1){
-          arr.splice(2,0,{ title: '活动规则', field: 'prompName',key: "m", align: 'center',operationColumn: false },)
-          arr.splice(3,0,{ title: '产品名称', field: 'productName',key: "c", align: 'left',operationColumn: false , ellipsis: { showTitle: true },renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'}})
-        }else{
-          arr.splice(2,0,{ title: '产品名称', field: 'productName',key: "c", align: 'left',operationColumn: false , ellipsis: { showTitle: true },renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'}})
-        }
-
-        return arr
       }
     },
-    methods: {
-      // 合并活动分类单元格
-      bodyCellSpan({ row, column, rowIndex }) {
-        if (row.id.indexOf('promo-')>=0) {
-          if(column.field=='no'){
-            return {
-                      rowspan: 1,
-                      colspan: 17,
-                  };
-          }else{
-            return {
-                  rowspan: 0,
-                  colspan: 0,
-              }
+    // 选择单元格
+    selectedRowChange ({ row, isSelected, selectedRowKeys }) {
+      this.selectedRowKeys = selectedRowKeys
+    },
+    // 全选行
+    selectedAllChange ({ isSelected, selectedRowKeys }) {
+      this.selectedRowKeys = selectedRowKeys
+    },
+    // 数据查询
+    async searchTable () {
+      this.selectedRowKeys = []
+      this.disableSelectedRowKeys = []
+      this.dataSource = []
+      this.disabled = true
+      this.spinning = true
+      const params = this.productForm
+      // 带下推产品
+      const listData = await waitDispatchDetailAllList(params).then(res => res.data)
+      this.dataSource = listData
+
+      // 格式化数据
+      let f = 0
+      this.dataSource.map((item, i) => {
+        if (item.id.indexOf('promo-') >= 0) { f = f - 1 }
+        item.no = i + 1 + f
+        const productCode = (item.productEntity && item.productEntity.code) || (item.dealerProductEntity && item.dealerProductEntity.code)
+        const productName = (item.productEntity && item.productEntity.name) || (item.dealerProductEntity && item.dealerProductEntity.name)
+        const productOrigCode = (item.productEntity && item.productEntity.origCode) || (item.dealerProductEntity && item.dealerProductEntity.origCode)
+        const productOrigUnit = (item.productEntity && item.productEntity.unit) || (item.dealerProductEntity && item.dealerProductEntity.unit)
+        const warehouseName = item.dispatchBill && item.dispatchBill.warehouseName || ''
+        const prompName = item.promotionRule ? (item.promotionRule.promotion && item.promotionRule.promotion.description) + '(' + item.promotionRule.description + ')' : '--'
+        item.productCode = productCode || '--'
+        item.productName = productName || '--'
+        item.productOrigCode = productOrigCode == ' ' ? '--' : productOrigCode
+        item.productOrigUnit = productOrigUnit || '--'
+        item.warehouseName = warehouseName || '--'
+        item.qtyBackups = item.qty
+        item.prompName = prompName || '--'
+      })
+      this.showEmpty = this.dataSource.length <= 0
+      this.tableHeight = (this.showEmpty ? 300 : this.maxHeight) + 'px'
+      this.spinning = false
+      this.disabled = false
+    },
+    //  重置
+    resetSearchForm () {
+      this.dataSource = []
+      this.clearSelectTable()
+      this.searchTable()
+    },
+    // 页面初始化
+    pageInit (productForm, detailData, activeList) {
+      this.productForm = Object.assign(this.productForm, productForm)
+      this.detailData = detailData
+      this.activeList = activeList
+      // 查询列表
+      this.resetSearchForm()
+    },
+    // 清空选项
+    clearSelectTable () {
+      this.selectedRowKeys = []
+    },
+    // 取消数量修改
+    cancelNumsChange (e, record) {
+      const _this = this
+      const val = e.target.value
+      if (val && val != record.qtyBackups && val <= record.surplusQty) {
+        _this.spinning = true
+        updateQty({
+          dispatchBillDetailSn: record.dispatchBillDetailSn,
+          qty: record.qty,
+          salesBillSn: _this.detailData.salesBillSn,
+          dispatchBillSn: _this.productForm.dispatchBillSn
+        }).then(res => {
+          if (res.status == 200) {
+            _this.$message.success(res.message)
+            _this.spinning = false
+            _this.$emit('refashTable', true)
+          } else {
+            record.qty = record.qtyBackups
+            _this.spinning = false
           }
+        })
+      } else {
+        record.qty = record.qtyBackups
+      }
+    },
+    // 删除产品
+    handleDel (row) {
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '确认要删除吗?',
+        centered: true,
+        closable: true,
+        onOk () {
+          _this.deleteFun(row, 0)
         }
-      },
-      // 选择单元格
-      selectedRowChange({ row, isSelected, selectedRowKeys }){
-        // console.log(row, isSelected, selectedRowKeys);
-        this.selectedRowKeys = selectedRowKeys;
-      },
-      // 全选行
-      selectedAllChange({ isSelected, selectedRowKeys }){
-        // console.log(isSelected, selectedRowKeys);
-        this.selectedRowKeys = selectedRowKeys;
-      },
-      async searchTable(){
-          this.selectedRowKeys = []
-          this.disableSelectedRowKeys = []
-          this.dataSource = []
-          this.disabled = true
-          this.spinning = true
-          const params = this.productForm
-          // 带下推产品
-          const listData = await waitDispatchDetailAllList(params).then(res => res.data)
-          console.log(listData)
-          this.dataSource = listData
-  
-          // 格式化数据
-          let f = 0
-          this.dataSource.map((item,i) => {
-            if(item.id.indexOf('promo-')>=0){f = f - 1}
-            item.no = i + 1 + f
-            const productCode = (item.productEntity && item.productEntity.code) || (item.dealerProductEntity && item.dealerProductEntity.code)
-            const productName = (item.productEntity && item.productEntity.name) || (item.dealerProductEntity && item.dealerProductEntity.name)
-            const productOrigCode = (item.productEntity && item.productEntity.origCode) || (item.dealerProductEntity && item.dealerProductEntity.origCode)
-            const productOrigUnit = (item.productEntity && item.productEntity.unit) || (item.dealerProductEntity && item.dealerProductEntity.unit)
-            const warehouseName = item.dispatchBill && item.dispatchBill.warehouseName || ''
-            const prompName = item.promotionRule ? (item.promotionRule.promotion && item.promotionRule.promotion.description) + '('+item.promotionRule.description+')' : '--'
-            item.productCode = productCode || '--'
-            item.productName = productName || '--'
-            item.productOrigCode = productOrigCode == ' ' ? '--' : productOrigCode
-            item.productOrigUnit = productOrigUnit || '--'
-            item.warehouseName = warehouseName || '--'
-            item.qtyBackups = item.qty
-            item.prompName = prompName || '--'
-          })
-          this.showEmpty = this.dataSource.length <= 0
-          this.tableHeight = (this.showEmpty ? 300 : this.maxHeight) + 'px'
-          this.spinning = false
-          this.disabled = false
-      },
-      //  重置
-      resetSearchForm () {
-        this.dataSource = []
-        this.clearSelectTable()
-        this.searchTable()
-      },
-      pageInit (productForm, detailData, activeList) {
-        this.productForm = Object.assign(this.productForm,productForm)
-        this.detailData = detailData
-        this.activeList = activeList
-        // 获取活动列表
-        this.resetSearchForm()
-      },
-      // 清空选项
-      clearSelectTable () {
-         this.selectedRowKeys = []
-      },
-      // 已选产品  blur
-      cancelNumsChange (e, record) {
-        const _this = this
-        const val = e.target.value
-        if (val && val != record.qtyBackups && val<=record.surplusQty) {
-          _this.spinning = true
-          updateQty({
-            dispatchBillDetailSn: record.dispatchBillDetailSn,
-            qty: record.qty,
-            salesBillSn: _this.detailData.salesBillSn,
-            dispatchBillSn: _this.productForm.dispatchBillSn
-          }).then(res => {
-            if (res.status == 200) {
-              _this.$message.success(res.message)
-              _this.spinning = false
-              _this.$emit('refashTable', true)
-            } else {
-              record.qty = record.qtyBackups
-              _this.spinning = false
-            }
-          })
+      })
+    },
+    // 删除接口
+    deleteFun (row, type) {
+      const _this = this
+      _this.spinning = true
+      deleteBatch({
+        dispatchBillSn: this.productForm.dispatchBillSn,
+        dispatchBillDetailList: type == 0 ? [row.dispatchBillDetailSn] : row
+      }).then(res => {
+        if (res.status == 200) {
+          _this.$emit('refashTable', true)
+          _this.$message.success(res.message)
+          _this.spinning = false
         } else {
-          record.qty = record.qtyBackups
+          _this.spinning = false
         }
-      },
-       // 删除产品
-        handleDel (row) {
-          const _this = this
-          this.$confirm({
-            title: '提示',
-            content: '确认要删除吗?',
-            centered: true,
-            closable: true,
-            onOk () {
-              _this.deleteFun(row, 0)
-            }
-          })
-        },
-        // 移除操作
-        deleteFun (row, type) {
-          const _this = this
-          _this.spinning = true
-          deleteBatch({
-            dispatchBillSn: this.productForm.dispatchBillSn,
-            dispatchBillDetailList : type == 0 ? [row.dispatchBillDetailSn] : row
-          }).then(res => {
-            if (res.status == 200) {
-              _this.$emit('refashTable', true)
-              _this.$message.success(res.message)
-              _this.spinning = false
-            } else {
-              _this.spinning = false
-            }
-          })
-        },
-        // 批量删除
-        delSalerDetailAll () {
-          const _this = this
-          const chooseList = this.selectedRowKeys
-          if (chooseList.length == 0) {
-            _this.$message.warning('请选择待下推产品!')
-            return
-          }
-          const chooseRow = this.dataSource.filter(item => chooseList.includes(item.id) && item.id.indexOf('promo-')<0)
-          const obj = []
-          chooseRow && chooseRow.map(item => {
-            obj.push(item.dispatchBillDetailSn)
-          })
+      })
+    },
+    // 批量删除
+    delSalerDetailAll () {
+      const _this = this
+      const chooseList = this.selectedRowKeys
+      if (chooseList.length == 0) {
+        _this.$message.warning('请选择待下推产品!')
+        return
+      }
+      const chooseRow = this.dataSource.filter(item => chooseList.includes(item.id) && item.id.indexOf('promo-') < 0)
+      const obj = []
+      chooseRow && chooseRow.map(item => {
+        obj.push(item.dispatchBillDetailSn)
+      })
 
-          this.$confirm({
-            title: '提示',
-            content: '确认要批量删除吗?',
-            centered: true,
-            closable: true,
-            onOk () {
-              _this.deleteFun(obj, 1)
-            }
-          })
-        },
+      this.$confirm({
+        title: '提示',
+        content: '确认要批量删除吗?',
+        centered: true,
+        closable: true,
+        onOk () {
+          _this.deleteFun(obj, 1)
+        }
+      })
     }
   }
-  </script>
+}
+</script>
   <style lang="less">
   .empty-data{
         color: #999;
@@ -370,11 +374,11 @@
         background: #f3f8fa;
       }
     }
-    .ve-table .ve-table-container .ve-table-content-wrapper table.ve-table-content tbody.ve-table-body tr.ve-table-body-tr td.table-body-cell-no, 
+    .ve-table .ve-table-container .ve-table-content-wrapper table.ve-table-content tbody.ve-table-body tr.ve-table-body-tr td.table-body-cell-no,
     .ve-table .ve-table-container .ve-table-content-wrapper table.ve-table-content tbody.ve-table-body tr.ve-table-expand-tr td.table-body-cell-no{
       padding: 0;
-    } 
+    }
     .ve-table .ve-table-container .ve-table-content-wrapper{
       border-bottom: 1px solid #ddd;
     }
-  </style>
+  </style>

+ 28 - 26
src/views/salesManagement/waitDispatchNew/dsModal.vue

@@ -1,7 +1,7 @@
 <template>
   <a-modal
     centered
-    class="dealerAccountEdit-modal"
+    class="dsModal-modal"
     :footer="null"
     :maskClosable="false"
     :title="title"
@@ -12,7 +12,7 @@
     <div>
       <a-spin :spinning="spinning" tip="Loading...">
         <a-form-model
-          id="dealerAccountEdit-form"
+          id="dsModal-form"
           ref="ruleForm"
           :model="form"
           :rules="rules"
@@ -24,12 +24,12 @@
           </a-form-model-item>
           <div v-if="!receiverDisabled">
             <a-form-model-item label="收货客户名称" extra="如果收货客户和下单客户相同,则不需要选择收货客户名称">
-              <dealerSubareaScopeList ref="dealerSubareaScopeList" defValKey="buyerSn" @change="custChange" v-model="form.receiverSn" />
+              <dealerSubareaScopeList id="dsModal-receiverSn" ref="dealerSubareaScopeList" defValKey="buyerSn" @change="custChange" v-model="form.receiverSn" />
             </a-form-model-item>
             <a-form-model-item label="收货地址" prop="dealerRecevieAddressSn" v-if="form.receiverSn">
               <div style="display:flex;padding-top:6px;">
                 <div style="width:80%;flex-grow:1;line-height: 24px;">{{ chooseAddr }}</div>
-                <a-button size="small" type="link" @click="openAddrModal = true">{{ addressVal }} >></a-button>
+                <a-button id="dsModal-addressVal" size="small" type="link" @click="openAddrModal = true">{{ addressVal }} >></a-button>
               </div>
             </a-form-model-item>
           </div>
@@ -46,7 +46,7 @@
           </div>
           <a-form-model-item label="发货编号" prop="sendNo">
             <a-input
-              id="dealerAccountEdit-phone"
+              id="dsModal-sendNo"
               :maxLength="10"
               v-model.trim="form.sendNo"
               placeholder="请输入发货编号"
@@ -57,7 +57,7 @@
           </a-form-model-item>
           <a-form-model-item label="发货说明">
             <a-input
-              id="dealerAccountEdit-explainInfo"
+              id="dsModal-explainInfo"
               type="textarea"
               :maxLength="100"
               v-model.trim="form.explainInfo"
@@ -65,22 +65,22 @@
               allowClear />
           </a-form-model-item>
           <a-form-model-item label="备货打印" prop="printStatus">
-            <a-radio-group v-model="form.printStatus">
-              <a-radio value="NO_PRINT">
+            <a-radio-group v-model="form.printStatus" id="dsModal-printStatus">
+              <a-radio value="NO_PRINT" id="dsModal-printStatus-1">
                 允许打印
               </a-radio>
-              <a-radio value="UNABLE_PRINT">
+              <a-radio value="UNABLE_PRINT" id="dsModal-printStatus-2">
                 暂不打印
               </a-radio>
-              <a-radio value="CANCEL_PRINT">
+              <a-radio value="CANCEL_PRINT" id="dsModal-printStatus-3">
                 取消打印
               </a-radio>
             </a-radio-group>
           </a-form-model-item>
         </a-form-model>
         <div class="btn-cont">
-          <a-button id="dealerAccountEdit-back" @click="isShow = false">取消下推</a-button>
-          <a-button type="primary" id="dealerAccountEdit-save" @click="handleSave" style="margin-left: 15px;">确定下推</a-button>
+          <a-button id="dsModal-back" @click="isShow = false">取消下推</a-button>
+          <a-button type="primary" id="dsModal-save" @click="handleSave" style="margin-left: 15px;">确定下推</a-button>
         </div>
       </a-spin>
       <!-- 选择地址 -->
@@ -103,7 +103,7 @@ export default {
       type: Boolean,
       default: false
     },
-    title: {
+    title: { // 弹框标题
       type: String,
       default: '下推销售单'
     }
@@ -117,13 +117,13 @@ export default {
         wrapperCol: { span: 18 }
       },
       form: {
-        sendNo: '',
-        printStatus: undefined,
-        buyerName: '',
-        receiverSn: '',
-        receiverName: '',
+        sendNo: '', // 发货编号
+        printStatus: undefined, // 备货打印
+        buyerName: '', // 客户名称
+        receiverSn: '', // 收货客户sn
+        receiverName: '', // 收货客户名称
         dealerRecevieAddressSn: '', // 地址sn
-        explainInfo: ''
+        explainInfo: '' // 备注
       },
       rules: {
         sendNo: [{ required: true, message: '请输入发货编号', trigger: 'change' }],
@@ -134,21 +134,23 @@ export default {
       addressVal: '选择地址', //  选择地址/更换地址
       chooseAddr: '', //  当前已选地址信息
       openAddrModal: false, // 选择地址弹框是否显示
-      addressId: undefined,
-      receiverDisabled: false
+      addressId: undefined, // 地址id
+      receiverDisabled: false // 是否选择收货客户名称
     }
   },
   methods: {
+    // 设置发货编号
     setSendNo (i) {
       this.form.sendNo = i
       this.$refs.ruleForm.validateField('sendNo')
     },
-    // 客户 change
+    // 选择收货客户名称
     custChange (val) {
       if (val && val.key) {
         this.form.receiverSn = val.key || undefined
         this.form.receiverName = val.name || ''
         this.$refs.ruleForm.clearValidate()
+        // 获取默认地址
         this.getDefaultAddress()
       } else {
         this.form.receiverSn = undefined
@@ -170,6 +172,7 @@ export default {
         }
       })
     },
+    // 选择地址
     verifyFun (id) {
       if (id == this.addressId) {
         this.chooseAddr = ''
@@ -177,7 +180,7 @@ export default {
         this.form.dealerRecevieAddressSn = ''
       }
     },
-    //  保存
+    //  确定下推
     handleSave () {
       const _this = this
       _this.$refs.ruleForm.validate(valid => {
@@ -191,9 +194,8 @@ export default {
         }
       })
     },
-    //  地址保存
+    // 保存地址
     handleOk (data) {
-      console.log(data, 'chooseAddr')
       this.chooseAddr = (data.consigneeName || '') + '(' + (data.consigneeTel || '-') + ')' + ' ' + (data.address || '')
       this.addressVal = '更换地址'
       this.form.dealerRecevieAddressSn = data.dealerRecevieAddressSn || ''
@@ -251,7 +253,7 @@ export default {
 </script>
 
 <style lang="less">
-  .dealerAccountEdit-modal{
+  .dsModal-modal{
     .ant-modal-body {
       padding: 40px 40px 24px;
     }

+ 27 - 35
src/views/salesManagement/waitDispatchNew/edit.vue

@@ -15,8 +15,8 @@
           ref="partQuery"
           :newLoading="isInster"
           @cancelProduct="cancelProduct"
-          @cancelAll = "cancelAll"
-          @convertPromoGifts = "convertPromoGifts"
+          @cancelAll="cancelAll"
+          @convertPromoGifts="convertPromoGifts"
           @addProduct="insterProduct"></queryPart>
       </a-card>
       <a-card size="small" :bordered="false" class="waitDispatch-cont">
@@ -28,6 +28,7 @@
 
         <!-- 已选配件列表 -->
         <detailProductList ref="waitProduct" @refashTable="refashTable">
+          <!-- 统计数据 -->
           <template slot="total">
             本次下推款数:<strong>{{ totalData&&(totalData.totalCategory || totalData.totalCategory==0) ? totalData.totalCategory : '--' }}</strong>;
             本次下推数量:<strong>{{ totalData&&(totalData.totalQty || totalData.totalQty==0) ? totalData.totalQty : '--' }}</strong>;
@@ -44,7 +45,7 @@
         class="button-primary"
         @click="handleDispatch()"
         :loading="loading"
-        id="productInfoList-handleSubmit">下推</a-button>
+        id="waitDispatch-handleSubmit">下推</a-button>
     </div>
     <!-- 下推 -->
     <dsModal ref="dsModal" :openModal="showDsModal" @close="showDsModal=false" @ok="handleSubmit" />
@@ -57,6 +58,7 @@ import { VSelect } from '@/components'
 import queryPart from './queryPart.vue'
 import detailProductList from './detailProductList.vue'
 import dsModal from './dsModal.vue'
+// 接口
 import { salesDetailBySn } from '@/api/salesNew'
 import { insertBatchOfWaitDispatch, salesDetailUpdateCancelQty, salesDetailCancleOfAll, batchTransferOfPurchaseAmount } from '@/api/salesDetailNew'
 import { pushDown } from '@/api/waitDispatchDetail'
@@ -68,7 +70,7 @@ export default {
   components: { detailProductList, VSelect, queryPart, dsModal },
   data () {
     return {
-      showDsModal: false,
+      showDsModal: false, // 下推弹框
       spinning: false,
       salesBillSn: null, // 销售单sn
       disabled: false, //  查询、重置按钮是否可操作
@@ -77,12 +79,16 @@ export default {
       loading: false, // 是否下推中
       detailData: { discountAmount: 0, id: null, salesBillSn: '' }, // 订单基础数据
       productForm: {
-        dispatchBillSn: ''
+        dispatchBillSn: '' // 下推单sn
       },
-      totalData: null
+      totalData: null // 统计数据
     }
   },
   methods: {
+    //  返回
+    handleBack () {
+      this.$router.push({ name: 'salesQueryNewList', query: { closeLastOldTab: true } })
+    },
     // 统计查询
     getTotalData (flag) {
       findBySalesBillSn({ salesBillSn: this.$route.params.salesBillSn }).then(res => {
@@ -91,9 +97,9 @@ export default {
           if (res.data && Object.keys(res.data).length > 0) {
             this.productForm.dispatchBillSn = res.data.dispatchBillSn
             const _this = this
-            if(flag){
+            if (flag) {
               _this.$refs.waitProduct.pageInit(this.productForm, this.detailData, this.$refs.partQuery.activeList)
-            }else{
+            } else {
               _this.$refs.waitProduct.resetSearchForm()
             }
           }
@@ -102,10 +108,6 @@ export default {
         }
       })
     },
-    //  返回
-    handleBack () {
-      this.$router.push({ name: 'salesQueryNewList', query: { closeLastOldTab: true } })
-    },
     // 添加产品
     insterProduct (list) {
       // 防止多次添加产品
@@ -133,16 +135,16 @@ export default {
       })
     },
     // 整单取消
-    cancelAll(){
-      salesDetailCancleOfAll({salesBillSn: this.salesBillSn}).then(res=>{
-        if(res.status == 200){
+    cancelAll () {
+      salesDetailCancleOfAll({ salesBillSn: this.salesBillSn }).then(res => {
+        if (res.status == 200) {
           this.handleBack()
           this.$message.success(res.message)
         }
       })
     },
     // 批量转采购额
-    convertPromoGifts(list){
+    convertPromoGifts (list) {
       this.$message.loading('正在批量转采购额...', 1)
       this.isInster = true
       this.spinning = true
@@ -180,9 +182,10 @@ export default {
         this.isInster = false
       })
     },
-    refashTable(flag){
+    // 刷新表格
+    refashTable (flag) {
       this.getTotalData()
-      if(flag){
+      if (flag) {
         this.getOrderDetail(false)
       }
     },
@@ -191,9 +194,11 @@ export default {
       salesDetailBySn({ salesBillSn: this.salesBillSn }).then(res => {
         if (res.status == 200) {
           this.detailData = res.data
-          if(flag){
+          if (flag) {
+            // 初始化表格
             this.$refs.partQuery.pageInit(this.salesBillSn, this.detailData)
-          }else{
+          } else {
+            // 刷新表格
             this.$refs.partQuery.resetSearchForm(this.detailData)
           }
         }
@@ -203,6 +208,7 @@ export default {
     handleDispatch () {
       const dataSource = this.$refs.waitProduct.dataSource
       if (dataSource.length) {
+        // 打开下推弹框
         this.showDsModal = true
         this.detailData.dispatchBillCount = this.totalData.dispatchBillCount
         this.detailData.receiverName = this.totalData.receiverName ? this.totalData.receiverName : ''
@@ -230,21 +236,7 @@ export default {
         this.spinning = false
       })
     },
-    // 一键下推
-    oneDispatch () {
-      this.isInster = true
-      this.spinning = true
-      salesDetailDispatchByOneKey({ salesBillSn: this.$route.params.salesBillSn }).then(res => {
-        if (res.status == 200) {
-          this.resetSearchForm()
-          this.$refs.partQuery.resetCurForm()
-          this.spinning = false
-        } else {
-          this.spinning = false
-        }
-        this.isInster = false
-      })
-    },
+    // 页面初始化
     pageInit () {
       this.$refs.partQuery.clearSelectTable()
       this.salesBillSn = this.$route.params.salesBillSn

+ 59 - 11
src/views/salesManagement/waitDispatchNew/queryPart.vue

@@ -103,7 +103,13 @@
           <a-icon style="font-size: 14px;" type="question-circle" />
         </a-tooltip>
         <span style="margin-left: 10px;" v-if="selectedRowKeys.length">已选 {{ selectedRowKeys.length }} 项</span>
-        <a-button @click="showPurchaseModal" type="primary" style="margin-left: 15px" class="button-info" id="dispatch-updateStock">整单转采购单</a-button>
+        <a-button
+          @click="confirPurchaseModal"
+          :loading="loading"
+          type="primary"
+          style="margin-left: 15px"
+          class="button-info"
+          id="dispatch-updateStock">整单转采购单</a-button>
       </div>
       <div style="padding-left: 20px;">
         总销售数量:<strong>{{ detailData&&(detailData.totalQty || detailData.totalQty==0) ? detailData.totalQty : '--' }}</strong>;
@@ -142,7 +148,7 @@
       <!-- 活动规则详情 -->
       <detailModal :openModal="openDetailModal" :itemSn="detailSn" @close="closeDetailModal"></detailModal>
       <!-- 转采购单 -->
-      <toPurchaseModal :openModal="openPurchaseModal" ref="purchaseModal"></toPurchaseModal>
+      <toPurchaseModal :openModal="openPurchaseModal" @ok="showLockStockQty = true" @close="openPurchaseModal=false" ref="purchaseModal"></toPurchaseModal>
     </a-spin>
 
   </div>
@@ -150,13 +156,15 @@
 
 <script>
 import { commonMixin } from '@/utils/mixin'
-import { salesPromoQueryList } from '@/api/salesNew'
+import { STable, VSelect } from '@/components'
+import { Empty } from 'ant-design-vue'
 import detailModal from '@/views/promotionRulesManagement/dealerPromotions/detailModal.vue'
 import toPurchaseModal from './toPurchaseModal'
-import { Empty } from 'ant-design-vue'
-import { salesDetailAllList, salesPromoDetailCount, salesDetaiCount } from '@/api/salesDetailNew'
-import { STable, VSelect } from '@/components'
 import chooseWarehouse from '@/views/common/chooseWarehouse'
+// 接口
+import { salesDetailAllList, salesPromoDetailCount, salesDetaiCount } from '@/api/salesDetailNew'
+import { salesPromoQueryList, getCreatePurchaseFlag } from '@/api/salesNew'
+
 export default {
   name: 'QueryPart',
   mixins: [commonMixin],
@@ -177,6 +185,7 @@ export default {
   },
   data () {
     return {
+      loading: false,
       advanced: true, // 高级搜索 展开/关闭
       openDetailModal: false, // 活动规则详情弹框
       openPurchaseModal: false, // 转采购单弹框
@@ -210,12 +219,12 @@ export default {
           }
         }
       },
+      // 可拖曳调整列宽
       columnWidthResizeOption: {
-        // default false
         enable: true,
-        // column resize min width
         minWidth: 50
       },
+      // 自定义单元格
       cellSpanOption: {
         bodyCellSpan: this.bodyCellSpan
       },
@@ -224,7 +233,8 @@ export default {
       disableSelectedRowKeys: [], // 禁用数据
       selectedRowKeys: [], // 已选数据
       colspanNums: 16, // 列合并数量
-      hasNormalProduct: false // 是否有正常产品
+      hasNormalProduct: false, // 是否有正常产品
+      showLockStockQty: false // 是否显示锁定库存列
     }
   },
   computed: {
@@ -416,7 +426,12 @@ export default {
       this.colspanNums = this.colspanNums + 8
       arr = arr.concat([
         { title: '单位', field: 'productOrigUnit', key: 'i', width: 80, align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } },
-        { title: '可用库存', field: 'stockQty', width: 80, key: 'j', align: 'center', fixed: 'right', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field]) } },
+        { title: '可用库存', field: 'stockQty', width: 80, key: 'j', align: 'center', fixed: 'right', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field]) } }
+      ])
+      if (this.showLockStockQty) {
+        arr.push({ title: '锁定库存', field: 'lockStockQty', width: 80, key: 'jk', align: 'center', fixed: 'right', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field]) } })
+      }
+      arr = arr.concat([
         { title: '销售数量', field: 'qty', width: 80, key: 'k', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field]) } },
         { title: '已取消', field: 'cancelQty', width: 80, key: 'o', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field]) } },
         { title: '已下推', field: 'pushedQty', width: 80, key: 'p', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field]) } },
@@ -635,6 +650,8 @@ export default {
       this.detailData = detailData
       // 获取活动列表
       this.getActiveList()
+      // 是否转过采购单
+      this.hasCreatePurchaseFlag()
     },
     // 清空选项
     clearSelectTable () {
@@ -758,10 +775,41 @@ export default {
 
       this.$emit('cancelProduct', obj)
     },
-    // 打开整单转采购单
+    // 确认整单转采购单
+    confirPurchaseModal () {
+      this.loading = true
+      getCreatePurchaseFlag({ salesBillSn: this.salesBillSn }).then(res => {
+        if (res.status == '200') {
+          // 没有转过
+          if (res.data == 0) {
+            this.showPurchaseModal()
+          } else {
+            // 转过,弹确认框
+            const _this = this
+            this.$confirm({
+              title: '提示',
+              content: '已转过采购单,是否再次转单?',
+              centered: true,
+              closable: true,
+              onOk () {
+                _this.showPurchaseModal()
+              }
+            })
+          }
+        }
+        this.loading = false
+      })
+    },
+    // 打开转采购单弹框
     showPurchaseModal () {
       this.openPurchaseModal = true
       this.$refs.purchaseModal.setDetail(this.detailData)
+    },
+    // 是否转过采购单
+    hasCreatePurchaseFlag () {
+      getCreatePurchaseFlag({ salesBillSn: this.salesBillSn }).then(res => {
+        this.showLockStockQty = res.data && res.data == 1
+      })
     }
   }
 }

+ 33 - 27
src/views/salesManagement/waitDispatchNew/toPurchaseModal.vue

@@ -25,19 +25,18 @@
           <a-form-model-item label="客户名称">
             <span>{{ detailData ? detailData.buyerName : '--' }}</span>
           </a-form-model-item>
-          <a-form-model-item label="销售类型" prop="salesType">
-            <a-radio-group v-model="form.salesType" id="purchase-salesType">
-              <a-radio value="0">
-                平台购
-              </a-radio>
-              <a-radio value="1">
-                直购
-              </a-radio>
-            </a-radio-group>
+          <a-form-model-item label="销售类型" prop="purchaseFlowType">
+            <v-select
+              v-model="form.purchaseFlowType"
+              showType="radio"
+              id="purchase-salesType"
+              code="PURCHASE_FLOW_TYPE"
+              placeholder="请选择销售类型"
+              allowClear></v-select>
           </a-form-model-item>
-          <a-form-model-item label="直采分类" prop="directClass">
-            <a-radio-group v-model="form.directClass" id="purchase-directClass">
-              <a-radio value="1">
+          <a-form-model-item label="直采分类" prop="purchaseType">
+            <a-radio-group v-model="form.purchaseType" id="purchase-purchaseType">
+              <a-radio value="TIRE">
                 轮胎
               </a-radio>
             </a-radio-group>
@@ -47,7 +46,7 @@
               id="purchase-explainInfo"
               type="textarea"
               :maxLength="30"
-              v-model.trim="form.remark"
+              v-model.trim="form.bizRemark"
               placeholder="请输入备注(最多30字符)"
               allowClear />
           </a-form-model-item>
@@ -63,11 +62,12 @@
 
 <script>
 import { commonMixin } from '@/utils/mixin'
-import { dealerRecevieAddrQuery } from '@/api/dealerRecevieAddr'
+import { STable, VSelect } from '@/components'
+import { allCreatePurchase } from '@/api/salesNew'
 export default {
-  name: 'DsModal',
+  name: 'ToPurchaseModal',
   mixins: [commonMixin],
-  components: { },
+  components: { STable, VSelect },
   props: {
     openModal: { //  弹框显示状态
       type: Boolean,
@@ -87,14 +87,13 @@ export default {
         wrapperCol: { span: 18 }
       },
       form: {
-        salesNo: '',
-        salesType: undefined,
-        directClass: undefined,
-        remark: ''
+        purchaseFlowType: undefined,
+        purchaseType: 'TIRE',
+        bizRemark: ''
       },
       rules: {
-        salesType: [{ required: true, message: '请选择销售类型', trigger: 'change' }],
-        directClass: [{ required: true, message: '请选择直采分类', trigger: 'change' }]
+        purchaseFlowType: [{ required: true, message: '请选择销售类型', trigger: 'change' }],
+        purchaseType: [{ required: true, message: '请选择直采分类', trigger: 'change' }]
       },
       detailData: null //  详情数据
     }
@@ -106,8 +105,16 @@ export default {
       _this.$refs.ruleForm.validate(valid => {
         if (valid) {
           const formData = JSON.parse(JSON.stringify(_this.form))
-          _this.$emit('ok', formData)
-          _this.isShow = false
+          formData.salesBillSn = _this.detailData.salesBillSn
+          _this.spinning = true
+          allCreatePurchase(formData).then(res => {
+            if (res.status == '200') {
+              _this.isShow = false
+              _this.$message.success(res.message)
+              _this.$emit('ok')
+            }
+            _this.spinning = false
+          })
         } else {
           return false
         }
@@ -122,9 +129,8 @@ export default {
       this.detailData = null
       this.$refs.ruleForm.resetFields()
       this.form = {
-        salesNo: '',
-        salesType: undefined,
-        directClass: undefined,
+        purchaseFlowType: undefined,
+        purchaseType: 'TIRE',
         remark: ''
       }
     }

+ 2 - 3
src/views/setting/erpAllotSettings/list.vue

@@ -5,7 +5,7 @@
       <s-table
         class="sTable fixPagination"
         ref="table"
-        :style="{ height: tableHeight+70+'px'}"
+        :style="{ height: tableHeight+60+'px'}"
         size="small"
         :rowKey="(record) => record.id"
         :columns="columns"
@@ -102,8 +102,7 @@ export default {
       })
     },
     setTableH () {
-      const tableSearchH = this.$refs.tableSearch.offsetHeight
-      this.tableHeight = window.innerHeight - tableSearchH - 230
+      this.tableHeight = window.innerHeight - 180
     }
   },
   watch: {