diff --git a/components/popups/index.vue b/components/popups/index.vue
index 7368a9b..4b9b696 100644
--- a/components/popups/index.vue
+++ b/components/popups/index.vue
@@ -53,7 +53,7 @@
type: String,
default: '付款'
},
- isPay: {
+ isPay: { //区分支付密码还是输入数字
type: Boolean,
default: false
}
diff --git a/mixins/password.js b/mixins/password.js
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/payment/get_payment.vue b/pages/payment/get_payment.vue
index 5db7432..8a36544 100644
--- a/pages/payment/get_payment.vue
+++ b/pages/payment/get_payment.vue
@@ -128,10 +128,6 @@
this.mer_id = opt.mer_id;
},
- onReady() {
- this.$refs.payModal.open();
- },
-
onShow() {
if (!this.isLogin) {
Cache.set("login_back_url_weixin", "/" + getCurrentPages()[0].route + "?mer_id=" + this.mer_id);
@@ -180,7 +176,7 @@
// 输入数字
handleChange(e) {
this.cartForm.total_amount = e;
- uni.$u.throttle(that.getProductInfoByMerid, 20)
+ uni.$u.debounce(that.getProductInfoByMerid, 200)
},
leftClick(e) {
@@ -229,27 +225,30 @@
}
}
- orderCheck(that.checkForm).then(res1 => {
- uni.navigateTo({
- url: "/pages/payment/settlement",
- success: (res) => {
- uni.setStorageSync('datas', {
- platformConsumption: res1.data.platformConsumption || [],
- productData: that.merchantInfo,
- checkForm: that.checkForm,
- money: that.cartForm.total_amount,
- merName: that.mer_name,
- money: that.cartForm.total_amount,
- key: res1.data.key
- })
- },
- fail(err) {
- console.log(err)
- }
- })
- }).catch(err => {
- Toast(err.message || err)
- });
+ if (that.checkForm.cart_id && that.checkForm.cart_id.length > 0) {
+ orderCheck(that.checkForm).then(res1 => {
+ uni.navigateTo({
+ url: "/pages/payment/settlement",
+ success: (res) => {
+ uni.setStorageSync('datas', {
+ platformConsumption: res1.data.platformConsumption ||
+ [],
+ productData: that.merchantInfo,
+ checkForm: that.checkForm,
+ money: that.cartForm.total_amount,
+ merName: that.mer_name,
+ money: that.cartForm.total_amount,
+ key: res1.data.key
+ })
+ },
+ fail(err) {
+ console.log(err)
+ }
+ })
+ }).catch(err => {
+ Toast(err.message || err)
+ });
+ }
},
// 折叠商品
diff --git a/pages/payment/settlement.vue b/pages/payment/settlement.vue
index 735c248..a557ea8 100644
--- a/pages/payment/settlement.vue
+++ b/pages/payment/settlement.vue
@@ -101,6 +101,13 @@
{{couponData.status != "noAddress" ? '提交订单':'选择地址'}}
+
+
+
+
+
+
+
@@ -135,8 +142,17 @@
orderPay,
orderCheck
} from "@/api/payment.js";
+ import {
+ verifyPwd
+ } from '@/api/order.js';
+ import payPwd from "@/components/payPwd/index.vue";
+ import popups from "@/components/popups/index.vue";
export default {
+ components: {
+ payPwd,
+ popups
+ },
data() {
return {
platformConsumption: [],
@@ -260,7 +276,8 @@
use_integral: false,
key: ''
},
- productData: []
+ productData: [],
+ orderData: {}
};
},
computed: {
@@ -576,11 +593,66 @@
});
}
this.payForm.pay_type = that.payType;
- uni.showLoading({
- title: '订单支付中',
- mask: true
- });
+ // 设置支付密码
+ if (that.payType == 'balance' || that.payType == 'merBalance') {
+ this.$refs.popups.handleOpen();
+ } else {
+ uni.showLoading({
+ title: '订单支付中',
+ mask: true
+ });
+ this.truePayOrder(data);
+ }
+ },
+
+
+ // 输入密码回调
+ handleConfirm(e) {
+ // 验证密码是否正确
+ verifyPwd({
+ withdrawal_pwd: e
+ }).then(res => {
+ // 密码是否有效 状态码判断
+ const code = res.data.code;
+ this.$set(this.payForm, 'withdrawal_pwd', e);
+
+ if (code == 100) { //密码正确
+ uni.showLoading({
+ title: '订单支付中',
+ mask: true
+ });
+ this.truePayOrder(this.payForm);
+ } else {
+ this.$refs.payPwd.handleOpen(code);
+ }
+ }).catch(err => {
+ console.log(err)
+ })
+ },
+
+ // 弹框左边按钮 101 未设置密码 102 忘记密码 都去设置密码
+ handleLeft(code) {
+ uni.navigateTo({
+ url: "/pages/users/user_modify_pwd/index?type=payPwd"
+ });
+ this.$refs.payPwd.handleClose();
+ },
+
+ // 弹框右边按钮 取消 重试
+ handleRight(code) {
+ if (code == 101) { //取消
+ this.$refs.payPwd.handleClose(code);
+ } else {
+ this.$refs.payPwd.handleClose();
+ this.$refs.popups.handleOpen();
+ }
+ },
+
+ handleClear() {},
+ handleChange() {},
+
+ truePayOrder() {
// #ifdef MP
openPaySubscribe().then(() => {
that.payment(this.payForm);
@@ -588,7 +660,7 @@
// #endif
// #ifndef MP
- that.payment(this.payForm);
+ this.payment(this.payForm);
// #endif
}
}