Browse Source

静态页面

1002884655 4 years ago
parent
commit
8866c1b01e

+ 23
- 4
package-lock.json View File

2178
           "requires": {
2178
           "requires": {
2179
             "safer-buffer": ">= 2.1.2 < 3"
2179
             "safer-buffer": ">= 2.1.2 < 3"
2180
           }
2180
           }
2181
+        },
2182
+        "qs": {
2183
+          "version": "6.5.2",
2184
+          "resolved": "https://registry.npm.taobao.org/qs/download/qs-6.5.2.tgz",
2185
+          "integrity": "sha1-yzroBuh0BERYTvFUzo7pjUA/PjY=",
2186
+          "dev": true
2181
         }
2187
         }
2182
       }
2188
       }
2183
     },
2189
     },
4983
         "vary": "~1.1.2"
4989
         "vary": "~1.1.2"
4984
       },
4990
       },
4985
       "dependencies": {
4991
       "dependencies": {
4992
+        "qs": {
4993
+          "version": "6.5.2",
4994
+          "resolved": "https://registry.npm.taobao.org/qs/download/qs-6.5.2.tgz",
4995
+          "integrity": "sha1-yzroBuh0BERYTvFUzo7pjUA/PjY=",
4996
+          "dev": true
4997
+        },
4986
         "statuses": {
4998
         "statuses": {
4987
           "version": "1.4.0",
4999
           "version": "1.4.0",
4988
           "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz",
5000
           "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz",
12023
       "dev": true
12035
       "dev": true
12024
     },
12036
     },
12025
     "qs": {
12037
     "qs": {
12026
-      "version": "6.5.2",
12027
-      "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
12028
-      "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==",
12029
-      "dev": true
12038
+      "version": "6.9.4",
12039
+      "resolved": "https://registry.npm.taobao.org/qs/download/qs-6.9.4.tgz",
12040
+      "integrity": "sha1-kJCykNH5FyjTwi5UhDykSupatoc="
12030
     },
12041
     },
12031
     "query-string": {
12042
     "query-string": {
12032
       "version": "4.3.4",
12043
       "version": "4.3.4",
12705
         "tough-cookie": "~2.4.3",
12716
         "tough-cookie": "~2.4.3",
12706
         "tunnel-agent": "^0.6.0",
12717
         "tunnel-agent": "^0.6.0",
12707
         "uuid": "^3.3.2"
12718
         "uuid": "^3.3.2"
12719
+      },
12720
+      "dependencies": {
12721
+        "qs": {
12722
+          "version": "6.5.2",
12723
+          "resolved": "https://registry.npm.taobao.org/qs/download/qs-6.5.2.tgz",
12724
+          "integrity": "sha1-yzroBuh0BERYTvFUzo7pjUA/PjY=",
12725
+          "dev": true
12726
+        }
12708
       }
12727
       }
12709
     },
12728
     },
12710
     "request-promise-core": {
12729
     "request-promise-core": {

+ 1
- 0
package.json View File

18
     "exports-loader": "^0.7.0",
18
     "exports-loader": "^0.7.0",
19
     "js-md5": "^0.7.3",
19
     "js-md5": "^0.7.3",
20
     "md5": "^2.3.0",
20
     "md5": "^2.3.0",
21
+    "qs": "^6.9.4",
21
     "script-loader": "^0.7.2",
22
     "script-loader": "^0.7.2",
22
     "vant": "^2.10.3",
23
     "vant": "^2.10.3",
23
     "vue": "^2.5.2",
24
     "vue": "^2.5.2",

+ 5
- 1
src/components/common/MainPageContainer/index.vue View File

138
       ''
138
       ''
139
     ]),
139
     ]),
140
     ...mapUserActions([
140
     ...mapUserActions([
141
-      'SignIn'
141
+      'SignIn',
142
+      'GetCurrentShopInfo'
142
     ]),
143
     ]),
143
     Init () { // 初始化
144
     Init () { // 初始化
144
       if (this.UserInfo === null) {
145
       if (this.UserInfo === null) {
148
               // this.$router.push({ name: 'SignIn' })
149
               // this.$router.push({ name: 'SignIn' })
149
             } else {
150
             } else {
150
               this.$emit('UserInfoChange')
151
               this.$emit('UserInfoChange')
152
+              this.GetCurrentShopInfo().then(() => { // 获取当前店铺信息
153
+                this.$emit('ShopInfoChange')
154
+              })
151
             }
155
             }
152
           }).catch(() => {
156
           }).catch(() => {
153
             // this.$router.push({ name: 'SignIn' })
157
             // this.$router.push({ name: 'SignIn' })

+ 56
- 7
src/pages/CaiMinGuanLi/CaiMinLieBiao/index.vue View File

2
   <div class="Page">
2
   <div class="Page">
3
     <MainPageContainer :ShowMainHeader="true" :MainHeaderTitle="`全部彩民`" :ShowMainHeaderBack="true">
3
     <MainPageContainer :ShowMainHeader="true" :MainHeaderTitle="`全部彩民`" :ShowMainHeaderBack="true">
4
       <div class="Content">
4
       <div class="Content">
5
-        <scroller :on-refresh="Refresh">
5
+        <scroller :on-refresh="Refresh" :on-infinite="Infinite" ref="MyScroller">
6
           <div class="Container">
6
           <div class="Container">
7
             <ul>
7
             <ul>
8
-              <li v-for="(item, index) in 15" :key="index" class="flex-h">
8
+              <li v-for="(item, index) in CurrentShopAllCustomer" :key="index" class="flex-h">
9
                 <div class="Icon">
9
                 <div class="Icon">
10
                   <img src="" class="centerLabel cover" alt="">
10
                   <img src="" class="centerLabel cover" alt="">
11
                 </div>
11
                 </div>
12
                 <div class="flex-item">
12
                 <div class="flex-item">
13
                   <div>
13
                   <div>
14
-                    <span>叭叭叭</span>
15
-                    <span>2天前,下单2元未出票</span>
14
+                    <span>{{item.name}}</span>
15
+                    <span>{{ToolClass.DateFormat(item.createDate)}}</span>
16
                   </div>
16
                   </div>
17
                 </div>
17
                 </div>
18
-                <span>2.00</span>
18
+                <!-- <span>2.00</span> -->
19
               </li>
19
               </li>
20
             </ul>
20
             </ul>
21
           </div>
21
           </div>
27
 
27
 
28
 <script>
28
 <script>
29
 import MainPageContainer from '../../../components/common/MainPageContainer'
29
 import MainPageContainer from '../../../components/common/MainPageContainer'
30
+import { createNamespacedHelpers } from 'vuex'
31
+const { mapState: mapUserState, mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
30
 export default {
32
 export default {
31
   name: 'index',
33
   name: 'index',
32
   data () {
34
   data () {
33
     return {
35
     return {
36
+      PageData: {
37
+        pageNum: 0,
38
+        pageSize: 10
39
+      },
40
+      Timer: null,
41
+      HasNextPage: true,
42
+      DataLock: false
34
     }
43
     }
35
   },
44
   },
36
   computed: {
45
   computed: {
46
+    ...mapUserState({
47
+      UserInfo: x => x.UserInfo,
48
+      CurrentShopAllCustomer: x => x.CurrentShopAllCustomer
49
+    })
37
   },
50
   },
38
   components: {
51
   components: {
39
     MainPageContainer
52
     MainPageContainer
40
   },
53
   },
41
   created () {
54
   created () {
55
+    this.EmptyCurrentShopAllCustomer()
42
   },
56
   },
43
   mounted () {
57
   mounted () {
44
     this.$nextTick(() => {
58
     this.$nextTick(() => {
45
     })
59
     })
46
   },
60
   },
47
   methods: {
61
   methods: {
62
+    ...mapUserMutations([
63
+      'EmptyCurrentShopAllCustomer'
64
+    ]),
65
+    ...mapUserActions([
66
+      'GetShopAllCustomer'
67
+    ]),
68
+    Init (done = () => { }) { // 初始化
69
+      this.EmptyCurrentShopAllCustomer()
70
+      this.PageData.pageNum = 1
71
+      this.HasNextPage = true
72
+      this.DataLock = false
73
+      this.ToGetPageList(done)
74
+    },
75
+    ToGetPageList (done = () => { }) { // 获取页面列表
76
+      if (this.HasNextPage) {
77
+        this.GetShopAllCustomer({ queryData: { ...this.PageData, from: 'all' } }).then((res) => {
78
+          this.HasNextPage = res.data.data.total > this.CurrentShopAllCustomer.length
79
+          done()
80
+        }).catch(() => {
81
+          done()
82
+        })
83
+      }
84
+    },
85
+    Infinite (done) { // 上拉加载
86
+      this.Timer = window.setTimeout(() => {
87
+        if (this.HasNextPage) {
88
+          this.PageData.pageNum += 1
89
+          this.ToGetPageList(done)
90
+        } else {
91
+          this.$refs.MyScroller.finishInfinite(true)
92
+        }
93
+      }, 1000)
94
+    },
48
     Refresh (done) { // 页面下拉刷新
95
     Refresh (done) { // 页面下拉刷新
49
-      window.setTimeout(() => {
96
+      if (!this.DataLock) {
97
+        this.Init(done)
98
+      } else {
50
         done()
99
         done()
51
-      }, 1000)
100
+      }
52
     }
101
     }
53
   }
102
   }
54
 }
103
 }

+ 57
- 8
src/pages/CaiMinGuanLi/ShouYe/index.vue View File

14
         <div class="flex-item">
14
         <div class="flex-item">
15
           <div>
15
           <div>
16
             <div class="Content">
16
             <div class="Content">
17
-              <scroller :on-refresh="Refresh">
17
+              <scroller :on-refresh="Refresh" :on-infinite="Infinite" ref="MyScroller">
18
                 <div class="Container">
18
                 <div class="Container">
19
                   <ul>
19
                   <ul>
20
-                    <li v-for="(item, index) in 15" :key="index" class="flex-h">
20
+                    <li v-for="(item, index) in CurrentShopCustomer" :key="index" class="flex-h">
21
                       <div class="Icon">
21
                       <div class="Icon">
22
-                        <img src="" class="centerLabel cover" alt="">
22
+                        <img :src="item.avatar" class="centerLabel cover" alt="">
23
                       </div>
23
                       </div>
24
                       <div class="flex-item">
24
                       <div class="flex-item">
25
                         <div>
25
                         <div>
26
-                          <span>叭叭叭</span>
27
-                          <span>2天前,下单2元未出票</span>
26
+                          <span>{{item.name}}</span>
27
+                          <span>{{ToolClass.DateFormat(item.createDate)}}</span>
28
                         </div>
28
                         </div>
29
                       </div>
29
                       </div>
30
-                      <span>2.00</span>
30
+                      <!-- <span>2.00</span> -->
31
                     </li>
31
                     </li>
32
                   </ul>
32
                   </ul>
33
                 </div>
33
                 </div>
42
 
42
 
43
 <script>
43
 <script>
44
 import MainPageContainer from '../../../components/common/MainPageContainer'
44
 import MainPageContainer from '../../../components/common/MainPageContainer'
45
+import { createNamespacedHelpers } from 'vuex'
46
+const { mapState: mapUserState, mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
45
 export default {
47
 export default {
46
   name: 'index',
48
   name: 'index',
47
   data () {
49
   data () {
48
     return {
50
     return {
51
+      PageData: {
52
+        pageNum: 0,
53
+        pageSize: 10
54
+      },
55
+      Timer: null,
56
+      HasNextPage: true,
57
+      DataLock: false
49
     }
58
     }
50
   },
59
   },
51
   computed: {
60
   computed: {
61
+    ...mapUserState({
62
+      UserInfo: x => x.UserInfo,
63
+      CurrentShopCustomer: x => x.CurrentShopCustomer
64
+    })
52
   },
65
   },
53
   components: {
66
   components: {
54
     MainPageContainer
67
     MainPageContainer
55
   },
68
   },
56
   created () {
69
   created () {
70
+    this.EmptyCurrentShopCustomer()
57
   },
71
   },
58
   mounted () {
72
   mounted () {
59
     this.$nextTick(() => {
73
     this.$nextTick(() => {
60
     })
74
     })
61
   },
75
   },
62
   methods: {
76
   methods: {
77
+    ...mapUserMutations([
78
+      'EmptyCurrentShopCustomer'
79
+    ]),
80
+    ...mapUserActions([
81
+      'GetShopCustomer'
82
+    ]),
83
+    Init (done = () => { }) { // 初始化
84
+      this.EmptyCurrentShopCustomer()
85
+      this.PageData.pageNum = 1
86
+      this.HasNextPage = true
87
+      this.DataLock = false
88
+      this.ToGetPageList(done)
89
+    },
90
+    ToGetPageList (done = () => { }) { // 获取页面列表
91
+      if (this.HasNextPage) {
92
+        this.GetShopCustomer({ queryData: { ...this.PageData, from: 'order' } }).then((res) => {
93
+          this.HasNextPage = res.data.data.total > this.CurrentShopCustomer.length
94
+          done()
95
+        }).catch(() => {
96
+          done()
97
+        })
98
+      }
99
+    },
100
+    Infinite (done) { // 上拉加载
101
+      this.Timer = window.setTimeout(() => {
102
+        if (this.HasNextPage) {
103
+          this.PageData.pageNum += 1
104
+          this.ToGetPageList(done)
105
+        } else {
106
+          this.$refs.MyScroller.finishInfinite(true)
107
+        }
108
+      }, 1000)
109
+    },
63
     Refresh (done) { // 页面下拉刷新
110
     Refresh (done) { // 页面下拉刷新
64
-      window.setTimeout(() => {
111
+      if (!this.DataLock) {
112
+        this.Init(done)
113
+      } else {
65
         done()
114
         done()
66
-      }, 1000)
115
+      }
67
     }
116
     }
68
   }
117
   }
69
 }
118
 }

+ 73
- 12
src/pages/index/ShouYe/index.vue View File

1
 <template>
1
 <template>
2
   <div class="Page">
2
   <div class="Page">
3
-    <MainPageContainer :MainHeaderTitle="`订单管理`" :MainTabBarActiveId="1" :ShowMainHeader="true" :ShowMainTabBar="true" :ShowMainHeaderMore="true" :MainHeaderMoreIcon="`icondaojishi`" :MainHeaderMoreText="`全部彩种`" :MainHeaderMoreClick="() => { $router.push({ name: 'DingDanChaXun' }) }">
3
+    <MainPageContainer :MainHeaderTitle="`订单管理`" :MainTabBarActiveId="1" :ShowMainHeader="true" :ShowMainTabBar="true">
4
       <div class="PageContainer flex-v">
4
       <div class="PageContainer flex-v">
5
         <a class="flex-h">
5
         <a class="flex-h">
6
           <i class="iconfont icontongzhi"></i>
6
           <i class="iconfont icontongzhi"></i>
11
         <!-- 内容 -->
11
         <!-- 内容 -->
12
         <div class="flex-item">
12
         <div class="flex-item">
13
           <div>
13
           <div>
14
-            <div class="Content">
15
-              <scroller :on-refresh="Refresh">
14
+            <div class="Content" v-if="UserInfo !== null">
15
+              <scroller :on-refresh="Refresh" :on-infinite="Infinite" ref="MyScroller">
16
                 <div class="Container">
16
                 <div class="Container">
17
                   <ul>
17
                   <ul>
18
-                    <li v-for="(item, index) in 15" :key="index">
18
+                    <li v-for="(item, index) in CurrentShopOrderList" :key="index">
19
                       <div class="Res">
19
                       <div class="Res">
20
                         <div class="Num flex-h">
20
                         <div class="Num flex-h">
21
                           <div class="Icon">
21
                           <div class="Icon">
22
-                            <img src="../../../assets/img/icon5.png" class="centerLabel contain" alt="">
22
+                            <img v-if="item.customerBetting.lotteryId === 'double-color'" src="../../../assets/img/icon5.png" class="centerLabel contain" alt="">
23
+                            <img v-if="item.customerBetting.lotteryId === 'lottery'" src="../../../assets/img/icon4.png" class="centerLabel contain" alt="">
24
+                            <img v-if="item.customerBetting.lotteryId === 'p5'" src="../../../assets/img/icon2.png" class="centerLabel contain" alt="">
25
+                            <img v-if="item.customerBetting.lotteryId === 'p3'" src="../../../assets/img/icon7.png" class="centerLabel contain" alt="">
26
+                            <img v-if="item.customerBetting.lotteryId === 'football'" src="../../../assets/img/icon3.png" class="centerLabel contain" alt="">
27
+                            <img v-if="item.customerBetting.lotteryId === 'basketball'" src="../../../assets/img/icon6.png" class="centerLabel contain" alt="">
23
                           </div>
28
                           </div>
24
-                          <span>双色球</span>
29
+                          <span v-if="item.customerBetting.lotteryId === 'double-color'">双色球</span>
30
+                          <span v-if="item.customerBetting.lotteryId === 'lottery'">大乐透</span>
31
+                          <span v-if="item.customerBetting.lotteryId === 'p5'">排列5</span>
32
+                          <span v-if="item.customerBetting.lotteryId === 'p3'">排列3</span>
33
+                          <span v-if="item.customerBetting.lotteryId === 'football'">足球</span>
34
+                          <span v-if="item.customerBetting.lotteryId === 'basketball'">篮球</span>
25
                           <div class="flex-item">
35
                           <div class="flex-item">
26
-                            <ul>
36
+                            <ul v-if="item.customerBetting.lotteryId === 'lottery' || item.customerBetting.lotteryId === 'double-color'">
27
                               <li>01</li>
37
                               <li>01</li>
28
                               <li>01</li>
38
                               <li>01</li>
29
                               <li>01</li>
39
                               <li>01</li>
32
                               <li class="active">01</li>
42
                               <li class="active">01</li>
33
                               <li class="active">01</li>
43
                               <li class="active">01</li>
34
                             </ul>
44
                             </ul>
45
+                            <span v-if="item.customerBetting.lotteryId === 'football' || item.customerBetting.lotteryId === 'basketball'">{{item.customerBetting.planName}} 预计奖金:{{item.customerBetting.expectedEarning}}</span>
35
                           </div>
46
                           </div>
36
                         </div>
47
                         </div>
37
                         <div class="Count flex-h">
48
                         <div class="Count flex-h">
38
-                          <span class="flex-item"><em>1</em>注<em>1</em>倍<em>2.00</em>元</span>
39
-                          <span>第202076期</span>
40
-                          <span>2020-08-14 18:43:22</span>
49
+                          <span class="flex-item" v-if="item.customerBetting.lotteryId !== 'football' && item.customerBetting.lotteryId !== 'basketball'"><em>1</em>注<em>1</em>倍<em>2.00</em>元</span>
50
+                          <span class="flex-item" v-else>{{item.customerBetting.notesNum}}注{{item.customerBetting.totalPrice}}元</span>
51
+                          <span v-if="item.customerBetting.lotteryId !== 'football' && item.customerBetting.lotteryId !== 'basketball'">第202076期</span>
52
+                          <span>{{ToolClass.DateFormat(item.customerBetting.createDate)}}</span>
41
                         </div>
53
                         </div>
42
                       </div>
54
                       </div>
43
                       <div class="Time flex-h">
55
                       <div class="Time flex-h">
58
 
70
 
59
 <script>
71
 <script>
60
 import MainPageContainer from '../../../components/common/MainPageContainer'
72
 import MainPageContainer from '../../../components/common/MainPageContainer'
73
+import { createNamespacedHelpers } from 'vuex'
74
+const { mapState: mapUserState, mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
61
 export default {
75
 export default {
62
   name: 'index',
76
   name: 'index',
63
   data () {
77
   data () {
64
     return {
78
     return {
79
+      PageData: {
80
+        pageNum: 0,
81
+        pageSize: 10
82
+      },
83
+      Timer: null,
84
+      HasNextPage: true,
85
+      DataLock: false
65
     }
86
     }
66
   },
87
   },
67
   computed: {
88
   computed: {
89
+    ...mapUserState({
90
+      UserInfo: x => x.UserInfo,
91
+      CurrentShopOrderList: x => x.CurrentShopOrderList
92
+    })
68
   },
93
   },
69
   components: {
94
   components: {
70
     MainPageContainer
95
     MainPageContainer
71
   },
96
   },
72
   created () {
97
   created () {
98
+    this.EmptyCurrentShopOrderList()
73
   },
99
   },
74
   mounted () {
100
   mounted () {
75
     this.$nextTick(() => {
101
     this.$nextTick(() => {
76
     })
102
     })
77
   },
103
   },
78
   methods: {
104
   methods: {
105
+    ...mapUserMutations([
106
+      'EmptyCurrentShopOrderList'
107
+    ]),
108
+    ...mapUserActions([
109
+      'GetCurrentShopOrderList'
110
+    ]),
111
+    Init (done = () => { }) { // 初始化
112
+      this.EmptyCurrentShopOrderList()
113
+      this.PageData.pageNum = 1
114
+      this.HasNextPage = true
115
+      this.DataLock = false
116
+      this.ToGetPageList(done)
117
+    },
118
+    ToGetPageList (done = () => { }) { // 获取页面列表
119
+      if (this.HasNextPage) {
120
+        this.GetCurrentShopOrderList({ queryData: { ...this.PageData } }).then((res) => {
121
+          this.HasNextPage = res.data.data.total > this.CurrentShopOrderList.length
122
+          done()
123
+        }).catch(() => {
124
+          done()
125
+        })
126
+      }
127
+    },
128
+    Infinite (done) { // 上拉加载
129
+      this.Timer = window.setTimeout(() => {
130
+        if (this.HasNextPage) {
131
+          this.PageData.pageNum += 1
132
+          this.ToGetPageList(done)
133
+        } else {
134
+          this.$refs.MyScroller.finishInfinite(true)
135
+        }
136
+      }, 1000)
137
+    },
79
     Refresh (done) { // 页面下拉刷新
138
     Refresh (done) { // 页面下拉刷新
80
-      window.setTimeout(() => {
139
+      if (!this.DataLock) {
140
+        this.Init(done)
141
+      } else {
81
         done()
142
         done()
82
-      }, 1000)
143
+      }
83
     }
144
     }
84
   }
145
   }
85
 }
146
 }

+ 8
- 0
src/pages/index/ShouYe/page.scss View File

72
                       margin-right: 0.1rem;
72
                       margin-right: 0.1rem;
73
                     }
73
                     }
74
                     > .flex-item {
74
                     > .flex-item {
75
+                      > span {
76
+                        display: block;
77
+                        font-size: 0.1rem;
78
+                        line-height: 0.2rem;
79
+                        white-space: nowrap;
80
+                        overflow: hidden;
81
+                        text-overflow: ellipsis;
82
+                      }
75
                       > ul {
83
                       > ul {
76
                         width: 100%;
84
                         width: 100%;
77
                         font-size: 0;
85
                         font-size: 0;

+ 45
- 0
src/store/user/index.js View File

4
 export default {
4
 export default {
5
   namespaced: true,
5
   namespaced: true,
6
   state: {
6
   state: {
7
+    CurrentShopCustomer: [], // 当前店铺顾客列表
8
+    CurrentShopAllCustomer: [], // 当前店铺所有顾客列表
9
+    CurrentShopOrderList: [], // 当前店铺订单列表
10
+    CurrentShopInfo: null, // 当前店铺信息
7
     UserInfo: null, // 用户信息
11
     UserInfo: null, // 用户信息
8
     UserOrderList: [ // 用户订单
12
     UserOrderList: [ // 用户订单
9
       { createDate: '2020-08-14  15:10:20', dateNum: '202076期', type: '超级大乐透', amount: 2, id: 1, orderNum: 'TE202008140000146179970', status: '已撤单' },
13
       { createDate: '2020-08-14  15:10:20', dateNum: '202076期', type: '超级大乐透', amount: 2, id: 1, orderNum: 'TE202008140000146179970', status: '已撤单' },
41
     },
45
     },
42
     EmptyUserInfo (state) { // 清空用户信息
46
     EmptyUserInfo (state) { // 清空用户信息
43
       state.UserInfo = null
47
       state.UserInfo = null
48
+    },
49
+    UpdateCurrentShopInfo (state, data) { // 更新当前店铺信息
50
+      state.CurrentShopInfo = data || null
51
+    },
52
+    UpdateCurrentShopOrderList (state, data) { // 更新当前店铺订单列表
53
+      state.CurrentShopOrderList = state.CurrentShopOrderList.concat(data.records || [])
54
+    },
55
+    EmptyCurrentShopOrderList (state) { // 清空当前店铺订单列表
56
+      state.CurrentShopOrderList = []
57
+    },
58
+    UpdateCurrentShopCustomer (state, data) { // 更新当前店铺顾客列表
59
+      state.CurrentShopCustomer = state.CurrentShopCustomer.concat(data.records || [])
60
+    },
61
+    EmptyCurrentShopCustomer (state) { // 清空当前店铺顾客列表
62
+      state.CurrentShopCustomer = []
63
+    },
64
+    UpdateCurrentShopAllCustomer (state, data) { // 更新当前店铺所有顾客列表
65
+      state.CurrentShopAllCustomer = state.CurrentShopAllCustomer.concat(data.records || [])
66
+    },
67
+    EmptyCurrentShopAllCustomer (state) { // 清空当前店铺所有顾客列表
68
+      state.CurrentShopAllCustomer = []
44
     }
69
     }
45
   },
70
   },
46
   actions: {
71
   actions: {
48
       return new Promise((resolve, reject) => {
73
       return new Promise((resolve, reject) => {
49
         ToolClass.Axios(resolve, reject, Api.SignIn, context, payload, 1000, 'UpdateUserInfo')
74
         ToolClass.Axios(resolve, reject, Api.SignIn, context, payload, 1000, 'UpdateUserInfo')
50
       })
75
       })
76
+    },
77
+    GetCurrentShopInfo (context, payload) { // 获取当前店铺信息
78
+      return new Promise((resolve, reject) => {
79
+        ToolClass.Axios(resolve, reject, Api.GetCurrentShopInfo, context, payload, 1000, 'UpdateCurrentShopInfo')
80
+      })
81
+    },
82
+    GetCurrentShopOrderList (context, payload) { // 获取当前店铺订单列表
83
+      return new Promise((resolve, reject) => {
84
+        ToolClass.Axios(resolve, reject, Api.GetCurrentShopOrderList, context, payload, 1000, 'UpdateCurrentShopOrderList')
85
+      })
86
+    },
87
+    GetShopCustomer (context, payload) { // 获取当前店铺用户列表
88
+      return new Promise((resolve, reject) => {
89
+        ToolClass.Axios(resolve, reject, Api.GetShopCustomer, context, payload, 1000, 'UpdateCurrentShopCustomer')
90
+      })
91
+    },
92
+    GetShopAllCustomer (context, payload) { // 获取当前店铺所有用户列表
93
+      return new Promise((resolve, reject) => {
94
+        ToolClass.Axios(resolve, reject, Api.GetShopCustomer, context, payload, 1000, 'UpdateCurrentShopAllCustomer')
95
+      })
51
     }
96
     }
52
   }
97
   }
53
 }
98
 }

+ 12
- 0
src/util/Api.js View File

5
   SignIn: { // 登录
5
   SignIn: { // 登录
6
     method: 'post',
6
     method: 'post',
7
     url: `${prefix}/shop/login`
7
     url: `${prefix}/shop/login`
8
+  },
9
+  GetCurrentShopInfo: { // 获取当前店铺信息
10
+    method: 'get',
11
+    url: `${prefix}/shop/current`
12
+  },
13
+  GetCurrentShopOrderList: { // 获取当前店铺订单列表
14
+    method: 'get',
15
+    url: `${prefix}/shop/order`
16
+  },
17
+  GetShopCustomer: { // 获取店铺用户列表
18
+    method: 'get',
19
+    url: `${prefix}/shop/customer`
8
   }
20
   }
9
 }
21
 }
10
 
22
 

+ 31
- 7
src/util/PublicMethod.js View File

1
 /* eslint-disable */
1
 /* eslint-disable */
2
 import Axios from 'axios'
2
 import Axios from 'axios'
3
+import qs from 'qs'
3
 const ToolClass = {
4
 const ToolClass = {
4
   Axios (resolve, reject, target, context, payload = {}, code = 0, commit = null, params = null, hasdata = false) { // Axios
5
   Axios (resolve, reject, target, context, payload = {}, code = 0, commit = null, params = null, hasdata = false) { // Axios
6
+    let Data = null
7
+    let Url = null
8
+    if (payload.urlData !== undefined) {
9
+      Url = this.ReplaceURLParams(target.url, payload.urlData)
10
+    } else {
11
+      Url = target.url
12
+    }
13
+    if (payload.queryData !== undefined) {
14
+      Url += '?' + qs.stringify(payload.queryData)
15
+    }
16
+    if (payload.data !== undefined) {
17
+      Data = payload.data
18
+    }
19
+    let Header = {}
20
+    if (window.localStorage.Jwt !== undefined && window.localStorage.JwtTime !== undefined && window.localStorage.JwtTime + 24 * 60 * 60 * 1000 >= Date.now()) { // 本地获取token
21
+      Header['x-authorization-jwt'] = window.localStorage.Jwt
22
+    }
5
     Axios({
23
     Axios({
6
       method: target.method,
24
       method: target.method,
7
-      url: target.url,
8
-      ...payload
25
+      url: Url,
26
+      data: { ...Data },
27
+      headers: { ...Header }
9
     }).then(res => {
28
     }).then(res => {
29
+      const token = res.headers['x-authorization-jwt']
30
+      if (token) { // 更新本地存储token
31
+        window.localStorage.Jwt = token
32
+        window.localStorage.JwtTime = Date.now()
33
+      }
10
       if (res.data.code - 0 === code - 0) {
34
       if (res.data.code - 0 === code - 0) {
11
         if (commit !== null) {
35
         if (commit !== null) {
12
           context.commit(commit, params === null ? res.data.data : hasdata ? { ...params, data: res.data.data } : params)
36
           context.commit(commit, params === null ? res.data.data : hasdata ? { ...params, data: res.data.data } : params)
47
     return false
71
     return false
48
   },
72
   },
49
   DateFormat (timestamp) { // 格式化时间
73
   DateFormat (timestamp) { // 格式化时间
50
-    let Date = new Date(timestamp - 0)
74
+    let aDate = new Date(timestamp)
51
     let yy = new Date(timestamp).getFullYear()
75
     let yy = new Date(timestamp).getFullYear()
52
     let mm = new Date(timestamp).getMonth() + 1
76
     let mm = new Date(timestamp).getMonth() + 1
53
     let dd = new Date(timestamp).getDate()
77
     let dd = new Date(timestamp).getDate()
54
-    let hh = Date.getHours()
55
-    let min = Date.getMinutes()
56
-    let ss = Date.getSeconds()
57
-    return `${yy}-${mm}-${dd} ${hh}:${min}:${ss}`
78
+    let hh = aDate.getHours()
79
+    let min = aDate.getMinutes()
80
+    let ss = aDate.getSeconds()
81
+    return `${yy}-${mm > 9 ? mm : `0${mm}`}-${dd > 9 ? dd : `0${dd}`} ${hh > 9 ? hh : `0${hh}`}:${min > 9 ? min : `0${min}`}:${ss > 9 ? ss : `0${ss}`}`
58
   },
82
   },
59
   WindowClick (callback) { // window点击事件
83
   WindowClick (callback) { // window点击事件
60
     let WindowClickFn = window.onclick
84
     let WindowClickFn = window.onclick