Przeglądaj źródła

修改平均成本

shish 8 miesięcy temu
rodzic
commit
801740872f
2 zmienionych plików z 53 dodań i 2 usunięć
  1. 48 2
      ghsApp/src/admin/item/detail.vue
  2. 5 0
      ghsApp/src/api/product/index.js

+ 48 - 2
ghsApp/src/admin/item/detail.vue

@@ -72,7 +72,7 @@
 
         <tui-list-cell class="line-cell" :arrow="false" :hover="false">
         <view class="tui-title" style="color:#19b31f;">平均成本</view>
-        <view style="color:#19b31f;width:300upx;">{{productData.avCost?productData.avCost:0}}</view>
+        <view style="color:#19b31f;width:300upx;" @click="showModifyAvCost(productData)">{{productData.avCost?productData.avCost:0}}</view>
         <button v-if="productData.id > 0" class="admin-button-com blue middle" @click="goAvCostDetail(productData)">变动记录</button>
         </tui-list-cell>
 
@@ -433,6 +433,18 @@
 		</template>
 		</modal-module>
 
+		<modal-module :show="modifyAvCostShow" @click="modifyAvCostConfirm" :maskClosable="true" title="修改平均成本" padding="30rpx 30rpx" >
+		<template v-slot:content>
+			<view class="app-modal-input-wrap">
+        <view class="inp-list-line">
+          <view class="line-input">
+          <input type="digit" ref="input" style="width:62%;text-align:center;" v-model="newAvCost" @focus="newAvCost=''" :adjust-position="false" class="inp-input" />
+          </view>
+        </view>
+			</view>
+		</template>
+		</modal-module>
+
   </view>
 </template>
 
@@ -443,7 +455,7 @@ import { getAllItemClass } from "@/api/item-class";
 import { applyAuth,modifyCgStaff,setLosing,modifyUnit,modifyRatio,modifyWeight,clearLimitBuy } from '@/api/item';
 //import { delCpItem,addCpItem } from '@/api/cp'
 import { getAllUnit } from "@/api/unit";
-import { addProduct,updateProduct,getProductDetail,py,print,modifyOnStockFn,delStatusUpdate,changeBelongCost } from "@/api/product";
+import { addProduct,updateProduct,getProductDetail,py,print,modifyOnStockFn,delStatusUpdate,changeBelongCost,modifyAvCost } from "@/api/product";
 import { getPtItemDetail } from "@/api/pt-item";
 import { wastage } from "@/api/order";
 import { mapGetters } from "vuex"
@@ -467,6 +479,8 @@ export default {
       newWeight:'',
       onStockShow:false,
       newOnStock:0,
+      modifyAvCostShow:false,
+      newAvCost:'',
       status: 1,
       currentImgData: [],
       form: {
@@ -1006,6 +1020,38 @@ export default {
     goAvCostDetail(item){
       this.$util.pageTo({url: "/pagesStorehouse/stockWarn/detailed?id="+item.id+'&name='+item.name})
     },
+    showModifyAvCost(item){
+      this.modifyAvCostShow = true
+      this.newAvCost = item.avCost ? parseFloat(item.avCost) : 0
+      let that = this
+      setTimeout(x => {
+        this.$nextTick(() => {
+          that.avCostFocus = true
+        })
+      }, 300)
+    },
+    modifyAvCostConfirm(val){
+      let that = this
+      if (val.index == 0) {
+        this.modifyAvCostShow = false
+        this.newAvCost = ''
+        return
+      }
+      if(Number(that.newAvCost) < 0){
+        that.$msg('请填写正确的数值')
+        return false
+      }
+      that.$util.confirmModal({content:'确认修改?'},() => {
+        modifyAvCost({id:this.productData.id,avCost:that.newAvCost}).then((res) => {
+            if(res.code == 1){
+              that.getDetail()
+              that.modifyAvCostShow = false
+              that.newAvCost = ''
+              that.$msg('修改成功')
+            }
+          });
+      })
+    },
     goStockDetail(item){
 				this.$util.pageTo({url: "/pagesStorehouse/stockWarn/detailed?id="+item.id+'&name='+item.name})
 		},

+ 5 - 0
ghsApp/src/api/product/index.js

@@ -138,4 +138,9 @@ export const generateBarcodeTable = data => {
 
 export const changeBelongCost = data => {
 	return https.get("/product/change-belong-cost", data);
+};
+
+//修改平均成本
+export const modifyAvCost = data => {
+	return https.get("/product/modify-av-cost", data);
 };