Commit 3495eb76 authored by mengcuiguang's avatar mengcuiguang

添加ios钻石支付

parent 2b46873e
...@@ -49,15 +49,24 @@ ...@@ -49,15 +49,24 @@
<view class="section"> <view class="section">
<view class="pack-box"> <view class="pack-box">
<view class="pack-item" <view class="pack-item"
:style="item.largeType !=='vip' ?'background: #f5f5f5;':'background: #f4c98b;'" :style="item.largeType !=='vip' ?'background: #f5f5f5;':'background: #f5f5f5;'"
:class="[{active: index==selectedIndex}]" v-for='(item, index) in vipList' :class="[{active: index==selectedIndex}]" v-for='(item, index) in vipList'
:key='index' @click="choosePack(item, index)"> :key='index' @click="choosePack(item, index)">
<view style="display: flex;flex-direction: column;align-items: center;"> <view style="display: flex;flex-direction: column;align-items: center;">
<view class="price row"> <view v-if="os=='android'" class="price row">
{{item.firstPayPrice}} {{item.firstPayPrice}}
</view> </view>
<view v-else style="display: flex;align-items: center;font-size: 40rpx;
color: #f2b068;
font-weight: 700;">
<image style="width: 50rpx;height: 50rpx;display: flex;margin-right: 10rpx;"
src="@/static/ic_zuan.png">
</image>
+{{multiply(item.firstPayPrice)}}
</view>
<view class="name row" v-if="item.title!=null&&item.title!=''"> <view class="name row" v-if="item.title!=null&&item.title!=''">
{{item.title}} {{item.title}}
</view> </view>
...@@ -137,6 +146,9 @@ ...@@ -137,6 +146,9 @@
}; };
}, },
methods: { methods: {
multiply(num) {
return parseInt(num * 10);
},
// 支付完成回调 // 支付完成回调
paySuccess(largeType) { paySuccess(largeType) {
this.$emit('paySuccess', largeType); this.$emit('paySuccess', largeType);
...@@ -200,11 +212,6 @@ ...@@ -200,11 +212,6 @@
this.handlePay(); this.handlePay();
}, },
handlePay() { handlePay() {
if (this.os == 'ios') {
message.notify('暂不支持ios支付');
return
}
let that = this; let that = this;
let vipBean = this.vipList[this.selectedIndex]; let vipBean = this.vipList[this.selectedIndex];
this.post({ this.post({
...@@ -251,47 +258,19 @@ ...@@ -251,47 +258,19 @@
} }
let that = this; let that = this;
if (this.os == 'ios') { tt.getOrderPayment({
if (!tt.canIUse('getOrderPayment.object.imId')) { orderId: oid,
message.notify('请升级抖音APP版本'); success(res) {
return that.queryOrderStatus(largeType, ttData.tidStr);
} },
fail(res) {
if (ttData.imId == null) { if (res.errNo == '4') {
message.notify('暂不支付ios支付,请更换设备'); // 4-支付取消
return
}
tt.getOrderPayment({
orderId: oid,
imId: ttData.imId,
success(res) {
that.queryOrderStatus(largeType, ttData.tidStr);
},
fail(res) {
if (res.errNo == '4') {
// 4-支付取消
}
// message.notify(res.errMsg);
},
});
} else {
tt.getOrderPayment({
orderId: oid,
success(res) {
that.queryOrderStatus(largeType, ttData.tidStr);
},
fail(res) {
if (res.errNo == '4') {
// 4-支付取消
} }
// message.notify(res.errMsg); // message.notify(res.errMsg);
}, },
}); });
}
}, },
queryOrderStatus(largeType, tid) { queryOrderStatus(largeType, tid) {
let that = this; let that = this;
......
...@@ -5,15 +5,24 @@ ...@@ -5,15 +5,24 @@
<view class="section"> <view class="section">
<view class="pack-box"> <view class="pack-box">
<view class="pack-item" <view class="pack-item"
:style="item.largeType !=='vip' ?'background: #f5f5f5;':'background: #f4c98b;'" :style="item.largeType !=='vip' ?'background: #f5f5f5;':'background: #f5f5f5;'"
:class="[{active: index==selectedIndex}]" v-for='(item, index) in pointList' :key='index' :class="[{active: index==selectedIndex}]" v-for='(item, index) in pointList' :key='index'
@click="choosePack(item, index)"> @click="choosePack(item, index)">
<view style="display: flex;flex-direction: column;align-items: center;"> <view style="display: flex;flex-direction: column;align-items: center;">
<view class="price row"> <view v-if="os=='android'" class="price row">
{{item.firstPayPrice}} {{item.firstPayPrice}}
</view> </view>
<view v-else style="display: flex;align-items: center;font-size: 40rpx;
color: #f2b068;
font-weight: 700;">
<image style="width: 50rpx;height: 50rpx;display: flex;margin-right: 10rpx;"
src="@/static/ic_zuan.png">
</image>
+{{multiply(item.firstPayPrice)}}
</view>
<view class="name row" v-if="item.title!=null&&item.title!=''"> <view class="name row" v-if="item.title!=null&&item.title!=''">
{{item.title}} {{item.title}}
</view> </view>
...@@ -41,15 +50,24 @@ ...@@ -41,15 +50,24 @@
<view class="section"> <view class="section">
<view class="pack-box"> <view class="pack-box">
<view class="pack-item" <view class="pack-item"
:style="item.largeType !=='vip' ?'background: #f5f5f5;':'background: #f4c98b;'" :style="item.largeType !=='vip' ?'background: #f5f5f5;':'background: #f5f5f5;'"
:class="[{active: index==selectedVipIndex}]" v-for='(item, index) in vipList' :key='index' :class="[{active: index==selectedVipIndex}]" v-for='(item, index) in vipList' :key='index'
@click="choosePack2(item, index)"> @click="choosePack2(item, index)">
<view style="display: flex;flex-direction: column;align-items: center;"> <view style="display: flex;flex-direction: column;align-items: center;">
<view class="price row"> <view v-if="os=='android'" class="price row">
{{item.firstPayPrice}} {{item.firstPayPrice}}
</view> </view>
<view v-else style="display: flex;align-items: center;font-size: 40rpx;
color: #f2b068;
font-weight: 700;">
<image style="width: 50rpx;height: 50rpx;display: flex;margin-right: 10rpx;"
src="@/static/ic_zuan.png">
</image>
+{{multiply(item.firstPayPrice)}}
</view>
<view class="name row" v-if="item.title!=null&&item.title!=''"> <view class="name row" v-if="item.title!=null&&item.title!=''">
{{item.title}} {{item.title}}
</view> </view>
...@@ -89,13 +107,13 @@ ...@@ -89,13 +107,13 @@
{{ btnText }} {{ btnText }}
</text> </text>
</view> </view>
</view> </view>
<view class="box-wrap" @click="handleKefu"> <view class="box-wrap" @click="handleKefu">
<image src="../../static/ic_service.png"></image> <image src="../../static/ic_service.png"></image>
<text>客服时间</text> <text>客服时间</text>
<text>工作日9:00-18:00</text> <text>工作日9:00-18:00</text>
</view> </view>
<kefu-popup :show="showKefuPop" @close="showKefuPop = false" /> <kefu-popup :show="showKefuPop" @close="showKefuPop = false" />
</view> </view>
</template> </template>
...@@ -125,90 +143,118 @@ ...@@ -125,90 +143,118 @@
selectedVipIndex: -1, selectedVipIndex: -1,
btnText: '', btnText: '',
userBean: {}, userBean: {},
os: 'android', os: 'android',
showKefuPop:false showKefuPop: false
} }
}, },
onLoad(options) { onLoad(options) {
let that = this; let that = this;
if (tt.getSystemInfoSync().platform === 'ios') { if (tt.getSystemInfoSync().platform === 'ios') {
this.os = 'ios'; this.os = 'ios';
} }
this.post({ this.post({
url: '/user/baseMsg', url: '/user/baseMsg',
showLoading: false, showLoading: false,
success: ({ success: ({
data data
}) => { }) => {
this.userBean = data; this.userBean = data;
} }
}); });
this.post({ this.post({
url: '/vip/getVipProducts', url: '/vip/getVipProducts',
showLoading: false, showLoading: false,
success: ({ success: ({
data data
}) => { }) => {
if (data.list != null && data.list.length > 0) { if (data.list != null && data.list.length > 0) {
for (let i = 0; i < data.list.length; i++) { for (let i = 0; i < data.list.length; i++) {
if (data.list[i].largeType == 'point') { if (data.list[i].largeType == 'point') {
that.pointList.push(data.list[i]); that.pointList.push(data.list[i]);
} else { } else {
that.vipList.push(data.list[i]); that.vipList.push(data.list[i]);
} }
} }
} }
if (that.pointList != null && that.pointList.length > 0) { if (that.pointList != null && that.pointList.length > 0) {
for (let i = 0; i < that.pointList.length; i++) { for (let i = 0; i < that.pointList.length; i++) {
if (that.pointList[i].activityType == 1) { if (that.pointList[i].activityType == 1) {
that.selectedIndex = i; that.selectedIndex = i;
let cashStr = that.pointList[i].firstPayPrice let cashStr = that.pointList[i].firstPayPrice
that.btnText = "立即支付" + cashStr + "元"
if (that.pointList[i].yhqRateBalance != null) { if (that.os == 'ios') {
let tempYhq = new Decimal(cashStr).sub(new Decimal(that.pointList[i] that.btnText = "立即支付" + that.multiply(cashStr) + "钻石"
.yhqRateBalance)).toNumber() } else {
that.btnText = "立即支付" + cashStr + "元"
}
if (that.pointList[i].yhqRateBalance != null) {
let tempYhq = new Decimal(cashStr).sub(new Decimal(that.pointList[i]
.yhqRateBalance)).toNumber()
if (that.os == 'ios') {
that.btnText = "立即支付" + that.multiply(that.pointList[i]
.yhqRateBalance) + "钻石,已优惠" +
that.multiply(tempYhq) + "钻石"
} else {
that.btnText = "立即支付" + that.pointList[i].yhqRateBalance + "元,已优惠" +
tempYhq + "元"
}
}
if (that.pointList[i].weixin) {
that.wxShowFlag = true
that.isZfb = false
} else {
that.wxShowFlag = false
that.isZfb = true
}
break;
}
}
}
if (that.pointList != null && that.pointList.length > 0 && that.selectedIndex == 0) {
let cashStr = that.pointList[0].firstPayPrice
if (that.os == 'ios') {
that.btnText = "立即支付" + that.multiply(cashStr) + "钻石"
} else {
that.btnText = "立即支付" + cashStr + "元"
}
if (that.pointList[0].yhqRateBalance != null) {
let tempYhq = new Decimal(cashStr).sub(new Decimal(that.pointList[0]
.yhqRateBalance)).toNumber()
if (that.os == 'ios') {
that.btnText = "立即支付" + that.multiply(that.pointList[i]
.yhqRateBalance) + "钻石,已优惠" +
that.multiply(tempYhq) + "钻石"
} else {
that.btnText = "立即支付" + that.pointList[i].yhqRateBalance + "元,已优惠" + that.btnText = "立即支付" + that.pointList[i].yhqRateBalance + "元,已优惠" +
tempYhq + "元" tempYhq + "元"
} }
if (that.pointList[i].weixin) { }
that.wxShowFlag = true if (that.pointList[0].weixin) {
that.isZfb = false that.wxShowFlag = true
} else { that.isZfb = false
that.wxShowFlag = false } else {
that.isZfb = true that.wxShowFlag = false
} that.isZfb = true
break; }
} }
} }
} });
if (that.pointList != null && that.pointList.length > 0 && that.selectedIndex == 0) {
let cashStr = that.pointList[0].firstPayPrice
that.btnText = "立即支付" + cashStr + "元"
if (that.pointList[0].yhqRateBalance != null) {
let tempYhq = new Decimal(cashStr).sub(new Decimal(that.pointList[0]
.yhqRateBalance)).toNumber()
that.btnText = "立即支付" + that.pointList[0].yhqRateBalance + "元,已优惠" + tempYhq +
"元"
}
if (that.pointList[0].weixin) {
that.wxShowFlag = true
that.isZfb = false
} else {
that.wxShowFlag = false
that.isZfb = true
}
}
}
});
}, },
methods: { methods: {
multiply(num) {
return parseInt(num * 10);
},
loadData() { loadData() {
}, },
dialogClose() { dialogClose() {
this.$refs.alertDialog.close(); this.$refs.alertDialog.close();
...@@ -220,21 +266,42 @@ ...@@ -220,21 +266,42 @@
// this.handlePay(); // this.handlePay();
if (this.selectedIndex == -1) { if (this.selectedIndex == -1) {
// vip充值 // vip充值
let cashStr = this.vipList[this.selectedVipIndex].firstPayPrice let cashStr = this.vipList[this.selectedVipIndex].firstPayPrice
that.btnText = "立即支付" + cashStr + "元" if (that.os == 'ios') {
that.btnText = "立即支付" + that.multiply(cashStr) + "钻石"
} else {
that.btnText = "立即支付" + cashStr + "元"
}
if (that.vipList[this.selectedVipIndex].yhqRateBalance != null) { if (that.vipList[this.selectedVipIndex].yhqRateBalance != null) {
let tempYhq = new Decimal(cashStr).sub(new Decimal(that.vipList[this.selectedVipIndex] let tempYhq = new Decimal(cashStr).sub(new Decimal(that.vipList[this.selectedVipIndex]
.yhqRateBalance)).toNumber() .yhqRateBalance)).toNumber()
that.btnText = "立即支付" + that.vipList[this.selectedVipIndex].yhqRateBalance + "元,已优惠" + tempYhq + if (that.os == 'ios') {
"元" that.btnText = "立即支付" + that.multiply(that.vipList[selectedVipIndex]
.yhqRateBalance) + "钻石,已优惠" +
that.multiply(tempYhq) + "钻石"
} else {
that.btnText = "立即支付" + that.vipList[this.selectedVipIndex].yhqRateBalance + "元,已优惠" + tempYhq +
"元"
}
} }
} else { } else {
let cashStr = this.pointList[this.selectedIndex].firstPayPrice let cashStr = this.pointList[this.selectedIndex].firstPayPrice
that.btnText = "立即支付" + cashStr + "元" if (that.os == 'ios') {
that.btnText = "立即支付" + that.multiply(cashStr) + "钻石"
} else {
that.btnText = "立即支付" + cashStr + "元"
}
if (that.pointList[this.selectedIndex].yhqRateBalance != null) { if (that.pointList[this.selectedIndex].yhqRateBalance != null) {
let tempYhq = new Decimal(cashStr).sub(new Decimal(that.pointList[this.selectedIndex] let tempYhq = new Decimal(cashStr).sub(new Decimal(that.pointList[this.selectedIndex]
.yhqRateBalance)).toNumber() .yhqRateBalance)).toNumber()
that.btnText = "立即支付" + that.pointList[this.selectedIndex].yhqRateBalance + "元,已优惠" + tempYhq + "元" if (that.os == 'ios') {
that.btnText = "立即支付" + that.multiply(that.pointList[this.selectedIndex].yhqRateBalance) + "钻石,已优惠" +
that.multiply(tempYhq) + "钻石"
} else {
that.btnText = "立即支付" + that.pointList[this.selectedIndex].yhqRateBalance + "元,已优惠" + tempYhq + "元"
}
} }
} }
}, },
...@@ -246,20 +313,40 @@ ...@@ -246,20 +313,40 @@
if (this.selectedIndex == -1) { if (this.selectedIndex == -1) {
// vip充值 // vip充值
let cashStr = this.vipList[this.selectedVipIndex].firstPayPrice let cashStr = this.vipList[this.selectedVipIndex].firstPayPrice
that.btnText = "立即支付" + cashStr + "元" if (that.os == 'ios') {
that.btnText = "立即支付" + that.multiply(cashStr) + "钻石"
} else {
that.btnText = "立即支付" + cashStr + "元"
}
if (that.vipList[this.selectedVipIndex].yhqRateBalance != null) { if (that.vipList[this.selectedVipIndex].yhqRateBalance != null) {
let tempYhq = new Decimal(cashStr).sub(new Decimal(that.vipList[this.selectedVipIndex] let tempYhq = new Decimal(cashStr).sub(new Decimal(that.vipList[this.selectedVipIndex]
.yhqRateBalance)).toNumber() .yhqRateBalance)).toNumber()
that.btnText = "立即支付" + that.vipList[this.selectedVipIndex].yhqRateBalance + "元,已优惠" + tempYhq + if (that.os == 'ios') {
"元" that.btnText = "立即支付" + that.multiply(that.vipList[selectedVipIndex]
.yhqRateBalance) + "钻石,已优惠" +
that.multiply(tempYhq) + "钻石"
} else {
that.btnText = "立即支付" + that.vipList[this.selectedVipIndex].yhqRateBalance + "元,已优惠" + tempYhq +
"元"
}
} }
} else { } else {
let cashStr = this.pointList[this.selectedIndex].firstPayPrice let cashStr = this.pointList[this.selectedIndex].firstPayPrice
that.btnText = "立即支付" + cashStr + "元" if (that.os == 'ios') {
that.btnText = "立即支付" + that.multiply(cashStr) + "钻石"
} else {
that.btnText = "立即支付" + cashStr + "元"
}
if (that.pointList[this.selectedIndex].yhqRateBalance != null) { if (that.pointList[this.selectedIndex].yhqRateBalance != null) {
let tempYhq = new Decimal(cashStr).sub(new Decimal(that.pointList[this.selectedIndex] let tempYhq = new Decimal(cashStr).sub(new Decimal(that.pointList[this.selectedIndex]
.yhqRateBalance)).toNumber() .yhqRateBalance)).toNumber()
that.btnText = "立即支付" + that.pointList[this.selectedIndex].yhqRateBalance + "元,已优惠" + tempYhq + "元" if (that.os == 'ios') {
that.btnText = "立即支付" + that.multiply(that.pointList[this.selectedIndex].yhqRateBalance) + "钻石,已优惠" +
that.multiply(tempYhq) + "钻石"
} else {
that.btnText = "立即支付" + that.pointList[this.selectedIndex].yhqRateBalance + "元,已优惠" + tempYhq + "元"
}
} }
} }
}, },
...@@ -274,11 +361,6 @@ ...@@ -274,11 +361,6 @@
// this.$refs.alertDialog.open(); // this.$refs.alertDialog.open();
}, },
handlePay() { handlePay() {
if (this.os == 'ios') {
message.notify('暂不支持ios支付');
return
}
let that = this; let that = this;
let vipBean = this.pointList[this.selectedIndex]; let vipBean = this.pointList[this.selectedIndex];
if (this.selectedIndex == -1) { if (this.selectedIndex == -1) {
...@@ -326,36 +408,16 @@ ...@@ -326,36 +408,16 @@
} }
let that = this; let that = this;
if (this.os == 'ios') { tt.getOrderPayment({
if (!tt.canIUse('getOrderPayment.object.imId')) { orderId: oid,
message.notify('请升级抖音APP版本.'); success(res) {
return that.queryOrderStatus(largeType, ttData.tidStr);
} },
fail(res) {
tt.getOrderPayment({ console.log('android=ttPay res.errMsg', res)
orderId: oid, // message.notify(res.errMsg);
imId: ttData.imId, },
immediate: true, });
success(res) {
that.queryOrderStatus(largeType, ttData.tidStr);
},
fail(res) {
console.log('ios=ttPay res.errMsg', res)
// message.notify(res.errMsg);
},
});
} else {
tt.getOrderPayment({
orderId: oid,
success(res) {
that.queryOrderStatus(largeType, ttData.tidStr);
},
fail(res) {
console.log('android=ttPay res.errMsg', res)
// message.notify(res.errMsg);
},
});
}
}, },
queryOrderStatus(largeType, tid) { queryOrderStatus(largeType, tid) {
let that = this; let that = this;
...@@ -480,24 +542,24 @@ ...@@ -480,24 +542,24 @@
color: white; color: white;
font-size: 26rpx; font-size: 26rpx;
margin-bottom: 40rpx; margin-bottom: 40rpx;
} }
.box-wrap { .box-wrap {
position: absolute; position: absolute;
bottom: 20%; bottom: 20%;
right: 6%; right: 6%;
z-index: 999; z-index: 999;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
image { image {
width: 100rpx; width: 100rpx;
height: 100rpx; height: 100rpx;
} }
text { text {
color: #2c2c2c; color: #2c2c2c;
} }
} }
</style> </style>
\ No newline at end of file
...@@ -11,7 +11,15 @@ ...@@ -11,7 +11,15 @@
<view style="font-size: 26rpx;color: gray;margin-top: 16rpx;">付款时间:{{item.createtime}}</view> <view style="font-size: 26rpx;color: gray;margin-top: 16rpx;">付款时间:{{item.createtime}}</view>
<view style="font-size: 26rpx;color: gray;margin-top: 1rpx;">订单编号:{{item.orderid}}</view> <view style="font-size: 26rpx;color: gray;margin-top: 1rpx;">订单编号:{{item.orderid}}</view>
</view> </view>
<view style="display: flex;align-items: center;margin-right: 8rpx;font-size: 36rpx;color: red;"> <view v-if="item.detailChannel=='DIAMOND'"
style="display: flex;align-items: center;margin-right: 8rpx;font-size: 36rpx;color: #f2b068;">
<image style="width: 50rpx;height: 50rpx;display: flex;margin-right: 10rpx;"
src="@/static/ic_zuan.png">
</image>
{{multiply(item.balance)}}
</view>
<view v-else
style="display: flex;align-items: center;margin-right: 8rpx;font-size: 36rpx;color: red;">
{{item.balance}} {{item.balance}}
</view> </view>
</view> </view>
...@@ -35,8 +43,8 @@ ...@@ -35,8 +43,8 @@
mixins: [common], mixins: [common],
data() { data() {
return { return {
dataList: [], dataList: [],
showKefuPop:false showKefuPop: false
}; };
}, },
methods: { methods: {
...@@ -44,6 +52,9 @@ ...@@ -44,6 +52,9 @@
if (this.$refs.paging != null) { if (this.$refs.paging != null) {
this.$refs.paging.refresh(); this.$refs.paging.refresh();
} }
},
multiply(num) {
return parseInt(num * 10);
}, },
queryList(page, size) { queryList(page, size) {
this.post({ this.post({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment