Browse Source

1. 优化

MONSTER-ygh 4 months ago
parent
commit
b5b9f2de02

+ 303 - 0
src/views/tourism/orderManagement/hotelsOrders/formBox/cancelOrder.vue

@@ -0,0 +1,303 @@
+<template>
+  <el-dialog
+    :title="title"
+    :visible.sync="open"
+    width="40%"
+    append-to-body
+    :close-on-click-modal="false"
+    @close="cancel"
+  >
+    <div class="form-dialog-box"
+    v-loading="loading"
+    :element-loading-text="loadingText"
+    element-loading-spinner="el-icon-loading"
+    element-loading-background="rgba(0, 0, 0, 0)">
+      <div
+        v-loading="loading"
+        :element-loading-text="''"
+        element-loading-spinner="''"
+        element-loading-background="rgba(0, 0, 0, 0.8)"
+        >
+        <el-form :model="form" ref="form" :rules="rules" label-width="130px">
+          <el-form-item 
+          label="取消原因:" 
+          prop="closeReason">
+            <el-input 
+            style="width: 350px;"
+             v-model="form.closeReason" 
+             placeholder="请输入回复内容" 
+             maxlength="150" 
+             show-word-limit 
+             type="textarea"
+            :rows="6"
+             />
+          </el-form-item>
+        </el-form>
+      </div>
+    </div>
+    <span slot="footer" class="dialog-footer" v-if="formStatus==1">
+      <el-button @click="cancel">取消</el-button>
+      <el-button
+        type="primary"
+        @click="submitForm"
+        :loading="loading"
+        element-loading-text="提交中..."
+        element-loading-spinner="el-icon-loading"
+        element-loading-background="rgba(0, 0, 0, 0.8)"
+      > 
+        {{ loading ? '提交中...' : '确认' }}
+      </el-button>
+    </span>
+    <!-- 添加或修改对话框 End -->
+  </el-dialog>
+</template>
+
+<script>
+import { 
+  addTableApi
+ } from '@/api/CURD'
+export default {
+  name: "repastOrderAccept",
+  data() {
+    return {
+      title: "",
+      activeName: 'first',
+      model: "", // EDIT: 编辑模式 ADD : 新增模式  EDITInit : 编辑模式(需要请求详情)
+      open: false,
+      loading: false,
+      loadingText: "拼命加载数据中...",
+      formStatus: null, // 0/null : 加载中 1 : 获取详情成功 2  : 获取详情失败 
+      configUrl: {
+        add: '/order/ordernfo/cancel', // 新增地址
+        details: '', // 详情地址
+        edit: '/order/ordernfo/cancel', // 编辑地址
+      },
+      form: {
+        id: undefined,
+      },
+      rules: {
+        closeReason: [{ required: false, message: "请输入取消原因", trigger: ["change","blur"] }],
+      },
+      scenicAreaProducts: [],// 景点产品关联
+
+      //  上传文件
+      actionUrl: process.env.VUE_APP_BASE_API + process.env.VUE_APP_UPLOAD_IMAGE,
+      actionUrlLoading: false,
+    };
+  },
+  methods: {
+    async initData(title , model,row){
+      this.title = title
+      this.open = true
+      this.loadingText = "拼命加载数据中..."
+      this.loading = true
+      this.actionUrlLoading = false
+      this.model = model
+      this.formStatus = 0
+      if(model=='ADD') { // 新增
+        this.$set(this,'form',{
+          ...row,
+        })
+        this.formStatus = 1
+      }else if(model=='EDIT') { // 新增
+        let obj = {
+          orderId: row.id,
+          closeReason: ''
+        }
+        this.$set(this,'form',obj)
+        this.formStatus = 1
+      }
+      this.loading = false
+      this.$nextTick(()=>{
+        if(this.$refs["form"]) {
+          this.$refs["form"].clearValidate();
+        }
+      })
+    },
+    /**
+     * 保存
+     * @date 2023-11-22
+     * @returns {any}
+     */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          this.loadingText = "提交数据中..."
+          this.loading = true
+          let params = JSON.parse(JSON.stringify(this.form))
+          addTableApi(this.configUrl.edit,{
+            ...params,
+          }).then(response => {
+              this.$modal.msgSuccess("发货成功");
+              this.loading = false
+              this.open = false;
+              this.$emit('refresh')
+          }).catch(()=>{
+              this.$message.error("发货失败!!!");
+              this.loading = false
+          })
+        }
+      });
+    },
+    /**
+     * 重置
+     * @date 2023-11-22
+     * @returns {any}
+     */
+    reset() {
+      if(this.$refs["form"]) {
+        this.$refs["form"].clearValidate();
+      }
+    },
+    /**
+     * 关闭弹框
+     * @date 2023-11-22
+     * @returns {any}
+     */
+    cancel() {
+      this.reset();
+      this.open = false;
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.form-dialog-box {
+  padding: 0 30px;
+  padding: 0 30px;
+  min-height: 30vh;
+  max-height: 65vh;
+  overflow-y: auto;
+  >div {
+    width: 100%;
+    min-height: 30vh;
+  }
+  .form-title {
+    padding: 0 0 10px 0;
+    span {
+      display: flex;
+      color: rgba(65,80,88,1);
+      font-size: 16px;
+      font-family: SourceHanSansSC;
+      font-weight: 700;
+      line-height: 23px;
+      border-left: 4px solid rgb(22, 132, 252);
+      padding-left: 10px;
+    }
+    
+  }
+  ::v-deep .ql-editor {
+    height: 400px;
+  }
+  .upload-btn {
+    width: 100px;
+    height: 100px;
+    background-color: #fbfdff;
+    border: dashed 1px #c0ccda;
+    border-radius: 5px;
+    i {
+      font-size: 30px;
+      margin-top: 20px;
+    }
+    &-text {
+      margin-top: -10px;
+    }
+  }
+  .avatar {
+    cursor: pointer;
+  }
+}
+.el-table{
+  .upload-btn {
+    width: 100px;
+    height: 100px;
+    background-color: #fbfdff;
+    border: dashed 1px #c0ccda;
+    border-radius: 5px;
+    i {
+      font-size: 30px;
+      margin-top: 20px;
+    }
+    &-text {
+      margin-top: -10px;
+    }
+  }
+  .avatar {
+    cursor: pointer;
+  }
+}
+
+.area-container {
+  min-height: 400px;
+}
+
+::v-deep .area-wrap-city.el-cascader {
+  line-height: normal;
+  .el-input {
+    cursor: pointer;
+    width: 100% !important;
+    height: 28px !important;
+    .el-input__inner {
+      display: none !important;
+    }
+    span.el-input__suffix {
+      position: inherit !important;
+      i.el-input__icon {
+        line-height: inherit;
+        margin-left: 5px;
+      }
+    }
+
+    .el-input__wrapper {
+      box-shadow: none;
+      input {
+        display: none;
+      }
+    }
+  }
+
+  .el-cascader__tags {
+    display: none;
+  }
+}
+
+.area-city-popper {
+  .el-cascader-panel {
+    .el-scrollbar.el-cascader-menu {
+      .el-cascader-menu__wrap.el-scrollbar__wrap {
+        height: 315px;
+      }
+    }
+  }
+}
+
+::v-deep .avatar-uploader .el-upload {
+    border: 1px dashed #d9d9d9;
+    border-radius: 6px;
+    cursor: pointer;
+    position: relative;
+    overflow: hidden;
+  }
+  ::v-deep .avatar-uploader .el-upload:hover {
+    border-color: #409EFF;
+  }
+  ::v-deep .avatar-uploader-icon {
+    font-size: 28px;
+    color: #8c939d;
+    width: 100px;
+    height: 100px;
+    line-height: 100px;
+    text-align: center;
+  }
+  ::v-deep .avatar {
+    width: 100px;
+    height: 100px;
+    display: block;
+  }
+</style>
+<style>
+.custom-class-box {
+  z-index: 999999 !important;
+}
+</style>

+ 17 - 2
src/views/tourism/orderManagement/hotelsOrders/hotelsOrders.vue

@@ -189,6 +189,13 @@
                   v-hasPermi="configPermi.repastOrderAccept"
                   v-if="scope.row.orderStatus == 3"
                 >拒单</el-button>
+                <el-button
+                  size="mini"
+                  type="text"
+                  icon="el-icon-delete"
+                  @click="cancelOrderFun(scope.row)"
+                  v-hasPermi="configPermi.cancelOrder"
+                >取消</el-button>
               </template>
             </el-table-column>
           </el-table>
@@ -206,6 +213,8 @@
       <detailsBox ref="detailsBox" @refresh="getList"></detailsBox>
       <!-- 发货  -->
       <repastOrderAccept ref="repastOrderAccept" @refresh="getList"></repastOrderAccept>
+      <!--  取消订单 -->
+      <cancelOrder ref="cancelOrder" @refresh="getList"></cancelOrder>
     </div>
   </template>
 
@@ -213,13 +222,14 @@
   import {
     listTableApi,
     delTableParamsApi,
-    } from "@/api/CURD";
+  } from "@/api/CURD";
   import detailsBox from "./detailsBox/hotelsOrdersDetails.vue"
   import repastOrderAccept from "./formBox/repastOrderAccept.vue";
+  import cancelOrder from "./formBox/cancelOrder.vue";
   export default {
     name: "User",
     dicts: ['tourism_ticketOrders_source','tourism_ticketOrders_status','tourism_ticketOrders_payStatus','tourism_ticketOrders_payWay'],
-    components: {detailsBox,repastOrderAccept},
+    components: {detailsBox,repastOrderAccept,cancelOrder},
     data() {
       return {
         title: "酒店订单",// 通用标题
@@ -231,6 +241,7 @@
           export: ['orderManagement:hotelsOrders:export'],// 导出权限
           delivery: [''],// 发货
           repastOrderAccept: ['orderManagement:hotelsOrders:repastOrderAccept'],
+          cancelOrder: ['orderManagement:hotelsOrders:cancelOrder']
         },
         configUrl: {
           list: '/order/orderInfo/hotelOrderList', // 列表地址
@@ -399,6 +410,10 @@
           })
         }
       },
+      /**  取消订单  */
+      cancelOrderFun(row){
+        this.$refs.cancelOrder.initData(`取消订单操作`, "EDIT",{...row})
+      }
     }
   };
   </script>