|
@@ -17,10 +17,10 @@
|
|
|
<text>油品名:</text><text>{{selectedGas.oilName}}</text>
|
|
|
</view>
|
|
|
<view>
|
|
|
- <text>油站价:</text><text>¥{{selectedGas.oilPrice}}/L</text>
|
|
|
+ <text>油站价:</text><text>¥{{selectedGas.oilPrice}}/{{orderInfo.cardOilsType==4 ? "Kg" : "L"}}</text>
|
|
|
</view>
|
|
|
<view>
|
|
|
- <text>优惠价:</text><text>¥{{orderInfo.discountPrice}}/L</text>
|
|
|
+ <text>优惠价:</text><text>¥{{orderInfo.discountPrice}}/{{orderInfo.cardOilsType==4 ? "Kg" : "L"}}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -35,15 +35,16 @@
|
|
|
<view>
|
|
|
<view class="icon oil"></view>加油升数
|
|
|
</view>
|
|
|
- <text>{{orderInfo.oilLiters}}L</text>
|
|
|
+ <text>{{orderInfo.oilLiters}}{{orderInfo.cardOilsType==4 ? "Kg" : "L"}}</text>
|
|
|
</view>
|
|
|
<view>
|
|
|
<view>
|
|
|
<view class="icon discount"></view>优惠金额
|
|
|
</view>
|
|
|
- <text>¥{{(orderInfo.receivableAmt - orderInfo.amt).toFixed(2)}}</text>
|
|
|
+ <text>¥{{payType === 1 ? (+orderInfo.discountAmt_dzk).toFixed(2):(+orderInfo.discountAmt).toFixed(2)}}</text>
|
|
|
</view>
|
|
|
|
|
|
+ <!--
|
|
|
<view class="dispose coupon">
|
|
|
<view class="title">
|
|
|
<text>优惠券</text>
|
|
@@ -56,30 +57,38 @@
|
|
|
<view class="extra">
|
|
|
有可用的优惠券 >>
|
|
|
</view>
|
|
|
- </view>
|
|
|
- <view class="dispose dzk">
|
|
|
+ </view>
|
|
|
+ -->
|
|
|
+ <view class="dispose dzk" @click="selectPayType" v-if="orderInfo.oilsCardFlag == 1">
|
|
|
<view class="title">
|
|
|
- <text>电子卡支付</text>
|
|
|
- <text>立减50元</text>
|
|
|
+ <text>电子卡</text>
|
|
|
+ <text>电子卡支付更优惠</text>
|
|
|
</view>
|
|
|
<view class="tip">
|
|
|
<text class="icon"></text>
|
|
|
- <text>优惠券和电子卡不可叠加</text>
|
|
|
+ <text v-show="availableCredit">您的{{ cardTypeTranslate[orderInfo.cardOilsType]}}余额<text>{{' ' + orderInfo.balance + ' '}}</text>元,可用来支付此订单</text>
|
|
|
+ <text v-show="!availableCredit">{{ cardTypeTranslate[orderInfo.cardOilsType] }}余额<text>{{' ' + orderInfo.balance + ' '}}</text>元,<text>不足以</text>完成此笔订单</text>
|
|
|
</view>
|
|
|
- <view class="extra icon" :class="[1 === 1 ? 'selected':'', availableCredit ? '':'forbid']"></view>
|
|
|
+ <view class="extra icon" :class="[payType === 1 ? 'selected':'', availableCredit ? '':'forbid']"></view>
|
|
|
</view>
|
|
|
-<!-- <view>
|
|
|
+ <!--
|
|
|
+ <view>
|
|
|
<view>
|
|
|
<view class="icon vip"></view>油站会员
|
|
|
</view>
|
|
|
<text>立刻开通</text>
|
|
|
- </view> -->
|
|
|
+ </view>
|
|
|
+ -->
|
|
|
</view>
|
|
|
<view class="submit">
|
|
|
<view class="area">
|
|
|
- <text>实付款</text>
|
|
|
- <text>¥{{orderInfo.amt}}</text>
|
|
|
- <button class="btn" @click="goSelectPayType" :loading="wxPayLoading" :disabled="wxPayLoading">
|
|
|
+ <text class="type" v-if="orderInfo.oilsCardFlag == 0" @click="selectPayType">实付款</text>
|
|
|
+ <text class="type" v-show="orderInfo.oilsCardFlag == 1 && payType==2" @click="selectPayType">微信付款</text>
|
|
|
+ <text class="type" v-show="orderInfo.oilsCardFlag == 1 && payType==1" @click="selectPayType">电子卡付款</text>
|
|
|
+ <text class="icon" v-if="orderInfo.oilsCardFlag == 1 && availableCredit" @click="selectPayType"></text>
|
|
|
+ <text class="amount" v-show="payType==2">¥{{orderInfo.amt}}</text>
|
|
|
+ <text class="amount" v-show="payType==1">¥{{orderInfo.amt_dzk}}</text>
|
|
|
+ <button class="btn" @click="goPay" :loading="wxPayLoading" :disabled="wxPayLoading">
|
|
|
提交订单
|
|
|
</button>
|
|
|
</view>
|
|
@@ -90,11 +99,11 @@
|
|
|
</view>
|
|
|
<view class="amount">
|
|
|
<text>¥</text>
|
|
|
- {{ orderInfo.amt }}
|
|
|
+ {{ payType==2 ? orderInfo.amt : orderInfo.amt_dzk}}
|
|
|
</view>
|
|
|
- <view class="type">
|
|
|
+ <view class="type" @click="selectPayType">
|
|
|
<text>付款方式</text>
|
|
|
- <text>电子卡支付</text>
|
|
|
+ <text> {{ payType==2 ? '微信支付' : '电子卡支付'}}</text>
|
|
|
<text></text>
|
|
|
</view>
|
|
|
<button type="default" class="pay" @click="creditPay" :loading="creditPayLoading">
|
|
@@ -102,7 +111,7 @@
|
|
|
</button>
|
|
|
</view>
|
|
|
</uni-popup>
|
|
|
- <uni-popup ref="selectPayType" class="selectPayType" type="bottom" maskClick="false">
|
|
|
+<!-- <uni-popup ref="selectPayType" class="selectPayType" type="bottom" maskClick="false">
|
|
|
<view class="cont">
|
|
|
<view class="close" @click="closeSelectPayType">
|
|
|
</view>
|
|
@@ -124,7 +133,7 @@
|
|
|
确认
|
|
|
</button>
|
|
|
</view>
|
|
|
- </uni-popup>
|
|
|
+ </uni-popup> -->
|
|
|
<uni-popup ref="coupon" class="coupon" type="bottom" maskClick="false">
|
|
|
<view class="coupon-container">
|
|
|
<view class="close" @click="closeCoupon">
|
|
@@ -184,58 +193,57 @@
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- creditFlag: false,
|
|
|
- payType: "", // 1电子卡 2微信
|
|
|
+ payType: 2, // 1电子卡 2微信
|
|
|
wxPayLoading: false,
|
|
|
- creditPayLoading: false
|
|
|
+ creditPayLoading: false,
|
|
|
+ cardTypeTranslate:['','汽油卡','柴油卡','非油品卡','LNG','CNG']
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
- ...mapState(["orderInfo", "selectedGas", "openId", "stationId"]),
|
|
|
+ // ...mapState(["orderInfo", "selectedGas", "openId", "stationId"]),
|
|
|
+ // ...mapState({
|
|
|
+ // orderInfo: state => state.order.orderInfo,
|
|
|
+ // openId: state => state.user.openId,
|
|
|
+ // stationId: state => state.station.stationId,
|
|
|
+ // selectedGas: state => state.station.selectedGas,
|
|
|
+ // }),
|
|
|
availableCredit() {
|
|
|
- if (this.selectedGas.oilGunType == '2') {
|
|
|
+ if(this.orderInfo.oilsCardFlag == 0){
|
|
|
return false
|
|
|
}
|
|
|
- if ((+this.orderInfo.balance) < (+this.orderInfo.amt)) {
|
|
|
+ if ((+this.orderInfo.balance) < (+this.orderInfo.amt_dzk)) {
|
|
|
return false
|
|
|
}
|
|
|
return true
|
|
|
},
|
|
|
- tip() {
|
|
|
- if (this.selectedGas.oilGunType == '2') {
|
|
|
- return "非油品不可用电子卡支付"
|
|
|
- }
|
|
|
- if ((+this.orderInfo.balance) < (+this.orderInfo.amt)) {
|
|
|
- if (this.orderInfo.cardOilsType == "1") {
|
|
|
- return "汽油卡余额不足,请在微信公众号充值"
|
|
|
- }
|
|
|
- if (this.orderInfo.cardOilsType == "2") {
|
|
|
- return "柴油卡余额不足,请在微信公众号充值"
|
|
|
- }
|
|
|
- }
|
|
|
- return "电子卡余额充足,可以使用电子卡支付"
|
|
|
+ creditFlag(){
|
|
|
+ return this.orderInfo.oilsCardFlag == '1' ? true : false
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
- this.getCreditFlag()
|
|
|
+ // console.log(this.orderInfo)
|
|
|
+ this.initPayType()
|
|
|
},
|
|
|
mounted() {
|
|
|
// this.$refs.pay.close()
|
|
|
// this.$refs.coupon.open();
|
|
|
},
|
|
|
methods: {
|
|
|
+ ...mapMutations(["clearLabelId"]),
|
|
|
+ initPayType(){
|
|
|
+ if(this.orderInfo.oilsCardFlag == 1 && this.availableCredit){
|
|
|
+ this.payType = 1
|
|
|
+ }
|
|
|
+ },
|
|
|
closeCoupon(){
|
|
|
this.$refs.coupon.close();
|
|
|
},
|
|
|
- async goSelectPayType() {
|
|
|
- if (!this.creditFlag) { //未启用电子卡
|
|
|
+ async creditPay() {
|
|
|
+ this.creditPayLoading = true;
|
|
|
+ if (this.payType === 2) {
|
|
|
this.wxPay()
|
|
|
return
|
|
|
}
|
|
|
- this.$refs.selectPayType.open()
|
|
|
- },
|
|
|
- async creditPay() {
|
|
|
- this.creditPayLoading = true;
|
|
|
uni.showLoading({
|
|
|
title: '支付中...',
|
|
|
mask: true
|
|
@@ -253,7 +261,7 @@
|
|
|
}
|
|
|
this.creditPayLoading = false;
|
|
|
uni.hideLoading();
|
|
|
- uni.navigateTo({
|
|
|
+ uni.redirectTo({
|
|
|
url: "/pages/succeed/succeed"
|
|
|
})
|
|
|
} catch (e) {
|
|
@@ -262,9 +270,6 @@
|
|
|
this.showToastAndGoback(e.toString())
|
|
|
}
|
|
|
},
|
|
|
- cancelCreditPay() {
|
|
|
- this.showToastAndGoback("你取消了电子卡支付")
|
|
|
- },
|
|
|
async wxPay() {
|
|
|
this.wxPayLoading = true;
|
|
|
uni.showLoading({
|
|
@@ -272,37 +277,19 @@
|
|
|
mask: true
|
|
|
});
|
|
|
try {
|
|
|
- // 因为后期要加入定时删除 所以此步骤来确认数据库里是否有此订单
|
|
|
- // 如果没有定时删除任务,此步骤冗余
|
|
|
- const PayOrderData = await this.$Request({
|
|
|
- url: "/getPayOrderList",
|
|
|
- data: {
|
|
|
- "orderNo": this.orderInfo.ordNo,
|
|
|
- "openId": this.openId,
|
|
|
- "userType": 2
|
|
|
- },
|
|
|
- })
|
|
|
- console.log(PayOrderData)
|
|
|
- if (PayOrderData.retCode !== 0) {
|
|
|
- throw new Error("获取order主键失败")
|
|
|
- }
|
|
|
- const orderId = PayOrderData.data[0].orderId
|
|
|
- // 提供给服务端必要的信息,服务端生成随行付的支付信息,返回回来
|
|
|
const JhPayData = await this.$Request({
|
|
|
url: "/getJhPayInfo",
|
|
|
method: "POST",
|
|
|
data: {
|
|
|
- "orderId": orderId,
|
|
|
+ "ordNo": this.orderInfo.ordNo,
|
|
|
"openId": this.openId,
|
|
|
"stationId": this.stationId,
|
|
|
- "subject": this.orderInfo.stationName + "_" + this.selectedGas.oilName + this.selectedGas
|
|
|
- .oilGunType == "1" ? "油品" : "非油品" + "支付订单",
|
|
|
- "userType": "2"
|
|
|
+ "userType": "1"
|
|
|
},
|
|
|
})
|
|
|
console.log(JhPayData)
|
|
|
if (JhPayData.retCode !== 0) {
|
|
|
- throw new Error("请求聚合支付下单接口失败")
|
|
|
+ throw new Error("请求信息失败")
|
|
|
}
|
|
|
if (JhPayData.data.code !== '0000') {
|
|
|
throw new Error(JhPayData.data.msg)
|
|
@@ -324,8 +311,9 @@
|
|
|
|
|
|
if (!!payData && payData.errMsg === "requestPayment:ok") {
|
|
|
this.wxPayLoading = false;
|
|
|
+ this.clearLabelId();
|
|
|
uni.hideLoading();
|
|
|
- uni.navigateTo({
|
|
|
+ uni.redirectTo({
|
|
|
url: "/pages/succeed/succeed"
|
|
|
})
|
|
|
return;
|
|
@@ -333,7 +321,7 @@
|
|
|
this.wxPayLoading = false;
|
|
|
uni.hideLoading();
|
|
|
if (payErr.errMsg === "requestPayment:fail cancel") {
|
|
|
- this.showToastAndGoback("你取消了支付")
|
|
|
+ this.showToastAndGoback("取消了支付")
|
|
|
return;
|
|
|
}
|
|
|
this.showToastAndGoback("支付失败")
|
|
@@ -354,29 +342,27 @@
|
|
|
})
|
|
|
}, 1500)
|
|
|
},
|
|
|
- async getCreditFlag() {
|
|
|
- const PayOrderData = await this.$Request({
|
|
|
- url: "/getStationCardEnabledFlag",
|
|
|
- data: {
|
|
|
- stationId: this.stationId
|
|
|
- }
|
|
|
- })
|
|
|
- console.log(PayOrderData)
|
|
|
- if (PayOrderData.retCode !== 0) {
|
|
|
- this.showToastAndGoback("拉取电子卡启用状态失败")
|
|
|
- return
|
|
|
- }
|
|
|
- this.creditFlag = PayOrderData.data == '1' ? true : false
|
|
|
- },
|
|
|
- selectPayType(type) {
|
|
|
- if (!this.availableCredit && type == 1) {
|
|
|
+
|
|
|
+ // selectPayType(type) {
|
|
|
+ // if (!this.availableCredit && type == 1) {
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // if (type === this.payType) {
|
|
|
+ // this.payType = ""
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // this.payType = type
|
|
|
+ // },
|
|
|
+
|
|
|
+ selectPayType() {
|
|
|
+ if (!this.availableCredit) {
|
|
|
return
|
|
|
}
|
|
|
- if (type === this.payType) {
|
|
|
- this.payType = ""
|
|
|
+ if (this.payType === 1) {
|
|
|
+ this.payType = 2
|
|
|
return
|
|
|
}
|
|
|
- this.payType = type
|
|
|
+ this.payType = 1
|
|
|
},
|
|
|
goPay() {
|
|
|
if (this.payType === 2) {
|
|
@@ -384,17 +370,17 @@
|
|
|
return
|
|
|
}
|
|
|
if (this.payType === 1) {
|
|
|
- this.$refs.selectPayType.close();
|
|
|
+ // this.$refs.selectPayType.close();
|
|
|
this.$refs.pay.open()
|
|
|
}
|
|
|
},
|
|
|
backToSelectPayType() {
|
|
|
this.$refs.pay.close()
|
|
|
- this.$refs.selectPayType.open();
|
|
|
+ // this.$refs.selectPayType.open();
|
|
|
},
|
|
|
- closeSelectPayType() {
|
|
|
- this.$refs.selectPayType.close();
|
|
|
- }
|
|
|
+ // closeSelectPayType() {
|
|
|
+ // this.$refs.selectPayType.close();
|
|
|
+ // }
|
|
|
|
|
|
}
|
|
|
}
|
|
@@ -527,7 +513,6 @@
|
|
|
}
|
|
|
|
|
|
text.price {
|
|
|
- font-size: 24rpx;
|
|
|
color: #F3B235;
|
|
|
line-height: 33rpx;
|
|
|
}
|
|
@@ -541,7 +526,7 @@
|
|
|
}
|
|
|
view.dispose{
|
|
|
width: 690rpx;
|
|
|
- height: 138rpx;
|
|
|
+ height: 150rpx;
|
|
|
position: relative;
|
|
|
display: inline-block;
|
|
|
.title{
|
|
@@ -579,14 +564,21 @@
|
|
|
background: url(../../static/icon/tipicon1.png) no-repeat 0px 0px;
|
|
|
background-size: 100% 100%;
|
|
|
}
|
|
|
- text:nth-child(2){
|
|
|
- width: 220rpx;
|
|
|
+ text:nth-child(2),
|
|
|
+ text:nth-child(3){
|
|
|
height: 28rpx;
|
|
|
font-size: 20rpx;
|
|
|
font-family: PingFangSC-Regular, PingFang SC;
|
|
|
font-weight: 400;
|
|
|
color: rgba(0, 0, 0, 0.4);
|
|
|
line-height: 28rpx;
|
|
|
+
|
|
|
+ text{
|
|
|
+ font-size: 27rpx;
|
|
|
+ font-weight: 800rpx;
|
|
|
+ // color: #007AFF;
|
|
|
+ color: #838383;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -643,19 +635,34 @@
|
|
|
justify-content: flex-end;
|
|
|
align-items: center;
|
|
|
|
|
|
- text:nth-child(1) {
|
|
|
+ >.type{
|
|
|
font-size: 28rpx;
|
|
|
font-weight: 400;
|
|
|
color: #111111;
|
|
|
line-height: 40rpx;
|
|
|
}
|
|
|
-
|
|
|
- text:nth-child(2) {
|
|
|
+ >.amount{
|
|
|
font-size: 30rpx;
|
|
|
font-weight: 600;
|
|
|
color: #f3b338;
|
|
|
line-height: 40rpx;
|
|
|
}
|
|
|
+ >.icon{
|
|
|
+ background: url(../../static/icon/1_b01_down.2x.png) no-repeat 0px 0px;
|
|
|
+ background-size: 100% 100%;
|
|
|
+ display: inline-block;
|
|
|
+ width: 13rpx;
|
|
|
+ height: 8rpx;
|
|
|
+ line-height: 40rpx;
|
|
|
+ margin-left: 10rpx;
|
|
|
+ margin-right: 15rpx;
|
|
|
+ }
|
|
|
+ // text:nth-child(2) {
|
|
|
+ // font-size: 30rpx;
|
|
|
+ // font-weight: 600;
|
|
|
+ // color: #f3b338;
|
|
|
+ // line-height: 40rpx;
|
|
|
+ // }
|
|
|
|
|
|
.btn {
|
|
|
margin-left: 20rpx;
|