|
|
@@ -6,7 +6,7 @@
|
|
|
<text class="time">请在{{payLimitTime}}前完成支付</text>
|
|
|
<view class="price-box">
|
|
|
<text class="unit">¥</text>
|
|
|
- <text class="num">{{payMoney.toFixed(2)}}</text>
|
|
|
+ <text class="num">{{payMoney}}</text>
|
|
|
</view>
|
|
|
<!-- <text class="desc" v-if="payType==2">代收金额{{payDelivery.toFixed(2)}},请您在收到快递后支付尾款给快递人员。</text> -->
|
|
|
<!-- <text class="desc" v-if="payType==3">货到付款金额{{payDelivery.toFixed(2)}},请您在收到快递后支付给快递人员。</text> -->
|
|
|
@@ -15,7 +15,7 @@
|
|
|
<view class="pay-type">
|
|
|
<view class="title">支付方式</view>
|
|
|
<!-- 改价订单只能选择微信支付和物流代收 -->
|
|
|
- <radio-group @change="payTypeChange" v-if="order.isEditMoney!=null&&order.isEditMoney==1">
|
|
|
+ <radio-group @change="payTypeChange">
|
|
|
<view class="item">
|
|
|
<view class="left">
|
|
|
<image
|
|
|
@@ -24,7 +24,7 @@
|
|
|
<text class="text">微信支付</text>
|
|
|
</view>
|
|
|
<label>
|
|
|
- <radio :value="1" :checked="order.payType=='1'" />
|
|
|
+ <radio :value="1" :checked="payType=='1'" />
|
|
|
</label>
|
|
|
</view>
|
|
|
<!-- <view class="item" >
|
|
|
@@ -37,85 +37,6 @@
|
|
|
</label>
|
|
|
</view> -->
|
|
|
</radio-group>
|
|
|
-
|
|
|
- <radio-group @change="payTypeChange" v-else-if="order.orderCreateType!=null&& order.orderCreateType==3">
|
|
|
- <view class="item">
|
|
|
- <view class="left">
|
|
|
- <image
|
|
|
- src="https://jnlzjk-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/wecha_pay.png"
|
|
|
- mode=""></image>
|
|
|
- <text class="text">微信支付</text>
|
|
|
- </view>
|
|
|
- <label>
|
|
|
- <radio :value="1" :checked="order.payType=='1'" />
|
|
|
- </label>
|
|
|
- </view>
|
|
|
- <!-- <view class="item" >
|
|
|
- <view class="left">
|
|
|
- <image src="https://jnlzjk-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/pay_de.png" mode=""></image>
|
|
|
- <text class="text">物流代收</text>
|
|
|
- </view>
|
|
|
- <label>
|
|
|
- <radio :value="2" :checked="order.payType=='2'" />
|
|
|
- </label>
|
|
|
- </view> -->
|
|
|
- <!-- <view class="item" v-if="user!=null&&user.level==1 "> -->
|
|
|
- <!-- <view class="item" >
|
|
|
- <view class="left">
|
|
|
- <image src="https://jnlzjk-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/pay_1.png" mode=""></image>
|
|
|
- <text class="text">货到付款</text>
|
|
|
- </view>
|
|
|
- <label>
|
|
|
- <radio :value="3" :checked="order.payType=='3'" />
|
|
|
- </label>
|
|
|
- </view> -->
|
|
|
- </radio-group>
|
|
|
- <radio-group @change="payTypeChange" v-else-if="order.orderCreateType!=null&& order.orderCreateType==2">
|
|
|
- <view class="item" v-if="payType==1||payType==4">
|
|
|
- <view class="left">
|
|
|
- <image
|
|
|
- src="https://jnlzjk-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/wecha_pay.png"
|
|
|
- mode=""></image>
|
|
|
- <text class="text">微信支付</text>
|
|
|
- </view>
|
|
|
- <label>
|
|
|
- <radio :value="1" :checked="order.payType=='1'" />
|
|
|
- </label>
|
|
|
- </view>
|
|
|
- <!-- <view class="item" v-if="payType==2||payType==4">
|
|
|
- <view class="left" >
|
|
|
- <image src="https://jnlzjk-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/pay_de.png" mode=""></image>
|
|
|
- <text class="text">物流代收</text>
|
|
|
- </view>
|
|
|
- <label>
|
|
|
- <radio :value="2" :checked="order.payType=='2'" />
|
|
|
- </label>
|
|
|
- </view> -->
|
|
|
- <!-- <view class="item" v-if="user!=null&&user.level==1 "> -->
|
|
|
- <!-- <view class="item" v-if="payType==1||payType==4" >
|
|
|
- <view class="left">
|
|
|
- <image src="https://jnlzjk-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/pay_1.png" mode=""></image>
|
|
|
- <text class="text">货到付款</text>
|
|
|
- </view>
|
|
|
- <label>
|
|
|
- <radio :value="3" :checked="order.payType=='3'" />
|
|
|
- </label>
|
|
|
- </view> -->
|
|
|
- </radio-group>
|
|
|
- <radio-group @change="payTypeChange"
|
|
|
- v-else-if="order.orderCreateType!=null&&(order.orderCreateType==1)">
|
|
|
- <view class="item">
|
|
|
- <view class="left">
|
|
|
- <image
|
|
|
- src="https://jnlzjk-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/wecha_pay.png"
|
|
|
- mode=""></image>
|
|
|
- <text class="text">微信支付</text>
|
|
|
- </view>
|
|
|
- <label>
|
|
|
- <radio :value="1" checked />
|
|
|
- </label>
|
|
|
- </view>
|
|
|
- </radio-group>
|
|
|
</view>
|
|
|
<!-- 订单详情查看 -->
|
|
|
<view class="order-info">
|
|
|
@@ -133,7 +54,7 @@
|
|
|
</view>
|
|
|
<view class="item">
|
|
|
<text class="label">订单金额</text>
|
|
|
- <text class="text" v-if="order!=null">{{order.payPrice.toFixed(2)}}</text>
|
|
|
+ <text class="text" v-if="order!=null">{{order.payPrice}}</text>
|
|
|
</view>
|
|
|
|
|
|
<!-- <view class="item">
|
|
|
@@ -144,6 +65,9 @@
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
+ <uni-popup ref="popTip" type="dialog">
|
|
|
+ <uni-popup-dialog cancelText="支付失败" confirmText="支付成功" mode="base" content="是否已支付成功?" title="提示" :duration="2000" :before-close="true" @close="closeTip" @confirm="confirmTip"></uni-popup-dialog>
|
|
|
+ </uni-popup>
|
|
|
<view class="btn-box">
|
|
|
<view class="btn" @click="payOrder()">去支付</view>
|
|
|
<!-- <view class="other-btn" >
|
|
|
@@ -177,7 +101,7 @@
|
|
|
config: null,
|
|
|
payType: 1,
|
|
|
payLimitTime: null,
|
|
|
- order: null,
|
|
|
+ order:{},
|
|
|
user: null,
|
|
|
payParams: null,
|
|
|
userinfo: {},
|
|
|
@@ -186,11 +110,11 @@
|
|
|
}
|
|
|
},
|
|
|
onLoad(option) {
|
|
|
- this.getSafeUserInfo();
|
|
|
- this.orderId = JSON.parse(option.orderId);
|
|
|
+ //this.getSafeUserInfo();
|
|
|
+ this.orderId = option.orderId;
|
|
|
// this.orderBindUser(this.orderId)
|
|
|
this.getStoreOrderById();
|
|
|
- this.getStoreConfig();
|
|
|
+ //this.getStoreConfig();
|
|
|
// this.getUserInfo();
|
|
|
},
|
|
|
onShow() {
|
|
|
@@ -200,6 +124,16 @@
|
|
|
this.clearPayTypeFun()
|
|
|
},
|
|
|
methods: {
|
|
|
+ closeTip(){
|
|
|
+ this.$refs.popTip.close()
|
|
|
+ },
|
|
|
+ confirmTip() {
|
|
|
+ uni.showLoading({title:"请稍侯...",mask:true});
|
|
|
+ setTimeout(()=>{
|
|
|
+ uni.hideLoading();
|
|
|
+ this.getStoreOrder()
|
|
|
+ },2000);
|
|
|
+ },
|
|
|
getSafeUserInfo() {
|
|
|
try {
|
|
|
const userInfoStr = uni.getStorageSync('userInfo');
|
|
|
@@ -313,19 +247,61 @@
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ getStoreOrder() {
|
|
|
+ var data = {
|
|
|
+ orderId: this.orderId
|
|
|
+ };
|
|
|
+ uni.showLoading();
|
|
|
+ getStoreOrderById(data).then(res => {
|
|
|
+ this.$refs.popTip.close();
|
|
|
+ if (res.code == 200) {
|
|
|
+ uni.hideLoading();
|
|
|
+ this.order = res.order;
|
|
|
+ this.payLimitTime = res.payLimitTime;
|
|
|
+ this.payMoney = this.order.payPrice;
|
|
|
+ this.payDelivery = this.order.payDelivery;
|
|
|
+ if(this.order.status==0){ //0:代付款 1:已支付
|
|
|
+ uni.showToast({title: '未支付成功',icon: 'none'});
|
|
|
+ }
|
|
|
+ else if(this.order.status==1){ //0:代付款 1:已支付
|
|
|
+ this.$refs.popTip.close();
|
|
|
+ uni.redirectTo({
|
|
|
+ url:"./success?order="+JSON.stringify(this.order)
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //套餐订单处理
|
|
|
+ if (res.productPackage != null) {
|
|
|
+ this.payType = res.productPackage.payType;
|
|
|
+ console.log(this.payType)
|
|
|
+ if (this.order.payType == 4) {
|
|
|
+ this.order.payType = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: res.msg,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ rej => {}
|
|
|
+ );
|
|
|
+
|
|
|
+ },
|
|
|
getStoreOrderById() {
|
|
|
var data = {
|
|
|
orderId: this.orderId
|
|
|
};
|
|
|
- var that = this;
|
|
|
uni.showLoading();
|
|
|
- getStoreOrderById(data).then(
|
|
|
- res => {
|
|
|
+ getStoreOrderById(data).then(res => {
|
|
|
+ this.$refs.popTip.close();
|
|
|
if (res.code == 200) {
|
|
|
- console.log(res);
|
|
|
uni.hideLoading();
|
|
|
- that.order = res.order;
|
|
|
- that.payLimitTime = res.payLimitTime;
|
|
|
+ console.log('res.order',res)
|
|
|
+ this.order = res.order;
|
|
|
+ this.payLimitTime = res.payLimitTime;
|
|
|
+ this.payMoney = this.order.payPrice;
|
|
|
+ this.payDelivery = this.order.payDelivery;
|
|
|
//套餐订单处理
|
|
|
if (res.productPackage != null) {
|
|
|
this.payType = res.productPackage.payType;
|
|
|
@@ -334,8 +310,6 @@
|
|
|
this.order.payType = 1;
|
|
|
}
|
|
|
}
|
|
|
- this.editPayType(this.order.payType)
|
|
|
-
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
icon: 'none',
|
|
|
@@ -365,6 +339,15 @@
|
|
|
//this.payType=this.order.payType
|
|
|
this.payMoney = this.order.payMoney;
|
|
|
this.payDelivery = this.order.payDelivery;
|
|
|
+ if(res.order.status==0){ //0:代付款 1:已支付
|
|
|
+ uni.showToast({title: '未支付成功',icon: 'none'});
|
|
|
+ }
|
|
|
+ else if(res.order.status==1){ //0:代付款 1:已支付
|
|
|
+ this.$refs.popTip.close();
|
|
|
+ uni.redirectTo({
|
|
|
+ url:"./success?order="+JSON.stringify(this.order)
|
|
|
+ });
|
|
|
+ }
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
icon: 'none',
|
|
|
@@ -381,64 +364,50 @@
|
|
|
url: '/pages_user/user/otherPaymentOrder?orderId=' + this.orderId
|
|
|
})
|
|
|
},
|
|
|
- // 防抖后的支付方法
|
|
|
- // 修复后的支付方法
|
|
|
- payOrder() {
|
|
|
- // 1. 安全地获取用户信息
|
|
|
- this.getSafeUserInfo();
|
|
|
- // 2. 检查 maOpenId,但不要直接修改字符串
|
|
|
- // 3. 检查用户信息是否有效
|
|
|
- if (!this.userinfo || Object.keys(this.userinfo).length === 0) {
|
|
|
- // uni.showToast({
|
|
|
- // title: '用户信息异常,请重新登录',
|
|
|
- // icon: 'none'
|
|
|
- // });
|
|
|
-
|
|
|
- // 直接跳转到登录页
|
|
|
- this.redirectToLogin();
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- // 4. 检查 maOpenId,如果不存在则提示重新登录
|
|
|
- if (!this.userinfo.maOpenId) {
|
|
|
- // uni.showModal({
|
|
|
- // title: '提示',
|
|
|
- // content: '用户信息不完整,需要重新登录',
|
|
|
- // success: (res) => {
|
|
|
- // if (res.confirm) {
|
|
|
- // this.redirectToLogin();
|
|
|
- // }
|
|
|
- // }
|
|
|
- // });
|
|
|
- this.redirectToLogin();
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- // 5. 检查登录状态
|
|
|
- // this.utils.isLogin().then(res => {
|
|
|
- if (this.$isLogin()) {
|
|
|
- // 创建防抖函数实例
|
|
|
- const debouncedPay = this.debounce(function() {
|
|
|
- this.executePay();
|
|
|
- }, 1000); // 1秒防抖时间
|
|
|
-
|
|
|
- // 执行防抖函数
|
|
|
- debouncedPay();
|
|
|
- } else {
|
|
|
- // 未登录,直接跳转到登录页
|
|
|
- this.redirectToLogin();
|
|
|
+ payOrder() {
|
|
|
+ var that=this;
|
|
|
+ plus.share.getServices(function(res){
|
|
|
+ var sweixin = null;
|
|
|
+ for(var i=0;i<res.length;i++){
|
|
|
+ var t = res[i];
|
|
|
+ if(t.id == 'weixin'){
|
|
|
+ sweixin = t;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(sweixin){
|
|
|
+ console.log('调起小程序')
|
|
|
+ // that.$refs.popPayType.close()
|
|
|
+ that.$refs.popTip.open()
|
|
|
+ //唤起微信跳转小程序
|
|
|
+ sweixin.launchMiniProgram({
|
|
|
+ id:"gh_b51445318864",//gh_7a6a32e5ef61 御君方互医
|
|
|
+ path:'pages/shopping/paymentOrder?orderId='+that.orderId+"&payMethod=app",
|
|
|
+ type:0
|
|
|
+ },function(){
|
|
|
+ console.log("微信唤起成功");
|
|
|
+ return true;
|
|
|
+ },function(e){
|
|
|
+ console.log("微信唤起失败",e);
|
|
|
+ uni.showToast({
|
|
|
+ title:'微信唤起失败,请检查是否有微信应用',
|
|
|
+ icon:'none'
|
|
|
+ })
|
|
|
+ return false;
|
|
|
+ })
|
|
|
+
|
|
|
+ }else{
|
|
|
+ uni.showToast({
|
|
|
+ title:'微信唤起失败,请检查是否有微信应用',
|
|
|
+ icon:'none',
|
|
|
+ duration:3000
|
|
|
+ })
|
|
|
+ return false;
|
|
|
}
|
|
|
- // }).catch(err => {
|
|
|
- // console.error('检查登录状态失败:', err);
|
|
|
- // uni.showToast({
|
|
|
- // title: '登录状态异常',
|
|
|
- // icon: 'none'
|
|
|
- // });
|
|
|
- // // 登录状态异常,也跳转到登录页
|
|
|
- // this.redirectToLogin();
|
|
|
- // });
|
|
|
+
|
|
|
+ },function(res){
|
|
|
+ console.log(JSON.stringify(res));
|
|
|
+ });
|
|
|
},
|
|
|
-
|
|
|
// 实际的支付执行逻辑
|
|
|
executePay() {
|
|
|
var data = {
|