فهرست منبع

调拨 快捷编辑售价

chenrui 3 سال پیش
والد
کامیت
616f205af0
2فایلهای تغییر یافته به همراه55 افزوده شده و 14 حذف شده
  1. 7 0
      src/api/product.js
  2. 48 14
      src/views/allocationManagement/transferOut/edit.vue

+ 7 - 0
src/api/product.js

@@ -231,3 +231,10 @@ export const productPriceList = (params) => {
     method: 'post'
   })
 }
+//  产品 获取价格
+export const productPriceInfo = (params) => {
+  return axios({
+    url: `/product/getProductPriceInfo/${params.sn}`,
+    method: 'get'
+  })
+}

+ 48 - 14
src/views/allocationManagement/transferOut/edit.vue

@@ -111,8 +111,25 @@
               :rowKey="(record) => record.id"
               :columns="chooseColumns"
               :data="chooseLoadData"
-              :scroll="{ x: 1090, y: 300 }"
+              :scroll="{ x: 1160, y: 300 }"
               bordered>
+              <!-- 售价 -->
+              <template slot="price" slot-scope="text, record, index">{{ record.provincePrice }}
+                <a-select
+                  size="small"
+                  id="allocateBillEdit-price"
+                  option-label-prop="label"
+                  v-model="record.price"
+                  placeholder="请选择"
+                  @change="e => priceChange(e, record)"
+                  @focus="e => priceFocus(record, index)"
+                  style="width: 100%;">
+                  <a-select-option v-if="record.cost" :value="record.cost" :label="record.cost">成本 {{ record.cost }}</a-select-option>
+                  <a-select-option v-if="loadDataSource&&loadDataSource[index]&&loadDataSource[index].provincePrice" :value="loadDataSource[index].provincePrice" :label="loadDataSource[index].provincePrice">A价 {{ loadDataSource[index].provincePrice }}</a-select-option>
+                  <a-select-option v-if="loadDataSource&&loadDataSource[index]&&loadDataSource[index].cityPrice" :value="loadDataSource[index].cityPrice" :label="loadDataSource[index].cityPrice">B价 {{ loadDataSource[index].cityPrice }}</a-select-option>
+                  <a-select-option v-if="loadDataSource&&loadDataSource[index]&&loadDataSource[index].specialPrice" :value="loadDataSource[index].specialPrice" :label="loadDataSource[index].specialPrice">C价 {{ loadDataSource[index].specialPrice }}</a-select-option>
+                </a-select>
+              </template>
               <!-- 调出数量 -->
               <template slot="qty" slot-scope="text, record">
                 <a-input-number
@@ -125,15 +142,6 @@
                   placeholder="请输入"
                   @blur="e => qtyBlur(e.target.value, record)"
                   style="width: 100%;" />
-                <!-- <a-select
-                  id="allocateBillEdit-qty"
-                  option-label-prop="label"
-                  v-model="record.qty"
-                  placeholder="请选择"
-                  style="width: 100%;">
-                  <a-select-option v-if="record.price" :value="record.price" :label="record.price">成本价{{ record.price }}</a-select-option>
-                  <a-select-option v-if="record.totalCost" :value="record.totalCost" :label="record.totalCost">A价{{ record.totalCost }}</a-select-option>
-                </a-select> -->
               </template>
               <!-- 操作 -->
               <template slot="action" slot-scope="text, record">
@@ -165,6 +173,7 @@
 import { STable, VSelect } from '@/components'
 import ImportGuideModal from './importGuideModal.vue'
 import { queryStockProductPage } from '@/api/stock'
+import { productPriceInfo } from '@/api/product'
 import { allocateBillDetailList, allocateBillDetailCount, allocateBillDetailSave, allocateBillSubmit, allocateBillDetailDel, allocateBillDetailDelAll, allocateBillDetailPrint, allocateBillBatchInsert } from '@/api/allocateBill'
 export default {
   components: { STable, VSelect, ImportGuideModal },
@@ -197,10 +206,12 @@ export default {
           for (var i = 0; i < data.list.length; i++) {
             data.list[i].no = no + i + 1
           }
+          this.loadDataSource = data.list || []
           this.disabled = false
           return data
         })
       },
+      loadDataSource: [],
       localDataSource: [],
       // 加载数据方法 必须为 Promise 对象
       chooseLoadData: parameter => {
@@ -214,8 +225,9 @@ export default {
           for (var i = 0; i < data.list.length; i++) {
             data.list[i].no = no + i + 1
             data.list[i].qtyBackups = data.list[i].qty
+            data.list[i].priceBackups = data.list[i].price
           }
-          this.localDataSource = data.list
+          this.localDataSource = data.list || []
           this.chooseDisabled = false
           return data
         })
@@ -247,7 +259,7 @@ export default {
         { title: '产品编码', dataIndex: 'productEntity.code', width: 180, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品名称', dataIndex: 'productEntity.name', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '原厂编码', dataIndex: 'productEntity.origCode', width: 180, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '售价', dataIndex: 'price', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '售价', scopedSlots: { customRender: 'price' }, width: 150, align: 'center' },
         { title: '库存数量', dataIndex: 'currentStockQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '调出数量', scopedSlots: { customRender: 'qty' }, width: 100, align: 'center' },
         { title: '单位', dataIndex: 'productEntity.unit', width: 60, align: 'center', customRender: function (text) { return text || '--' } },
@@ -303,10 +315,14 @@ export default {
       }
       if (isEdit) { // 编辑
         // 清空数量时,值应保持未清空前的值,因数量不可为空
-        if (!row.qty || row.qty == row.qtyBackups) {
+        if (!row.qty) {
           row.qty = row.qtyBackups
           return
         }
+        if (!row.price) {
+          row.price = row.priceBackups
+          return
+        }
       }
       this.spinning = true
       allocateBillDetailSave(params).then(res => {
@@ -316,7 +332,6 @@ export default {
           this.$refs.chooseTable.refresh()
           this.spinning = false
         } else {
-          row.qty = row.qtyBackups
           this.spinning = false
         }
       })
@@ -395,6 +410,25 @@ export default {
         this.handleAdd(record, 'edit')
       }
     },
+    // 已选产品 售价  change
+    priceChange (val, record) {
+      //  光标移出,值发生改变再调用编辑接口
+      if (val != record.priceBackups) {
+        this.handleAdd(record, 'edit')
+      }
+    },
+    // 获取价格
+    priceFocus (row, index) {
+      if (row.productSn) {
+        productPriceInfo({ sn: row.productSn }).then(res => {
+          if (res.status == 200 && res.data) {
+            this.loadDataSource[index].provincePrice = res.data.provincePrice || undefined
+            this.loadDataSource[index].cityPrice = res.data.cityPrice || undefined
+            this.loadDataSource[index].specialPrice = res.data.specialPrice || undefined
+          }
+        })
+      }
+    },
     // 打印预览/快捷打印
     handlePrint (type) {
       const _this = this