Bladeren bron

静态页面

xcx 4 jaren geleden
bovenliggende
commit
ea1e14d137

+ 144
- 27
src/pages/PaiJiang/PaiJiangGuanLi/index.vue Bestand weergeven

@@ -3,14 +3,14 @@
3 3
     <MainPageContainer :ShowMainHeader="true" :ShowMainTabBar="true" :MainTabBarActiveId="2" :MainHeaderTitle="`派奖管理`" :ShowMainHeaderBack="true" :ShowMainHeaderMore="true" :MainHeaderMoreIcon="`iconjilu`" :MainHeaderMoreText="`派奖记录`" :MainHeaderMoreClick="() => { this.$router.push({ name: 'PaiJiangJiLu' }) }">
4 4
       <div class="PageContainer flex-v">
5 5
         <!-- 搜索 -->
6
-        <div class="Search">
6
+        <!-- <div class="Search">
7 7
           <div class="flex-h">
8 8
             <i class="iconfont iconsousuo"></i>
9 9
             <div class="flex-item">
10 10
               <input type="text" placeholder="请输入您要查询的派奖类型">
11 11
             </div>
12 12
           </div>
13
-        </div>
13
+        </div> -->
14 14
 
15 15
         <!-- nav -->
16 16
         <div class="Nav flex-h">
@@ -27,23 +27,23 @@
27 27
         <!-- 列表 -->
28 28
         <div class="ListContainer flex-item">
29 29
           <div>
30
-            <scroller :on-refresh="Refresh">
30
+            <scroller :on-refresh="Refresh" :on-infinite="Infinite" ref="MyScroller">
31 31
               <div class="Container">
32 32
                 <ul>
33
-                  <li v-for="(item, index) in 15" :key="index" class="flex-h">
34
-                    <a class="iconfont iconweigouxuan"></a>
33
+                  <li v-for="(item, index) in PageList" :key="index" class="flex-h">
34
+                    <a class="iconfont" :class="[item.Active ? 'icongouxuan active' : 'iconweigouxuan']" @click="SelectItem(item, index)"></a>
35 35
                     <div class="flex-item">
36 36
                       <div class="Title flex-h">
37
-                        <span class="flex-item">竞足胜平负</span>
38
-                        <span>1注</span>
39
-                        <span>1倍</span>
40
-                        <span><em>2.00</em>元</span>
37
+                        <span class="flex-item">{{item.customerBetting.lotteryName}}</span>
38
+                        <span>{{item.customerBetting.notesNum}}注</span>
39
+                        <span>{{item.customerBetting.bettingTimes}}倍</span>
40
+                        <span><em>{{item.customerBetting.totalPrice}}</em>元</span>
41 41
                       </div>
42
-                      <span>订单编号:TE20200810000146179970</span>
43
-                      <span>出票时间:2020-08-10 15:10:10</span>
42
+                      <span>订单编号:{{item.orderId}}</span>
43
+                      <span>出票时间:{{ToolClass.DateFormat(item.createDate)}}</span>
44 44
                       <div class="Res">
45
-                        <span>过关方式:2串1</span>
46
-                        <span>奖金:<em>5.20元</em></span>
45
+                        <span v-if="item.customerBetting.lotteryId === 'basketball' || item.customerBetting.lotteryId === 'football'">过关方式:{{item.customerBetting.bettingPlan.passName}}</span>
46
+                        <span>奖金:<em>{{item.customerBetting.winAmount}}元</em></span>
47 47
                       </div>
48 48
                     </div>
49 49
                   </li>
@@ -55,14 +55,14 @@
55 55
 
56 56
         <!-- 底部栏 -->
57 57
         <div class="Bottom flex-h">
58
-          <a class="iconfont iconweigouxuan"></a>
59
-          <span>全选</span>
58
+          <!-- <a class="iconfont" :class="[SelectNum === PageList.length ? 'icongouxuan active' : 'iconweigouxuan']" @click="SelectAll"></a>
59
+          <span>全选</span> -->
60 60
           <div class="flex-item">
61 61
             <div>
62
-              <span>合计:<em>5.20元</em></span>
62
+              <span>合计:<em>{{TotalPrice}}元</em></span>
63 63
             </div>
64 64
           </div>
65
-          <a>派奖</a>
65
+          <a @click="SendMoney" :class="{'active': !DataLock}">{{DataLock ? '正在提交' : '派奖'}}</a>
66 66
         </div>
67 67
       </div>
68 68
     </MainPageContainer>
@@ -73,26 +73,44 @@
73 73
 import MainPageContainer from '../../../components/common/MainPageContainer'
74 74
 import 'swiper/dist/css/swiper.css'
75 75
 import { swiper, swiperSlide } from 'vue-awesome-swiper'
76
+import { createNamespacedHelpers } from 'vuex'
77
+const { mapState: mapUserState, mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
76 78
 export default {
77 79
   name: 'index',
78 80
   data () {
79 81
     return {
82
+      PageList: [],
83
+      Done: null,
84
+      PageData: {
85
+        pageNum: 0,
86
+        pageSize: 10
87
+      },
88
+      Timer: null,
89
+      HasNextPage: true,
90
+      DataLock: false,
80 91
       SwiperOptions: {
81 92
         slidesPerView: 'auto'
82 93
       },
83
-      ActiveNavId: 1,
94
+      SelectNum: 0,
95
+      ActiveNavId: 'all',
96
+      IsAll: false,
97
+      TotalPrice: 0,
84 98
       NavList: [
85
-        { Name: '全部彩种', Id: 1 },
86
-        { Name: '双色球', Id: 2 },
87
-        { Name: '大乐透', Id: 3 },
88
-        { Name: '排列三', Id: 4 },
89
-        { Name: '排列五', Id: 5 },
90
-        { Name: '足球', Id: 6 },
91
-        { Name: '篮球', Id: 7 }
99
+        { Name: '全部彩种', Id: 'all' },
100
+        { Name: '双色球', Id: 'double-color' },
101
+        { Name: '大乐透', Id: 'lottery' },
102
+        { Name: '排列三', Id: 'p3' },
103
+        { Name: '排列五', Id: 'p5' },
104
+        { Name: '足球', Id: 'football' },
105
+        { Name: '篮球', Id: 'basketball' }
92 106
       ]
93 107
     }
94 108
   },
95 109
   computed: {
110
+    ...mapUserState({
111
+      UserInfo: x => x.UserInfo,
112
+      CurrentShopOrderList: x => x.CurrentShopOrderList
113
+    }),
96 114
     MySwiper () {
97 115
       return this.$refs.MySwiper.swiper
98 116
     }
@@ -109,13 +127,112 @@ export default {
109 127
     })
110 128
   },
111 129
   methods: {
130
+    ...mapUserMutations([
131
+      'EmptyCurrentShopOrderList'
132
+    ]),
133
+    ...mapUserActions([
134
+      'GetCurrentShopOrderList',
135
+      'SendPrize'
136
+    ]),
137
+    SendMoney () { // 派奖
138
+      if (this.DataLock || this.SelectNum === 0) return
139
+      this.DataLock = true
140
+      let OrderId = []
141
+      let Index = null
142
+      this.PageList.map((item, index) => {
143
+        if (item.Active) {
144
+          Index = index
145
+          OrderId.push(item.orderId)
146
+        }
147
+      })
148
+      this.SendPrize({ urlData: { id: OrderId.join(',') } }).then(() => {
149
+        this.Toast('派奖成功')
150
+        this.PageList.splice(Index, 1)
151
+        this.DataLock = false
152
+      }).catch((res) => {
153
+        this.Toast(res.data.message)
154
+        this.DataLock = false
155
+      })
156
+    },
157
+    SelectAll () {
158
+      if (this.SelectNum === this.PageList.length) {
159
+        this.PageList.map((item) => {
160
+          item.Active = false
161
+        })
162
+      } else {
163
+        this.PageList.map((item) => {
164
+          item.Active = true
165
+        })
166
+      }
167
+      this.CheckList()
168
+    },
169
+    SelectItem (item, index) {
170
+      if (!item.Active) {
171
+        this.PageList.map((item) => {
172
+          item.Active = false
173
+        })
174
+      }
175
+      item.Active = !item.Active
176
+      this.CheckList()
177
+    },
178
+    CheckList () {
179
+      this.SelectNum = 0
180
+      this.TotalPrice = 0
181
+      this.PageList.map((item) => {
182
+        if (item.Active) {
183
+          this.SelectNum += 1
184
+          this.TotalPrice += item.customerBetting.winAmount
185
+        }
186
+      })
187
+    },
188
+    Init (done = () => { }) { // 初始化
189
+      this.EmptyCurrentShopOrderList()
190
+      this.PageList = []
191
+      this.PageData.pageNum = 1
192
+      this.HasNextPage = true
193
+      this.DataLock = false
194
+      this.ToGetPageList(done)
195
+    },
196
+    ToGetPageList (done = () => { }) { // 获取页面列表
197
+      if (this.HasNextPage) {
198
+        let QueryData = { ...this.PageData, isCashed: true }
199
+        if (this.ActiveNavId !== 'all') {
200
+          QueryData.lotteryId = this.ActiveNavId
201
+        }
202
+        this.GetCurrentShopOrderList({ queryData: { ...QueryData } }).then((res) => {
203
+          let Arr = res.data.data.records || []
204
+          Arr.map((item) => {
205
+            this.PageList.push({ ...item, Active: false })
206
+          })
207
+          this.HasNextPage = res.data.data.total > this.CurrentShopOrderList.length
208
+          done()
209
+        }).catch(() => {
210
+          done()
211
+        })
212
+      }
213
+    },
112 214
     CutNav (id) {
113 215
       this.ActiveNavId = id
216
+      this.EmptyCurrentShopOrderList()
217
+      this.PageList = []
218
+      this.$refs.MyScroller.triggerPullToRefresh(true)
219
+    },
220
+    Infinite (done) { // 上拉加载
221
+      this.Timer = window.setTimeout(() => {
222
+        if (this.HasNextPage) {
223
+          this.PageData.pageNum += 1
224
+          this.ToGetPageList(done)
225
+        } else {
226
+          this.$refs.MyScroller.finishInfinite(true)
227
+        }
228
+      }, 1000)
114 229
     },
115 230
     Refresh (done) { // 页面下拉刷新
116
-      window.setTimeout(() => {
231
+      if (!this.DataLock) {
232
+        this.Init(done)
233
+      } else {
117 234
         done()
118
-      }, 1000)
235
+      }
119 236
     }
120 237
   }
121 238
 }

+ 7
- 1
src/pages/PaiJiang/PaiJiangGuanLi/page.scss Bestand weergeven

@@ -173,14 +173,20 @@
173 173
           font-size: 0.2rem;
174 174
           margin-left: 0.15rem;
175 175
           color: #999;
176
+          &.active {
177
+            color: #d91d36;
178
+          }
176 179
         }
177 180
         &:last-child {
178 181
           font-size: 0.16rem;
179 182
           color: #fff;
180
-          background: #d91d36;
183
+          background: #ccc;
181 184
           padding: 0 0.3rem;
182 185
           line-height: 0.5rem;
183 186
           margin-left: 0.1rem;
187
+          &.active {
188
+            background: #d91d36;
189
+          }
184 190
         }
185 191
       }
186 192
       > span {

+ 148
- 20
src/pages/PaiJiang/PaiJiangJiLu/index.vue Bestand weergeven

@@ -2,6 +2,16 @@
2 2
   <div class="Page">
3 3
     <MainPageContainer :ShowMainHeader="true" :MainHeaderTitle="`派奖记录`" :ShowMainHeaderBack="true">
4 4
       <div class="PageContainer flex-v">
5
+        <!-- 搜索 -->
6
+        <!-- <div class="Search">
7
+          <div class="flex-h">
8
+            <i class="iconfont iconsousuo"></i>
9
+            <div class="flex-item">
10
+              <input type="text" placeholder="请输入您要查询的派奖类型">
11
+            </div>
12
+          </div>
13
+        </div> -->
14
+
5 15
         <!-- nav -->
6 16
         <div class="Nav flex-h">
7 17
           <div class="flex-item">
@@ -17,22 +27,23 @@
17 27
         <!-- 列表 -->
18 28
         <div class="ListContainer flex-item">
19 29
           <div>
20
-            <scroller :on-refresh="Refresh">
30
+            <scroller :on-refresh="Refresh" :on-infinite="Infinite" ref="MyScroller">
21 31
               <div class="Container">
22 32
                 <ul>
23
-                  <li v-for="(item, index) in 15" :key="index" class="flex-h">
33
+                  <li v-for="(item, index) in PageList" :key="index" class="flex-h">
34
+                    <!-- <a class="iconfont" :class="[item.Active ? 'icongouxuan active' : 'iconweigouxuan']" @click="SelectItem(item, index)"></a> -->
24 35
                     <div class="flex-item">
25 36
                       <div class="Title flex-h">
26
-                        <span class="flex-item">竞足胜平负</span>
27
-                        <span>1注</span>
28
-                        <span>1倍</span>
29
-                        <span><em>2.00</em>元</span>
37
+                        <span class="flex-item">{{item.customerBetting.lotteryName}}</span>
38
+                        <span>{{item.customerBetting.notesNum}}注</span>
39
+                        <span>{{item.customerBetting.bettingTimes}}倍</span>
40
+                        <span><em>{{item.customerBetting.totalPrice}}</em>元</span>
30 41
                       </div>
31
-                      <span>订单编号:TE20200810000146179970</span>
32
-                      <span>出票时间:2020-08-10 15:10:10</span>
42
+                      <span>订单编号:{{item.orderId}}</span>
43
+                      <span>出票时间:{{ToolClass.DateFormat(item.createDate)}}</span>
33 44
                       <div class="Res">
34
-                        <span>过关方式:2串1</span>
35
-                        <span>奖金:<em>5.20元</em></span>
45
+                        <span v-if="item.customerBetting.lotteryId === 'basketball' || item.customerBetting.lotteryId === 'football'">过关方式:{{item.customerBetting.bettingPlan.passName}}</span>
46
+                        <span>奖金:<em>{{item.customerBetting.winAmount}}元</em></span>
36 47
                       </div>
37 48
                     </div>
38 49
                   </li>
@@ -50,26 +61,44 @@
50 61
 import MainPageContainer from '../../../components/common/MainPageContainer'
51 62
 import 'swiper/dist/css/swiper.css'
52 63
 import { swiper, swiperSlide } from 'vue-awesome-swiper'
64
+import { createNamespacedHelpers } from 'vuex'
65
+const { mapState: mapUserState, mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
53 66
 export default {
54 67
   name: 'index',
55 68
   data () {
56 69
     return {
70
+      PageList: [],
71
+      Done: null,
72
+      PageData: {
73
+        pageNum: 0,
74
+        pageSize: 10
75
+      },
76
+      Timer: null,
77
+      HasNextPage: true,
78
+      DataLock: false,
57 79
       SwiperOptions: {
58 80
         slidesPerView: 'auto'
59 81
       },
60
-      ActiveNavId: 1,
82
+      SelectNum: 0,
83
+      ActiveNavId: 'all',
84
+      IsAll: false,
85
+      TotalPrice: 0,
61 86
       NavList: [
62
-        { Name: '全部彩种', Id: 1 },
63
-        { Name: '双色球', Id: 2 },
64
-        { Name: '大乐透', Id: 3 },
65
-        { Name: '排列三', Id: 4 },
66
-        { Name: '排列五', Id: 5 },
67
-        { Name: '足球', Id: 6 },
68
-        { Name: '篮球', Id: 7 }
87
+        { Name: '全部彩种', Id: 'all' },
88
+        { Name: '双色球', Id: 'double-color' },
89
+        { Name: '大乐透', Id: 'lottery' },
90
+        { Name: '排列三', Id: 'p3' },
91
+        { Name: '排列五', Id: 'p5' },
92
+        { Name: '足球', Id: 'football' },
93
+        { Name: '篮球', Id: 'basketball' }
69 94
       ]
70 95
     }
71 96
   },
72 97
   computed: {
98
+    ...mapUserState({
99
+      UserInfo: x => x.UserInfo,
100
+      CurrentShopOrderList: x => x.CurrentShopOrderList
101
+    }),
73 102
     MySwiper () {
74 103
       return this.$refs.MySwiper.swiper
75 104
     }
@@ -86,13 +115,112 @@ export default {
86 115
     })
87 116
   },
88 117
   methods: {
118
+    ...mapUserMutations([
119
+      'EmptyCurrentShopOrderList'
120
+    ]),
121
+    ...mapUserActions([
122
+      'GetCurrentShopOrderList',
123
+      'SendPrize'
124
+    ]),
125
+    SendMoney () { // 派奖
126
+      if (this.DataLock || this.SelectNum === 0) return
127
+      this.DataLock = true
128
+      let OrderId = []
129
+      let Index = null
130
+      this.PageList.map((item, index) => {
131
+        if (item.Active) {
132
+          Index = index
133
+          OrderId.push(item.orderId)
134
+        }
135
+      })
136
+      this.SendPrize({ urlData: { id: OrderId.join(',') } }).then(() => {
137
+        this.Toast('派奖成功')
138
+        this.PageList.splice(Index, 1)
139
+        this.DataLock = false
140
+      }).catch((res) => {
141
+        this.Toast(res.data.message)
142
+        this.DataLock = false
143
+      })
144
+    },
145
+    SelectAll () {
146
+      if (this.SelectNum === this.PageList.length) {
147
+        this.PageList.map((item) => {
148
+          item.Active = false
149
+        })
150
+      } else {
151
+        this.PageList.map((item) => {
152
+          item.Active = true
153
+        })
154
+      }
155
+      this.CheckList()
156
+    },
157
+    SelectItem (item, index) {
158
+      if (!item.Active) {
159
+        this.PageList.map((item) => {
160
+          item.Active = false
161
+        })
162
+      }
163
+      item.Active = !item.Active
164
+      this.CheckList()
165
+    },
166
+    CheckList () {
167
+      this.SelectNum = 0
168
+      this.TotalPrice = 0
169
+      this.PageList.map((item) => {
170
+        if (item.Active) {
171
+          this.SelectNum += 1
172
+          this.TotalPrice += item.customerBetting.winAmount
173
+        }
174
+      })
175
+    },
176
+    Init (done = () => { }) { // 初始化
177
+      this.EmptyCurrentShopOrderList()
178
+      this.PageList = []
179
+      this.PageData.pageNum = 1
180
+      this.HasNextPage = true
181
+      this.DataLock = false
182
+      this.ToGetPageList(done)
183
+    },
184
+    ToGetPageList (done = () => { }) { // 获取页面列表
185
+      if (this.HasNextPage) {
186
+        let QueryData = { ...this.PageData }
187
+        if (this.ActiveNavId !== 'all') {
188
+          QueryData.lotteryId = this.ActiveNavId
189
+        }
190
+        this.GetCurrentShopOrderList({ queryData: { ...QueryData } }).then((res) => {
191
+          let Arr = res.data.data.records || []
192
+          Arr.map((item) => {
193
+            this.PageList.push({ ...item, Active: false })
194
+          })
195
+          this.HasNextPage = res.data.data.total > this.CurrentShopOrderList.length
196
+          done()
197
+        }).catch(() => {
198
+          done()
199
+        })
200
+      }
201
+    },
89 202
     CutNav (id) {
90 203
       this.ActiveNavId = id
204
+      this.EmptyCurrentShopOrderList()
205
+      this.PageList = []
206
+      this.$refs.MyScroller.triggerPullToRefresh(true)
207
+    },
208
+    Infinite (done) { // 上拉加载
209
+      this.Timer = window.setTimeout(() => {
210
+        if (this.HasNextPage) {
211
+          this.PageData.pageNum += 1
212
+          this.ToGetPageList(done)
213
+        } else {
214
+          this.$refs.MyScroller.finishInfinite(true)
215
+        }
216
+      }, 1000)
91 217
     },
92 218
     Refresh (done) { // 页面下拉刷新
93
-      window.setTimeout(() => {
219
+      if (!this.DataLock) {
220
+        this.Init(done)
221
+      } else {
94 222
         done()
95
-      }, 1000)
223
+      }
96 224
     }
97 225
   }
98 226
 }

+ 79
- 0
src/pages/PaiJiang/PaiJiangJiLu/page.scss Bestand weergeven

@@ -7,6 +7,31 @@
7 7
     width: 100%;
8 8
     height: 100%;
9 9
     position: relative;
10
+    > .Search {
11
+      padding: 0.1rem 0.15rem;
12
+      > div {
13
+        width: 100%;
14
+        position: relative;
15
+        overflow: hidden;
16
+        border-radius: 0.3rem;
17
+        background: #fff;
18
+        align-items: center;
19
+        box-shadow: 0 0 0.02rem 0.02rem rgba(0, 0, 0, 0.05);
20
+        > i {
21
+          font-size: 0.2rem;
22
+          color: #999;
23
+          margin-left: 0.1rem;
24
+        }
25
+        > div {
26
+          > input {
27
+            width: 100%;
28
+            font-size: 0.12rem;
29
+            line-height: 0.2rem;
30
+            padding: 0.05rem 0;
31
+          }
32
+        }
33
+      }
34
+    }
10 35
     > .Nav {
11 36
       position: relative;
12 37
       overflow: hidden;
@@ -137,5 +162,59 @@
137 162
         }
138 163
       }
139 164
     }
165
+    > .Bottom {
166
+      background: #fff;
167
+      align-items: center;
168
+      box-shadow: 0 0 0.02rem 0.02rem rgba(0, 0, 0, 0.05);
169
+      position: relative;
170
+      z-index: 4;
171
+      > a {
172
+        &.iconfont {
173
+          font-size: 0.2rem;
174
+          margin-left: 0.15rem;
175
+          color: #999;
176
+          &.active {
177
+            color: #d91d36;
178
+          }
179
+        }
180
+        &:last-child {
181
+          font-size: 0.16rem;
182
+          color: #fff;
183
+          background: #ccc;
184
+          padding: 0 0.3rem;
185
+          line-height: 0.5rem;
186
+          margin-left: 0.1rem;
187
+          &.active {
188
+            background: #d91d36;
189
+          }
190
+        }
191
+      }
192
+      > span {
193
+        font-size: 0.15rem;
194
+        line-height: 0.5rem;
195
+        margin-left: 0.1rem;
196
+        color: #666;
197
+      }
198
+      > div {
199
+        position: relative;
200
+        overflow: hidden;
201
+        > div {
202
+          width: 100%;
203
+          position: relative;
204
+          overflow: hidden;
205
+          > span {
206
+            display: block;
207
+            text-align: right;
208
+            font-size: 0.15rem;
209
+            color: #333;
210
+            > em {
211
+              font-size: 0.15rem;
212
+              color: #d91d36;
213
+              font-weight: bold;
214
+            }
215
+          }
216
+        }
217
+      }
218
+    }
140 219
   }
141 220
 }

+ 5
- 0
src/store/user/index.js Bestand weergeven

@@ -79,6 +79,11 @@ export default {
79 79
     }
80 80
   },
81 81
   actions: {
82
+    SendPrize (context, payload) { // 派奖
83
+      return new Promise((resolve, reject) => {
84
+        ToolClass.Axios(resolve, reject, Api.SendPrize, context, payload, 1000)
85
+      })
86
+    },
82 87
     GetAliAppId (context, payload) { // 获取阿里pay id
83 88
       return new Promise((resolve, reject) => {
84 89
         ToolClass.Axios(resolve, reject, Api.GetAliAppId, context, payload, 1000)

+ 4
- 0
src/util/Api.js Bestand weergeven

@@ -2,6 +2,10 @@
2 2
 const prefix = process.env.NODE_ENV === 'production' ? '/api' : '/api'
3 3
 
4 4
 const $api = {
5
+  SendPrize: { // 派奖
6
+    method: 'put',
7
+    url: `${prefix}/shop/sent-award/order/:id`
8
+  },
5 9
   GetAliAppId: { // 获取阿里pay id
6 10
     method: 'get',
7 11
     url: `${prefix}/shop/alipay/appid`