|
@@ -50,27 +50,11 @@
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</u-modal>
|
|
</u-modal>
|
|
- <!-- 缴费方式-->
|
|
|
|
- <u-modal
|
|
|
|
- v-model="payWayPop"
|
|
|
|
- :title-style="{color: '#404040'}"
|
|
|
|
- title="缴费方式"
|
|
|
|
- :show-confirm-button="false"
|
|
|
|
- :show-cancel-button="false">
|
|
|
|
- <view class="slot-content">
|
|
|
|
- <view class="pay-way">
|
|
|
|
- <view class="pay-way-item" @click="gyBankPay">
|
|
|
|
- <image src="../../static/img/gy-bank-pay-icon.png" mode=""></image>
|
|
|
|
- <view>贵州银行</view>
|
|
|
|
- </view>
|
|
|
|
- <view class="pay-way-item" @click="wechatPay">
|
|
|
|
- <image src="../../static/img/wechat-pay-icon.png" mode=""></image>
|
|
|
|
- <view>微信支付</view>
|
|
|
|
- </view>
|
|
|
|
- </view>
|
|
|
|
- <button class="pay-way-close-btn" @click="payWayPop = false">关闭</button>
|
|
|
|
- </view>
|
|
|
|
- </u-modal>
|
|
|
|
|
|
+ <!-- 支付方式 -->
|
|
|
|
+ <PaymentMethod
|
|
|
|
+ :payWayPop="payWayPop"
|
|
|
|
+ :curOrderList="currentItem"
|
|
|
|
+ @closePaymentMethod="closePaymentMethod"></PaymentMethod>
|
|
<u-toast ref="uToast" />
|
|
<u-toast ref="uToast" />
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
@@ -78,8 +62,12 @@
|
|
<script>
|
|
<script>
|
|
import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
|
|
import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
|
|
import getUrlParams from "../../utils/getUrlParams.js";
|
|
import getUrlParams from "../../utils/getUrlParams.js";
|
|
|
|
+ import PaymentMethod from '@/pages/paymentMethod/paymentMethod.vue'
|
|
export default {
|
|
export default {
|
|
mixins: [MescrollMixin], // 使用mixin
|
|
mixins: [MescrollMixin], // 使用mixin
|
|
|
|
+ components: {
|
|
|
|
+ PaymentMethod
|
|
|
|
+ },
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
currentPayUrl: "",
|
|
currentPayUrl: "",
|
|
@@ -118,17 +106,7 @@
|
|
}
|
|
}
|
|
},
|
|
},
|
|
onLoad(){
|
|
onLoad(){
|
|
- // let locationLocaturl = window.location.hash;
|
|
|
|
- // this.orderId = getUrlParams(locationLocaturl,"orderId"); // 截取orderId
|
|
|
|
- // console.log('this.orderId',this.orderId);
|
|
|
|
- // if (this.orderId) {
|
|
|
|
- // this.handleGetOrderinfo(this.orderId);
|
|
|
|
- // }
|
|
|
|
- // this.code = getUrlParams(locationLocaturl,"code");
|
|
|
|
- // if (this.code) {
|
|
|
|
- // this.handleGetWXInfo(this.code)
|
|
|
|
- // }
|
|
|
|
-
|
|
|
|
|
|
+
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
customBack(){
|
|
customBack(){
|
|
@@ -226,54 +204,23 @@
|
|
},
|
|
},
|
|
// 去支付,选择支付方式
|
|
// 去支付,选择支付方式
|
|
choosePayWay(item) {
|
|
choosePayWay(item) {
|
|
- console.log(item)
|
|
|
|
this.currentItem = []
|
|
this.currentItem = []
|
|
this.currentItem.push(item)
|
|
this.currentItem.push(item)
|
|
this.payWayPop = true
|
|
this.payWayPop = true
|
|
},
|
|
},
|
|
- // 贵阳银行支付
|
|
|
|
- gyBankPay(list) {
|
|
|
|
- this.$u.api.payGzbank({orderList: this.currentItem}).then(res=>{
|
|
|
|
- let payUrl = res.data.url;
|
|
|
|
- this.currentPayUrl=encodeURIComponent(res.data.url);
|
|
|
|
- // console.log('this.currentPayUrl',this.currentPayUrl);
|
|
|
|
- // return;
|
|
|
|
- this.$u.route({
|
|
|
|
- url: 'pages/payLists/pay',
|
|
|
|
- params: {
|
|
|
|
- currentPayUrl:this.currentPayUrl
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }).catch(err=>{
|
|
|
|
- this.$refs.uToast.show({
|
|
|
|
- title: err.msg,
|
|
|
|
- type: 'error',
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
- // 微信支付
|
|
|
|
- wechatPay() {
|
|
|
|
- const openId = this.$store.state.vuex_wxinfo.openId
|
|
|
|
- if (openId) {
|
|
|
|
- this.getWXPay(this.currentItem)
|
|
|
|
- } else {
|
|
|
|
- this.getCode()
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
// 全部缴费确认
|
|
// 全部缴费确认
|
|
confirmPrice() {
|
|
confirmPrice() {
|
|
let orderNum = 0, price = 0
|
|
let orderNum = 0, price = 0
|
|
this.currentItem = []
|
|
this.currentItem = []
|
|
this.payList.forEach(item => {
|
|
this.payList.forEach(item => {
|
|
- console.log(item)
|
|
|
|
if (item.orderStatus !== 4 && item.payStatus !== 1 ) {
|
|
if (item.orderStatus !== 4 && item.payStatus !== 1 ) {
|
|
- price += item.payAmount
|
|
|
|
|
|
+ price += Number(item.payAmount)
|
|
orderNum ++
|
|
orderNum ++
|
|
this.currentItem.push(item.orderId)
|
|
this.currentItem.push(item.orderId)
|
|
}
|
|
}
|
|
})
|
|
})
|
|
this.payTipsItem.num = orderNum
|
|
this.payTipsItem.num = orderNum
|
|
- this.payTipsItem.price = price
|
|
|
|
|
|
+ this.payTipsItem.price = price.toFixed(2)
|
|
if (orderNum !== 0 && price !== 0) {
|
|
if (orderNum !== 0 && price !== 0) {
|
|
this.payTipsPop = true
|
|
this.payTipsPop = true
|
|
} else {
|
|
} else {
|
|
@@ -287,69 +234,9 @@
|
|
payTipsPopConfirm() {
|
|
payTipsPopConfirm() {
|
|
this.payWayPop = true
|
|
this.payWayPop = true
|
|
},
|
|
},
|
|
- getCode () {
|
|
|
|
- var local = window.location.href // 获取页面url
|
|
|
|
- let locationLocaturl = window.location.search;
|
|
|
|
- this.code = getUrlParams(locationLocaturl,"code"); // 截取code
|
|
|
|
- if (this.code == null || this.code === '') { // 如果没有code,则去请求
|
|
|
|
- window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${this.config.wxAppid}&redirect_uri=${encodeURIComponent(local)}&response_type=code&scope=snsapi_userinfo&#wechat_redirect`
|
|
|
|
- } else {
|
|
|
|
- this.handleGetWXInfo(this.code) //把code传给后台获取用户信息
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- handleGetWXInfo (code) { // 通过code获取 openId等用户信息,/api/user/wechat/login 为后台接口
|
|
|
|
- let _this = this
|
|
|
|
- this.$u.api.getWXInfo(code).then((res) => {
|
|
|
|
- if (res.code === 200 ) {
|
|
|
|
- this.$u.vuex('vuex_wxinfo', res.data);
|
|
|
|
- // 继续支付
|
|
|
|
- this.getWXPay(this.currentItem)
|
|
|
|
- } else {
|
|
|
|
- this.$refs.uToast.show({
|
|
|
|
- title: res.msg,
|
|
|
|
- type: 'error',
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- }).catch((err) => {
|
|
|
|
- this.$refs.uToast.show({
|
|
|
|
- title: err.msg,
|
|
|
|
- type: 'error',
|
|
|
|
- });
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
- async getWXPay(list){
|
|
|
|
- let params = {
|
|
|
|
- orderList: list,
|
|
|
|
- openid:this.$store.state.vuex_wxinfo.openId
|
|
|
|
- };
|
|
|
|
- await this.$wxApi.config();
|
|
|
|
- this.$pay.wechatPay(params).then(res =>{
|
|
|
|
- if(res.code == 0){
|
|
|
|
- // 成功
|
|
|
|
- this.$u.route({
|
|
|
|
- url:'pages/payLists/payLists',
|
|
|
|
- });
|
|
|
|
- }else if(res.code == 1){
|
|
|
|
- // 取消
|
|
|
|
- // uni.redirectTo({
|
|
|
|
- // url: '/pages/userCenter/myOrder/myOrder'
|
|
|
|
- // })
|
|
|
|
- }else if(res.code == 2){
|
|
|
|
- this.$refs.uToast.show({
|
|
|
|
- title: '支付失败,请检查!',
|
|
|
|
- type: 'error',
|
|
|
|
- // url: '/pages/user/index'
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
handleGetOrderinfo(orderId){
|
|
handleGetOrderinfo(orderId){
|
|
this.$u.api.getOrderinfo({id:orderId})
|
|
this.$u.api.getOrderinfo({id:orderId})
|
|
.then(res=>{
|
|
.then(res=>{
|
|
- // this.$refs.uToast.show({
|
|
|
|
- // title: res.msg,
|
|
|
|
- // type: 'success',
|
|
|
|
- // });
|
|
|
|
this.orderInfo = res.data;
|
|
this.orderInfo = res.data;
|
|
console.log('handleGetOrderinfo',JSON.parse(JSON.stringify(res)));
|
|
console.log('handleGetOrderinfo',JSON.parse(JSON.stringify(res)));
|
|
}).catch(err=>{
|
|
}).catch(err=>{
|
|
@@ -357,10 +244,12 @@
|
|
title: err.msg,
|
|
title: err.msg,
|
|
type: 'error',
|
|
type: 'error',
|
|
});
|
|
});
|
|
- console.log('handleGetOrderinfo ',err)
|
|
|
|
});
|
|
});
|
|
|
|
|
|
},
|
|
},
|
|
|
|
+ closePaymentMethod() {
|
|
|
|
+ this.payWayPop = false
|
|
|
|
+ }
|
|
}
|
|
}
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|