Explorar el Código

订单异常功能页面

ymy hace 2 años
padre
commit
2a6d0db08a

+ 7 - 0
src/api/question.ts

@@ -46,4 +46,11 @@ export function del(data:any){
 		method: 'POST',
 		params: data
 	})
+}
+//查询异常类型(仅系统异常)
+export function querySys(){
+	return request({
+		url: '/omsOrder/omsQuestionType/querySys',
+		method: 'GET'
+	})
 }

+ 8 - 0
src/benyun/components/byTable/byTable.vue

@@ -5,6 +5,8 @@
       :data="value"
       :size="attrs.size?attrs.size:'small'"
       resizable
+      sync-resize
+      auto-resize
       :height="attrs.height"
       :max-height="attrs.maxHeight"
       :stripe="attrs.stripe"
@@ -155,6 +157,11 @@ export default class ByTable extends VueViews {
       }
     })
   }
+  recalculate(){
+    if(this.$refs.table){
+      (this.$refs.table as any).recalculate();
+    }
+  }
   loadTableData(data:Array<any>){
     if(this.$refs.table){
       (this.$refs.table as any).loadData(data);
@@ -171,6 +178,7 @@ export default class ByTable extends VueViews {
     if(this.attrs.pageSize){
       this.page.pageSize = this.attrs.pageSize;
     }
+    this.recalculate();
   }
 
   //设置分页

+ 2 - 1
src/views/oms/order/components/addQuest.vue

@@ -1,5 +1,5 @@
 <template>
-  <vxe-modal v-model="value" id="addQuest" width="400" v-loading="load" @show="show" @hide="hide" height="200" show-zoom resize transfer show-footer title="新增异常类型">
+  <vxe-modal v-model="value" id="addQuest" width="400" v-loading="load" @show="show" @hide="hide" height="200" show-footer title="新增异常类型">
     <by-form :propConfig="config" ref="form"></by-form>
     <template #footer>
       <div class="btn">
@@ -28,6 +28,7 @@ export default class AddQuestModel extends Vue {
       [{
         label:'类型',
         prop:'type',
+        labelWidth:'80px',
         component:'by-input'
       }]
     ]

+ 5 - 5
src/views/oms/order/components/orderTool.vue

@@ -35,11 +35,11 @@
     <el-dropdown split-button type="text" class="dropdown">
       修改
       <el-dropdown-menu slot="dropdown">
-        <el-dropdown-item>添加赠品</el-dropdown-item>
-        <el-dropdown-item>改运费</el-dropdown-item>
-        <el-dropdown-item>改标签</el-dropdown-item>
-        <el-dropdown-item>改备注</el-dropdown-item>
-        <el-dropdown-item>设定业务员</el-dropdown-item>
+        <el-dropdown-item command="updateGift">添加赠品</el-dropdown-item>
+        <el-dropdown-item command="updateFreight">改运费</el-dropdown-item>
+        <el-dropdown-item command="updateTag">改标签</el-dropdown-item>
+        <el-dropdown-item command="updateRmk">改备注</el-dropdown-item>
+        <el-dropdown-item command="updateSalesman">设定业务员</el-dropdown-item>
         <!-- <el-dropdown-item>拆分</el-dropdown-item>
         <el-dropdown-item command="mergeOrder">合并</el-dropdown-item> -->
       </el-dropdown-menu>

+ 70 - 6
src/views/oms/order/components/questModel.vue

@@ -1,9 +1,9 @@
 <template>
-  <vxe-modal v-model="value" id="questModel" width="70%" v-loading="load" @show="show" height="80%" show-zoom resize transfer show-footer>
+  <vxe-modal v-model="value" id="questModel" width="70%" v-loading="load" @show="show" @hide="hide" height="80%" show-zoom resize transfer show-footer>
     <template #title>
       <span>异常类型</span>
     </template>
-    <by-table :propConfig="tableConfig" ref="table">
+    <by-table :propConfig="tableConfig" ref="table" id="quest-table">
       <template v-slot:ordered="{row}">
         <span v-if="row.isSystem == 1">{{ row.ordered }}</span>
         <vxe-input v-else v-model="row.ordered" size="small" type="number"></vxe-input>
@@ -17,6 +17,7 @@
           v-model="row.isShow"
           :active-value="1"
           :inactive-value="0"
+          @change="changeShow($event,row)"
           :disabled="row.isSystem == 1">
         </el-switch>
       </template>
@@ -32,7 +33,7 @@
 
 <script lang="ts">
 import { Component, Prop, Vue, Watch } from "vue-property-decorator";
-import { queryAll } from '@/api/question'
+import { queryAll,updateOrdered,updatePriority,updateShow,del } from '@/api/question'
 import AddQuestModel from "./addQuest.vue";
 @Component({components:{AddQuestModel}})
 export default class QuestModel extends Vue {
@@ -71,7 +72,7 @@ export default class QuestModel extends Vue {
             return row.isSystem != 1
           },
           click:(row:any) => {
-
+            this.sortHandle(row);
           }
         }
       },{
@@ -81,7 +82,7 @@ export default class QuestModel extends Vue {
             return row.isSystem != 1
           },
           click:(row:any) => {
-            
+            this.priorityHandle(row)
           }
         }
       },{
@@ -91,7 +92,7 @@ export default class QuestModel extends Vue {
             return row.isSystem != 1
           },
           click:(row:any) => {
-            
+            this.delHandle(row);
           }
         }
       }]
@@ -101,8 +102,68 @@ export default class QuestModel extends Vue {
   
   mounted(){
     
+  }
+  sortHandle(row:any){
+    this.load = true;
+    updateOrdered({
+      id:row.id,
+      ordered:row.ordered
+    }).then(()=>{
+      this.$message({message:'“'+row.type+'”'+'排序修改成功!',type:'success'})
+      this.load = false;
+      this.getQuestionList();
+    }).catch(()=>{
+      this.load = false;
+    })
+  }
+  priorityHandle(row:any){
+    this.load = true;
+    updatePriority({
+      id:row.id,
+      priority:row.priority
+    }).then(()=>{
+      this.$message({message:'“'+row.type+'”'+'优先级修改成功!',type:'success'})
+      this.load = false;
+      this.getQuestionList();
+    }).catch(()=>{
+      this.load = false;
+    })
+  }
+  changeShow(v:number,row:any){
+    this.load = true;
+    updateShow({
+      id:row.id,
+      isShow:v
+    }).then(()=>{
+      this.$message({message:'“'+row.type+'”'+'显示修改成功!',type:'success'})
+      this.load = false;
+      this.getQuestionList();
+    }).catch(()=>{
+      this.load = false;
+    })
+  }
+  delHandle(row:any){
+    this.$confirm('此操作将删除“'+row.type+'”, 是否继续?', '提示', {
+      confirmButtonText: '确定',
+      cancelButtonText: '取消',
+      type: 'warning'
+    }).then(() => {
+      this.load = true;
+        del({
+          id:row.id,
+        }).then(()=>{
+          this.$message({message:'删除成功!',type:'success'})
+          this.load = false;
+          this.getQuestionList();
+        }).catch(()=>{
+          this.load = false;
+        })
+    })
   }
   show(){
+    let height = (document.getElementById('quest-table') as any).parentNode.offsetHeight;
+    this.tableConfig.attr.height=height - 36;
+    (this.$refs.table as any).setConfig(this.tableConfig);
     this.getQuestionList()
   }
   handleSuccess(){
@@ -129,6 +190,9 @@ export default class QuestModel extends Vue {
   add(){
     (this.$refs.addQuestModel as any).setShow(true)
   }
+  hide(){
+    this.$emit('questHide')
+  }
 }
 </script>
 

+ 14 - 3
src/views/oms/order/index.vue

@@ -20,7 +20,9 @@
                 </div>
                 <el-collapse-transition>
                   <div class="ques-list"  v-show="showQues">
-                    <el-checkbox v-for="item of questData" :label="item.id" :key="item.value">{{item.type}}</el-checkbox>
+                    <template v-for="item of questData">
+                      <el-checkbox :label="item.id" v-if="item.isShow == 1" :key="item.value">{{item.type}}</el-checkbox>
+                    </template>
                   </div>
                 </el-collapse-transition>
               </div>
@@ -162,7 +164,7 @@
     <div class="order-right">
       <div class="tool">
         <order-tool @addOrder="addOrder" @smt="smtOrder" @reSmt="reSmt" @loadOrder="loadOrder" @producePurchase="producePurchase" @cancelOrder="cancelOrder" 
-        @reCancelOrder="reCancelOrder"/>
+        @reCancelOrder="reCancelOrder" @updateRmk="updateRmk"/>
       </div>
       <div class="table">
         <order-table :data="data" ref="orderTable" class="order-table" @detail="detail" @mergeHandle="mergeHandle" @splitHandle="splitHandle"/>
@@ -184,7 +186,7 @@
       <!-- 取消订单 -->
       <cancel-order-model ref="cancelOrderModel" @handleSuccess="handleSuccess" />
       <!-- 异常 -->
-      <quest-model ref="questModel" />
+      <quest-model ref="questModel" @questHide="getQuestionList" />
     </div>
   </div>
 </template>
@@ -481,6 +483,15 @@ export default class Order extends Vue {
     this.getProvince();
     this.getQuestionList();
   }
+  updateRmk(){
+    let data = (this.$refs.table as any).getValue();
+    if(data.length == 0){
+      this.$message('请选择订单');
+      return
+    }
+    
+  }
+  //异常数据弹窗
   showQuestType(){
     (this.$refs.questModel as any).setShow(true);
   }

+ 65 - 0
src/views/oms/quesType/components/addQuest.vue

@@ -0,0 +1,65 @@
+<template>
+  <vxe-modal v-model="value" id="addQuest" width="400" v-loading="load" @show="show" @hide="hide" height="200" show-footer title="新增异常类型">
+    <by-form :propConfig="config" ref="form"></by-form>
+    <template #footer>
+      <div class="btn">
+        <el-button type="primary" size="small" @click="btn">确定</el-button>
+      </div>
+    </template>
+  </vxe-modal>
+</template>
+
+<script lang="ts">
+import { Component, Prop, Vue, Watch } from "vue-property-decorator";
+import { save } from '@/api/question'
+@Component({components:{}})
+export default class AddQuestModel extends Vue {
+  value = false;
+  load = false;
+  config:any={
+    attr:{
+      rules:{
+        type: [
+          { required: true, message: '请输入类型', trigger: 'blur' }
+        ]
+      }
+    },
+    columns:[
+      [{
+        label:'类型',
+        prop:'type',
+        labelWidth:'80px',
+        component:'by-input'
+      }]
+    ]
+  }
+  show(){
+    
+  }
+  hide(){
+    (this.$refs.form as any).clearValidate();
+    (this.$refs.form as any).clearValue();
+  }
+  setShow(v:boolean){
+    this.value = v;
+  }
+  btn(){
+    (this.$refs.form as any).validate().then(()=>{
+      let data = (this.$refs.form as any).getValue();
+      data.isSystem = 1;
+      this.load = true
+      save(data).then(()=>{
+        this.load = false;
+        this.$emit('handleSuccess');
+        this.value = false;
+      }).catch(()=>{
+        this.load = false;
+      })
+    })
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+
+</style>

+ 191 - 0
src/views/oms/quesType/index.vue

@@ -0,0 +1,191 @@
+<template>
+  <div class="ques" id="questTypePage" v-loading="load">
+    <by-tool :propConfig="tool" class="tool" @clickHandle="clickHandle" />
+    <by-table :propConfig="tableConfig" ref="table">
+      <template v-slot:ordered="{row}">
+        <vxe-input v-model="row.ordered" size="small" type="number"></vxe-input>
+      </template>
+      <template v-slot:priority="{row}">
+        <vxe-input v-model="row.priority" size="small" type="number"></vxe-input>
+      </template>
+      <template v-slot:isShow="{row}">
+        <el-switch
+          v-model="row.isShow"
+          :active-value="1"
+          :inactive-value="0"
+          @change="changeShow($event,row)">
+        </el-switch>
+      </template>
+    </by-table>
+    <add-quest-model ref="addQuestModel" @handleSuccess="getQuestionList" />
+  </div>
+</template>
+
+<script lang="ts">
+import { Component, Prop, Vue, Watch } from "vue-property-decorator";
+import { querySys,updateOrdered,updatePriority,updateShow,del } from '@/api/question'
+import AddQuestModel from "./components/addQuest.vue";
+@Component({components:{AddQuestModel}})
+export default class QuestType extends Vue {
+  load=false;
+  tool={
+    tools:{
+      add:true,
+      refresh:true
+    },
+    audit:{
+      add:'oms:quesType:add',
+    },
+  }
+  tableConfig:any={
+    attr:{
+      size:'mini',
+      align:'center',
+      seq:true
+    },
+    columns:[{
+      title:'类型',
+      field:'type'
+    },{
+      title:'排序',
+      field:'ordered',
+      width:150,
+      slot:true
+    },{
+      title:'优先级',
+      field:'priority',
+      width:150,
+      slot:true
+    },{
+      title:'显示',
+      field:'isShow',
+      width:150,
+      slot:true
+    },{
+      title:'操作',
+      action:true,
+      width:200,
+      plugins:[{
+        name:'排序',
+        event:{
+          click:(row:any) => {
+            this.sortHandle(row);
+          }
+        }
+      },{
+        name:'优先级',
+        event:{
+          click:(row:any) => {
+            this.priorityHandle(row)
+          }
+        }
+      },{
+        name:'删除',
+        event:{
+          click:(row:any) => {
+            this.delHandle(row);
+          }
+        }
+      }]
+    }]
+  }
+  mounted(){
+    let height = (document.getElementById('questTypePage') as any).offsetHeight;
+    this.tableConfig.attr.height=height - 32 - 48;
+    if(this.$refs.table){
+      (this.$refs.table as any).setConfig(this.tableConfig);
+    }
+    this.getQuestionList();
+  }
+  sortHandle(row:any){
+    this.load = true;
+    updateOrdered({
+      id:row.id,
+      ordered:row.ordered
+    }).then(()=>{
+      this.$message({message:'“'+row.type+'”'+'排序修改成功!',type:'success'})
+      this.load = false;
+      this.getQuestionList();
+    }).catch(()=>{
+      this.load = false;
+    })
+  }
+  priorityHandle(row:any){
+    this.load = true;
+    updatePriority({
+      id:row.id,
+      priority:row.priority
+    }).then(()=>{
+      this.$message({message:'“'+row.type+'”'+'优先级修改成功!',type:'success'})
+      this.load = false;
+      this.getQuestionList();
+    }).catch(()=>{
+      this.load = false;
+    })
+  }
+  changeShow(v:number,row:any){
+    this.load = true;
+    updateShow({
+      id:row.id,
+      isShow:v
+    }).then(()=>{
+      this.$message({message:'“'+row.type+'”'+'显示修改成功!',type:'success'})
+      this.load = false;
+      this.getQuestionList();
+    }).catch(()=>{
+      this.load = false;
+    })
+  }
+  delHandle(row:any){
+    this.$confirm('此操作将删除“'+row.type+'”, 是否继续?', '提示', {
+      confirmButtonText: '确定',
+      cancelButtonText: '取消',
+      type: 'warning'
+    }).then(() => {
+      this.load = true;
+        del({
+          id:row.id,
+        }).then(()=>{
+          this.$message({message:'删除成功!',type:'success'})
+          this.load = false;
+          this.getQuestionList();
+        }).catch(()=>{
+          this.load = false;
+        })
+    })
+  }
+  //获取异常数据
+  getQuestionList(){
+    this.load = true;
+    querySys().then((res:any) => {
+      if(this.$refs.table){
+        (this.$refs.table as any).setValue(res.data);
+      }
+      this.load = false;
+    }).catch((err:any) => {
+      this.load = false;
+    })
+  }
+
+  clickHandle(e:string){
+    if(e == 'onAdd'){
+      (this.$refs.addQuestModel as any).setShow(true)
+    }
+    if(e == 'onRefresh'){
+      this.getQuestionList();
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.ques{
+  width: 100%;
+  height: 100%;
+  padding: 16px;
+  box-sizing: border-box;
+  .tool{
+    padding-bottom: 16px;
+  }
+}
+</style>