chenrui 2 سال پیش
والد
کامیت
b00af3d6f6
3فایلهای تغییر یافته به همراه144 افزوده شده و 6 حذف شده
  1. 18 2
      src/api/sales.js
  2. 51 4
      src/views/salesManagement/salesQuery/edit.vue
  3. 75 0
      src/views/salesManagement/salesQuery/setPriceModal.vue

+ 18 - 2
src/api/sales.js

@@ -99,9 +99,9 @@ export const salesList = (params) => {
 //  销售 提交
 export const salesWriteSubmit = (params) => {
   return axios({
-    url: `/sales/submit/${params.salesBillSn}`,
+    url: '/sales/submit',
     data: params,
-    method: 'get'
+    method: 'post'
   })
 }
 //  财务收款 列表 分页
@@ -214,3 +214,19 @@ export const vinCodeParse = params => {
     responseType: 'blob'
   })
 }
+// 是否更新价格判断
+export const submitCheck = (params) => {
+  return axios({
+    url: '/sales/submitCheck',
+    method: 'post',
+    data: params
+  })
+}
+// 当前价格  提交
+export const updateBatch = (params) => {
+  return axios({
+    url: '/sales/detail/updateBatch',
+    method: 'post',
+    data: params
+  })
+}

+ 51 - 4
src/views/salesManagement/salesQuery/edit.vue

@@ -217,6 +217,8 @@
     <importGuideModal :openModal="openGuideModal" :params="{salesBillSn: $route.params.sn}" @close="closeGuideModel" @ok="hanldeOk" />
     <!-- 仓库设置 -->
     <setWarehouse :show="openWarehouseModal" @ok="chooseCustomOk" @cancel="openWarehouseModal=false"></setWarehouse>
+    <!-- 价格更新弹窗 -->
+    <setPriceModal :show="priceUpdateModal" @ok="updatePrice" @cancel="priceUpdateModal=false"></setPriceModal>
   </div>
 </template>
 
@@ -228,13 +230,14 @@ import queryPromotable from './queryPromotable.vue'
 import ChooseActive from './chooseActive.vue'
 import ImportGuideModal from './importGuideModal.vue'
 import setWarehouse from './setWarehouse.vue'
+import setPriceModal from './setPriceModal.vue'
 import chooseWarehouse from '@/views/common/chooseWarehouse'
-import { salesModify, salesDetailBySn, salesWriteSubmit, getPromoacActiveList, deleteAll } from '@/api/sales'
+import { salesModify, salesDetailBySn, salesWriteSubmit, getPromoacActiveList, deleteAll, submitCheck, updateBatch } from '@/api/sales'
 import { salesDetailStockList, salesDetailInsert, salesDetailUpdateQty, salesDetailDel, salesDetailBatchDel, salesDetailDelAll, addPromoGoods, salesBatchInsert } from '@/api/salesDetail'
 export default {
   name: 'SalesEdit',
   mixins: [commonMixin],
-  components: { STable, VSelect, queryPart, queryPromotable, ChooseActive, ImportGuideModal, chooseWarehouse, setWarehouse },
+  components: { STable, VSelect, queryPart, queryPromotable, ChooseActive, ImportGuideModal, chooseWarehouse, setWarehouse, setPriceModal },
   data () {
     return {
       spinning: false,
@@ -279,7 +282,9 @@ export default {
         productCode: '',
         productName: ''
       },
-      rowSelectionInfo: null
+      rowSelectionInfo: null,
+      priceUpdateModal: false, // 价格更新弹窗
+      updataData: undefined
     }
   },
   computed: {
@@ -534,8 +539,28 @@ export default {
     },
     // 提交销售单
     handleSubmit () {
+      // 先不提交,先判断是否有价格更新  (下级创建时判断)
+      if (this.detailData && this.detailData.salesBillSource && this.detailData.salesBillSource == 'PURCHASE') {
+        submitCheck({ salesBillSn: this.salesBillSn }).then(res => {
+          if (res.status == 200) {
+            if (res.data.length > 0) {
+              this.updataData = res.data
+              this.priceUpdateModal = true
+            } else {
+              const ajax_data = { salesBillSn: this.salesBillSn }
+              this.submitResult(ajax_data)
+            }
+          }
+        })
+      } else {
+        const ajax_data = { salesBillSn: this.salesBillSn }
+        this.submitResult(ajax_data)
+      }
+    },
+    // 提交
+    submitResult (data) {
       this.spinning = true
-      salesWriteSubmit({ salesBillSn: this.salesBillSn }).then(res => {
+      salesWriteSubmit(data).then(res => {
         if (res.status == 200) {
           this.handleBack()
           this.$message.success(res.message)
@@ -545,6 +570,27 @@ export default {
         }
       })
     },
+    // 选择价格类型  并更新
+    updatePrice (type) {
+      const _this = this
+      if (type == 0) {
+        const ajax_data = {
+          salesBillSn: _this.salesBillSn,
+          productPriceChangeFlag: type
+        }
+        _this.submitResult(ajax_data)
+      } else {
+        updateBatch(_this.updataData).then(res => {
+          if (res.status == 200) {
+            const ajax_data = {
+              salesBillSn: _this.salesBillSn,
+              productPriceChangeFlag: type
+            }
+            _this.submitResult(ajax_data)
+          }
+        })
+      }
+    },
     // 获取促销活动
     getPromoacActiveList () {
       const _this = this
@@ -558,6 +604,7 @@ export default {
         }
       })
     },
+
     // 选择促销品
     handleSelCx (row) {
       // this.nowData = row

+ 75 - 0
src/views/salesManagement/salesQuery/setPriceModal.vue

@@ -0,0 +1,75 @@
+<template>
+  <a-modal
+    v-model="opened"
+    title="提交"
+    centered
+    :maskClosable="false"
+    :confirmLoading="confirmLoading"
+    width="36%"
+    :footer="null"
+    @cancel="cancel"
+  >
+    <a-spin :spinning="spinning" tip="Loading...">
+      <div style="display:flex;align-items:center;justify-content:center;">
+        <a-icon type="warning" theme="twoTone" two-tone-color="#D9001b" style="font-size:60px;margin-right:30px;"/>
+        <div>
+          <div>销售单部分产品价格发生变更,请确认</div>
+          <a-radio-group v-model="priceVal">
+            <a-radio value="0" :style="radioStyle">
+              以之前价格为准
+            </a-radio>
+            <a-radio value="1" :style="radioStyle">
+              以当前价格为准
+            </a-radio>
+          </a-radio-group>
+        </div>
+      </div>
+      <div style="margin-top:30px;text-align:center;">
+        <a-button @click="cancel" style="margin-right: 15px" id="chooseCustom-btn-back">取消</a-button>
+        <a-button type="primary" :loading="confirmLoading" @click="handleSubmit" id="chooseCustom-btn-submit">确定</a-button>
+      </div>
+    </a-spin>
+  </a-modal>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+export default {
+  name: 'SetPriceModal',
+  mixins: [commonMixin],
+  props: {
+    show: [Boolean]
+  },
+  data () {
+    return {
+      opened: this.show,
+      spinning: false,
+      priceVal: undefined,
+      confirmLoading: false,
+      radioStyle: {
+        display: 'block',
+        height: '30px',
+        lineHeight: '30px'
+      }
+    }
+  },
+  methods: {
+    //  保存
+    handleSubmit () {
+      this.$emit('ok', this.priceVal)
+    },
+    cancel () {
+      this.opened = false
+      this.$emit('cancel')
+    }
+  },
+  watch: {
+    show (newValue, oldValue) {
+      this.opened = newValue
+      if (!newValue) {
+        this.priceVal = undefined
+      }
+    }
+  }
+}
+</script>