소스 검색

修改bug

chenrui 11 달 전
부모
커밋
aebd19d7e9

+ 46 - 4
src/views/salesManagement/salesQueryNew/detail.vue

@@ -182,7 +182,7 @@
         type="primary"
         id="salesDetail-edit1-btn"
         v-if="detailData&&detailData.salesBillSource == 'PURCHASE' && (detailData.billStatus == 'WAIT_AUDIT'||detailData.billStatus == 'HQ_CHANGE')&&$hasPermissions('B_salesEdit')"
-        @click="handleEdit()"
+        @click="handleChangeOrder()"
       >
         改单
       </a-button>
@@ -220,6 +220,8 @@
     <dsModal ref="dsModal" title="销售单一键审核" :openModal="showDsModal" @close="showDsModal=false" @ok="handleOnceAudit" />
     <!-- 缺货明细 -->
     <stockOutDetail :openModal="showStockOut" :detailData="detailData" :salesBillSn="$route.params.sn || bizSn" @close="showStockOut=false"></stockOutDetail>
+    <!-- 改单 -->
+    <tipModal ref="tipModal" :openModal="openTipModal" :dataList="sourceData" @close="openTipModal=false" @ok="openTipModalOk"></tipModal>
   </div>
 </template>
 
@@ -234,13 +236,14 @@ import dsModal from '@/views/salesManagement/waitDispatchNew/dsModal.vue'
 import stockOutDetail from './stockOutDetailModal.vue'
 import chooseWarehouse from '@/views/common/chooseWarehouse'
 import detailProductList from './comps/detailProductList.vue'
+import tipModal from './tipModal.vue'
 // 接口
-import { salesDetailBySn, salesDetailPrint, salesDetailExcel, salesDetailTypeExcel, salesWriteAuditPass, salesWriteAuditReject, salesWriteAuditPush, getThirdStockQty, salesPromoValidaSubmit } from '@/api/salesNew'
+import { salesDetailBySn, salesDetailPrint, salesDetailExcel, salesDetailTypeExcel, salesWriteAuditPass, salesWriteAuditReject, salesWriteAuditPush, getThirdStockQty, salesPromoValidaSubmit, changeBillCheckUpdatePrice, changeBillCheck } from '@/api/salesNew'
 
 export default {
   name: 'SalesDetailNew',
   mixins: [commonMixin],
-  components: { VSelect, printModal, auditModal, dsModal, stockOutDetail, chooseWarehouse, detailProductList },
+  components: { VSelect, printModal, auditModal, dsModal, stockOutDetail, chooseWarehouse, detailProductList, tipModal },
   props: {
     bizSn: { //  有值则为弹框,无值则为页面
       type: [Number, String],
@@ -265,7 +268,9 @@ export default {
       auditText: null, // 审核备注信息
       fromRouter: null, // 从那个页面打开当前页面
       warehouseSn: undefined, // 所在仓库
-      promoFlag: undefined // 产品类型
+      promoFlag: undefined, // 产品类型
+      openTipModal: false, // 改单弹窗
+      sourceData: undefined// 价格变动数据
     }
   },
   computed: {
@@ -313,6 +318,43 @@ export default {
       const row = this.detailData
       this.$router.push({ name: 'salesNewEdit', params: { sn: row.salesBillSn, wSn: row.warehouseSn } })
     },
+    // 改单
+    handleChangeOrder () {
+      const _this = this
+      const row = _this.detailData
+      changeBillCheck({ salesBillSn: row.salesBillSn }).then(res => {
+        let data
+        if (res.status == 200) {
+          data = res.data
+          if (data && data.length > 0) {
+            _this.sourceData = res.data
+            const obj = {
+              buyerName: row.buyerName,
+              salesBillNo: row.salesBillNo
+            }
+            _this.$refs.tipModal.getShowInfo(obj)
+            _this.openTipModal = true
+          } else {
+            _this.$router.push({ name: 'salesNewEdit', params: { sn: row.salesBillSn, wSn: row.warehouseSn } })
+          }
+        }
+      })
+    },
+    // 改单成功  关闭弹窗
+    openTipModalOk (ajaxData) {
+      const row = this.detailData
+      ajaxData.salesBillSn = row.salesBillSn
+      ajaxData.detailList = this.sourceData
+      changeBillCheckUpdatePrice(ajaxData).then(res => {
+        if (res.status == 200) {
+          this.$message.success(res.message)
+          this.openTipModal = false
+          this.$nextTick(() => {
+            this.$router.push({ name: 'salesNewEdit', params: { sn: row.salesBillSn, wSn: row.warehouseSn } })
+          })
+        }
+      })
+    },
     //  重置
     resetSearchForm () {
       this.warehouseSn = undefined

+ 35 - 5
src/views/salesManagement/salesQueryNew/list.vue

@@ -305,7 +305,7 @@
       <!-- 导出提示框 -->
       <reportModal :visible="showExport" @close="showExport=false"></reportModal>
       <!-- 改单 -->
-      <tipModal :openModal="openTipModal" @close="openTipModal=false" @ok="openTipModalOk"></tipModal>
+      <tipModal ref="tipModal" :openModal="openTipModal" :dataList="sourceData" @close="openTipModal=false" @ok="openTipModalOk"></tipModal>
     </a-card>
   </div>
 </template>
@@ -330,7 +330,7 @@ import chooseWarehouse from '@/views/common/chooseWarehouse'
 import customerService from '@/views/common/customerService'
 // 接口
 import { dispatchBatchPrintStatus, queryBySalesBillSn } from '@/api/dispatch'
-import { salesList, salesDel, salesCancle, salesCount, queryCreateBySalesBillSn, expenseAccountSave } from '@/api/salesNew'
+import { salesList, salesDel, salesCancle, salesCount, queryCreateBySalesBillSn, expenseAccountSave, changeBillCheckUpdatePrice, changeBillCheck } from '@/api/salesNew'
 import { salesDetailExport } from '@/api/salesBillReport'
 
 export default {
@@ -350,6 +350,7 @@ export default {
       expenseOption: false, // 已选转费用报销单状态
       tableHeight: 0, // 表格高度
       openTipModal: false, // 改单提示弹窗
+      sourceData: [], // 改单表格数据
       // 默认时间
       time: [
         moment(getDate.getThreeMonthDays().starttime, 'YYYY-MM-DD'),
@@ -578,10 +579,39 @@ export default {
     },
     // 改单
     handleChangeOrder (row) {
-      this.openTipModal = true
+      const _this = this
+      _this.tempSalesBillSn = row.salesBillSn
+      changeBillCheck({ salesBillSn: row.salesBillSn }).then(res => {
+        let data
+        if (res.status == 200) {
+          data = res.data
+          if (data && data.length > 0) {
+            _this.sourceData = res.data
+            const obj = {
+              buyerName: row.buyerName,
+              salesBillNo: row.salesBillNo
+            }
+            _this.$refs.tipModal.getShowInfo(obj)
+            _this.openTipModal = true
+          } else {
+            _this.$router.push({ name: 'salesNewEdit', params: { sn: row.salesBillSn } })
+          }
+        }
+      })
     },
-    openTipModalOk () {
-      this.openTipModal = false
+    // 改单成功  关闭弹窗
+    openTipModalOk (ajaxData) {
+      ajaxData.salesBillSn = this.tempSalesBillSn
+      ajaxData.detailList = this.sourceData
+      changeBillCheckUpdatePrice(ajaxData).then(res => {
+        if (res.status == 200) {
+          this.$message.success(res.message)
+          this.openTipModal = false
+          this.$nextTick(() => {
+            this.$router.push({ name: 'salesNewEdit', params: { sn: this.tempSalesBillSn } })
+          })
+        }
+      })
     },
     // 删除
     handleDel (row) {

+ 121 - 56
src/views/salesManagement/salesQueryNew/tipModal.vue

@@ -6,27 +6,65 @@
     class="sales-print-type-modal"
     v-model="isShow"
     @cancel="isShow=false"
-    :width="600">
-    <solt>提示:(销售单号: XS240717000014      客户名称:箭冠汽配武汉四新店)</solt>
+    :width="900">
+    <solt name="title" v-if="detailInfo"><div>提示:(销售单号:{{ detailInfo.salesBillNo }}      客户名称:{{ detailInfo.buyerName }})</div></solt>
+    <solt name="title" v-else>提示</solt>
     <a-spin :spinning="spinning" tip="Loading...">
       <div class="tipModal-content">
         <strong class="tipModal-tit">销售单以下产品价格发生变更,请确认</strong>
-        <s-table
-          class="sTable fixPagination"
+        <a-table
+          class="sTable"
           ref="table"
           size="small"
-          :rowKey="(record) => record.id"
+          :rowKey="(record) => record.allocateSn"
           :columns="columns"
-          :data="loadData"
-          :scroll="{ y: 500 }"
-          :showPagination="false"
-          :defaultLoadData="false"
+          :dataSource="dataList"
+          :scroll="{ y: 300 }"
+          :pagination="false"
           bordered>
-        </s-table>
+          <!-- 初始价 省  市  特约-->
+          <template slot="provincePriceOrig" slot-scope="text, record">
+            <span v-if="record.provincePriceOrig||record.provincePriceOrig==0">
+              <span :class="record.provincePriceOrig!=record.provincePrice?'redWord':''">{{ toThousands(record.provincePriceOrig) }}</span>
+            </span>
+            <span v-else>--</span>
+          </template>
+          <template slot="cityPriceOrig" slot-scope="text, record">
+            <span v-if="record.cityPriceOrig||record.cityPriceOrig==0">
+              <span :class="record.cityPriceOrig!=record.cityPrice?'redWord':''">{{ toThousands(record.cityPriceOrig) }}</span>
+            </span>
+            <span v-else>--</span>
+          </template>
+          <template slot="specialPriceOrig" slot-scope="text, record">
+            <span v-if="record.specialPriceOrig||record.specialPriceOrig==0">
+              <span :class="record.specialPriceOrig!=record.specialPrice?'redWord':''">{{ toThousands(record.specialPriceOrig) }}</span>
+            </span>
+            <span v-else>--</span>
+          </template>
+          <!-- 最新价  省  市  特约 -->
+          <template slot="provincePrice" slot-scope="text, record">
+            <span v-if="record.provincePrice||record.provincePrice==0">
+              <span :class="record.provincePrice!=record.provincePriceOrig?'redWord':''">{{ toThousands(record.provincePrice) }}</span>
+            </span>
+            <span v-else>--</span>
+          </template>
+          <template slot="cityPrice" slot-scope="text, record">
+            <span v-if="record.cityPrice||record.cityPrice==0">
+              <span :class="record.cityPrice!=record.cityPriceOrig?'redWord':''">{{ toThousands(record.cityPrice) }}</span>
+            </span>
+            <span v-else>--</span>
+          </template>
+          <template slot="specialPrice" slot-scope="text, record">
+            <span v-if="record.specialPrice||record.specialPrice==0">
+              <span :class="record.specialPrice!=record.specialPriceOrig?'redWord':''">{{ toThousands(record.specialPrice) }}</span>
+            </span>
+            <span v-else>--</span>
+          </template>
+        </a-table>
         <div>
           <a-radio-group v-model="priceVal">
             <a-radio :value="item.id" v-for="item in priceSelectList" :key="item.id">
-              {{ item.name }}
+              {{ item.nameWord }}
             </a-radio>
           </a-radio-group>
         </div>
@@ -41,18 +79,19 @@
 
 <script>
 import { commonMixin } from '@/utils/mixin'
-// 组件
-import { STable } from '@/components'
-// 接口
-import { salesDetailAddPromo } from '@/api/salesDetailNew'
 export default {
-  name: 'NewPromoModal',
+  name: 'TipModal',
   mixins: [commonMixin],
-  components: { STable },
   props: {
     openModal: { //  弹框显示状态
       type: Boolean,
       default: false
+    },
+    dataList: {
+      type: Array,
+      default: () => {
+        return []
+      }
     }
   },
   data () {
@@ -62,56 +101,78 @@ export default {
       spinning: false,
       newPromoSnList: [], // 新活动选项sn
       confirmLoading: false,
+      detailInfo: null,
+      sourceData: [],
       columns: [
-        { title: '产品编码', dataIndex: 'productCode', width: '33%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '初始价', dataIndex: 'product.name', width: '33%', align: 'left', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '最新价', dataIndex: 'product.origCode', width: '33%', align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
+        { title: '产品编码', dataIndex: 'productCode', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '价格级别', dataIndex: 'priceLevelDictValue', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '初始价',
+          children: [
+            {
+              title: '省级价',
+              align: 'right',
+              dataIndex: 'provincePriceOrig',
+              scopedSlots: { customRender: 'provincePriceOrig' }
+            },
+            {
+              title: '市级价',
+              align: 'right',
+              dataIndex: 'cityPriceOrig',
+              scopedSlots: { customRender: 'cityPriceOrig' }
+            },
+            {
+              title: '特约价',
+              dataIndex: 'specialPriceOrig',
+              align: 'right',
+              scopedSlots: { customRender: 'specialPriceOrig' }
+            }
+          ],
+          width: '30%' },
+        { title: '最新价',
+          children: [
+            {
+              title: '省级价',
+              dataIndex: 'provincePrice',
+              align: 'right',
+              scopedSlots: { customRender: 'provincePrice' }
+            },
+            {
+              title: '市级价',
+              dataIndex: 'cityPrice',
+              align: 'right',
+              scopedSlots: { customRender: 'cityPrice' }
+            },
+            {
+              title: '特约价',
+              dataIndex: 'specialPrice',
+              align: 'right',
+              scopedSlots: { customRender: 'specialPrice' }
+            }
+          ],
+          width: '30%' }
       ],
       priceSelectList: [{
-        id: 1,
-        name: '以【初始价】为准'
+        id: 0,
+        nameWord: '以【初始价】为准'
       }, {
-        id: 2,
-        name: '以【最新价】为准'
+        id: 1,
+        nameWord: '以【最新价】为准'
       }],
-      priceVal: undefined,
-      // 加载数据方法 必须为 Promise 对象
-      loadData: parameter => {
-        // 查询列表
-        return salesList(Object.assign(parameter, this.queryParam)).then(res => {
-          let data
-          if (res.status == 200) {
-            data = res.data
-            // 计算编号
-            const no = (data.pageNo - 1) * data.pageSize
-            data.list.forEach((con, i) => {
-              con.no = no + i + 1
-            })
-            this.disabled = false
-          }
-          this.spinning = false
-          return data
-        })
-      }
+      priceVal: undefined
     }
   },
   methods: {
+    // 获取弹窗显示信息
+    getShowInfo (obj) {
+      this.detailInfo = obj
+    },
     //  保存
     handleSubmit () {
       const _this = this
-      if (_this.newPromoSnList.length) {
-        salesDetailAddPromo({
-          'salesBillSn': _this.salesBillSn,
-          'promoSnList': _this.newPromoSnList
-        }).then(res => {
-          if (res.status == 200) {
-            _this.$emit('ok')
-          }
-        })
-      } else {
-        _this.$message.info('请选择要参与的新活动')
-        return true
+      const objInfo = {
+        productPriceChangeFlag: _this.priceVal
       }
+      _this.$emit('ok', objInfo)
     }
   },
   watch: {
@@ -122,6 +183,7 @@ export default {
     isShow (newValue, oldValue) {
       if (!newValue) {
         this.$emit('close')
+        this.priceVal = undefined
       }
     }
   }
@@ -129,7 +191,7 @@ export default {
 </script>
 <style lang="less" scoped>
   .tipModal-content{
-    width:80%;
+    width:85%;
     margin:30px auto 0;
     text-align:center;
     .tipModal-tit{
@@ -141,5 +203,8 @@ export default {
    .ant-radio-wrapper:first-child{
       margin-right:70px !important;
     }
+    .redWord{
+      color:#ed1c24;
+    }
   }
 </style>