Browse Source

bug 修复

lilei 3 years ago
parent
commit
649c9460fc

+ 109 - 8
src/views/salesManagement/salesReturn/queryPart.vue

@@ -45,22 +45,75 @@
       :rowKey="(record) => record.id"
       :columns="columns"
       :data="loadData"
-      :customRow="handleClickRow"
       :defaultLoadData="false"
       :pageSize="10"
       :scroll="{ y: 149 }"
       bordered>
       <!-- 价格 -->
-      <template slot="price" slot-scope="text, record">{{ text }}</template>
+      <template slot="price" slot-scope="text, record">
+        <span v-if="grabFlag==1">{{ text }}</span>
+        <div v-else>
+          <a-input-number
+            size="small"
+            v-model="record.salePrice"
+            :precision="2"
+            :min="0"
+            :max="999999"
+            placeholder="请输入"
+            style="width: 100%;" />
+        </div>
+      </template>
       <span slot="customTitle">
         操作
-        <a-popover>
+        <!-- <a-popover>
           <template slot="content">
             双击列表配件可快速选中添加
           </template>
           <a-icon type="question-circle" theme="twoTone" />
-        </a-popover>
+        </a-popover> -->
       </span>
+      <!-- 本次退货数量 -->
+      <template slot="returnQty" slot-scope="text, record">
+        <a-input-number
+          size="small"
+          v-model="record.returnQty"
+          :precision="0"
+          :min="0"
+          :max="record.qty-record.hasReturnQty"
+          placeholder="请输入"
+          style="width: 100%;"
+          v-if="(grabFlag==1)&&(record.qty!=record.hasReturnQty)||grabFlag==0"
+        />
+        <span v-else>--</span>
+      </template>
+      <!-- 废品数量 -->
+      <template slot="celQty" slot-scope="text, record">
+        <a-input-number
+          size="small"
+          v-model="record.celQty"
+          :precision="0"
+          :min="0"
+          :max="record.returnQty"
+          placeholder="请输入"
+          style="width: 100%;"
+          v-if="(grabFlag==1)&&(record.qty!=record.hasReturnQty)||grabFlag==0"/>
+        <span v-else>--</span>
+      </template>
+      <!-- 仓库仓位 -->
+      <template slot="warehouse" slot-scope="text, record, index">
+        <a-cascader
+          size="small"
+          @change="e => changeWarehouseCascade(e, record, index)"
+          v-model="record.warehouseCascade"
+          expand-trigger="hover"
+          :options="warehouseCascadeData"
+          :allowClear="false"
+          :fieldNames="{ label: 'name', value: 'sn', children: 'warehouseLocationList' }"
+          placeholder="请选择仓库仓位"
+          style="width: 100%;"
+          v-if="(grabFlag==1)&&(record.qty!=record.hasReturnQty)||grabFlag==0"/>
+        <span v-else>--</span>
+      </template>
       <!-- 操作 -->
       <template slot="action" slot-scope="text, record">
         <a-button
@@ -89,6 +142,12 @@ export default {
     //   type: [Number, String],
     //   default: ''
     // },
+    warehouseCascadeData: {
+      type: Array,
+      default: function () {
+        return []
+      }
+    },
     newLoading: Boolean,
     grabFlag: [Number, String]
     // priceType: [Number, String]
@@ -125,8 +184,24 @@ export default {
             const no = (data.pageNo - 1) * data.pageSize
             for (var i = 0; i < data.list.length; i++) {
               data.list[i].no = no + i + 1
+              // 不抓单
               if (this.grabFlag == 0) {
                 data.list[i].putCost = data.list[i].lastStockCost
+                const warehouse = this.warehouseCascadeData[0].warehouseLocationList[0]
+                data.list[i].warehouseCascade = [warehouse.warehouseSn, warehouse.warehouseLocationSn]
+                data.list[i].returnQty = 1
+                data.list[i].celQty = 0
+              } else {
+                // 抓单
+                data.list[i].returnQty = data.list[i].qty - data.list[i].hasReturnQty
+                data.list[i].celQty = 0
+                const warehouseSn = data.list[i].warehouseSn || undefined
+                const warehouseLocationSn = data.list[i].warehouseLocationSn || undefined
+                if (warehouseSn || warehouseLocationSn) {
+                  data.list[i].warehouseCascade = [warehouseSn, warehouseLocationSn]
+                } else {
+                  data.list[i].warehouseCascade = undefined
+                }
               }
             }
             this.listData = data.list || []
@@ -152,6 +227,9 @@ export default {
         { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '销售数量', dataIndex: 'qty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '已退数量', dataIndex: 'hasReturnQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '本次退货数量', align: 'center', width: '7%', scopedSlots: { customRender: 'returnQty' } },
+        { title: '废品数量', align: 'center', width: '6%', scopedSlots: { customRender: 'celQty' } },
+        { title: '仓库仓位', scopedSlots: { customRender: 'warehouse' }, width: '10%', align: 'center' },
         { slots: { title: 'customTitle' }, scopedSlots: { customRender: 'action' }, width: '7%', align: 'center' }]
     } else {
       this.columns = [
@@ -161,6 +239,9 @@ export default {
         { title: '原厂编码', dataIndex: 'productOrigCode', width: '21%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '售价', dataIndex: 'salePrice', width: '10%', align: 'center', scopedSlots: { customRender: 'price' } },
         { title: '单位', dataIndex: 'productUnit', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '仓库仓位', scopedSlots: { customRender: 'warehouse' }, width: '10%', align: 'center' },
+        { title: '本次退货数量', align: 'center', width: '7%', scopedSlots: { customRender: 'returnQty' } },
+        { title: '废品数量', align: 'center', width: '6%', scopedSlots: { customRender: 'celQty' } },
         { slots: { title: 'customTitle' }, scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }]
     }
   },
@@ -186,6 +267,28 @@ export default {
         }
       }
     },
+    // 修改仓库仓位
+    changeWarehouseCascade (val, opt, ind) {
+      console.log(val, opt, ind)
+      const loadData = this.listData[ind]
+      if (val.length < 2) {
+        this.$message.warning('当前仓库无仓位,请选择其他仓库')
+        const warehouseSnBackups = loadData.warehouseSnBackups || undefined
+        const warehouseLocationSnBackups = loadData.warehouseLocationSnBackups || undefined
+        loadData.warehouseSn = warehouseSnBackups
+        loadData.warehouseLocationSn = warehouseLocationSnBackups
+        if (warehouseSnBackups || warehouseLocationSnBackups) {
+          loadData.warehouseCascade = [warehouseSnBackups, warehouseLocationSnBackups]
+        } else {
+          loadData.warehouseCascade = undefined
+        }
+      } else {
+        loadData.warehouseSn = val[0] ? val[0] : ''
+        loadData.warehouseLocationSn = val[1] ? val[1] : ''
+        loadData.warehouseSnBackups = val[0] ? val[0] : ''
+        loadData.warehouseLocationSnBackups = val[1] ? val[1] : ''
+      }
+    },
     //  重置
     resetSearchForm () {
       this.$refs.rangeDate && this.$refs.rangeDate.resetDate()
@@ -200,12 +303,10 @@ export default {
       console.log(buyerSn, priceType)
       this.buyerSn = buyerSn
       this.priceType = priceType
-      this.resetSearchForm()
+      this.refreshData()
     },
     refreshData () {
-      if (this.listData.length > 0) {
-        this.$refs.table.refresh(true)
-      }
+      this.$refs.table.refresh(true)
     },
     // 选择配件
     handleAdd (row) {

+ 2 - 1
src/views/salesManagement/salesReturn/salesReturnEdit.vue

@@ -18,6 +18,7 @@
           ref="queryPart"
           grabFlag="0"
           :newLoading="isInster"
+          :warehouseCascadeData="warehouseCascadeData"
           @add="saveProduct"></queryPart>
       </a-card>
       <a-card size="small" :bordered="false" class="pages-wrap">
@@ -458,7 +459,7 @@ export default {
         'cost': row.putCost,
         'productSn': row.productSn,
         'celQty': row.celQty,
-        'hasReturnQty': row.hasReturnQty,
+        'hasReturnQty': row.returnQty,
         'qty': 1,
         'warehouseLocationSn': row.warehouseLocationSn,
         'warehouseSn': row.warehouseSn

+ 2 - 2
src/views/salesManagement/salesReturn/salesReturnGrabEdit.vue

@@ -14,7 +14,7 @@
       </a-page-header>
       <a-card size="small" :bordered="false" class="pages-wrap">
         <!-- 查询配件列表 -->
-        <queryPart ref="queryPart" grabFlag="1" :newLoading="isInster" @add="saveProduct"></queryPart>
+        <queryPart ref="queryPart" grabFlag="1" :newLoading="isInster" :warehouseCascadeData="warehouseCascadeData" @add="saveProduct"></queryPart>
       </a-card>
       <a-card size="small" :bordered="false" class="pages-wrap">
         <!-- alert -->
@@ -445,7 +445,7 @@ export default {
         'cost': row.cost,
         'productSn': row.productSn,
         'celQty': row.celQty,
-        'qty': row.qty - row.hasReturnQty,
+        'qty': row.returnQty,
         'hasReturnQty': row.hasReturnQty,
         'warehouseLocationSn': row.warehouseLocationSn,
         'warehouseSn': row.warehouseSn