Просмотр исходного кода

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

lilei 1 год назад
Родитель
Сommit
09e9c9970d

+ 9 - 0
src/api/salesReturn.js

@@ -291,3 +291,12 @@ export const queryOverviewPage = (params) => {
     method: 'post'
   })
 }
+
+// 抓单  设置退货单价
+export const grabSalesBill = (params) => {
+  return axios({
+    url: '/salesReturn/detail/grabSalesBill',
+    data: params,
+    method: 'post'
+  })
+}

+ 146 - 0
src/views/salesReturnManagement/custConfirm/grabOrderModal.vue

@@ -0,0 +1,146 @@
+<template>
+  <a-modal
+    centered
+    :footer="null"
+    title="选择退货单价"
+    v-model="isShow"
+    @cancel="isShow=false"
+    width="50%">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <a-table
+        class="sTable"
+        style="max-height:240px;"
+        ref="table"
+        size="small"
+        :rowKey="(record) => record.productScopeSn"
+        :columns="columns"
+        :data-source="grabSalesList"
+        :scroll="{ y: 200 }"
+        :pagination="false"
+        bordered
+      >
+        <template v-for="col in ['code','normalPrice', 'specialPrice', 'salesPrice']" :slot="col" slot-scope="text, record, index" >
+          <div :key="col">
+            <template v-if="col=='code'">
+              <span>{{ text }}</span>
+            </template>
+            <div v-else>
+              <a-radio-group name="radioGroup" v-model="record.resultVal">
+                <div v-if="record.NORMAL&&col==='normalPrice'">
+                  <a-radio :value="record.NORMAL" >
+                    {{ record.NORMAL.price }}
+                  </a-radio>
+                </div>
+                <div v-else-if="record.DISCOUNT&&col==='specialPrice'">
+                  <a-radio :value="record.DISCOUNT" >
+                    {{ record.DISCOUNT.specialPrice }}
+                  </a-radio>
+                </div>
+                <div v-else-if="record.GIFT&&col==='salesPrice'">
+                  <a-radio :value="record.GIFT" >
+                    {{ record.GIFT.realSalePrice }}
+                  </a-radio>
+                </div>
+                <div v-else>--</div>
+              </a-radio-group>
+            </div>
+          </div>
+        </template>
+      </a-table>
+      <div class="btn-cont">
+        <a-button id="sales-print-back" @click="handleCancel">取消</a-button>
+        <a-button type="primary" id="sales-print-save" @click="handleSave" style="margin-left: 15px;">确定</a-button>
+      </div>
+    </a-spin>
+  </a-modal>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { VSelect, STable } from '@/components'
+import { grabSalesBill } from '@/api/salesReturn'
+export default {
+  name: 'GrabOrderModal',
+  mixins: [commonMixin],
+  components: { VSelect, STable },
+  props: {
+    openModal: {
+      type: Boolean,
+      default: false
+    },
+    infoData: {
+      type: Object,
+      default: function () {
+        return {}
+      }
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal,
+      spinning: false,
+      columns: [
+        { title: '产品编码', dataIndex: 'product.code', width: '26%', scopedSlots: { customRender: 'code' }, align: 'center' },
+        { title: '正常产品单价', width: '28%', scopedSlots: { customRender: 'normalPrice' }, align: 'center' },
+        { title: '特价产品单价', width: '28%', scopedSlots: { customRender: 'specialPrice' }, align: 'center' },
+        { title: '促销产品单价', width: '28%', scopedSlots: { customRender: 'salesPrice' }, align: 'center' }
+      ],
+      grabSalesList: []
+    }
+  },
+  methods: {
+    // 获取列表数据
+    getDataList () {
+      grabSalesBill(this.infoData).then(res => {
+        this.grabSalesList = res.data
+      })
+    },
+    // 重置选择
+    reSetSelect () {
+      this.grabSalesList.map(item => { item.resultVal = null })
+    },
+    // 取消
+    handleCancel () {
+      this.isShow = false
+    },
+    // 保存
+    handleSave () {
+      const flag = this.grabSalesList.some(item => !item.resultVal)
+      if (flag) {
+        this.$message.warning('未选择产品单价')
+        return
+      }
+      const resultVal = this.grabSalesList.map(item => {
+        const newobj = {
+          salesReturnDetailSn: item.product.salesReturnDetailSn, salesBillDetailSn: item.resultVal.salesBillDetailSn
+        }
+        return newobj
+      })
+      this.$emit('ok', resultVal)
+      this.isShow = false
+    }
+  },
+  watch: {
+    openModal (nVal, oVal) {
+      this.isShow = nVal
+    },
+    isShow (nVal, oVal) {
+      if (!nVal) {
+        this.reSetSelect()
+        this.$emit('close')
+      } else {
+        if (this.infoData) {
+          this.getDataList()
+        }
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+  .btn-cont {
+    text-align: center;
+    margin: 35px 0 10px;
+  }
+</style>

+ 39 - 9
src/views/salesReturnManagement/custConfirm/setPriceModal.vue

@@ -44,7 +44,7 @@
           </div>
           <div v-else>
             销售单号:
-            <a-input placeholder="请输入销售单号" v-model.trim="form.salesBillNo" :maxLength="50" @change="fetchUser"/>
+            <a-input placeholder="请输入销售单号" v-model.trim="form.salesBillNo" :maxLength="50" @change="fetchUser" @blur="handleBlur"/>
             <span class="mleft">{{ buyerName }}</span>
             <a-button type="primary" :disabled="disabled" @click="handleSave" class="button-error">设置完成</a-button>
           </div>
@@ -84,6 +84,7 @@
           </template>
         </s-table>
       </div>
+      <grabOrderModal ref="grabOrder" :infoData="objInfo" :openModal="openGrabOrderModal" @ok="handleGrabOrderOk" @close="closeGrabOrder"></grabOrderModal>
     </a-spin>
   </a-modal>
 </template>
@@ -94,10 +95,11 @@ import debounce from 'lodash/debounce'
 import { STable, VSelect } from '@/components'
 import { salesDetailByNo } from '@/api/sales'
 import { setReturnPrice } from '@/api/salesReturnDetail'
+import grabOrderModal from './grabOrderModal.vue'
 export default {
   name: 'SetPriceModal',
   mixins: [commonMixin],
-  components: { STable, VSelect },
+  components: { STable, VSelect, grabOrderModal },
   props: {
     openModal: { //  弹框显示状态
       type: Boolean,
@@ -142,7 +144,7 @@ export default {
         { title: '返库数量', dataIndex: 'backStockQty', align: 'center', width: '10%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '退货单价', dataIndex: 'price', align: 'right', width: '10%', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
         { title: '退货单价说明', dataIndex: 'priceRemark', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '退货原因', dataIndex: 'returnReason', width: '15%', align: 'center', scopedSlots: { customRender: 'returnReason' } },
+        { title: '退货原因', dataIndex: 'returnReason', width: '15%', align: 'center', scopedSlots: { customRender: 'returnReason' } }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -157,7 +159,10 @@ export default {
           })
         })
       },
-      buyerName: ''
+      buyerName: '',
+      openGrabOrderModal: false,
+      objInfo: null,
+      salesBillSnList: []
     }
   },
   methods: {
@@ -174,6 +179,27 @@ export default {
         this.buyerName = res.data ? res.data.buyerName : ''
       })
     },
+    // 打开抓单设置单价弹窗
+    handleBlur () {
+      if (!this.buyerName) {
+        this.$message.warning('请输入正确的销售单号!')
+        return
+      }
+      const productArr = this.chooseData.map(item => { return { productSn: item.productSn, code: item.productEntity.code, salesReturnDetailSn: item.salesReturnDetailSn } })
+      this.objInfo = {
+        salesReturnBillSn: this.$route.params.sn,
+        salesBillNo: this.form.salesBillNo,
+        productList: productArr
+      }
+      this.openGrabOrderModal = true
+    },
+    handleGrabOrderOk (con) {
+      this.salesBillSnList = con
+    },
+    closeGrabOrder () {
+      this.objInfo = null
+      this.openGrabOrderModal = false
+    },
     // 设置价格
     handleSave () {
       // 不抓单且打折
@@ -191,12 +217,16 @@ export default {
         }
         this.form.discountFlag = undefined
         this.form.discount = undefined
+        this.form.salesReturnBillDetailList = this.salesBillSnList
+      } else {
+        const snList = []
+        this.chooseData.map(item => {
+          snList.push(item.salesReturnDetailSn)
+        })
+        this.form.salesReturnBillDetailList = snList
       }
-      const snList = []
-      this.chooseData.map(item => {
-        snList.push(item.salesReturnDetailSn)
-      })
-      const params = Object.assign(this.form, { salesReturnBillDetailSnList: snList })
+
+      const params = Object.assign(this.form)
       console.log(params)
       this.disabled = true
       this.spinning = true