chenrui преди 1 година
родител
ревизия
78cc797a12

+ 9 - 0
src/api/checkWarehouse.js

@@ -203,3 +203,12 @@ export const checkWarehouseDetailPrint = params => {
   }
   return axios.request(data)
 }
+
+// 盈亏成本单价修改
+export const detailModifyCost = (params) => {
+  return axios({
+    url: '/checkWarehouse/detail/modifyCost',
+    data: params,
+    method: 'post'
+  })
+}

+ 43 - 4
src/views/inventoryManagement/inventoryChecking/makeInventory.vue

@@ -149,6 +149,24 @@
           <template slot="checkProfitLossQty" slot-scope="text, record">
             <span :style="{ color: record.checkProfitLossQty>0?'red':record.checkProfitLossQty<0?'green':'', fontWeight: record.checkProfitLossQty!=0?'bold':'' }">{{ (record.checkProfitLossQty || record.checkProfitLossQty==0) ? Math.abs(record.checkProfitLossQty) : '--' }}</span>
           </template>
+          <!-- 盈亏成本单价 -->
+          <template slot="checkProfitLossCost" slot-scope="text, record">
+            <div v-if="record.cost">
+              <span v-if="record.checkProfitLossQty<=0||record.stockQty==record.checkQty" :style="{ color: record.checkProfitLossQty<0?'green':'', fontWeight: record.checkProfitLossQty!=0?'bold':'' }">{{ record.cost }}</span>
+              <div v-else>
+                <a-input-number
+                  size="small"
+                  v-model="record.cost"
+                  :precision="2"
+                  :min="0"
+                  :max="999999"
+                  placeholder="请输入"
+                  @blur="e => checkCostBlur(e.target.value, record)"
+                  style="width:100%;color: red;fontWeight:bold'"/>
+              </div>
+            </div>
+            <span v-else>--</span>
+          </template>
         </s-table>
       </a-card>
     </a-spin>
@@ -178,7 +196,7 @@ import ProductType from '@/views/common/productType.js'
 import printModal from './printModal.vue'
 import exportModal from './exportModal.vue'
 import { hdPrint } from '@/libs/JGPrint.js'
-import { checkWarehouseDetailList, checkWarehouseDetailCount, checkWarehouseInventory, checkWarehouseDetail, checkWarehouseDetailSave, checkWarehouseCheckZero, checkWarehouseWarehouse, checkWarehouseDetailExport, checkWarehouseDetailPrint } from '@/api/checkWarehouse'
+import { checkWarehouseDetailList, checkWarehouseDetailCount, checkWarehouseInventory, checkWarehouseDetail, checkWarehouseDetailSave, checkWarehouseCheckZero, checkWarehouseWarehouse, checkWarehouseDetailExport, checkWarehouseDetailPrint, detailModifyCost } from '@/api/checkWarehouse'
 export default {
   name: 'MakeInventory',
   components: { STable, VSelect, ProductType, printModal, exportModal },
@@ -233,13 +251,14 @@ export default {
     columns () {
       const arr = [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '产品编码', dataIndex: 'productCode', width: '21%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'productName', width: '21%', align: 'left', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'productCode', width: '17%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', width: '17%', align: 'left', customRender: function (text) { return text || '--' } },
         { title: '产品分类', scopedSlots: { customRender: 'productType' }, width: '14%' },
         { title: '单位', dataIndex: 'productUnit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '库存数量', dataIndex: 'stockQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '盘点数量', scopedSlots: { customRender: 'checkQty' }, width: '8%', align: 'center' },
-        { title: '盈亏数量', scopedSlots: { customRender: 'checkProfitLossQty' }, width: '8%', align: 'center' }
+        { title: '盈亏数量', scopedSlots: { customRender: 'checkProfitLossQty' }, width: '8%', align: 'center' },
+        { title: '盈亏成本单价', scopedSlots: { customRender: 'checkProfitLossCost' }, width: '8%', align: 'center' }
       ]
       if (this.basicInfoData && this.basicInfoData.warehouseFlag == '1') {
         arr.splice(4, 0, { title: '仓库', dataIndex: 'warehouseName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } })
@@ -281,6 +300,26 @@ export default {
         this.handleAdd(record, 'edit')
       }
     },
+    // 成本
+    checkCostBlur (val, row) {
+      if (!val) {
+        this.$message.warning('请输入盈亏成本单价!')
+        return
+      }
+      this.spinning = true
+      const params = {
+        id: row.id, checkWarehouseSn: row.checkWarehouseSn, cost: val
+      }
+      detailModifyCost(params).then(res => {
+        if (res.status == 200) {
+          this.$message.success(res.message)
+          this.$refs.table.refresh()
+          this.spinning = false
+        } else {
+          this.spinning = false
+        }
+      })
+    },
     //  添加/编辑
     handleAdd (row, isEdit) {
       if (!isEdit && !row.checkQty) {

+ 4 - 2
src/views/inventoryManagement/inventoryChecking/selfDisk.vue

@@ -380,7 +380,8 @@ export default {
         productProduceDate: row.productProduceDate || undefined,
         productExpiryDate: row.productExpiryDate || undefined,
         warehouseSn: row.warehouseSn || undefined,
-        warehouseLocationSn: row.warehouseLocationSn || undefined
+        warehouseLocationSn: row.warehouseLocationSn || undefined,
+        cost: row.lastStockCost
       }
       this.spinning = true
       checkWarehouseDetailSave(params).then(res => {
@@ -423,7 +424,8 @@ export default {
             productProduceDate: item.productProduceDate || undefined,
             productExpiryDate: item.productExpiryDate || undefined,
             warehouseSn: item.warehouseSn || undefined,
-            warehouseLocationSn: item.warehouseLocationSn || undefined
+            warehouseLocationSn: item.warehouseLocationSn || undefined,
+            cost: item.lastStockCost
           })
         })
       } else if (type == 'all') { //  全部添加