Bladeren bron

优化请求接口数量,提取公共接口本地储存数据,完善权限,修改Tb上bug

ltx529596 4 jaren geleden
bovenliggende
commit
4fb17b7506

+ 2 - 1
src/App.vue

@@ -7,6 +7,7 @@ export default {
   onHide () {
   },
   methods: {
+   
     // 数据初始化
     async initData () {
       const token = uni.getStorageSync('accessToken');
@@ -23,7 +24,7 @@ export default {
     initSystemInfo () {
       uni.getSystemInfo({
         success (e) {
-          console.log(e);
+          // console.log(e);
           // #ifndef MP
           Vue.prototype.StatusBar = e.statusBarHeight;
           if (e.platform == 'android') {

+ 0 - 0
src/Json.js


+ 11 - 16
src/components/tabbar/tabbar.vue

@@ -7,7 +7,7 @@
           <view class="icon">
             <view :class="item.code" class="iconbgc"></view>
           </view>
-          <view class="text">{{ item.name }}</view>
+          <view class="text">{{ item.name }} </view>
         </view>
       </view>
     </view>
@@ -18,38 +18,33 @@
 
 export default {
   name: 'tabbar',
-  components: {},
   props:{
     currentIndex:{
       type:Number,
       default: 0
-    },
-    role:{
-      type:Array,
-      role:[]
     }
   },
   data () {
     //这里存放数据
     return {
       roleList:[]
-      // role: [
-      //   { name: '首页管理', code: 'index' },
-      //   { name: '订单管理', code: 'order' },
-      //   { name: '商品管理', code: 'shop' }
-      // ]
     };
   },
   onReady () {
-    // this.roleList = this.$mStore.getters.hasrole.reverse()
-    let role = uni.getStorageSync('role')
-    this.roleList = role.reverse()
+    if (uni.getStorageSync('role') ) {
+      this.roleList = uni.getStorageSync('role')
+    } else {
+      return this.roleList = null
+    }
+  },
+  onShow () {
   },
   onLoad () {},
-  //方法集合
+  //方法集合`······
   methods: {
     switchTab (index, url) {
-      this.$emit('iscurrentIndex',index)
+      console.log(index);
+      this.$mStore.commit('changeRole',index)
       this.$mRouter.switchTab({ route: `/pages/${url}/${url}` })
     }
   }

+ 2 - 3
src/config/index.config.js

@@ -2,8 +2,8 @@ const CONFIG = {
     //开发环境配置
     development: {
         assetsPath: '/static', // 静态资源路径
-        baseUrl: 'http://tyou.xiudo.cn/merch',  // 后台接口请求地址
-        // baseUrl: 'http://192.168.100.135:83/merch',  // 后台接口请求地址
+        // baseUrl: 'http://tyou.xiudo.cn/merch',  // 后台接口请求地址
+        baseUrl: 'http://192.168.100.135:83/merch',  // 后台接口请求地址
         hostUrl: 'http://localhost:8080',        // H5地址(前端运行地址)
         websocketUrl: '',        // websocket服务端地址
         weixinAppId: '', // 微信公众号appid
@@ -18,6 +18,5 @@ const CONFIG = {
         weixinAppId: '', // 微信公众号appid
         uploadUrl: 'https://you.xiudo.cn/merch/common/upload/oss'
     }
-
 };
 export default CONFIG[process.env.NODE_ENV];

+ 0 - 24
src/demo.vue

@@ -1,24 +0,0 @@
-<template>
-    <div>
-        <select-tree @choose='choose' v-model='selectList'></select-tree>
-    </div>
-</template>
-
-<script>
-import selectTree from '@/components/DLHTX-select_tree/DLHTX-select_tree'
-    export default {
-        components: {
-            selectTree,
-        },
-        methods: {
-            choose(e){
-                console.log(e)
-            }
-        },
-    }
-
-</script>
-
-<style lang="scss" scoped>
-
-</style>

+ 0 - 1
src/main.js

@@ -25,7 +25,6 @@ import rfImage from '@/components/rf-image/rf-image';
 import rfEmpty from '@/components/rf-empty';
 import rfLoading from '@/components/rf-loading/rf-loading';
 import rfLoadProgress from '@/components/rf-load-progress/rf-load-progress';
-// import tabBar from '@/components/tabbar.vue';
 import tabBar from '@/components/tabbar/tabbar.vue';
 
 // 网络状态监听

+ 16 - 1
src/pages.json

@@ -1,6 +1,14 @@
 {
   "pages": [
     {
+      "path": "pages/index/blankPage",
+      "style": {
+        "navigationBarTitleText": "",
+        "navigationBarTextStyle": "black",
+        "navigationBarBackgroundColor":"#ffffff"
+      }
+    },
+    {
       "path": "pages/index/index",
       "style": {
         "navigationBarTitleText": "店铺首页",
@@ -170,7 +178,14 @@
 		"borderStyle": "black",
     "backgroundColor": "#ffffff",
     "custom": true,
-    "list": [{
+    "list": [
+    {
+			"pagePath": "pages/index/blankPage",
+			"text": "",
+			"iconPath": "static/images/index.png",
+			"selectedIconPath": "static/images/index_active.png"
+    },
+    {
 			"pagePath": "pages/index/index",
 			"text": "店铺首页",
 			"iconPath": "static/images/index.png",

+ 47 - 26
src/pages/goods/goods.vue

@@ -183,9 +183,11 @@
       </view>
     </view>
 
-    <tabBar :currentIndex="typeNum"></tabBar>
+
     <uni-load-more :status="more"> </uni-load-more>
     <rf-loading v-if="loading"></rf-loading>
+    <tabBar :currentIndex="typeNum"></tabBar>
+    <view style="height: 100upx;"></view>
   </view>
 </template>
 
@@ -197,10 +199,10 @@ export default {
   data() {
     //这里存放数据
     return {
-      typeNum: 2,
+      typeNum: null,
 
       deleteId: '',
-      scenicID: 0, // 景区id 唯一(一个账号代表一个景区)
+      // scenicID: 0, // 景区id 唯一(一个账号代表一个景区)
       loading: false,
       more: 'loading', // more  loading noMore
       shopArray: [{ name: '全部', id: '' }],
@@ -220,7 +222,7 @@ export default {
       params: {
         pageNum: 1,
         pageSize: 10,
-        mid: 0, // 景区id
+        mid: uni.getStorageSync('scenicMessage').id, // 景区id
         status: '1', // 审核状态
         upDown: '', // 上下架状态
         shopId: '', // 商铺id 选择框
@@ -260,13 +262,13 @@ export default {
     this.params = {
       pageNum: 1,
       pageSize: 10,
-      mid: 0, // 景区id
+      mid: uni.getStorageSync('scenicMessage').id,
       status: '1', // 审核状态
       upDown: '', // 上下架状态
       shopId: '', // 商铺id 选择框
       name: '',
     };
-    this.getShopMessage();
+    this.getTicketShopList();
   },
   // 上拉加载
   onReachBottom() {
@@ -277,18 +279,30 @@ export default {
       this.getMoreByStatus();
     }
   },
-  onShow() {
-    this.getShopList();
-    this.getShopMessage();
+  // 监听页面返回
+  onBackPress (options) {
+    console.log(options);
+    this.getTicketShopList().then(()=>{
+      this.getShopList()
+    })
   },
+  onLoad () {
+    this.typeNum = this.$mStore.state.roleIndex
+
+    // this.params.mid = uni.getStorageSync('scenicMessage').id
+    // console.log(this.params.mid);
+    
+    this.getTicketShopList().then(()=>{
+      this.getShopList()
+    })
+  },
+  
+  
   //方法集合
   methods: {
+   
     // 跳转详情
     topage(id) {
-      
-      // if (id) {
-      //   uni.setStorageSync('Id', id);
-      // }
       this.$mRouter.push({ route: '/pages/goods/shopdetail', query:{id: id}});
     },
     // 删除商品
@@ -328,6 +342,7 @@ export default {
       this.params.shopId = this.shopArray[this.index].id;
       this.getTicketShopList();
     },
+   
     // 获取店铺列表
     async getShopList() {
       await this.$http.get('/homePage/getShopByMerId').then((res) => {
@@ -337,18 +352,20 @@ export default {
         }
       });
     },
+
     // 商家信息
-    async getShopMessage() {
-      await this.$http.get('/getUserInfo').then(async (res) => {
-        if (res.data) {
-          uni.setStorageSync('scenicId', res.data.id);
+    // async getShopMessage() {
+    //   await this.$http.get('/getUserInfo').then(async (res) => {
+    //     if (res.data) {
+    //       uni.setStorageSync('scenicId', res.data.id);
+
+    //       this.params.mid = res.data.id;
+    //       this.getTicketShopList();
+    //     }
+    //   });
+    //   uni.stopPullDownRefresh(); // 关闭下拉刷新
+    // },
 
-          this.params.mid = res.data.id;
-          this.getTicketShopList();
-        }
-      });
-      uni.stopPullDownRefresh(); // 关闭下拉刷新
-    },
     // 待审核tab切换
     changeTabByStatus(type, status) {
       this.more = 'loading';
@@ -393,6 +410,7 @@ export default {
 
     // 商品列表(待审核状态)
     async getTicketShopList() {
+      this.more = 'loading'
       this.soleStatus = 1;
       this.shoplist = [];
 
@@ -402,6 +420,7 @@ export default {
       } else {
         delete this.params.upDown;
       }
+      console.log(this.params.mid);
       await this.$http.get('/goods/list', this.params).then((res) => {
         if (res.data.list.length > 0) {
           this.shoplist = res.data.list;
@@ -411,6 +430,8 @@ export default {
         } else {
           this.more = 'noMore';
         }
+
+        uni.stopPullDownRefresh(); // 关闭下拉刷新
       });
     },
     // 更多(待审核状态)
@@ -479,7 +500,7 @@ export default {
 </script>
 <style lang="scss" scoped>
 .shop {
-  background-color: #f4f4f4;
+  // background-color: #f4f4f4;
 
   .header-warp {
     width: 100%;
@@ -607,7 +628,7 @@ export default {
   }
 
   .order-content {
-    padding: 24upx 32upx 0;
+    padding: 24upx 32upx 30upx;
 
     .order-list {
       background-color: #fff;
@@ -636,7 +657,7 @@ export default {
             width: 120upx;
             height: 120upx;
             border-radius: 5upx;
-            background-color: pink;
+            background-color: #ccc;
           }
         }
         .center {

+ 8 - 4
src/pages/goods/shopdetail.vue

@@ -8,10 +8,10 @@
           <!-- goodsFrom 0自营;1分销 -->
           <radio-group class="change-radio" name="goodsfrom" @change="changeGoodsFrom">  
             <label class="radio1"> 
-              <radio class="radioValue1" value="0" :checked="goodsFrom=== '0'" style="transform:scale(0.7)" /><text class="bar">自营</text>
+              <radio class="radioValue1" value="0" :disabled="radionChechk" :checked="goodsFrom=== '0'" style="transform:scale(0.7)" /><text class="bar">自营</text>
             </label>
             <label class="radio2">
-              <radio class="radioValue2" value="1" :checked="goodsFrom === '1'"  style="transform:scale(0.7)" /><text class="bar">分销</text>
+              <radio class="radioValue2" value="1" :disabled="radionChechk" :checked="goodsFrom === '1'"  style="transform:scale(0.7)" /><text class="bar">分销</text>
             </label>
           </radio-group>
         </view>
@@ -99,7 +99,7 @@
           <!-- verifyType   1验码核销;2滑动核销-->
           <radio-group class="change-radio" name="goodsfrom" @change="changeCancel">
             <label class="radio1">
-              <radio class="radioValue1" :checked="verifyType === '1'" value="1" checked="" style="transform:scale(0.7)" /><text class="bar">验码核销</text>
+              <radio class="radioValue1" :checked="verifyType === '1'" value="1"  style="transform:scale(0.7)" /><text class="bar">验码核销</text>
             </label>
             <label class="radio2">
               <radio class="radioValue2" :checked="verifyType === '2'" value="2" style="transform:scale(0.7)" /><text class="bar">滑动核销</text>
@@ -336,7 +336,7 @@ export default {
   data () {
     return {
       loading: false,
-      scenicId: uni.getStorageSync('scenicId'),
+      scenicId: uni.getStorageSync('scenicMessage').id,
       title: '商品详情',
       showoperat: false,
       salerule: '',
@@ -422,6 +422,7 @@ export default {
       trueNme: true,
       codeShow: false,
       
+      radionChechk: false,
       goodsName: '',
       goodsFrom: '1',  // 0 自营,1分销
       verifyType: '1', // 1验码核销 ; 2滑动核销
@@ -468,6 +469,8 @@ export default {
           this.getShopName(this.typeId, this.storeId);
         });
 
+        this.radionChechk = true
+
         // 数据回显
         this.price = this.shopData.salePrice / 100;
         this.rateprice = this.shopData.price / 100;
@@ -535,6 +538,7 @@ export default {
         this.loading = false;
       });
     } else {
+      this.radionChechk = false
       this.getShopList()
     }
   },

+ 40 - 0
src/pages/index/blankPage.vue

@@ -0,0 +1,40 @@
+<!-- 空白页 -->
+<template>
+  <view class="page">
+    
+  </view>
+  
+</template>
+
+<script>
+
+export default {
+  name: '',
+  components: {},
+  data () {
+    //这里存放数据
+    return {
+
+    };
+  },
+  onLoad () {
+    if (uni.getStorageSync('user') && uni.getStorageSync('role')) {
+      let role = uni.getStorageSync('role')
+      this.$mRouter.reLaunch({route: `/pages/${role[0].code}/${role[0].code}`})
+    } else {
+      this.$mRouter.reLaunch({route: '/pages/public/login'})
+    }
+  },
+  //方法集合
+  methods: {
+
+  },
+}
+</script>
+<style lang='scss' scoped>
+  .page {
+    width: 100vw;
+    height: 100vh;
+    background-color: #fff;
+  }
+</style>

+ 2 - 10
src/pages/index/conversion.vue

@@ -37,7 +37,7 @@
         <view class="orderstatus titlebar"
           >订单状态:<text class="txt">{{ orderDetail.statusName }}</text>
         </view>
-        <view class="tourist">
+        <view class="tourist" v-if="orderDetail.playManList[0].name">
           <view class="title">游客信息</view>
           <view
             class="tourist-warp"
@@ -72,12 +72,6 @@
       </view>
     </view>
 
-    <mask
-      :txt="masktxt"
-      :iconShow="iconShow"
-      v-if="isShowMask"
-      @isSureConver="isSureConver"
-    ></mask>
 
     <rf-loading v-if="loading"></rf-loading>
   </view>
@@ -86,11 +80,9 @@
 <script>
 let showCode = true
 import Header from '../components/header.vue';
-import mask from '../components/mask';
 export default {
   components: {
-    Header,
-    mask,
+    Header
   },
   data() {
     return {

+ 45 - 48
src/pages/index/index.vue

@@ -145,13 +145,12 @@
 									今日订单量
 								</view>
 								<view class="num">
-									{{todayorderSun.num*100}}
+									{{ (todayorderSun.num*100).toFixed(0) }}
 								</view>
 								<view class="ratio">
 									<view class="detail">
                     <image src="../../static/images/down.png" class="icon" v-if="todayorderSun.yesnum >=todayorderSun.todaynum">
 										<image src="../../static/images/up.png" class="icon" v-if="todayorderSun.yesnum < todayorderSun.todaynum"> {{ todayorderSun.percent }}% 
-                    <!-- <text class="compare">{{ todayorderSun.status ? '无增长' :'同比上月' }}</text> -->
                     <text class="compare">同比昨日</text>
 									</view>
 								</view>
@@ -284,19 +283,17 @@
 					</view>
 				</view>
 
-        <view id="testecharts"></view>
+        <view style="height:80upx"></view>
 			</view>
 
-      <tabBar :currentIndex="typeNum"></tabBar>
 		</view>
-    <!-- <mask :txt="masktxt" :iconShow="iconShow" v-if="isShowMask" @isSureConver="isSureConver"></mask> -->
 		<rf-loading v-if="loading"></rf-loading>
+    <tabBar :currentIndex="typeNum"></tabBar>
 	</view>
 </template>
 <script>
 import uCharts from '../../js_sdk/u-charts/u-charts/u-charts';
 import moment from '@/common/moment';
-// import mask from '../components/mask';
 
 let _self;
 let canvaLineA = null;
@@ -306,14 +303,12 @@ let shopMoneyLine = null;
 let getDataBuyTime = null;
 export default {
   name: 'Header',
-  // components: {
-  //   mask,
-  // },
+  
   data() {
     return {
       uderName: '',
       // tabbar
-      typeNum: 0,
+      typeNum: null,
       
 
       loadingMore1: true,
@@ -401,55 +396,44 @@ export default {
       shopimg: '',
     };
   },
-
-
-  // 此处定义传入的数据
-  props: {
-    shoplist: {
-      type: Object,
-      value: null,
-    },
+  onReady () {
+    this.uderName = uni.getStorageSync('scenicMessage').name
   },
+
   computed:{
     logingname: function (){
-
        if ( this.uderName.indexOf('@') != -1) {
-        console.log('子账号');
         return this.uderName.slice(this.uderName.indexOf('@')+1)
       } else {
-        console.log('景区账号');
         return this.uderName
       }
     }
   },
-  
+  onTabItemTap (e){
+    console.log('1');
+  },
   onLoad () {
-    // 商家信息
-    this.$http.get('/getUserInfo').then(async (res) => {
-      if (res.data) {
-        this.uderName = res.data.name
-        this.$mStore.commit('setScenic',res.data)
-      }
-    });
+    this.typeNum = this.$mStore.state.roleIndex
   },
   onShow() {
+
     this.todayforday = moment().format('YYYY-MM-DD HH:mm:ss')
     _self = this;
     this.cWidth = uni.upx2px(690); // upx2px 转换为px
     this.cHeight = uni.upx2px(300);
+
     this.bWidth = uni.upx2px(690);
-    this.bHeight = uni.upx2px(300);
+    this.bHeight = uni.upx2px(500);
 
-    this.getShopList();
-    this.loading = false;
+    this.getShopList()
 
     getDataBuyTime = setInterval(() => {
       this.todayforday = moment().format('YYYY-MM-DD HH:mm:ss')
       this.loading = false;
       this.getShopList();
       // this.$mHelper.toast(`自动更新数据${moment().format('h:mm:ss')}`);
-    }, 1000 * 60 * 5);
-  },
+    }, 1011 * 60 * 5);
+  },  
   onHide() {
     clearInterval(getDataBuyTime);
   },
@@ -537,6 +521,7 @@ export default {
     },
     // 关键指数
     async getExponentData() {
+      this.loading = true
       if (this.shopID === 0) {
         this.shopID = '';
       }
@@ -555,6 +540,7 @@ export default {
             this.dataDo(res.data.ddzl, this.orderSun);
             // 今日订单总量
             this.dataDODO(res.data.jrdds, this.todayorderSun);
+            this.loading = false
           }
         });
     },
@@ -621,6 +607,7 @@ export default {
     },
     // 待处理事物
     async getPendingData() {
+      this.loading = true
       if (this.shopID === 0) {
         this.shopID = '';
       }
@@ -636,6 +623,7 @@ export default {
             this.pendingData.shelf = res.data.upGoods;
             this.pendingData.payorder = res.data.payNum;
             this.pendingData.refund = res.data.refundNum;
+            this.loading = false
           }
         });
     },
@@ -1011,6 +999,7 @@ export default {
           }
         });
     },
+    
     // 饼图
     showPie(canvasId, chartData) {
       canvaPie = new uCharts({
@@ -1021,8 +1010,8 @@ export default {
         fontSize: 12,
         legend: {
           show: true,
-          position: 'left',
-          float: 'center',
+          position: 'top',
+          float: 'left',
           itemGap: 10,
           padding: 5,
           lineHeight: 20,
@@ -1038,18 +1027,23 @@ export default {
         dataLabel: true,
         extra: {
           pie: {
+            type:'area',
+            minRadius: 200,
+            activeOpacity:0.5,
+            offsetAngle:0,
             lableWidth: 15,
           },
         },
       });
+
       setTimeout(() => {
         uni.canvasToTempFilePath(
           {
             //将图表转成图片
             x: 0,
             y: 0,
-            width: _self.cWidth * _self.pixelRatio,
-            height: _self.cHeight * _self.pixelRatio,
+            width: _self.bWidth * _self.pixelRatio,
+            height: _self.bHeight * _self.pixelRatio,
             fileType: 'png',
             canvasId: canvasId,
             success: function (res) {
@@ -1079,11 +1073,14 @@ canvas {
 }
 .shopsellimg,
 .shopmoneyimg,
-.futureimg,
-.shopimg {
+.futureimg {
   width: 690upx;
   height: 300upx;
 }
+.shopimg {
+  width: 690upx;
+  height: 500upx;
+}
 
 .header {
   width: 100%;
@@ -1533,25 +1530,25 @@ canvas {
 
       .shop-echarts {
         position: relative;
-        width: 690rpx;
-        height: 300rpx;
+        width: 690upx;
+        height: 500upx;
         .loadingMore {
           position: absolute;
           left: 0;
           top: 0;
-          width: 690rpx;
-          height: 300rpx;
+          width: 690upx;
+          height: 500upx;
           text-align: center;
-          line-height: 300upx;
+          line-height: 500upx;
           font-size: 28upx;
           color: #cccece;
         }
       }
-
       .shopecharts {
-        width: 690rpx;
-        height: 300rpx;
+        width: 690upx;
+        height: 500upx;
       }
+
     }
   }
 }

+ 12 - 11
src/pages/index/setting/editnotice.vue

@@ -90,7 +90,7 @@ export default {
     //这里存放数据
     return {
       loading: true,
-      scenicId: '',
+      scenicId: uni.getStorageSync('scenicMessage').id,
       title: '公告编辑',
       storeList: [{ name: '请选择公告所属店铺', id: '' }],
       storeIndex: 0,
@@ -122,7 +122,8 @@ export default {
   },
   onLoad(option) {
     this.newid = option.id;
-    this.getShopMessage();
+    // this.getShopMessage();
+    this.getShopList();
     if (this.newid === 'add') {
       this.title = '添加公告';
       this.loading = false;
@@ -139,15 +140,15 @@ export default {
 			this.storeId = this.storeList[this.storeIndex].id;
 			this.noticeMessage.sid = this.storeId
     },
-    // 商家信息
-    async getShopMessage() {
-      await this.$http.get('/getUserInfo').then(async (res) => {
-        if (res.data) {
-          this.scenicId = res.data.id;
-          this.getShopList();
-        }
-      });
-    },
+    // // 商家信息
+    // async getShopMessage() {
+    //   await this.$http.get('/getUserInfo').then(async (res) => {
+    //     if (res.data) {
+    //       this.scenicId = res.data.id;
+    //       this.getShopList();
+    //     }
+    //   });
+    // },
     async getShopList() {
       this.storeList = [{ name: '请选择公告所属店铺', id: '' }];
       await this.$http

+ 1 - 1
src/pages/index/setting/notice.vue

@@ -12,7 +12,7 @@
       <view class="item" v-for="item in noticeList" :key="item.id">
         <view class="notice-top">
           <view class="title">{{ item.shopName }}</view>
-          <image :src="item.icon" class="picture"></image>
+          <image mode="aspectFill" :src="item.icon" class="picture"></image>
           <view class="detail">
             <text class="txt">{{ item.title }}</text>
             <text class="time">{{ item.time.substring(0, 10) }}</text>

+ 8 - 4
src/pages/index/userinfo/adduser.vue

@@ -74,7 +74,7 @@ export default {
 
       userArray: [{ name: '请选择角色', id: '' }],
       userIndex: 0,
-      roleList:[],
+      // roleList: [{ name: '请选择角色', id: '' }],
 
       // 用户信息
       passwordone: null,
@@ -102,11 +102,14 @@ export default {
       this.userdata.account =  this.userdata.account.substring(this.namePrefix.length)
       this.userdata.password = ''
       this.userInfo = this.userdata
+      
       console.log(this.userInfo);
     }
   },
   onShow () {
-    this.getRoleList().then( ()=>{
+    this.getRoleList()
+    .then( ()=>{
+      console.log(this.userArray);
       if (this.userInfo.id) {
         this.userArray.forEach((item,index) => {
           if (item.name === this.userInfo.roleName) {
@@ -125,14 +128,15 @@ export default {
     },
     // 角色列表
     async getRoleList () {
+      this.userArray =  [{ name: '请选择角色', id: '' }],
       await this.$http.get('/mrole/getList',{
         mid:this.userInfo.mid
       }).then( res=>{
+        console.log(res);
         if (res.code === 200 && res.msg==='OK') {
           res.data.forEach(element => {
             if (element.name) {
-              this.roleList.push({name: element.name,id: element.id})
-              this.userArray = this.userArray.concat(this.roleList)
+              this.userArray.push({name: element.name,id: element.id})
             }
           });
         }

+ 0 - 2
src/pages/index/userinfo/roleedit.vue

@@ -117,12 +117,10 @@ export default {
         this.$mHelper.toast('请选择菜单权限')
         return
       }
-      console.log(this.$mStore.state.hasRoleList);
       this.roledata.routes = this.$mStore.state.hasRoleList
       this.roledata.mid = uni.getStorageSync('scenicMessage').id
       this.isloading = true
       this.$http.post('/mrole/saveRole', this.roledata).then(res=>{
-        console.log(res);
         if (res.code === 200 && res.msg==='OK') {
           this.$mHelper.toast('提交成功!')
           this.isloading = false

+ 3 - 4
src/pages/index/userinfo/rolemenage.vue

@@ -65,15 +65,14 @@ export default {
             _self.isloading = true
             _self.$http.post('/mrole/delete/'+id).then(res=>{
               console.log(res);
-              if (res.code === 200 && res.msg=== 'OK') {
+              if (res.code === 200) {
                 _self.$mHelper.toast('删除成功')
                 _self.getRoleList().then( ()=>{
                   _self.isloading = false
                 })
-              } else {
-                _self.isloading = false
-                _self.$mHelper.toast(res.msg)
               }
+            }).catch ((error)=>{
+             _self.isloading = false
             })
           }
         }

+ 2 - 10
src/pages/index/userinfo/usermenage.vue

@@ -36,19 +36,11 @@
           </view>
           <view class="bottom">
             <view class="btns">
-              <!-- <view class="btn more">
-                <view class="txt" @tap.stop="showMore(index)">更多</view>
-                <view class="bar" v-if="index === code">
-                  <view class="trigon"></view>
-                  <view class="item" @tap.stop="freeze(item.id,item.name,item.status,index)">{{ item.status === '0' ? '禁用' : '启用' }}</view>
-                  <view class="item" @tap.stop='dele(item.id,item.name,index)'>删除</view>
-                </view>
-              </view> -->
+             
               <view class="btn" @tap.stop="freeze(item.id,item.name,item.status,index)">{{ item.status === '0' ? '禁用' : '启用' }}</view>
               <view class="btn edit" @tap.stop="add(item)">编辑</view>
               <view class="btn reds" @tap.stop='dele(item.id,item.name,index)'>删除</view>
-              <!-- <view class="btn change">修改密码</view>
-              <view class="btn reds">重置密码</view> -->
+              
             </view>
           </view>
         </view>

+ 13 - 36
src/pages/order/order.vue

@@ -1,29 +1,17 @@
 <!-- order -->
 <template>
-  <view class="order"  @touchstart="handstart($event)"
-      @touchend="handend($event)">
+  <!-- <view class="order"  @touchstart="handstart($event)" @touchend="handend($event)"> -->
+  <view class="order">
     <view class="header-warp">
       <view class="header-search">
         <view class="search">
-          <input
-            type="text"
-            placeholder-style="color:#a3a8a8;font-size:10px;"
-            placeholder="请输入订单号或手机号"
-            class="cellphone"
-            v-model="params.buyPhone"
-          />
+          <input type="text" placeholder-style="color:#a3a8a8;font-size:10px;" placeholder="请输入订单号或手机号" class="cellphone" v-model="params.buyPhone"/>
           <text class="txt" @tap="orderByNum">搜索</text>
         </view>
       </view>
       <view class="uni-list-cell">
         <view class="uni-list-cell-db">
-          <picker
-            style="width: 100%; height: 100%;"
-            @change="bindPickerChange"
-            :value="index"
-            :range="shopArray"
-            range-key="name"
-          >
+          <picker style="width: 100%; height: 100%;" @change="bindPickerChange" :value="index" :range="shopArray" range-key="name">
             <view class="uni-input">{{ shopArray[index].name }}</view>
           </picker>
           <view class="icon-warp">
@@ -35,14 +23,7 @@
         </view>
       </view>
       <view class="btn-time">
-        <uni-calendar
-          ref="calendar"
-          :insert="false"
-          :range="true"
-          :startDate="'2020-01-01'"
-          :endDate="date"
-          @confirm="confirm"
-        />
+        <uni-calendar ref="calendar" :insert="false" :range="true" :startDate="'2020-01-01'" :endDate="date" @confirm="confirm"/>
         <view class="opentime" @tap="openTime">
           <view class="start">{{ startdate ? startdate : date }}</view>
           <text class="guo">至</text>
@@ -50,18 +31,11 @@
           <text class="sundate">共:{{ sunday }}天</text>
         </view>
         <view style="width: 19upx;">
-          <image
-            src="../../static/images/moreicon.png"
-            class="iconRight"
-          ></image>
+          <image src="../../static/images/moreicon.png" class="iconRight"></image>
         </view>
       </view>
       <view class="header-bar">
-        <view
-          class="item"
-          @tap="changeTab(0, flagList[0])"
-          :class="{ active: isactive === 0,henganimationLeft: direction === 'right', henganimationRight: direction === 'left' }"
-        >
+        <view class="item" @tap="changeTab(0, flagList[0])" :class="{ active: isactive === 0,henganimationLeft: direction === 'right', henganimationRight: direction === 'left' }">
           <view class="ordertype">已付款</view>
           <view class="heng"></view>
         </view>
@@ -201,10 +175,10 @@
       </view>
     </view>
 
-    
-    <tabBar :currentIndex="typeNum" ></tabBar>
+
     <uni-load-more :status="more"> </uni-load-more>
     <rf-loading v-if="loading"></rf-loading>
+    <tabBar :currentIndex="typeNum" ></tabBar>
     <view style="height: 100upx;"></view>
   </view>
 </template>
@@ -219,7 +193,7 @@ export default {
   data() {
     //这里存放数据
     return {
-      typeNum: 1,
+      typeNum: null,
       // loading: false,
       shopArray: [{ name: '全部', id: '' }],
       index: 0,
@@ -291,11 +265,14 @@ export default {
     }
   },
   onLoad() {
+    this.typeNum = this.$mStore.state.roleIndex
+
     this.getShopList();
     this.getOrderList();
   },
   //方法集合
   methods: {
+ 
     // 手势开始
     handstart(event) {
       this.startTime = Date.now();

+ 18 - 8
src/pages/public/login.vue

@@ -87,6 +87,7 @@ export default {
       this.$mRouter.reLaunch({ route: '/pages/index/index' });
     }
   },
+
   // 页面生命周期 监听页面加载是否加载完成
   onLoad() {   
     this.getCaptchaImage();
@@ -95,15 +96,13 @@ export default {
     uni.hideHomeButton()  // 会话过期更改页面跳转到登录页的跳转方式,并隐藏小房子
     // #endif
   },
+ 
   methods: {  
     // 统一跳转路由
     navTo() {
       this.$mRouter.redirectTo({ route: '/pages/public/resetpassword' });
     },
-    // 返回主页
-    toHome() {
-      this.$mRouter.reLaunch({ route: '/pages/index/index' });
-    },
+   
 
 		// 获取验证码
     async getCaptchaImage() {
@@ -139,15 +138,26 @@ export default {
       this.btnLoading = true;  
       await this.$http
         .post(loginApi, params)
-        .then((r) => {
+        .then( async r => {
+          console.log(r);
+          let rolelist = r.data.pages
           this.$mHelper.toast('恭喜您,登录成功!');
-          this.$mStore.commit('login', r.data);            
-          this.$mRouter.reLaunch({ route: '/pages/index/index' });
+          this.$mStore.commit('login', r.data);
+
+          // 商家信息
+          await this.$http.get('/getUserInfo').then(async (res) => {
+            if (res.data) {
+              this.$mStore.commit('setScenic',res.data)
+            }
+          });
+
+          this.$mRouter.reLaunch({ route: `/pages/${rolelist[0].code}/${rolelist[0].code}`}); 
+
         })
         .catch(() => {
           this.btnLoading = false;
         });
-    },
+    }
   },
 };
 </script>

+ 7 - 8
src/store/index.js

@@ -20,6 +20,8 @@ const hasMenuList = uni.getStorageSync('hasMenuList') || ''
 const store = new Vuex.Store({
     // 数据存放
     state: {
+        //  权限index
+        roleIndex: 0,
         // 景区信息
         scenic: sceniceMessage,
         // 菜单权限
@@ -70,6 +72,10 @@ const store = new Vuex.Store({
     },
     // 方法函数,一般用于计算state中的数据
     mutations: {
+        // 路由切换(active)
+        changeRole(state,index){
+            state.roleIndex = index
+        },
         // 菜单
         setMenuRole (state, data) {
             uni.setStorageSync('menuList',data)
@@ -80,22 +86,15 @@ const store = new Vuex.Store({
             uni.setStorageSync('hasMenuList',data)
             state.hasRoleList = data
         },
-        // 保存景区Id
+        // 保存景区信息
         setScenic (state,data) {
             state.scenic = data
             uni.setStorageSync('scenicMessage',data)
         },
         login(state, provider) {
-           
-			// state.accessToken=provider.access_token;
-			// state.refreshToken=provider.refresh_token;
-			// state.userInfo = provider.member;
 			state.user = provider;
             uni.setStorageSync('user', provider.token);
             uni.setStorageSync('role',provider.pages)
-			// uni.setStorageSync('accessToken', provider.access_token);
-			// uni.setStorageSync('refreshToken', provider.refresh_token);
-			// uni.setStorageSync('userInfo', provider.member);
         },
         logout(state) {
             state.accessToken = '';

+ 2 - 0
src/utils/request/index.js

@@ -76,6 +76,7 @@ http.interceptor.response(async (response) => { /* 请求之后拦截器 */
 			} else {
 				// 如果refreshToken为空 则直接跳转登录
 				if (!store.state.refreshToken) {
+					console.log(store.state.refreshToken);
 					mHelper.backToLogin();
 					throw response.data.msg;
 				} else {
@@ -112,6 +113,7 @@ http.interceptor.response(async (response) => { /* 请求之后拦截器 */
 			mHelper.toast(response.data.msg || '服务器打瞌睡了');
 			return Promise.reject(response.data.msg);
 		default:
+			console.log(response.data.msg);
 			mHelper.toast(response.data.msg);
 			return Promise.reject(response.data.msg);
 	}