Bladeren bron

point display

EthnaYeh 6 jaren geleden
bovenliggende
commit
92d7b3f153
4 gewijzigde bestanden met toevoegingen van 32 en 3 verwijderingen
  1. 1 0
      package.json
  2. 19 0
      src/utils/point.js
  3. 8 3
      src/views/gambleGameBucket/detail/index.vue
  4. 4 0
      yarn.lock

+ 1 - 0
package.json

@@ -21,6 +21,7 @@
21 21
     "moment-timezone": "^0.5.14",
22 22
     "normalize.css": "7.0.0",
23 23
     "nprogress": "0.2.0",
24
+    "nzh": "^1.0.2",
24 25
     "vue": "2.5.9",
25 26
     "vue-multiselect": "^2.0.8",
26 27
     "vue-router": "3.0.1",

+ 19 - 0
src/utils/point.js

@@ -0,0 +1,19 @@
1
+const nzhhk = require('nzh/hk')
2
+
3
+export function ponitTransform(dealingRecord) {
4
+  let { point1, point2, totalPoints } = dealingRecord
5
+  point1 = Number(point1)
6
+  point2 = Number(point2)
7
+  totalPoints = Number(totalPoints)
8
+  if (point1 === 0 && point2 === 0) {
9
+    return `白板對`
10
+  } else if (point1 === point2) {
11
+    return `對子`
12
+  } else if (point1 + point2 === 10) {
13
+    return `尻`
14
+  } else if (point1 === 0 || point2 === 0) {
15
+    return `${point1 === 0 ? nzhhk.encodeS(`${point2}`) : nzhhk.encodeS(`${point1}`)}點半`
16
+  } else {
17
+    return `${nzhhk.encodeS(`${totalPoints}`)}點`
18
+  }
19
+}

+ 8 - 3
src/views/gambleGameBucket/detail/index.vue

@@ -62,7 +62,7 @@
62 62
         <el-table-column label="莊家" prop="MemberRecord.GambleMember.name"></el-table-column>
63 63
         <el-table-column label="點數">
64 64
           <template slot-scope="scope">
65
-            <span>{{`${scope.row.DealingRecord.point1} | ${scope.row.DealingRecord.point2} / ${scope.row.DealingRecord.totalPoints}`}}</span>
65
+            <span>{{`${scope.row.DealingRecord.point1} | ${scope.row.DealingRecord.point2} / ${point(scope.row.DealingRecord)}`}}</span>
66 66
           </template>
67 67
         </el-table-column>
68 68
         <el-table-column label="上莊分數" prop="bidChips"></el-table-column>      
@@ -90,7 +90,7 @@
90 90
         </el-table-column>
91 91
         <el-table-column prop="DealingRecord.totalPoints" label="點數">
92 92
           <template slot-scope="scope">
93
-            <span>{{`${scope.row.DealingRecord.point1} | ${scope.row.DealingRecord.point2} / ${scope.row.DealingRecord.totalPoints}`}}</span>
93
+            <span>{{`${scope.row.DealingRecord.point1} | ${scope.row.DealingRecord.point2} / ${point(scope.row.DealingRecord)}`}}</span>
94 94
           </template>
95 95
         </el-table-column>
96 96
         <el-table-column label="輸贏">
@@ -140,6 +140,7 @@
140 140
 import { mapGetters, mapActions } from 'vuex'
141 141
 import { fetchDetails, fetchRoundCount, fetchDealingRecords, fetchMemberRecords } from '@/api/gambleGameBucket'
142 142
 import { fetchGambleMemberList } from '@/api/gambleMember'
143
+import { ponitTransform } from '@/utils/point'
143 144
 import _ from 'lodash'
144 145
 import moment from 'moment-timezone'
145 146
 
@@ -323,6 +324,7 @@ export default {
323 324
       return sums
324 325
     },
325 326
     handleFilter() {
327
+      this.SetQuery({layer:2, query: {round: this.query.secondLayer.round}})      
326 328
       this.dealing = []
327 329
       this.getList()
328 330
     },
@@ -335,7 +337,7 @@ export default {
335 337
     // TODO refactor
336 338
     doorTableSwitch(rowIndex, colIndex) {
337 339
       if (rowIndex === 0) {
338
-        return `${this.dealing[0][`point1_${colIndex}`]} | ${this.dealing[0][`point2_${colIndex}`]} / ${this.dealing[0][`totalPoints_${colIndex}`]}`
340
+        return `${this.dealing[0][`point1_${colIndex}`]} | ${this.dealing[0][`point2_${colIndex}`]} / ${this.point({point1: this.dealing[0][`point1_${colIndex}`] ,point2: this.dealing[0][`point2_${colIndex}`] ,totalPoints: this.dealing[0][`totalPoints_${colIndex}`]})}`
339 341
       }
340 342
       if (rowIndex === 1) {
341 343
         return this.dealing[1][`member_${colIndex}`] ? `${this.dealing[1][`member_${colIndex}`]}` : 'N/A'
@@ -347,6 +349,9 @@ export default {
347 349
         count += this.group[j].length
348 350
       }
349 351
       return count
352
+    },
353
+    point(dealingRecord) {
354
+      return ponitTransform(dealingRecord)
350 355
     }
351 356
   },
352 357
   destroyed() {

+ 4 - 0
yarn.lock

@@ -3895,6 +3895,10 @@ number-is-nan@^1.0.0:
3895 3895
   version "1.0.1"
3896 3896
   resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d"
3897 3897
 
3898
+nzh@^1.0.2:
3899
+  version "1.0.2"
3900
+  resolved "https://registry.yarnpkg.com/nzh/-/nzh-1.0.2.tgz#f85e0595be28e088514abbceaba2b2bd4b4292eb"
3901
+
3898 3902
 oauth-sign@~0.8.1, oauth-sign@~0.8.2:
3899 3903
   version "0.8.2"
3900 3904
   resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43"