zhangqiOMG 2 years ago
parent
commit
67b4fcb48f

+ 13 - 2
src/SDrpManagement/ProductGroup/modules/GroupDetail/groupDetail.vue

@@ -31,7 +31,7 @@
       </div>
       <div class="flex-align-center" style="margin-bottom:30px">
         <p>数量:&emsp;</p>
-        <el-input-number v-model="count" :min="selectProduct.orderminqty" step-strictly :step="selectProduct.orderaddqty" size="small" label="描述文字"></el-input-number>
+        <el-input-number v-model="count" :min="selectProduct.orderminqty" :step="selectProduct.orderaddqty" @change="changeQty" size="small" label="描述文字"></el-input-number>
         <span style="color:#888;font-size: 14px;margin-left: 10px">起订量:{{selectProduct.orderminqty}}</span>
         <span style="color:#888;font-size: 14px;margin-left: 10px">增量:{{selectProduct.orderaddqty}}</span>
         <span style="color:#888;font-size: 14px;margin-left: 10px">库存:
@@ -124,7 +124,7 @@ export default {
   data () {
     return {
       detail: '',
-      count: 1,
+      count: 0,
       selectProduct: '',
       actImage:{},
       tradefield:[],
@@ -159,17 +159,28 @@ export default {
       this.actImage = this.detail ? this.detail[0].attinfos ? this.detail[0].attinfos[0]:{} : {}
       this.tradefield  = this.detail ? this.detail[0].tradefield : []
       this.actTradefield = this.detail?this.detail[0].tradefield?this.detail[0].tradefield[0].tradefield:'':''
+      this.count = this.detail[0].orderminqty
 
     },
     countChange (num) {
       this.count = num
     },
+    changeQty(num){
+      let a = num - this.selectProduct.orderminqty
+      let b = a / this.selectProduct.orderaddqty
+      if (b < 1) {
+        this.count = this.selectProduct.orderminqty +  this.selectProduct.orderaddqty
+      } else {
+        this.count = this.selectProduct.orderminqty +  this.selectProduct.orderaddqty * b.toFixed(0)
+      }
+    },
     typeClick (data) {
       console.log(data,"切换")
       this.selectProduct = data
       this.actImage = data.attinfos[0]
       this.actTradefield = data.tradefield[0].tradefield
       this.count = data.orderminqty
+      console.log(this.count)
     },
     
     async addCart () {

+ 3 - 5
src/utils/tool.js

@@ -1,4 +1,4 @@
-import { Notification } from 'element-ui';
+import { Message } from 'element-ui';
 import router from '@/router';
 export default {
   // 获取应用权限
@@ -47,15 +47,13 @@ export default {
   // 操作响应提示
   showMessage (res,success) {
     
-    if (res.code === 0)  return Notification({
-      title: '失败',
+    if (res.code === 0)  return Message({
       message: res.msg,
       type: 'error',
       
     });
 
-    Notification({
-      title: '成功',
+    Message({
       message: '操作成功',
       type: 'success'
     });