|
@@ -178,37 +178,22 @@
|
|
|
知道了
|
|
|
</view>
|
|
|
</u-popup>
|
|
|
- <!-- 缴费方式-->
|
|
|
- <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="curOrderList"
|
|
|
+ @closePaymentMethod="closePaymentMethod"></PaymentMethod>
|
|
|
<u-toast ref="uToast" />
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import getUrlParams from "../../utils/getUrlParams.js";
|
|
|
+ import PaymentMethod from '@/pages/paymentMethod/paymentMethod.vue'
|
|
|
export default {
|
|
|
- // components: {
|
|
|
- // citySelect
|
|
|
- // },
|
|
|
+ components: {
|
|
|
+ PaymentMethod
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
city: '普定县',
|
|
@@ -257,6 +242,7 @@
|
|
|
if(this.code&&!this.$store.state.vuex_wxinfo.openId){this.handleGetWXInfo(this.code)};
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 定位
|
|
|
getLocation(){
|
|
|
const that = this
|
|
|
uni.getLocation({
|
|
@@ -308,6 +294,7 @@
|
|
|
url: path
|
|
|
})
|
|
|
},
|
|
|
+ // 搜索
|
|
|
handleSearch(){
|
|
|
console.log('this.keyword',this.keyword);
|
|
|
uni.reLaunch({
|
|
@@ -389,83 +376,87 @@
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- gyBankPay() {
|
|
|
- this.$u.api.payGzbank({orderList: this.curOrderList}).then(res=>{
|
|
|
- let payUrl = res.data.url;
|
|
|
- this.currentPayUrl=encodeURIComponent(res.data.url);
|
|
|
- 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.curOrderList)
|
|
|
- } else {
|
|
|
- this.getCode()
|
|
|
- }
|
|
|
- },
|
|
|
- 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:'/',
|
|
|
- });
|
|
|
- }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'
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- 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)
|
|
|
- }
|
|
|
- }).catch((err) => {
|
|
|
- this.$refs.uToast.show({
|
|
|
- title: err.msg,
|
|
|
- type: 'error',
|
|
|
- });
|
|
|
- })
|
|
|
- },
|
|
|
+ // gyBankPay() {
|
|
|
+ // this.$u.api.payGzbank({orderList: this.curOrderList}).then(res=>{
|
|
|
+ // let payUrl = res.data.url;
|
|
|
+ // this.currentPayUrl=encodeURIComponent(res.data.url);
|
|
|
+ // 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.curOrderList)
|
|
|
+ // } else {
|
|
|
+ // this.getCode()
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // 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:'/',
|
|
|
+ // });
|
|
|
+ // }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'
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // },
|
|
|
+ // 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)
|
|
|
+ // }
|
|
|
+ // }).catch((err) => {
|
|
|
+ // this.$refs.uToast.show({
|
|
|
+ // title: err.msg,
|
|
|
+ // type: 'error',
|
|
|
+ // });
|
|
|
+ // })
|
|
|
+ // },
|
|
|
+ // 关闭弹框
|
|
|
+ closePaymentMethod() {
|
|
|
+ this.payWayPop = false
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|