Commit 51663a858336691dfce689a6cc69c9a8bcb434d0
1 parent
44ede266
兑换兼容判断
Showing
1 changed file
with
70 additions
and
5 deletions
src/pages/goodDetails/goodDetails.vue
| ... | ... | @@ -111,7 +111,7 @@ |
| 111 | 111 | <div v-if="goodsInfo && goodsInfo.stock != 0"> |
| 112 | 112 | <!-- 积分充足 --> |
| 113 | 113 | <div v-if="parseInt(goodsInfo.grade || 0)>parseInt(goodsInfo.num) || parseInt(goodsInfo.grade || 0) == parseInt(goodsInfo.num)" class="footer"> |
| 114 | - <div class="btn" @click="exchange"> | |
| 114 | + <div class="btn" @click="versionJudgment"> | |
| 115 | 115 | 立即兑换 |
| 116 | 116 | </div> |
| 117 | 117 | </div> |
| ... | ... | @@ -193,7 +193,9 @@ export default { |
| 193 | 193 | // pointsToast_control: false, |
| 194 | 194 | isExchange: false, // 是否已经兑换 |
| 195 | 195 | show: false, // 是否显示底部支付模块 |
| 196 | - stepperValue: 1 // 进步器 | |
| 196 | + stepperValue: 1, // 进步器 | |
| 197 | + version: this.$route.query.version, //长版本号(ios) | |
| 198 | + ver: this.$route.query.ver, //短版本号(Android) | |
| 197 | 199 | } |
| 198 | 200 | }, |
| 199 | 201 | //部件 |
| ... | ... | @@ -250,9 +252,8 @@ export default { |
| 250 | 252 | }, |
| 251 | 253 | // 跳转到确认订单详情 |
| 252 | 254 | jumpToConfirmOrderPage (item) { |
| 253 | - console.log(item); | |
| 254 | 255 | // 判断APP内 |
| 255 | - if (this.isCNLive.value) { | |
| 256 | + if (this.isCNLive.value){ | |
| 256 | 257 | // (判断app内是否有该方法)type=2为积分加现金模式 |
| 257 | 258 | if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.jumpToConfirmOrderPage) { |
| 258 | 259 | // 跳转到原生的任务列表 |
| ... | ... | @@ -260,7 +261,7 @@ export default { |
| 260 | 261 | } else if (window.obj && window.obj.jumpToConfirmOrderPage) { |
| 261 | 262 | // 跳转到原生的任务列表 |
| 262 | 263 | window.obj.jumpToConfirmOrderPage(JSON.stringify({ pointsOrderId: item.id, goodSid: item.goodsid, num: this.stepperValue, type:4 })); |
| 263 | - } | |
| 264 | + } | |
| 264 | 265 | } |
| 265 | 266 | }, |
| 266 | 267 | // 跳转网家家购买音频协议 |
| ... | ... | @@ -281,6 +282,13 @@ export default { |
| 281 | 282 | this.$parent.callApp(); |
| 282 | 283 | } |
| 283 | 284 | }, |
| 285 | + //获取连接中的参数 | |
| 286 | + getUrlParam (name) { | |
| 287 | + var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); | |
| 288 | + var r = window.location.search.substr(1).match(reg); | |
| 289 | + if (r != null) return r[2]; | |
| 290 | + return ""; | |
| 291 | + }, | |
| 284 | 292 | // toLinkPointsMall () { |
| 285 | 293 | // // 显示查看地址弹框 |
| 286 | 294 | // let options = { |
| ... | ... | @@ -344,6 +352,63 @@ export default { |
| 344 | 352 | this.$parent.callApp(); |
| 345 | 353 | } |
| 346 | 354 | }, |
| 355 | + // 版本判断 | |
| 356 | + versionJudgment(){ | |
| 357 | + if (this.isCNLive.value) { | |
| 358 | + let options; | |
| 359 | + if (this.isAndroid.value) { | |
| 360 | + if (this.ver != "") { | |
| 361 | + var ver = this.ver ? this.ver.replace(/\.*/g, "") : ""; | |
| 362 | + } | |
| 363 | + var isVer = 1732; | |
| 364 | + if (ver > isVer) { | |
| 365 | + // 调用兑换的方法 | |
| 366 | + this.exchange(); | |
| 367 | + }else{ | |
| 368 | + // 提示用积分兑换兑换 | |
| 369 | + options = { | |
| 370 | + message: "当前版本过旧,请升级最新版本", | |
| 371 | + messageAlign: "center", | |
| 372 | + confirmButtonText: "我知道了", | |
| 373 | + confirmButtonCallback:this.appUpdate | |
| 374 | + }; | |
| 375 | + } | |
| 376 | + } else if (this.isiPhone.value) { | |
| 377 | + if (this.version != "") { | |
| 378 | + var version = this.version ? this.version.replace(/\.*/g, "") : ""; | |
| 379 | + } | |
| 380 | + if (this.mode == "prod") { | |
| 381 | + var isVer = 189; | |
| 382 | + } else { | |
| 383 | + var isVer = 189; | |
| 384 | + } | |
| 385 | + if (version > isVer) { | |
| 386 | + // 调用兑换的方法 | |
| 387 | + this.exchange(); | |
| 388 | + }else{ | |
| 389 | + // 提示用积分兑换兑换 | |
| 390 | + options = { | |
| 391 | + message: "当前版本过旧,请升级最新版本", | |
| 392 | + messageAlign: "center", | |
| 393 | + confirmButtonText: "我知道了", | |
| 394 | + confirmButtonCallback:this.appUpdate | |
| 395 | + }; | |
| 396 | + } | |
| 397 | + } | |
| 398 | + // 调用showModal层参数 | |
| 399 | + this.$set(this.$parent, "showOptions", options); | |
| 400 | + // 显示通用浮层 | |
| 401 | + this.$parent.$refs.showModal.showLayer(); | |
| 402 | + } | |
| 403 | + }, | |
| 404 | + // App升级跳转 | |
| 405 | + appUpdate(){ | |
| 406 | + if(this.isiPhone.value){ | |
| 407 | + window.location.href ="http://itunes.apple.com/cn/app/id1337575478?mt=8" | |
| 408 | + }else if(this.isAndroid.value){ | |
| 409 | + window.location.href ="http://wjj.ys1.cnliveimg.com/download/ac/1723/strike-1.7.3.3-release.apk" | |
| 410 | + } | |
| 411 | + }, | |
| 347 | 412 | // 兑换 |
| 348 | 413 | exchange () { |
| 349 | 414 | if (this.isCNLive.value) { | ... | ... |