wxy 4 år sedan
förälder
incheckning
e2e564dec0
3 ändrade filer med 116 tillägg och 56 borttagningar
  1. 61 36
      src/views/order/goods.vue
  2. 20 17
      src/views/order/out.vue
  3. 35 3
      src/views/test/index.vue

+ 61 - 36
src/views/order/goods.vue

@@ -73,7 +73,7 @@
                   }
                 "
                 :min="0"
-                :max="scope.row.max"
+                :max="scope.row.numberMax"
                 size="mini"
                 style="width: 100px"
               ></el-input-number> </template
@@ -89,7 +89,7 @@
                   }
                 "
                 :min="0"
-                :max="scope.row.max"
+                :max="scope.row.weightMax"
                 size="mini"
                 style="width: 100px"
               ></el-input-number>
@@ -106,7 +106,7 @@
                   }
                 "
                 :min="0"
-                :max="scope.row.max"
+                :max="scope.row.volumeMax"
                 size="mini"
                 style="width: 100px"
               ></el-input-number>
@@ -273,73 +273,98 @@ export default {
     },
     //数量改变
     changeNumber(index, currentValue, oldValue) {
+      let orderForm = this.orderForm;
+      // const dList = _.cloneDeep(orderForm);
       let list = this.splitList;
       let count = 0;
+      // console.log(this.number);就是一直是订单的number
+      //拆分列表的总number
       for (let item of list) {
         count += item.number;
-        if (this.orderForm.number === 1) {
-          this.$set(item, `max`, item.number);
-        } else {
-          this.$set(item, `max`, item.number + this.orderForm.number + 1);
-        }
       }
       if (currentValue > oldValue) {
-        if (this.orderForm.number > 0) {
-          let sum = this.number - count;
-          this.$set(this.orderForm, `number`, sum);
+        let sum = this.number - count;
+        this.$set(orderForm, `number`, sum);
+        if (sum === 0) {
+          for (let item of list) {
+            this.$set(item, `numberMax`, item.number);
+          }
         }
       } else {
-        if (this.orderForm.number >= 0) {
-          let num = this.number - count;
-          this.$set(this.orderForm, `number`, num);
+        let orderNum = this.number - count;
+        this.$set(orderForm, `number`, orderNum);
+        for (let item of list) {
+          this.$set(item, `numberMax`, item.number + orderNum);
         }
       }
+      // this.$set(this, `orderForm`, dList);
     },
     //重量改变
     changeWeight(index, currentValue, oldValue) {
+      // let list = this.splitList;
+      // let count = 0;
+      // for (let item of list) {
+      //   count += item.weight;
+      //   if (this.orderForm.weight === 1) {
+      //     this.$set(item, `max`, item.weight);
+      //   } else {
+      //     this.$set(item, `max`, item.weight + this.orderForm.weight + 1);
+      //   }
+      // }
+      // if (currentValue > oldValue) {
+      //   if (this.orderForm.weight > 0) {
+      //     let sum = this.weight - count;
+      //     this.$set(this.orderForm, `weight`, sum);
+      //   }
+      // } else {
+      //   if (this.orderForm.weight >= 0) {
+      //     let num = this.weight - count;
+      //     this.$set(this.orderForm, `weight`, num);
+      //   }
+      // }
       let list = this.splitList;
+      let orderForm = this.orderForm;
       let count = 0;
       for (let item of list) {
         count += item.weight;
-        if (this.orderForm.weight === 1) {
-          this.$set(item, `max`, item.weight);
-        } else {
-          this.$set(item, `max`, item.weight + this.orderForm.weight + 1);
-        }
       }
       if (currentValue > oldValue) {
-        if (this.orderForm.weight > 0) {
-          let sum = this.weight - count;
-          this.$set(this.orderForm, `weight`, sum);
+        let sum = this.weight - count;
+        this.$set(this.orderForm, `weight`, sum);
+        if (sum === 0) {
+          for (let item of list) {
+            this.$set(item, `weightMax`, item.weight);
+          }
         }
       } else {
-        if (this.orderForm.weight >= 0) {
-          let num = this.weight - count;
-          this.$set(this.orderForm, `weight`, num);
+        let orderNum = this.weight - count;
+        this.$set(orderForm, `weight`, orderNum);
+        for (let item of list) {
+          this.$set(item, `weightMax`, item.number + orderNum);
         }
       }
     },
     //体积改变
     changeVolume(index, currentValue, oldValue) {
       let list = this.splitList;
+      let orderForm = this.orderForm;
       let count = 0;
       for (let item of list) {
         count += item.volume;
-        if (this.orderForm.volume === 1) {
-          this.$set(item, `max`, item.volume);
-        } else {
-          this.$set(item, `max`, item.volume + this.orderForm.volume + 1);
-        }
       }
       if (currentValue > oldValue) {
-        if (this.orderForm.volume > 0) {
-          let sum = this.volume - count;
-          this.$set(this.orderForm, `volume`, sum);
+        let sum = this.volume - count;
+        this.$set(this.orderForm, `volume`, sum);
+        if (sum === 0) {
+          for (let item of list) {
+            this.$set(item, `volumeMax`, item.volume);
+          }
         }
       } else {
-        if (this.orderForm.volume >= 0) {
-          let num = this.volume - count;
-          this.$set(this.orderForm, `volume`, num);
+        let orderNum = this.volume - count;
+        this.$set(orderForm, `volume`, orderNum);
+        for (let item of list) {
+          this.$set(item, `volumeMax`, item.number + orderNum);
         }
       }
     },

+ 20 - 17
src/views/order/out.vue

@@ -24,6 +24,7 @@
                     </el-table-column>
                     <el-table-column label="当前订单负责人" width="300">
                       <template slot-scope="scope">
+                        <!-- <span>{{ scope.row.principal }}</span> -->
                         <span>{{ getUser(scope.row.principal) }}</span>
                       </template>
                     </el-table-column>
@@ -66,10 +67,10 @@
               </el-row>
               <el-row>
                 <el-col :span="24" class="rate">
-                  <el-col :span="6" class="rateMoney">税前应收:{{ cost1 }}</el-col>
-                  <el-col :span="6" class="rateMoney">税后应收:{{ cost2 }}</el-col>
-                  <el-col :span="6" class="rateMoney">税前实收:{{ cost3 }}</el-col>
-                  <el-col :span="6" class="rateMoney">税后应收:{{ cost4 }}</el-col>
+                  <el-col :span="6" class="rateMoney">税前应收:{{ cost.cost1 }}</el-col>
+                  <el-col :span="6" class="rateMoney">税后应收:{{ cost.cost2 }}</el-col>
+                  <el-col :span="6" class="rateMoney">税前实收:{{ cost.cost3 }}</el-col>
+                  <el-col :span="6" class="rateMoney">税后应收:{{ cost.cost4 }}</el-col>
                   <el-col :span="24" class="tip"
                     ><span>关于长途运费:若是改成 他运且想根据设置的不同方式进行计算 需要重新生成订单,目前还无法处理这种情况</span></el-col
                   >
@@ -269,10 +270,11 @@ export default {
       costList: [],
       //税率列表
       rateList: [],
-      cost1: 0,
-      cost2: 0,
-      cost3: 0,
-      cost4: 0,
+      // cost1: 0,
+      // cost2: 0,
+      // cost3: 0,
+      // cost4: 0,
+      cost: {},
       detailForm: {},
       //判断是否结算
       judge: true,
@@ -330,6 +332,7 @@ export default {
       if (this.$checkRes(res4)) {
         const { data, total } = res4;
         this.$set(this, `userList`, data);
+        // console.log(this.userList);
       }
       // 查供应商
       const res5 = await this.clientQuery({ type: '供应商' });
@@ -338,7 +341,7 @@ export default {
         this.$set(this, `supClientList`, data);
       }
     },
-    // 查询其他信息
+    // 查询车牌号
     async searchOther() {
       let res = await this.carQuery();
       if (this.$checkRes(res)) {
@@ -410,10 +413,10 @@ export default {
         num3 = _.round(num3 + Number(row1.sq_ss), 2);
         num4 = _.round(num4 + row1.sh_ss, 2);
       }
-      this.$set(this, `cost1`, num1);
-      this.$set(this, `cost2`, num2);
-      this.$set(this, `cost3`, num3);
-      this.$set(this, `cost4`, num4);
+      this.$set(this.cost, `cost1`, num1);
+      this.$set(this.cost, `cost2`, num2);
+      this.$set(this.cost, `cost3`, num3);
+      this.$set(this.cost, `cost4`, num4);
     },
     //税前实收
     toChange(index) {
@@ -434,10 +437,10 @@ export default {
     back() {
       this.dialog = false;
       this.detailForm.out_bill = [];
-      this.cost1 = 0;
-      this.cost2 = 0;
-      this.cost3 = 0;
-      this.cost4 = 0;
+      this.cost.cost1 = 0;
+      this.cost.cost2 = 0;
+      this.cost.cost3 = 0;
+      this.cost.cost4 = 0;
     },
     //过滤客户
     getClient(client) {

+ 35 - 3
src/views/test/index.vue

@@ -8,12 +8,29 @@
             <el-button type="primary" size="mini" @click="getEquipment">获取设备</el-button>
           </el-col>
           <el-col :span="24" class="list">
-            <video id="webcam"></video>
-            <!-- <data-table :fields="fields" :opera="opera" :data="list" :total="total" @edit="toEdit" @delete="toDelete" @query="search"></data-table> -->
+            <el-table :data="tableData">
+              <el-table-column label="内容" prop="date"></el-table-column>
+              <el-table-column label="操作">
+                <template slot-scope="scope">
+                  <el-button size="mini" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
+                  <el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
+                </template>
+              </el-table-column>
+            </el-table>
           </el-col>
         </el-col>
       </el-col>
     </el-row>
+    <el-dialog title="收货地址" :visible.sync="dialogFormVisible">
+      <el-form :model="form">
+        <el-form-item label="内容">
+          <el-input v-model="form.date"></el-input>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="save(form)">确 定</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
@@ -31,6 +48,9 @@ export default {
   },
   data: function() {
     return {
+      dialogFormVisible: false,
+      tableData: [{ date: '11' }, { date: '22' }, { date: '134' }],
+      form: {},
       opera: [
         {
           label: '修改',
@@ -49,7 +69,6 @@ export default {
       // 增加菜单
       dialog: false,
       formFields: [{ label: '菜单名称', required: true, model: 'title' }],
-      form: {},
       rules: {
         title: [{ required: true, message: '请输入菜单名称', trigger: 'blur' }],
       },
@@ -113,6 +132,19 @@ export default {
     onError(error) {
       console.log('navigator.getUserMedia error: ', error);
     },
+    handleEdit(index, row) {
+      // this.$set(this, `form`, row);
+      let list = row;
+      this.form = list;
+      // this.form = {};
+      this.dialogFormVisible = true;
+    },
+    handleDelete() {
+      console.log('删除');
+    },
+    save(data) {
+      console.log(data);
+    },
   },
   computed: {
     ...mapState(['user']),