|
|
@@ -34,7 +34,9 @@
|
|
|
<view class="padding-right-xs">已绑定卡号{{cardNumber}}</view>
|
|
|
<button class="cu-btn sm round margin-right-sm" style="background-color: #f75757;color: #ffffff;" @click="changeNum">点击更换</button>
|
|
|
</block>
|
|
|
- <button class="cu-btn sm round margin-right-sm" style="background-color: #f75757;color: #ffffff;" v-else @click="changeNum">点击绑定</button>
|
|
|
+ <block v-else>
|
|
|
+ <button class="cu-btn sm round margin-right-sm" style="background-color: #f75757;color: #ffffff;" @click="changeNum">点击绑定</button>
|
|
|
+ </block>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -112,10 +114,11 @@
|
|
|
getCardInfo() {
|
|
|
let userId = uni.getStorageSync("userId");
|
|
|
this.$u.api.bankCard.cardDetail({userId: userId}).then(res => {
|
|
|
- console.log(res);
|
|
|
- this.cardInfo = res.records[0];
|
|
|
- let cardNo = res.records[0].cardNo;
|
|
|
- this.cardNumber = "**** " + cardNo.substring(cardNo.length - 4, cardNo.length);
|
|
|
+ if (!this.$u.test.isEmpty(res.records[0])) {
|
|
|
+ this.cardInfo = res.records[0];
|
|
|
+ let cardNo = res.records[0].cardNo;
|
|
|
+ this.cardNumber = "**** " + cardNo.substring(cardNo.length - 4, cardNo.length);
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
init(){
|
|
|
@@ -150,9 +153,15 @@
|
|
|
})
|
|
|
},
|
|
|
changeNum(id) {
|
|
|
- uni.navigateTo({
|
|
|
- url: "/pages/activityList/activity/bankCard?cardId=" + this.cardInfo.id
|
|
|
- })
|
|
|
+ if (this.$u.test.isEmpty(this.cardInfo)) {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: "/pages/activityList/activity/bankCard"
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: "/pages/activityList/activity/bankCard?cardId=" + this.cardInfo.id
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|