1002884655 преди 4 години
родител
ревизия
341a365f8c

+ 1
- 1
src/components/index/LanQiuGuoGuanShengFenCha/index.vue Целия файл

@@ -8,10 +8,10 @@
8 8
               <span>{{item.homeTeamName}} VS {{item.awayTeamName}}</span>
9 9
             </div>
10 10
           </div>
11
+          <span>{{item.awayTeamId}}</span>
11 12
           <span>{{item.leagueName}}<em>{{item.matchTime}}(截)</em></span>
12 13
         </div>
13 14
         <div class="Detail flex-h">
14
-          <span>{{item.awayTeamId}}</span>
15 15
           <div class="flex-item flex-h">
16 16
             <div class="flex-item">
17 17
               <div @click="SelectPoints(item, index)">

+ 0
- 1
src/components/index/LanQiuGuoGuanShengFenCha/page.scss Целия файл

@@ -14,7 +14,6 @@
14 14
         > div {
15 15
           position: relative;
16 16
           overflow: hidden;
17
-          margin-left: 0.2rem;
18 17
           > div {
19 18
             width: 100%;
20 19
             position: relative;

+ 70
- 16
src/pages/index/LanQiuDingDan/index.vue Целия файл

@@ -42,20 +42,14 @@
42 42
         <a @click="ShowStore = true">店铺:{{CurrentStoreName || '请选择'}}</a>
43 43
       </div>
44 44
       <div class="Chuan" v-if="$route.query.type === 'mix'">
45
-        <span>4串1</span>
45
+        <span @click="ShowPassWay = true">{{CurrentPassName || '请选择过关方式'}}</span>
46 46
       </div>
47 47
       <div class="Count">
48 48
         <span>
49
-          <em>{{TotalCount}}</em>注
50
-        </span>
51
-        <span>
52
-          金额:
53
-          <em>{{TotalPrize * Multiple}}</em>元
54
-        </span>
55
-        <span>
56
-          预计奖金:
57
-          <em>0 ~ 0</em>元
49
+          <em>{{AllParts.length}}</em>注
58 50
         </span>
51
+        <span>金额:<em>{{TotalPrize * Multiple}}</em>元</span>
52
+        <span>预计奖金:<em>0 ~ 0</em>元</span>
59 53
       </div>
60 54
       <a @click="ToPostBetting" :class="{'active': CurrentStoreId !== null && LanQiuCart.length}">立即购买</a>
61 55
     </div>
@@ -64,11 +58,14 @@
64 58
       <div class="centerLabel">
65 59
         <span>自由过关</span>
66 60
         <nav>
67
-          <a v-for="(item, index) in FootballKeys" :key="index" v-if="item.unitNum <= PageList.length && item.amount === 1">{{item.name}}</a>
61
+          <a v-for="(item, index) in FootballKeys.passes" :key="index" v-if="item.unitNum <= PageList.length && item.unitNum > 1 && item.amount === 1" :class="{'active': item.passCode === CurrentPassCode}" @click="CutPassCode(item)">{{item.name}}</a>
68 62
         </nav>
69 63
         <span>多串过关</span>
64
+        <nav>
65
+          <a v-for="(item, index) in FootballKeys.passes" :key="index" v-if="item.unitNum <= PageList.length && item.unitNum > 2 && item.amount !== 1" :class="{'active': item.passCode === CurrentPassCode}" @click="CutPassCode(item)">{{item.name}}</a>
66
+        </nav>
70 67
         <div class="Bottom flex-h">
71
-          <a class="flex-item" @click="CurrentPassWay = null; ShowPassWay = false">取消</a>
68
+          <a class="flex-item" @click="CurrentPassCode = null; ShowPassWay = false">取消</a>
72 69
           <a class="flex-item active" @click="ShowPassWay = false">确定</a>
73 70
         </div>
74 71
       </div>
@@ -112,14 +109,19 @@
112 109
 
113 110
 <script>
114 111
 import { Switch } from 'vant'
112
+import GetAllParts from '../../../util/FootballPrice'
115 113
 import { mapState, mapMutations, createNamespacedHelpers } from 'vuex'
116 114
 const { mapState: mapUserState, mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
117 115
 export default {
118 116
   name: '',
119 117
   data () {
120 118
     return {
121
-      CurrentPassWay: null, // 当前串法id
122
-      ShowPassWay: true, // 显隐串法选择弹窗
119
+      AllParts: [], // 投注生成结果
120
+      CurrentPassUnitNum: 0,
121
+      CurrentPassAmount: 0,
122
+      CurrentPassCode: null, // 当前串法id
123
+      CurrentPassName: null, // 当前串法名称
124
+      ShowPassWay: false, // 显隐串法选择弹窗
123 125
       CurrentStoreName: null, // 当前选择店铺名称
124 126
       CurrentStoreId: null, // 当前选择店铺id
125 127
       RecommendStoreList: [], // 推荐店铺列表
@@ -151,6 +153,9 @@ export default {
151 153
     ])
152 154
     this.PageList = [...this.LanQiuCart]
153 155
     console.log(this.PageList)
156
+    if (this.$route.query.type === 'single') {
157
+      this.CurrentPassCode = '1*1'
158
+    }
154 159
     this.CheckOrderCount() // 计算订单倍数、金额
155 160
     this.GetStoreList({
156 161
       queryData: {
@@ -188,6 +193,55 @@ export default {
188 193
       'PostBetting',
189 194
       'GetStoreList'
190 195
     ]),
196
+    ToGetAllParts () { // 获取投注数 & 金额
197
+      let ListData = []
198
+      this.LanQiuCart.map((item) => {
199
+        ListData.push({
200
+          matchId: item.id,
201
+          awayTeamId: item.awayTeamId, // 客队id
202
+          awayTeamName: item.awayTeamName, // 客队名称
203
+          homeTeamId: item.homeTeamId, // 主队id
204
+          homeTeamName: item.homeTeamName, // 主队名称
205
+          amount: this.Multiple * item.list.length, // 购买注数
206
+          charges: this.Multiple * 2 * 100, // 价格
207
+          detailList: this.ReturnDeatilList(item.list, item.id)
208
+        })
209
+      })
210
+      let PassTarget = null
211
+      this.FootballKeys.passes.map((item) => {
212
+        if (item.passCode === this.CurrentPassCode) {
213
+          PassTarget = item
214
+        }
215
+      })
216
+      this.AllParts = GetAllParts([...ListData], PassTarget)
217
+    },
218
+    CalcRes () { // 计算投注数、金额
219
+      if (this.CurrentPassCode === null) {
220
+        this.TotalCount = 0
221
+        this.TotalPrize = 0
222
+      } else {
223
+        if (this.CurrentPassAmount === 1) { // 自由过关
224
+
225
+        } else { // 多串过关
226
+
227
+        }
228
+      }
229
+    },
230
+    CutPassCode (item) { // 切换串法
231
+      if (this.CurrentPassCode === item.passCode) {
232
+        this.CurrentPassCode = null
233
+        this.CurrentPassName = null
234
+        this.CurrentPassUnitNum = 0
235
+        this.CurrentPassAmount = 0
236
+      } else {
237
+        this.CurrentPassCode = item.passCode
238
+        this.CurrentPassName = item.name
239
+        this.CurrentPassUnitNum = item.unitNum
240
+        this.CurrentPassAmount = item.amount
241
+      }
242
+      this.CalcRes()
243
+      this.ToGetAllParts()
244
+    },
191 245
     CalcTotalCount () {
192 246
       let Count = 0
193 247
       this.LanQiuCart.map((item) => {
@@ -217,7 +271,7 @@ export default {
217 271
       return Arr || []
218 272
     },
219 273
     ToPostBetting () { // 去下注
220
-      if (this.DataLock || !this.LanQiuCart.length || this.CurrentStoreId === null) return
274
+      if (this.DataLock || !this.LanQiuCart.length || this.CurrentStoreId === null || this.CurrentPassCode !== null) return
221 275
       this.DataLock = true
222 276
       let ListData = []
223 277
       this.LanQiuCart.map((item) => {
@@ -238,7 +292,7 @@ export default {
238 292
         notesNum: this.TotalCount || 1, // 总注数
239 293
         shopId: this.CurrentStoreId, // 店铺ID
240 294
         times: this.Multiple, // 倍数
241
-        passCode: '1*1', // 过关方式
295
+        passCode: this.CurrentPassCode, // 过关方式
242 296
         // totalPrice: this.TotalPrize * this.Multiple * 100 // 总金额
243 297
         totalPrice: this.CalcTotalCount() * this.Multiple * 2 * 100 // 总金额
244 298
       }

+ 31
- 10
src/pages/index/LanQiuDingDan/page.scss Целия файл

@@ -37,21 +37,21 @@
37 37
               font-size: 0.2rem;
38 38
               color: #999;
39 39
             }
40
-            >.Title {
40
+            > .Title {
41 41
               align-items: center;
42
-              >span {
42
+              > span {
43 43
                 font-size: 0.12rem;
44 44
                 color: #999;
45 45
                 line-height: 0.2rem;
46 46
               }
47
-              >div {
47
+              > div {
48 48
                 position: relative;
49 49
                 margin-left: 0.15rem;
50
-                >div {
50
+                > div {
51 51
                   width: 100%;
52 52
                   position: relative;
53 53
                   overflow: hidden;
54
-                  >span {
54
+                  > span {
55 55
                     display: block;
56 56
                     white-space: nowrap;
57 57
                     font-size: 0.12rem;
@@ -62,9 +62,9 @@
62 62
                 }
63 63
               }
64 64
             }
65
-            >.List {
65
+            > .List {
66 66
               font-size: 0;
67
-              >span {
67
+              > span {
68 68
                 display: inline-block;
69 69
                 vertical-align: middle;
70 70
                 font-size: 0.12rem;
@@ -77,7 +77,8 @@
77 77
               }
78 78
             }
79 79
           }
80
-        }> .OtherTab {
80
+        }
81
+        > .OtherTab {
81 82
           padding: 0 0.15rem;
82 83
           position: relative;
83 84
           margin-bottom: 0.15rem;
@@ -165,9 +166,9 @@
165 166
           text-overflow: ellipsis;
166 167
         }
167 168
       }
168
-      >.Chuan {
169
+      > .Chuan {
169 170
         margin: 0.1rem 0;
170
-        >span {
171
+        > span {
171 172
           font-size: 0.14rem;
172 173
           line-height: 0.2rem;
173 174
           display: block;
@@ -237,6 +238,26 @@
237 238
           display: block;
238 239
           text-indent: 0.15rem;
239 240
         }
241
+        > nav {
242
+          font-size: 0;
243
+          padding: 0 0.15rem;
244
+          > a {
245
+            display: inline-block;
246
+            font-size: 0.12rem;
247
+            color: #666;
248
+            border: 0.01rem solid #666;
249
+            border-radius: 0.03rem;
250
+            line-height: 0.2rem;
251
+            padding: 0 0.15rem;
252
+            margin-bottom: 0.1rem;
253
+            margin-right: 0.1rem;
254
+            &.active {
255
+              color: #fff;
256
+              background: #ff5200;
257
+              border-color: #ff5200;
258
+            }
259
+          }
260
+        }
240 261
         > ul {
241 262
           padding: 0 0.15rem;
242 263
           position: relative;

src/util/football_price.js → src/util/FootballPrice.js Целия файл

@@ -1,255 +1,257 @@
1
-import { descartes, combination } from './math'
2
-
3
-// 模拟比赛得分
4
-const matches = [
5
-  [1, 0], [2, 0], [2, 1], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2], [99, 0],
6
-  [0, 0], [1, 1], [2, 2], [3, 3], [99, 99], 
7
-  [0, 1], [0, 2], [1, 2], [0, 3], [1, 3], [2, 3], [0, 4], [1, 4], [2, 4], [0, 5], [1, 5], [2, 5], [0, 99],
8
-]
9
-
10
-const playWayFunc = {
11
-  'ft-wdl': computeWDL,
12
-  'ft-wdls': computeWDLS,
13
-  'ft-score': computeScore,
14
-  'ft-points': computePoints,
15
-  'ft-double': computeDouble,
16
-}
17
-
18
-/**
19
- * 依据投注列表,生成所有可能的排列组合
20
- * @param {*} noteList 投注列表
21
- * @param {*} passDict 过关字典
22
- */
23
-function getAllParts(noteList, passDict) {
24
-  // 转换过关字典
25
-  const passArr = [
26
-    passDict.level1,
27
-    passDict.level2,
28
-    passDict.level3,
29
-    passDict.level4,
30
-    passDict.level5,
31
-    passDict.level6,
32
-    passDict.level7,
33
-    passDict.level8,
34
-  ]
35
-
36
-  // 总投注场次, 比如选了 4 场
37
-  const noteLength = noteList.length
38
-
39
-  // 从投注场次中, 选择过关场次组合
40
-  // 比如投注4场比赛, 过关方式为3串4
41
-  // 这个步骤确定了场次的组合方式
42
-  const noCompact = combination(noteList, passDict.unitNum)
43
-
44
-  // 场次组合完成, 下面需要算出每种场次的 3串4 的方式
45
-  // 比如场次 A,B,C 或者 A,B,D 三场, 每种如何组成 3 串 4
46
-  // 这个步骤确定了每个场次组合方式的投注组合方式
47
-  const all = noCompact.map(list => {
48
-    const grps = passArr.forEach((pass, inx) => {
49
-      if (!pass) return undefined
50
-
51
-      // level1 的 inx 是 0, 但是实际上场次要求是 1
52
-      return combination(list, inx + 1)
53
-    }).filter(Boolean)
54
-
55
-    // 所有的过关, 笛卡尔积组合
56
-    return descartes(...grps)
57
-  })
58
-
59
-  // 把所有场次的组合方式展平
60
-  return all.reduce((acc, list) => ([...acc, ...list]),[])
61
-}
62
-
63
-// 遍历模拟比赛获取最大, 最小奖金
64
-// rq 让球数
65
-function getPrice(allParts, rq) {
66
-  let minPrice = undefined
67
-  let maxPrice = undefined
68
-
69
-  // 遍历模拟比赛的各种可能
70
-  matches.forEach(match => {
71
-    const [min, max] = getMinAndMax(allParts, match, rq)
72
-    if (min < minPrice || minPrice === undefined) {
73
-      minPrice = min
74
-    }
75
-
76
-    if (max > maxPrice || maxPrice === undefined) {
77
-      maxPrice = max
78
-    }
79
-  })
80
-
81
-  return [minPrice, maxPrice]
82
-}
83
-
84
-function getMinAndMax(allParts, match, rq) {
85
-  let minPrice = 0
86
-  let maxPrice = 0
87
-  
88
-  // 所有组合
89
-  allParts.forEach(parts => {
90
-    // 每种组合 比如 3串4 是 3个2串1, 1个3串1
91
-    const price = parts.map(part => {
92
-      // 场次组合 比如 2串1
93
-      return part.map(grp => {
94
-        const { wayCode } = grp.rules
95
-        const fn = playWayFunc[wayCode]
96
-        return fn(grp, match, rq)
97
-      }).filter(Boolean).reduce((acc, x) => acc * x, 1)
98
-
99
-    }).reduce((acc, x) => acc + x, 0)
100
-
101
-    if (minPrice === 0 || minPrice > price) {
102
-      minPrice = price
103
-    }
104
-
105
-    maxPrice += maxPrice
106
-  })
107
-
108
-  return [minPrice, maxPrice]
109
-}
110
-
111
-// 胜平负
112
-function computeWDL(part, match, rq) {
113
-  const [x, y] = match
114
-  const {ruleCode, odds} = part.rules
115
-
116
-  switch (ruleCode) {
117
-    case 'ft-win':
118
-      return x > y ? odds : 0
119
-    case 'ft-dead':
120
-      return x == y ? odds : 0
121
-    default:
122
-      return x < y ? odds : 0
123
-  }
124
-}
125
-
126
-// 让球胜平负
127
-function computeWDLS(part, match, rq) {
128
-  const [x, y] = match
129
-  const {ruleCode, odds} = part.rules
130
-
131
-  switch (ruleCode) {
132
-    case 'ft-sp-win':
133
-      return x + rq > y ? odds : 0
134
-    case 'ft-sp-dead':
135
-      return x + rq == y ? odds : 0
136
-    default:
137
-      return x + rq < y ? odds : 0
138
-  }
139
-}
140
-
141
-// 比分
142
-function computeScore(part, match, rq) {
143
-  const [x, y] = match
144
-  const {ruleCode, odds} = part.rules
145
-
146
-  switch (ruleCode) {
147
-    case 'ft-w10':
148
-      return x == 1 && y == 0 ? odds : 0
149
-    case 'ft-w20':
150
-      return x == 2 && y == 0 ? odds : 0
151
-    case 'ft-w21':
152
-      return x == 2 && y == 1 ? odds : 0
153
-    case 'ft-w30':
154
-      return x == 3 && y == 0 ? odds : 0
155
-    case 'ft-w31':
156
-      return x == 3 && y == 1 ? odds : 0
157
-    case 'ft-w32':
158
-      return x == 3 && y == 2 ? odds : 0
159
-    case 'ft-w40':
160
-      return x == 4 && y == 0 ? odds : 0
161
-    case 'ft-w41':
162
-      return x == 4 && y == 1 ? odds : 0
163
-    case 'ft-w42':
164
-      return x == 4 && y == 2 ? odds : 0
165
-    case 'ft-w50':
166
-      return x == 5 && y == 0 ? odds : 0
167
-    case 'ft-w51':
168
-      return x == 5 && y == 1 ? odds : 0
169
-    case 'ft-w52':
170
-      return x == 5 && y == 2 ? odds : 0
171
-    case 'ft-w99':
172
-      return x > 5 && x > y ? odds : 0
173
-    case 'ft-d00':
174
-      return x == 0 && x == y ? odds : 0
175
-    case 'ft-d11':
176
-      return x == 1 && x == y ? odds : 0
177
-    case 'ft-d22':
178
-      return x == 2 && x == y ? odds : 0
179
-    case 'ft-d33':
180
-      return x == 3 && x == y ? odds : 0
181
-    case 'ft-d99':
182
-      return x > 5 && x == y ? odds : 0
183
-    case 'ft-l01':
184
-      return x == 0 && y == 1 ? odds : 0
185
-    case 'ft-l02':
186
-      return x == 0 && y == 2 ? odds : 0
187
-    case 'ft-l12':
188
-      return x == 1 && y == 2 ? odds : 0
189
-    case 'ft-l03':
190
-      return x == 0 && y == 3 ? odds : 0
191
-    case 'ft-l13':
192
-      return x == 1 && y == 3 ? odds : 0
193
-    case 'ft-l23':
194
-      return x == 2 && y == 3 ? odds : 0
195
-    case 'ft-l04':
196
-      return x == 0 && y == 4 ? odds : 0
197
-    case 'ft-l14':
198
-      return x == 1 && y == 4 ? odds : 0
199
-    case 'ft-l24':
200
-      return x == 2 && y == 4 ? odds : 0
201
-    case 'ft-l05':
202
-      return x == 0 && y == 5 ? odds : 0
203
-    case 'ft-l15':
204
-      return x == 1 && y == 5 ? odds : 0
205
-    case 'ft-l25':
206
-      return x == 2 && y == 5 ? odds : 0
207
-    default:
208
-      return x < y && y > 5 ? odds : 0
209
-  }
210
-}
211
-
212
-// 进球数
213
-function computePoints(part, match, rq) {
214
-  const [x, y] = match
215
-  const {ruleCode, odds} = part.rules
216
-
217
-  switch (ruleCode) {
218
-    case 'ft-p0':
219
-      return x == 0 && y == 0 ? odds : 0
220
-    case 'ft-p1':
221
-      return x + y == 1 ? odds : 0
222
-    case 'ft-p2':
223
-      return x + y == 2 ? odds : 0
224
-    case 'ft-p3':
225
-      return x + y == 3 ? odds : 0
226
-    case 'ft-p4':
227
-      return x + y == 4 ? odds : 0
228
-    case 'ft-p5':
229
-      return x + y == 5 ? odds : 0
230
-    case 'ft-p6':
231
-      return x + y == 6 ? odds : 0
232
-    default:
233
-      return x + y > 6 ? odds : 0
234
-  }
235
-}
236
-
237
-// 半全场
238
-function computeDouble(part, match, rq) {
239
-  const [x, y] = match
240
-  const {ruleCode, odds} = part.rules
241
-
242
-  switch (ruleCode) {
243
-    case 'ft-ww':
244
-    case 'ft-dw':
245
-    case 'ft-lw':
246
-      return x > y ? odds : 0
247
-    case 'ft-wd':
248
-    case 'ft-dd':
249
-    case 'ft-ld':
250
-      return x == y ? odds : 0
251
-    default:
252
-      return x < y ? odds : 0
253
-  }
254
-}
255
-
1
+/* eslint-disable */
2
+import { descartes, combination } from './math'
3
+
4
+// 模拟比赛得分
5
+const matches = [
6
+  [1, 0], [2, 0], [2, 1], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2], [99, 0],
7
+  [0, 0], [1, 1], [2, 2], [3, 3], [99, 99],
8
+  [0, 1], [0, 2], [1, 2], [0, 3], [1, 3], [2, 3], [0, 4], [1, 4], [2, 4], [0, 5], [1, 5], [2, 5], [0, 99],
9
+]
10
+
11
+const playWayFunc = {
12
+  'ft-wdl': computeWDL,
13
+  'ft-wdls': computeWDLS,
14
+  'ft-score': computeScore,
15
+  'ft-points': computePoints,
16
+  'ft-double': computeDouble,
17
+}
18
+
19
+/**
20
+ * 依据投注列表,生成所有可能的排列组合
21
+ * @param {*} noteList 投注列表
22
+ * @param {*} passDict 过关字典
23
+ */
24
+function GetAllParts (noteList, passDict) {
25
+  // 转换过关字典
26
+  const passArr = [
27
+    passDict.level1,
28
+    passDict.level2,
29
+    passDict.level3,
30
+    passDict.level4,
31
+    passDict.level5,
32
+    passDict.level6,
33
+    passDict.level7,
34
+    passDict.level8,
35
+  ]
36
+
37
+  // 总投注场次, 比如选了 4 场
38
+  const noteLength = noteList.length
39
+
40
+  // 从投注场次中, 选择过关场次组合
41
+  // 比如投注4场比赛, 过关方式为3串4
42
+  // 这个步骤确定了场次的组合方式
43
+  const noCompact = combination(noteList, passDict.unitNum)
44
+
45
+  // 场次组合完成, 下面需要算出每种场次的 3串4 的方式
46
+  // 比如场次 A,B,C 或者 A,B,D 三场, 每种如何组成 3 串 4
47
+  // 这个步骤确定了每个场次组合方式的投注组合方式
48
+  const all = noCompact.map(list => {
49
+    const grps = passArr.map((pass, inx) => {
50
+      if (!pass) return undefined
51
+
52
+      // level1 的 inx 是 0, 但是实际上场次要求是 1
53
+      return combination(list, inx + 1)
54
+    }).filter(Boolean)
55
+
56
+    // 所有的过关, 笛卡尔积组合
57
+    return descartes(...grps)
58
+  })
59
+
60
+  // 把所有场次的组合方式展平
61
+  return all.reduce((acc, list) => ([...acc, ...list]), [])
62
+}
63
+
64
+// 遍历模拟比赛获取最大, 最小奖金
65
+// rq 让球数
66
+function GetPrice (allParts, rq) {
67
+  let minPrice = undefined
68
+  let maxPrice = undefined
69
+
70
+  // 遍历模拟比赛的各种可能
71
+  matches.forEach(match => {
72
+    const [min, max] = GetMinAndMax(allParts, match, rq)
73
+    if (min < minPrice || minPrice === undefined) {
74
+      minPrice = min
75
+    }
76
+
77
+    if (max > maxPrice || maxPrice === undefined) {
78
+      maxPrice = max
79
+    }
80
+  })
81
+
82
+  return [minPrice, maxPrice]
83
+}
84
+
85
+function GetMinAndMax (allParts, match, rq) {
86
+  let minPrice = 0
87
+  let maxPrice = 0
88
+
89
+  // 所有组合
90
+  allParts.forEach(parts => {
91
+    // 每种组合 比如 3串4 是 3个2串1, 1个3串1
92
+    const price = parts.map(part => {
93
+      // 场次组合 比如 2串1
94
+      return part.map(grp => {
95
+        const { wayCode } = grp.rules
96
+        const fn = playWayFunc[wayCode]
97
+        return fn(grp, match, rq)
98
+      }).filter(Boolean).reduce((acc, x) => acc * x, 1)
99
+
100
+    }).reduce((acc, x) => acc + x, 0)
101
+
102
+    if (minPrice === 0 || minPrice > price) {
103
+      minPrice = price
104
+    }
105
+
106
+    maxPrice += maxPrice
107
+  })
108
+
109
+  return [minPrice, maxPrice]
110
+}
111
+
112
+// 胜平负
113
+function computeWDL (part, match, rq) {
114
+  const [x, y] = match
115
+  const { ruleCode, odds } = part.rules
116
+
117
+  switch (ruleCode) {
118
+    case 'ft-win':
119
+      return x > y ? odds : 0
120
+    case 'ft-dead':
121
+      return x == y ? odds : 0
122
+    default:
123
+      return x < y ? odds : 0
124
+  }
125
+}
126
+
127
+// 让球胜平负
128
+function computeWDLS (part, match, rq) {
129
+  const [x, y] = match
130
+  const { ruleCode, odds } = part.rules
131
+
132
+  switch (ruleCode) {
133
+    case 'ft-sp-win':
134
+      return x + rq > y ? odds : 0
135
+    case 'ft-sp-dead':
136
+      return x + rq == y ? odds : 0
137
+    default:
138
+      return x + rq < y ? odds : 0
139
+  }
140
+}
141
+
142
+// 比分
143
+function computeScore (part, match, rq) {
144
+  const [x, y] = match
145
+  const { ruleCode, odds } = part.rules
146
+
147
+  switch (ruleCode) {
148
+    case 'ft-w10':
149
+      return x == 1 && y == 0 ? odds : 0
150
+    case 'ft-w20':
151
+      return x == 2 && y == 0 ? odds : 0
152
+    case 'ft-w21':
153
+      return x == 2 && y == 1 ? odds : 0
154
+    case 'ft-w30':
155
+      return x == 3 && y == 0 ? odds : 0
156
+    case 'ft-w31':
157
+      return x == 3 && y == 1 ? odds : 0
158
+    case 'ft-w32':
159
+      return x == 3 && y == 2 ? odds : 0
160
+    case 'ft-w40':
161
+      return x == 4 && y == 0 ? odds : 0
162
+    case 'ft-w41':
163
+      return x == 4 && y == 1 ? odds : 0
164
+    case 'ft-w42':
165
+      return x == 4 && y == 2 ? odds : 0
166
+    case 'ft-w50':
167
+      return x == 5 && y == 0 ? odds : 0
168
+    case 'ft-w51':
169
+      return x == 5 && y == 1 ? odds : 0
170
+    case 'ft-w52':
171
+      return x == 5 && y == 2 ? odds : 0
172
+    case 'ft-w99':
173
+      return x > 5 && x > y ? odds : 0
174
+    case 'ft-d00':
175
+      return x == 0 && x == y ? odds : 0
176
+    case 'ft-d11':
177
+      return x == 1 && x == y ? odds : 0
178
+    case 'ft-d22':
179
+      return x == 2 && x == y ? odds : 0
180
+    case 'ft-d33':
181
+      return x == 3 && x == y ? odds : 0
182
+    case 'ft-d99':
183
+      return x > 5 && x == y ? odds : 0
184
+    case 'ft-l01':
185
+      return x == 0 && y == 1 ? odds : 0
186
+    case 'ft-l02':
187
+      return x == 0 && y == 2 ? odds : 0
188
+    case 'ft-l12':
189
+      return x == 1 && y == 2 ? odds : 0
190
+    case 'ft-l03':
191
+      return x == 0 && y == 3 ? odds : 0
192
+    case 'ft-l13':
193
+      return x == 1 && y == 3 ? odds : 0
194
+    case 'ft-l23':
195
+      return x == 2 && y == 3 ? odds : 0
196
+    case 'ft-l04':
197
+      return x == 0 && y == 4 ? odds : 0
198
+    case 'ft-l14':
199
+      return x == 1 && y == 4 ? odds : 0
200
+    case 'ft-l24':
201
+      return x == 2 && y == 4 ? odds : 0
202
+    case 'ft-l05':
203
+      return x == 0 && y == 5 ? odds : 0
204
+    case 'ft-l15':
205
+      return x == 1 && y == 5 ? odds : 0
206
+    case 'ft-l25':
207
+      return x == 2 && y == 5 ? odds : 0
208
+    default:
209
+      return x < y && y > 5 ? odds : 0
210
+  }
211
+}
212
+
213
+// 进球数
214
+function computePoints (part, match, rq) {
215
+  const [x, y] = match
216
+  const { ruleCode, odds } = part.rules
217
+
218
+  switch (ruleCode) {
219
+    case 'ft-p0':
220
+      return x == 0 && y == 0 ? odds : 0
221
+    case 'ft-p1':
222
+      return x + y == 1 ? odds : 0
223
+    case 'ft-p2':
224
+      return x + y == 2 ? odds : 0
225
+    case 'ft-p3':
226
+      return x + y == 3 ? odds : 0
227
+    case 'ft-p4':
228
+      return x + y == 4 ? odds : 0
229
+    case 'ft-p5':
230
+      return x + y == 5 ? odds : 0
231
+    case 'ft-p6':
232
+      return x + y == 6 ? odds : 0
233
+    default:
234
+      return x + y > 6 ? odds : 0
235
+  }
236
+}
237
+
238
+// 半全场
239
+function computeDouble (part, match, rq) {
240
+  const [x, y] = match
241
+  const { ruleCode, odds } = part.rules
242
+
243
+  switch (ruleCode) {
244
+    case 'ft-ww':
245
+    case 'ft-dw':
246
+    case 'ft-lw':
247
+      return x > y ? odds : 0
248
+    case 'ft-wd':
249
+    case 'ft-dd':
250
+    case 'ft-ld':
251
+      return x == y ? odds : 0
252
+    default:
253
+      return x < y ? odds : 0
254
+  }
255
+}
256
+
257
+export default GetAllParts

+ 1
- 1
src/util/math.js Целия файл

@@ -1,4 +1,4 @@
1
-
1
+/* eslint-disable */
2 2
 // 笛卡尔积
3 3
 export function descartes(...args) {
4 4
   if (args.length < 2) return args