luyisha 3 years ago
parent
commit
063842ab1a
  1. 6
      pages/recordsList/recordsList.vue
  2. 8
      pages/scratchCard/scratch.js
  3. 35
      pages/scratchCard/scratchCard.vue

6
pages/recordsList/recordsList.vue

@ -20,7 +20,8 @@
<view class=""> <view class="">
<text v-if="type=='TX'||type=='ZJ'||type=='DOWN'">可提余额</text> <text v-if="type=='TX'||type=='ZJ'||type=='DOWN'">可提余额</text>
<text v-else-if="type=='CZ'">剩余</text> <text v-else-if="type=='CZ'">剩余</text>
<text v-else-if="type=='XF'||type=='UP'">余额</text> <text v-else-if="type=='XF'">{{item.actual_type}}</text>
<text v-else-if="type=='UP'">余额</text>
<text v-else-if="type=='BACK'"></text> <text v-else-if="type=='BACK'"></text>
{{item.amount2}} {{item.amount2}}
</view> </view>
@ -166,7 +167,8 @@
amount1: item.actual_price, amount1: item.actual_price,
amount2: item.residue_amount, amount2: item.residue_amount,
time: item.create_time, time: item.create_time,
zone_title: item.zone_title zone_title: item.zone_title,
actual_type: item.actual_type
} }
}); });
if(this.page===1){ if(this.page===1){

8
pages/scratchCard/scratch.js

@ -1,6 +1,6 @@
class Scratch { class Scratch {
constructor (page, opts) { constructor (page, opts, callback) {
opts = opts || {} opts = opts || {}
this.page = page this.page = page
this.canvasId = opts.canvasId || 'canvas' this.canvasId = opts.canvasId || 'canvas'
@ -20,6 +20,7 @@ class Scratch {
this.codeType = opts.codeType this.codeType = opts.codeType
this.direction = opts.direction;//号码行数 this.direction = opts.direction;//号码行数
this.transverse = opts.transverse;//每行个数 this.transverse = opts.transverse;//每行个数
this.callback = callback;
this.init() this.init()
// console.log(this.scale); // console.log(this.scale);
} }
@ -73,7 +74,10 @@ class Scratch {
// this.ctx.drawImage(this.bgImg, Math.floor(sx), Math.floor(sy), Math.floor(swidth), Math.floor(sheight), x, y, Math.floor(width), Math.floor(height)); // this.ctx.drawImage(this.bgImg, Math.floor(sx), Math.floor(sy), Math.floor(swidth), Math.floor(sheight), x, y, Math.floor(width), Math.floor(height));
this.ctx.setFillStyle(this.maskColor) this.ctx.setFillStyle(this.maskColor)
this.ctx.fillRect(0, 0, this.width, this.height) this.ctx.fillRect(0, 0, this.width, this.height)
this.ctx.draw() this.ctx.draw();
if(this.callback){
this.callback();
}
} }
bindTouch () { bindTouch () {

35
pages/scratchCard/scratchCard.vue

@ -6,7 +6,7 @@
<!-- <view class="bg" :style="{'background-image':`url('${ticketInfo.bg_image}')`}" v-if="gai"></view> --> <!-- <view class="bg" :style="{'background-image':`url('${ticketInfo.bg_image}')`}" v-if="gai"></view> -->
<!-- 上下刮板分体 --> <!-- 上下刮板分体 -->
<view class="scratchTop" v-if="code && code==='digit_number_icon'"> <view class="scratchTop" v-if="code && code==='digit_number_icon' && 0">
<!-- 刮奖结果图片 --> <!-- 刮奖结果图片 -->
<view class="result_img" :class="showBackboard?'zIndex1':'hide'" style="flex-direction: row;justify-content: space-between;background-color: transparent;"> <view class="result_img" :class="showBackboard?'zIndex1':'hide'" style="flex-direction: row;justify-content: space-between;background-color: transparent;">
<view style="display: flex;align-items: center;justify-content: space-around;width:284.72rpx;background-color: #ddd;border-radius: 10px;"> <view style="display: flex;align-items: center;justify-content: space-around;width:284.72rpx;background-color: #ddd;border-radius: 10px;">
@ -108,6 +108,7 @@
</view> </view>
</view> </view>
<!-- <view class="backBtn">{{ '<返回' }}</view> -->
</view> </view>
</template> </template>
@ -174,10 +175,10 @@ export default {
// console.log(n,o); // console.log(n,o);
if(n && n!=o){ if(n && n!=o){
if(this.code==='digit_number_icon'){ // if(this.code==='digit_number_icon'){
this.changeShowCount(); // this.changeShowCount();
return; // return;
} // }
this.showResult = true; this.showResult = true;
this.gai = false; this.gai = false;
this.doPrizeScratchTicketFun(); this.doPrizeScratchTicketFun();
@ -259,6 +260,7 @@ export default {
}, },
initCanvas () { initCanvas () {
let _this = this;
// onReadyh5onLoad // onReadyh5onLoad
this.guaCanvas = new Scratch(this, { this.guaCanvas = new Scratch(this, {
canvasId: 'guagua', canvasId: 'guagua',
@ -271,8 +273,13 @@ export default {
codeType: this.code, codeType: this.code,
direction: this.direction,// direction: this.direction,//
transverse: this.transverse,// transverse: this.transverse,//
}) }, function(){
setTimeout(()=>{
_this.showBackboard = true;
}, 1000)
})
if(this.code==='digit_number_icon'){ if(this.code==='digit_number_icon'){
return;
this.guaCanvasL = new Scratch(this.$refs.leftCa, { this.guaCanvasL = new Scratch(this.$refs.leftCa, {
canvasId: 'guaguaLeft', canvasId: 'guaguaLeft',
width: this.scratchTopWidthL, width: this.scratchTopWidthL,
@ -310,9 +317,6 @@ export default {
this.prizeList = res.data.prizes_data; this.prizeList = res.data.prizes_data;
this.prizesIconList = res.data.prizes_icon_data; this.prizesIconList = res.data.prizes_icon_data;
// console.log(this.dataList, 'dataList----'); // console.log(this.dataList, 'dataList----');
setTimeout(()=>{
this.showBackboard = true;
}, 1000)
}) })
}, },
// //
@ -803,4 +807,17 @@ export default {
transform: scale(1); transform: scale(1);
} }
} }
.backBtn{
font-size: 14px;
padding: 10px 20px;
color: #12488a;
// background-color: #12488a;
position: fixed;
z-index: 999;
right: 10px;
bottom: 30px;
border-radius: 100px;
font-weight: bold;
text-shadow: 1px 1px 3px #fff;
}
</style> </style>
Loading…
Cancel
Save