Browse Source

店铺管理

ymy 2 years ago
parent
commit
5184efb03e

+ 1 - 1
src/api/shop.ts

@@ -32,6 +32,6 @@ export function del(data:any) {
 	return request({
 		url: '/omsOrder/omsShop/delete',
 		method: 'POST',
-		data:data
+		params:data
 	})
 }

+ 2 - 0
src/benyun/compVue/ModuleViewHandle.ts

@@ -6,6 +6,7 @@ export default class ModuleViewHandle extends VueViews{
   toolID=this.getUuid(); // 工具栏id
   tableID=this.getUuid(); //表格id
   viewID=this.getUuid();
+  formID=this.getUuid();
   hideSearch=false  // 隐藏/显示搜索
   load=false
   time:any;
@@ -106,6 +107,7 @@ export default class ModuleViewHandle extends VueViews{
 
   //刷新
   onRefresh(){
+    (this.$refs[this.tableID] as any).setPage({pageNo:1,total:0});
 		this.$emit('onRefresh')
   }
   // onRefresh(){

+ 11 - 12
src/benyun/components/byForm/byForm.vue

@@ -244,19 +244,18 @@ export default class ByForm extends VueViews {
         resolve(true)
       }
       (this as any).$refs.byForm.validate((valid:any) => {
-          if (valid) {
-            resolve(true)
-          } else {
-            if(!parames || !parames.noMsg){
-              (this as any).$message({
-                message: '验证未通过,请检查!',
-                type: 'warning',
-              })
-            }
-            
-            reject()
+        if (valid) {
+          resolve(true)
+        } else {
+          if(!parames || !parames.noMsg){
+            (this as any).$message({
+              message: '验证未通过,请检查!',
+              type: 'warning',
+            })
           }
-        });
+          reject()
+        }
+      });
     })
   }
   //清除过滤提示

+ 1 - 1
src/benyun/components/bySwitch/bySwitch.vue

@@ -6,7 +6,7 @@
     :disabled="attrs.disabled"
     :width="attrs.width"
     :active-text="attrs.activeText"
-    :inactive-text="attts.inactiveText"
+    :inactive-text="attrs.inactiveText"
     :active-value="attrs.activeValue"
     :inactive-value="attrs.inactiveValue"
     @change="change"

+ 17 - 2
src/benyun/components/moduleView/moduleView.vue

@@ -29,7 +29,7 @@
           <by-tool :propConfig="modalConfig.tool" @clickHandle="modalHandle" />
         </div>
         <div class="view-form">
-          <by-form :propConfig="modalConfig.form"></by-form>
+          <by-form :propConfig="modalConfig.form" :ref="formID"></by-form>
         </div>
       </div>
     </transition>
@@ -114,6 +114,7 @@ export default class ModuleView extends ModuleViewHandle {
     }
   }
   search(){
+    (this.$refs[this.tableID] as any).setPage({pageNo:1,total:0});
     this.$emit('search');
     // this.searchHandle()
   }
@@ -148,7 +149,9 @@ export default class ModuleView extends ModuleViewHandle {
     }else{
       this.$emit('modalHandle',e)
     }
-    
+  }
+  closeModal(){
+    this.modalShow=false;
   }
   getSelectData(){
     let data:Array<any>=[];
@@ -186,6 +189,18 @@ export default class ModuleView extends ModuleViewHandle {
     this.$emit('pagination',page)
     // this.getList();
   }
+  getFormValidate(callBack:Function){
+    (this.$refs[this.formID] as any).validate().then(()=>{
+      callBack()
+    })
+  }
+  getFormValue(){
+    if(this.$refs[this.formID]){
+      (this.$refs[this.formID] as any)
+      return (this.$refs[this.formID] as any).getValue();
+    }
+    return null
+  }
 
   onChangeRow(row:any){
     this.$emit('onChangeRow',row);

+ 232 - 52
src/views/oms/shop/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="shop">
-    <module-view :propConfig="config" ref="view" v-loading="load" style="height:100%" @pagination="pagination" />
-
+    <module-view :propConfig="config" ref="view" v-loading="load" style="height:100%" @pagination="pagination" @modalHandle="modalHandle" @onRefresh="getList" 
+    @resert="queryList" @search="queryList" @clickHandle="clickHandle" />
   </div>
 </template>
 
@@ -14,6 +14,7 @@ export default class Shop extends Vue {
   load=false;
   time:any;
   timeNum = 0;
+  isSearch=false;
   config:any={
     attr:{
       calculateH:true
@@ -274,19 +275,48 @@ export default class Shop extends Vue {
         title:'创建时间',
         field:'createTime',
         width:150
+      },{
+        title:'操作',
+        action:true,
+        width:100,
+        plugins:[{
+          name:'删除',
+          event:{
+            click:(item:any) => {
+              // this.del(item);
+            }
+          }
+        }]
       }]
     },
     modal:{
       tool:{
         tools:{
           return:true,
-          save:true
+          add:true
         }
       },
       form:{
         attr:{
           size:'small',
-          labelWidth:'130px'
+          labelWidth:'130px',
+          rules:{
+            shopName:[
+              { required: true, message: '请输入店铺名称', trigger: 'blur' }
+            ],
+            shopId:[
+              { required: true, message: '请输入店铺编号', trigger: 'blur' }
+            ],
+            channelName:[
+              {required: true, message: '请输入所属平台', trigger: 'blur'}
+            ],
+            channel:[
+              { required: true, message: '请输入平台类型', trigger: 'blur' }
+            ],
+            authStatus:[
+              { required: true, message: '请选择授权状态', trigger: 'change' }
+            ]
+          }
         },
         columns:[
           [{
@@ -338,7 +368,22 @@ export default class Shop extends Vue {
           },{
             label:'授权状态',
             prop:'authStatus',
-            component:shopTag
+            component:'by-select',
+            compConfig:{
+              clearable:true,
+              attr:{
+                data:[{
+                  value:'Authorized',
+                  label:'已授权'
+                },{
+                  value:'Unauthorized',
+                  label:'未授权'
+                },{
+                  value:'Expired',
+                  label:'已过期'
+                }]
+              }
+            }
           }],
           [{
             label:'APP KEY',
@@ -375,12 +420,12 @@ export default class Shop extends Vue {
             component:'by-date-picker'
           }],
           [{
-            label:'店铺状态',
-            prop:'shopStatus',
+            label:'京东授权状态',
+            prop:'jdAuthStatus',
             component:'by-input'
           },{
-            label:'退款状态',
-            prop:'refundStatus',
+            label:'京东拒绝申请原因',
+            prop:'jdRejectReason',
             component:'by-input'
           },{
             label:'身份证号',
@@ -423,12 +468,12 @@ export default class Shop extends Vue {
             component:'by-input'
           }],
           [{
-            label:'同步发货',
-            prop:'enableSyncSend',
+            label:'支付宝授权状态',
+            prop:'alipayAuthStatus',
             component:'by-input'
           },{
-            label:'揽收轨迹同步发货',
-            prop:'enableTrackSyncSend',
+            label:'菜鸟电子面单',
+            prop:'enableCainiaoElectronicBill',
             component:'by-input'
           },{
             span:12,
@@ -436,23 +481,6 @@ export default class Shop extends Vue {
             prop:'returnAdress',
             component:'by-input'
           }],
-          [{
-            label:'拆分订单整单发货',
-            prop:'enableSplitOrderFullSend',
-            component:'by-input'
-          },{
-            label:'同步库存',
-            prop:'enableSynvStore',
-            component:'by-input'
-          },{
-            label:'订单下载',
-            prop:'enableSyncOrder',
-            component:'by-input'
-          },{
-            label:'天猫物流升级',
-            prop:'enableTmallLogistics',
-            component:'by-input'
-          }],
           [{
             label:'下载截止时间',
             prop:'endPullTime',
@@ -470,56 +498,138 @@ export default class Shop extends Vue {
             prop:'enableTaobaoMessageNotice',
             component:'by-input'
           }],
+          [{
+            label:'拆分订单整单发货',
+            prop:'enableSplitOrderFullSend',
+            component:'by-switch',
+            compConfig:{
+              activeValue:1,
+              inactiveValue:0
+            }
+          },{
+            label:'同步库存',
+            prop:'enableSynvStore',
+            component:'by-switch',
+            compConfig:{
+              activeValue:1,
+              inactiveValue:0
+            }
+          },{
+            label:'订单下载',
+            prop:'enableSyncOrder',
+            component:'by-switch',
+            compConfig:{
+              activeValue:1,
+              inactiveValue:0
+            }
+          },{
+            label:'天猫物流升级',
+            prop:'enableTmallLogistics',
+            component:'by-switch',
+            compConfig:{
+              activeValue:1,
+              inactiveValue:0
+            }
+          }],
+          
           [{
             label:'商品下载',
             prop:'enableSkuDownload',
-            component:'by-input'
+            component:'by-switch',
+            compConfig:{
+              activeValue:1,
+              inactiveValue:0
+            }
           },{
             label:'开启链接库存同步',
             prop:'enableLinkSync',
-            component:'by-input'
+            component:'by-switch',
+            compConfig:{
+              activeValue:1,
+              inactiveValue:0
+            }
           },{
             label:'是否虾皮SIP',
             prop:'shopeeSip',
-            component:'by-input'
+            component:'by-switch',
+            compConfig:{
+              activeValue:1,
+              inactiveValue:0
+            }
           },{
-            label:'支付宝授权状态',
-            prop:'alipayAuthStatus',
-            component:'by-input'
+            label:'同步发货',
+            prop:'enableSyncSend',
+            component:'by-switch',
+            compConfig:{
+              activeValue:1,
+              inactiveValue:0
+            }
           }],
           [{
-            label:'京东授权状态',
-            prop:'jdAuthStatus',
-            component:'by-input'
+            label:'店铺状态',
+            prop:'shopStatus',
+            component:'by-switch',
+            compConfig:{
+              activeValue:1,
+              inactiveValue:0
+            }
           },{
-            label:'京东拒绝申请原因',
-            prop:'jdRejectReason',
-            component:'by-input'
+            label:'退款状态',
+            prop:'refundStatus',
+            component:'by-switch',
+            compConfig:{
+              activeValue:'1',
+              inactiveValue:'0'
+            }
           },{
             label:'启用分销',
             prop:'enableDistribution',
-            component:'by-input'
+            component:'by-switch',
+            compConfig:{
+              activeValue:1,
+              inactiveValue:0
+            }
           },{
-            label:'菜鸟电子面单',
-            prop:'enableCainiaoElectronicBill',
-            component:'by-input'
+            label:'揽收轨迹同步发货',
+            prop:'enableTrackSyncSend',
+            component:'by-switch',
+            compConfig:{
+              activeValue:1,
+              inactiveValue:0
+            }
           }],
           [{
             label:'售后单下载',
             prop:'enableSyncAfterSale',
-            component:'by-input'
+            component:'by-switch',
+            compConfig:{
+              activeValue:1,
+              inactiveValue:0
+            }
           },{
             label:'开通AG',
             prop:'enableAg',
-            component:'by-input'
+            component:'by-switch',
+            compConfig:{
+              activeValue:1,
+              inactiveValue:0
+            }
           },{
             label:'确认收货自动退款',
             prop:'enableAutoRefund',
-            component:'by-input'
+            component:'by-switch',
+            compConfig:{
+              activeValue:1,
+              inactiveValue:0
+            }
           },{
             label:'开启跨境操作',
             prop:'enableCbec',
-            component:'by-input'
+            component:'by-switch',
+            compConfig:{
+              activeValue:1,
+              inactiveValue:0
+            }
           }]
         ]
       }
@@ -533,8 +643,41 @@ export default class Shop extends Vue {
       this.getList()
     })
   }
+  del(){
+    let data = (this.$refs.view as any).getSelectData()
+    if(data.length == 0){
+      this.$message('请选择店铺!')
+      return
+    }
+    let ids:Array<any>=[];
+    for(const item of data){
+      ids.push(item.id);
+    }  
+
+    this.$confirm('此操作将永久删除该店铺, 是否继续?', '提示', {
+      confirmButtonText: '确定',
+      cancelButtonText: '取消',
+      type: 'warning'
+    }).then(() => {
+      this.load = true;
+      del({ids:ids}).then(()=>{
+        this.load = false;
+        this.$message({
+          message:'删除成功!',
+          type:'success'
+        })
+      }).catch(()=>{
+        this.load = false;
+      })
+    }).catch(() => {});
+    
+  }
   pagination(){
-    this.getList();
+    if(this.isSearch){
+      this.queryList();
+    }else{
+      this.getList()
+    }
   }
   getList(){
     if(!this.$refs.view){
@@ -547,7 +690,17 @@ export default class Shop extends Vue {
       this.timeNum ++;
       return
     }
+    this.isSearch = false;
+    let data = (this.$refs.view as any).getPage();
+    this.requestList(data);
+  }
+  
+  queryList(){
+    this.isSearch = true;
     let data = (this.$refs.view as any).getQuery();
+    this.requestList(data);
+  }
+  requestList(data:any){
     this.load = true;
     query(data).then((res:any) => {
       this.load = false;
@@ -562,7 +715,34 @@ export default class Shop extends Vue {
     }).catch(()=>{
       this.load = false;
     })
-
+  }
+  modalHandle(n:string){
+    if(n == 'onAdd'){
+      (this.$refs.view as any).getFormValidate(this.addShop)
+      
+    }
+  }
+  clickHandle(n:string){
+    if(n == 'onDelete'){
+      this.del();
+    }
+  }
+  addShop(){
+    let value = (this.$refs.view as any).getFormValue();
+    if(value){
+      this.load = true;
+      save(value).then((res:any)=>{
+        this.load = false;
+        this.$message({
+          message:res.msg,
+          type:'success'
+        });
+        (this.$refs.view as any).closeModal();
+        this.getList();
+      }).catch(()=>{
+        this.load = false;
+      })
+    }
   }
 }
 </script>