Преглед изворни кода

添加/编辑商品,“兑换盲豆数量”字段可编辑

DELL пре 3 година
родитељ
комит
07983fde19
2 измењених фајлова са 7 додато и 6 уклоњено
  1. 3 3
      src/views/business/goods/add.vue
  2. 4 3
      src/views/business/goods/components/spec.vue

+ 3 - 3
src/views/business/goods/add.vue

@@ -160,7 +160,7 @@ export default {
         ],
         exchangePrice: [
           { required: true,message:'请输入盲豆数量', trigger: 'blur' },
-          { pattern: /^([1-9]\d*)$/, message: "请输入正确的数字", trigger: ["blur", "change"] }
+          { pattern: /^([1-9]\d*)$/, message: "请输入正确盲豆数量", trigger: ["blur", "change"] }
         ],
         cost: [
           { required: false, message: '请输入采购价格', trigger: 'blur' },
@@ -229,11 +229,11 @@ export default {
       this.$refs.addItem.validate((valid, items) => {
         if (valid) {
           this.addData.skuList = skuList
-          const { value, cost, description, ...rest } = this.addData
+          const { value, cost,exchangePrice, description, ...rest } = this.addData
           addGoods({...rest, ...{
             value: accMul(value, 100),
             cost: cost == '' || cost == null ? '' : accMul(cost, 100),
-            exchangePrice: accMul(value, 10),
+            exchangePrice: accMul(exchangePrice, 1),
             description: encodeURI(description)
           }}).then(res => {
             if (res.code === 0) {

+ 4 - 3
src/views/business/goods/components/spec.vue

@@ -126,7 +126,7 @@ export default {
         { pattern: /^([1-9]\d*(\.\d{1,2})?|([0](\.([0][1-9]|[1-9]\d{0,1}))))$/, message: "请输入正确的金额,最多两位小数", trigger: ["blur", "change"] }],
       exchangeRules: [
         { required: true,message:'请输入盲豆数量', trigger: 'blur' },
-        { pattern: /^([1-9]\d*)$/, message: "请输入正确的数字", trigger: ["blur", "change"] }
+        { pattern: /^([1-9]\d*)$/, message: "请输入正确的盲豆数量", trigger: ["blur", "change"] }
       ]
     }
   },
@@ -162,6 +162,7 @@ export default {
       this.specListTmp = JSON.parse(JSON.stringify(this.specList))
       this.skuList = sku.map(item => {
         this.$set(item, 'valueY', accDiv(item.value, 100))
+        this.$set(item, 'exchange', accDiv(item.exchangePrice,1))
         this.$set(item, 'costY', item.cost == null ? '' : accDiv(item.cost, 100) )
         this.$set(item, 'picUrlArr', item.picUrl.split(',').map(item => { return { fileName: item }}))
         this.$set(item, 'status', !!item.quantity)
@@ -292,9 +293,9 @@ export default {
       this.$refs.sku.validate((valid, items) => {
         if (valid) {
           this.skuList.forEach(item => {
-            const { valueY, costY } = item
+            const { valueY,exchange, costY } = item
             item.value = accMul(valueY, 100)
-            item.exchangePrice = accDiv(item.value, 10)
+            item.exchangePrice = accMul(exchange, 1)
             item.cost = costY == '' ? '' : accMul(costY, 100)
             item.picUrl = item.picUrlArr.map(item => { return item.fileName }).toString()
           })