فهرست منبع

feat: 提交代码

zhaolianxi 3 سال پیش
والد
کامیت
11e58ebf58

+ 1 - 0
src/api/http.js

@@ -12,6 +12,7 @@ const service = axios.create({
 //添加request拦截器
 service.interceptors.request.use(config => {
     config.headers = {
+      ...config.headers,
      // 设置全局请求头
      'token': 'cedebb6e872f539bef8c3f919874e9d7',
      'aliasId': '',

+ 16 - 1
src/api/order.js

@@ -29,4 +29,19 @@ export const getPayResult = ( params ) => {
 // 补打发票
 export const waimaiprinter = ( params ) => {
   return get('app/order/print/waimai', params);
-}
+}
+
+// 一件发单备注
+export const addRemark = ( params ) => {
+  return post('app/order/addRemark', params);
+}
+
+// 忽略订单
+export const ignoreOrder = ( params ) => {
+  return post('app/order/ignoreOrder', params);
+}
+
+// 撤回订单
+export const rollOrder = ( params ) => {
+  return post('app/order/rollOrder', params);
+}

+ 10 - 1
src/components/Home.vue

@@ -105,15 +105,24 @@
       sendOrderPopup,
       OrderList,
     },
+    destroyed() {
+      bus.$off('pullData');
+      bus.$off('refreshData');
+    },
     created() {
       bus.$on('pullData', (index) => {
-        console.log('执行$emit')
         this.tab_ac = index;
         this.params.status = this.tab_list[index].status;
         this.params.pageNum = 1;
         this.orderList = [];
         Promise.all([this.getOrder(), this.getMarker()])
       })
+      bus.$on('refreshData', () => {
+        console.log('执行refreshData')
+        this.params.pageNum = 1;
+        this.orderList = [];
+        Promise.all([this.getOrder(), this.getMarker()]);
+      })
     },
     mounted() {
       this.getOrder();

+ 156 - 9
src/components/orderComponents/orderList.vue

@@ -61,6 +61,8 @@
                 <div class="order_item_header_r">
                   <!-- <span class="header_r">已发单1分钟</span> -->
                   <el-button size='small' class="btn" @click.stop="deleteItem(item)">发起配送</el-button>
+                  <el-button size='small' class="btn" @click.stop="itemAddRemark(item.id, item)">添加备注</el-button>
+                  <el-button size='small' class="btn" @click.stop="iGnoreOrder(item.id)">忽略订单</el-button>
                 </div>
 
               </div>
@@ -83,7 +85,7 @@
                     </span>
                   </div>
                 </div>
-                <div v-if="item.caution" class="itme_r">备注:{{item.caution}}</div>
+                <div v-if="item.takeRemark" class="itme_r">备注:{{item.takeRemark}}</div>
               </div>
             </div>
           </div>
@@ -315,11 +317,42 @@
     <!-- 发起配送 -->
     <send-order-popup ref="sendOrderPopup"></send-order-popup>
     <!-- 骑手、商家、发件人地图 -->
-    <order-map ref="orderMap"></order-map>
+    <order-map ref="orderMap"></order-map>
+    <!-- 备注弹出层 -->
+    <el-dialog width="580px" center title="新增备注" destroy-on-close :visible.sync="dialogTableVisible">
+      <div>
+        <el-input placeholder="请添加备注信息,最多输入20个字!" v-model="remark" :maxlength="20" />
+      </div>
+      <div style="text-align: center;margin-top: 20px;">
+        <el-button @click.stop="dialogTableVisible = false">取消</el-button>
+        <el-button type="primary" class="submit-btn" @click.stop="commitRemark(orderId, item)">确定</el-button>
+      </div>
+    </el-dialog>
+    <!-- 忽略订单弹出层 -->
+    <el-dialog width="580px" center title="忽略订单" destroy-on-close :visible.sync="ignoreStatus">
+      <div class="ignore-modal">
+        <div class="title">请选择忽略该笔订单的原因</div>
+        <div class="check-item">
+          <img src="../../../static/image/check-radio.png" @click.stop="changeRadio(1)" v-if="radio != 1" class="radio" />
+          <img src="../../../static/image/check-radio-active.png" v-if="radio == 1" class="radio" />
+          <span>通过其他配送方式完成</span>
+        </div>
+        <div class="check-item">
+          <img src="../../../static/image/check-radio.png" @click.stop="changeRadio(2)" v-if="radio != 2" class="radio" />
+          <img src="../../../static/image/check-radio-active.png" v-if="radio == 2" class="radio" />
+          <span>取消该笔订单(由于用户取消或其他原因)</span>
+        </div>
+      </div>
+      <div style="text-align: center;margin-top: 20px;">
+        <el-button @click.stop="ignoreStatus = false">取消</el-button>
+        <el-button type="primary" class="submit-btn" @click.stop="commitIGnore(orderId)">确定</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
-<script>
+<script>
+  import bus from '../../common/bus.js';
   import orderMap from './orderAMap.vue';
   import OrderDetail from './orderDetail.vue';
   import orderTrack from './orderTrack.vue'
@@ -329,7 +362,10 @@
   import sendOrderPopup from './sendOrderPopup.vue';
   import {
     sendValuation,
-    waimaiprinter
+    waimaiprinter,
+    addRemark,
+    ignoreOrder,
+    rollOrder
   } from '../../api/order.js';
   export default {
     name: 'OrderList',
@@ -337,7 +373,13 @@
       return {
         needTrack: true,
         orderDetailStutus: 0,
-        isLoading: false
+        isLoading: false,
+        dialogTableVisible: false,
+        ignoreStatus: false,
+        remark: '',
+        orderId: '',
+        item: {},
+        radio: '',
       }
     },
     props: {
@@ -354,7 +396,71 @@
       ...mapState(['userInfo']),
     },
     mounted() {},
-    methods: {
+    methods: {
+      changeRadio(i) {
+        this.radio = i;
+      },
+      // 忽略订单
+      iGnoreOrder(orderId) {
+        this.orderId = orderId;
+        this.ignoreStatus = true;
+      },
+      commitIGnore(orderId) {
+        if ( !this.radio ) {
+          return this.$message({
+            message: '请选择忽略原因',
+            type: 'error'
+          })
+        }
+        let params = {
+          orderId,
+          ignoreReason: this.radio == 1 ? 0 : 1
+        }
+        ignoreOrder( params ).then( res => {
+          this.ignoreStatus = false;
+          if ( res.code == 200 ) {
+            this.$message({
+              message: '操作成功',
+              type: 'success'
+            })
+            bus.$emit('refreshData');
+          }else {
+            this.$message({
+              message: res.msg,
+              type: 'error'
+            })
+          }
+        } )
+      },
+      itemAddRemark(orderId, item) {
+        this.dialogTableVisible = true;
+        this.orderId = orderId;
+        this.item = item;
+        this.remark = item.takeRemark || '';
+      },
+      // 一键发单备注
+      commitRemark( orderId, item ) {
+        let params = {
+          orderId,
+          remark: this.remark.trim()
+        }
+        addRemark( params ).then( res => {
+          this.dialogTableVisible = false;
+          if ( res.code == 200 ) {
+            this.$message({
+              message: '添加备注成功',
+              type: 'success'
+            })
+            this.$set( this.list.find( v => { return item.id == v.id }), 'takeRemark', this.remark);
+            this.$forceUpdate();
+          }else {
+            this.$message({
+              message: res.msg,
+              type: 'error'
+            })
+          }
+        } )
+      },
       // 查看地图
       checkMap(item) {
         this.$refs.orderMap.setDialogStatus(item);
@@ -363,8 +469,21 @@
         this.getValuation(item);
       },
       // 撤回订单
-      orderBack(id) {
-
+      orderBack(orderId) {
+        rollOrder({ orderId }).then( res => {
+          if ( res.code == 200 ) {
+            this.$message({
+              message: '操作成功',
+              type: 'success'
+            })
+            bus.$emit('refreshData');
+          }else {
+            this.$message({
+              message: res.msg,
+              type: 'error'
+            })
+          }
+        } )
       },
       // 补打发票
       orderPrinter(waimaiId) {
@@ -449,7 +568,35 @@
 </script>
 
 <!-- Add "scoped" attribute to limit CSS to this component only -->
-<style lang="scss" scoped="scoped">
+<style lang="scss" scoped="scoped">
+  .ignore-modal {
+    .title {
+      font-size: 14px;
+      font-family: PingFang SC;
+      font-weight: 400;
+      color: #92959B;
+    }
+    .check-item {
+      display: flex;
+      align-items: center;
+      margin-top: 20px;
+      .radio {
+        width: 14px;
+        height: 14px;
+        margin-right: 6px;
+      }
+      span {
+        font-size: 14px;
+        font-family: PingFang SC;
+        font-weight: 400;
+        color: #222222;
+      }
+    }
+  }
+  .submit-btn {
+    border: none !important;
+    background-color: #FC7200;
+  }
   .empty-data {
     font-size: 0;
     text-align: center;

+ 1 - 1
src/components/orderComponents/sendOrderPopup.vue

@@ -84,7 +84,7 @@
             <span>支付方式</span>
           </div>
           <div class="pay-list">
-            <div class="pay-item" @click.stop="createOrder(item)" :class=" index ===0 ? 'pay-active' : '' " v-for="(item, index) in payList"
+            <div class="pay-item" @click.stop="createOrder(item)" :class=" this.payId == item.id ? 'pay-active' : '' " v-for="(item, index) in payList"
               :key="index">
               <img :src="item.icon" class="pay-icon" />
               <span>{{ item.name }}</span>

BIN
static/image/check-radio-active.png


BIN
static/image/check-radio.png