lilei 11 kuukautta sitten
vanhempi
commit
105f6922c6

+ 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}`

+ 52 - 6
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>
@@ -157,7 +163,7 @@ import toPurchaseModal from './toPurchaseModal'
 import chooseWarehouse from '@/views/common/chooseWarehouse'
 // 接口
 import { salesDetailAllList, salesPromoDetailCount, salesDetaiCount } from '@/api/salesDetailNew'
-import { salesPromoQueryList } from '@/api/salesNew'
+import { salesPromoQueryList, getCreatePurchaseFlag } from '@/api/salesNew'
 
 export default {
   name: 'QueryPart',
@@ -179,6 +185,7 @@ export default {
   },
   data () {
     return {
+      loading: false,
       advanced: true, // 高级搜索 展开/关闭
       openDetailModal: false, // 活动规则详情弹框
       openPurchaseModal: false, // 转采购单弹框
@@ -226,7 +233,8 @@ export default {
       disableSelectedRowKeys: [], // 禁用数据
       selectedRowKeys: [], // 已选数据
       colspanNums: 16, // 列合并数量
-      hasNormalProduct: false // 是否有正常产品
+      hasNormalProduct: false, // 是否有正常产品
+      showLockStockQty: false // 是否显示锁定库存列
     }
   },
   computed: {
@@ -418,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]) } },
@@ -637,6 +650,8 @@ export default {
       this.detailData = detailData
       // 获取活动列表
       this.getActiveList()
+      // 是否转过采购单
+      this.hasCreatePurchaseFlag()
     },
     // 清空选项
     clearSelectTable () {
@@ -760,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: ''
       }
     }