chrislee 1 éve
szülő
commit
1187fa1311

+ 3 - 3
src/views/modules/order/dispatch.vue

@@ -158,7 +158,7 @@
           label="操作">
           <template slot-scope="scope">
             <el-button v-if="isAuth('order:deliver:info') && Number(scope.row.state) <= 3" type="text" size="small" @click="detailHandle(scope.row)">查看</el-button>
-            <el-button v-if="isAuth('order:deliver:send') && Number(scope.row.state) === 2" type="text" size="small" @click="sendHandle(scope.row.deliverId)">发货</el-button>
+            <el-button v-if="isAuth('order:deliver:send') && Number(scope.row.state) === 2" type="text" size="small" @click="sendHandle(scope.row.deliverId, scope.row.cnt)">发货</el-button>
             <el-button v-if="isAuth('order:deliver:arrive') && Number(scope.row.state) === 3" type="text" size="small" @click="arriveHandle(scope.row.deliverId)">送达</el-button>
           </template>
         </el-table-column>
@@ -326,10 +326,10 @@ export default {
       })
     },
     // 发货
-    sendHandle (deliverId) {
+    sendHandle (deliverId, cnt) {
       this.dispatchVisible = true
       this.$nextTick(() => {
-        this.$refs.dispatching.init(deliverId)
+        this.$refs.dispatching.init(deliverId, cnt)
       })
     },
     // 转换属性“状态”

+ 8 - 2
src/views/modules/order/dispatching.vue

@@ -10,7 +10,7 @@
         <el-row class="my-row">
           <el-col>
             <el-form-item label="发货数量" prop="cnt">
-              <el-input-number v-model="dataForm.cnt" :min="0"></el-input-number>
+              <el-input-number v-model="dataForm.cnt" :min="0" :max="max"></el-input-number>
             </el-form-item>
           </el-col>
         </el-row>
@@ -29,6 +29,7 @@
     data () {
       return {
         visible: false,
+        max: 0,
         dataForm: {},
         dataRule: {
           cnt: [{ required: true, message: '发货数量不能为空', trigger: 'change' }]
@@ -40,8 +41,9 @@
         this.visible = false
         this.$emit('onChose')
       },
-      async init (deliverId) {
+      async init (deliverId, max) {
         if (!deliverId) return
+        this.max = max
         this.dataForm = {
           deliverId: deliverId
         }
@@ -54,6 +56,10 @@
       dataFormSubmit () {
         this.$refs['dataForm'].validate((valid) => {
           if (valid) {
+            if (this.dataForm.cnt > this.max) {
+              this.$message.warning('发货数量不能大于:' + this.max)
+              return
+            }
             this.$http({
               url: this.$http.adornUrl(`/biz-service/deliver/deliver`),
               method: 'post',