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

11/25 订单审核 添加修改功能

1
mo пре 4 година
родитељ
комит
284a434b30

+ 14 - 0
src/api/orderManager.js

@@ -242,3 +242,17 @@ export function auditOutOrder (data) {
     data: qs.stringify(data)
   })
 }
+
+
+// 修改审核订单
+export function updateRouteOrder (data) {
+  return request({
+    url: api + '/routeOrder/update',
+    method: 'post',
+    data,
+    headers: {
+      'Content-Type': 'application/json',
+    },
+  })
+}
+

+ 33 - 5
src/views/businessManager/orderManager/orderAudit/index.vue

@@ -122,6 +122,9 @@
               <div>
                 <el-button type="text"
                            @click="lookDetail(scope.row)">查看</el-button>
+                <el-button type="text"
+                           v-if="scope.row.auditStatus == 'REJECT'"
+                           @click="resetDetail(scope.row)">修改</el-button>
               </div>
             </template>
           </el-table-column>
@@ -140,15 +143,22 @@
       <orderAuditDetail :orderId='activceId'
                         :shopList="shopList"
                         :organList="organList"
+                        :isLook='isLook'
                         ref="orderAuditDetail"
                         v-if="orderVisible"
                         @getList="getList" />
       <span slot="footer"
-            v-if="activeRow&&activeRow.auditStatus == 'ING'"
             class="dialog-footer">
-        <el-button @click="submit('REJECT')">驳回</el-button>
-        <el-button @click="submit('PASS')"
+        <el-button v-if="activeRow&&activeRow.auditStatus == 'ING'"
+                   @click="submit('REJECT')">驳回</el-button>
+        <el-button v-if="activeRow&&activeRow.auditStatus == 'ING'"
+                   @click="submit('PASS')"
                    type="primary">审核通过</el-button>
+        <el-button @click="orderVisible = false"
+                   v-if="activeRow&&activeRow.auditStatus == 'REJECT'&&!isLook">取 消</el-button>
+        <el-button v-if="activeRow&&activeRow.auditStatus == 'REJECT'&&!isLook"
+                   @click="submitReaet"
+                   type="primary">确 定</el-button>
       </span>
     </el-dialog>
   </div>
@@ -189,7 +199,8 @@ export default {
       },
       orderVisible: false,
       activceId: null,
-      activeRow: null
+      activeRow: null,
+      isLook: null
     };
   },
   //生命周期 - 创建完成(可以访问当前this实例)
@@ -240,7 +251,6 @@ export default {
           this.tableList = res.data.rows
           this.rules.total = res.data.total
           this.orderVisible = false
-          console.log(this.orderVisible)
         }
 
       })
@@ -248,6 +258,13 @@ export default {
     lookDetail (row) {
       this.activceId = row.id
       this.activeRow = row
+      this.isLook = true
+      this.orderVisible = true
+    },
+    resetDetail (row) {
+      this.activceId = row.id
+      this.activeRow = row
+      this.isLook = false
       this.orderVisible = true
     },
     submit (str) {
@@ -263,6 +280,17 @@ export default {
         })
         .catch(() => { });
 
+    },
+    submitReaet () {
+      this.$confirm(`是否提交修改`, "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      })
+        .then(() => {
+          this.$refs.orderAuditDetail.submitReaet()
+        })
+        .catch(() => { });
     }
   }
 };

+ 80 - 27
src/views/businessManager/orderManager/orderAudit/orderAuditDetail.vue

@@ -1,6 +1,7 @@
 <template>
   <div>
-    <el-form :inline='true'>
+    <el-form :inline='true'
+             ref='ruleForm'>
       <div class="lookTitle">申请信息</div>
       <el-form-item label="申请人"
                     label-width="80px">
@@ -79,24 +80,26 @@
                         placeholder="选择交易日期">
         </el-date-picker>
       </el-form-item>
-      <!-- <el-form-item label="收入类型"
-                        :label-width="formLabelWidth"
-                        prop="applyType">
-            <el-select class="multiple"
-                       style="width: 100% !important;"
-                       v-model.trim="form.applyType"
-                       filterable
-                       clearable
-                       :disabled="!isAdd"
-                       placeholder="请选择收入类型">
-              <el-option v-for="(item,index) in orderServerList"
-                         :key="index"
-                         :label="item.label"
-                         :value="item.value"></el-option>
-            </el-select>
-          </el-form-item> -->
+      <el-form-item label="收入类型"
+                    :label-width="formLabelWidth"
+                    prop="applyType">
+        <el-select class="multiple"
+                   style="width: 100% !important;"
+                   v-model.trim="form.applyType"
+                   filterable
+                   clearable
+                   :disabled="!isAdd"
+                   placeholder="请选择收入类型">
+          <el-option v-for="(item,index) in orderServerList"
+                     :key="index"
+                     :label="item.label"
+                     :value="item.value"></el-option>
+        </el-select>
+      </el-form-item>
       <el-form-item label="销售金额"
-                    prop="saleAmount"
+                    v-if="form.applyType == 'SELL'"
+                    prop="
+                    saleAmount"
                     :label-width="formLabelWidth">
         <el-input v-model="form.saleAmount"
                   @mousewheel.native.prevent
@@ -105,6 +108,7 @@
                   placeholder="请输入销售金额" />
       </el-form-item>
       <el-form-item label="服务金额"
+                    v-if="form.applyType == 'SERVICE'"
                     prop="serviceAmount"
                     :label-width="formLabelWidth">
         <el-input type="number"
@@ -143,16 +147,17 @@
                       @mousewheel.native.prevent
                       v-model.number="goodsList.number"></el-input>
           </el-form-item>
-          <!-- <el-button icon="el-icon-minus"
+          <el-button icon="el-icon-minus"
                      :disabled="!isAdd"
-                     v-if="form.goodsList.length > 1"
+                     v-if="form.goodsList.length > 1&&auditStatus == 'REJECT'"
                      circle
                      @click.prevent="removeGoodsList(goodsList)"></el-button>
           <el-button icon="el-icon-plus"
                      :disabled="!isAdd"
+                     v-if="auditStatus == 'REJECT'"
                      @click.prevent="addGoodsList"
                      circle
-                     style="margin-left: 5px;"></el-button> -->
+                     style="margin-left: 5px;"></el-button>
         </div>
       </div>
       <div class="lookTitle">其它</div>
@@ -165,7 +170,7 @@
                   :rows="3"></el-input>
       </el-form-item>
       <el-form-item label="审核备注"
-                    v-if="auditStatus != 'ING'"
+                    v-if="auditStatus != 'ING'&&auditStatus != 'REJECT'"
                     :label-width="formLabelWidth">
         <el-input placeholder="请输入备注"
                   :disabled="!isAdd"
@@ -190,10 +195,11 @@
   </div>
 </template>
 <script>
-import { getRouteOrderInfo, auditOutOrder } from '@/api/orderManager'
+import { getRouteOrderInfo, auditOutOrder, updateRouteOrder } from '@/api/orderManager'
+import { orderServerList } from "@/utils/searchArray"
 import { getCooperation } from "@/api/buildTeam";
 export default {
-  props: ['orderId', 'shopList', 'organList'],
+  props: ['orderId', 'shopList', 'organList', 'isLook'],
   data () {
     return {
       formLabelWidth: "100px",
@@ -216,12 +222,13 @@ export default {
         userId: '',
         auditComment: ''
       },
-      isAdd: false,
+      isAdd: !this.isLook,
       cooperationList: [],
       submitForm: {
         memo: ''
       },
-      auditStatus: ''
+      auditStatus: '',
+      orderServerList: orderServerList
     }
   },
   mounted () {
@@ -243,7 +250,8 @@ export default {
             saleAmount: orderInfo.saleAmount,
             schoolId: orderInfo.schoolId,
             userId: orderInfo.userId ? orderInfo.userId : '',
-            auditComment: orderInfo.auditComment
+            auditComment: orderInfo.auditComment,
+            applyType: orderInfo.saleAmount ? 'SELL' : 'SERVICE'
           }
           this.auditStatus = orderInfo.auditStatus
           this.$set(this.form, 'goodsList', this.getShopList(orderInfo.goodsJson))
@@ -295,6 +303,51 @@ export default {
         }
       })
 
+    },
+    removeGoodsList (item) {
+      const index = this.form.goodsList.indexOf(item)
+      if (index !== -1) {
+        this.form.goodsList.splice(index, 1)
+      }
+    },
+    addGoodsList () {
+      this.form.goodsList.push({
+        id: null,
+        number: null
+      })
+    },
+    submitReaet () {
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          let form = this.form
+          if (!form.saleAmount && !form.serviceAmount) {
+            this.$message.error('请输入销售收入或服务收入')
+            return
+          }
+          if (!form.saleAmount) {
+            form.goodsList = null
+          }
+          let goodsJson = {}
+          for (let i in form.goodsList) {
+            goodsJson[form.goodsList[i]['id']] = form.goodsList[i]['number']
+          }
+          form.goodsJson = form.applyType == "SERVICE" ? null : JSON.stringify(goodsJson)
+          form.id = this.orderId
+          form.auditStatus = 'ING'
+          console.log(form)
+          updateRouteOrder(form).then(res => {
+            if (res.code == 200) {
+              this.$message.success("修改成功");
+              this.$emit('getList')
+              return
+            } else {
+              this.$message.error(res.msg);
+            }
+          })
+
+
+        }
+      })
     }
   }
 }