Browse Source

修改了付款流程

feature/feature-compatible
wangkesi 7 years ago
parent
commit
d368dfa1f1
2 changed files with 58 additions and 62 deletions
  1. 5
      src/view/order-check.vue
  2. 115
      src/view/order-detail.vue

5
src/view/order-check.vue

@ -189,8 +189,7 @@ export default {
}
} else {
setTimeout(function() {
window.location.href =
"/mall/web/order_index";
window.location.href = "/v2/order-list";
}, 2000);
}
} else if (data.code === 666) {
@ -213,7 +212,7 @@ export default {
this.$vux.toast.text(data.msg, "middle");
setTimeout(function() {
window.location.href =
"/mall/web/order_index";
"/v2/order-list";
}, 2000);
}
});

115
src/view/order-detail.vue

@ -104,7 +104,8 @@ export default {
state: "",
stateText: "",
orderNo: "",
info: {}
info: {},
authUrl: ""
};
},
watch: {
@ -146,6 +147,7 @@ export default {
})
.then(res => {
if (res.code === 0 && res.response.data) {
this.authUrl = res.response.authUrl || "";
let info = res.response.data;
this.wechat(info.merchantNo);
info.create = info.createdAt
@ -232,71 +234,66 @@ export default {
});
},
pay() {
this.addOrder().then(res => {
this.$vux.loading.show({
text: "正在调起支付"
});
if (isWeixin() && res.data.payPrice > 0) {
//
this.$vux.loading.hide();
location.href = res.authUrl.replace(
"state=2",
"state=2" + "," + res.data.orderNo
);
} else {
var paymentType = res.data.payPrice > 0 ? 7 : 10;
orderApi
.pay({
orderNo: res.data.orderNo,
paymentType: paymentType
})
.then(data => {
this.$vux.loading.hide();
if (data.code === 0) {
if (paymentType === 7) {
var transMessageOutput = data.response;
var transInfo =
transMessageOutput.weixinTransParameters;
if (
transInfo.prepayid !== "" &&
transInfo.prepayid !== undefined &&
transInfo.prepayid != null
) {
window.location.href =
transInfo.mwebUrl;
}
} else {
setTimeout(function() {
window.location.href =
"/mall/web/order_index";
}, 2000);
}
} else if (data.code === 666) {
this.$vux.toast.text(
"您还没登录,请先登录!",
"middle"
);
setTimeout(function() {
window.location.href =
"/mall/web/user/login";
}, 2000);
} else {
this.$vux.loading.show({
text: "正在调起支付"
});
if (isWeixin() && this.info.payPrice > 0) {
//
this.$vux.loading.hide();
location.href = this.authUrl.replace(
"state=2",
"state=2" + "," + this.info.orderNo
);
} else {
let paymentType = this.info.payPrice > 0 ? 7 : 10;
orderApi
.pay({
orderNo: this.info.orderNo,
paymentType: paymentType
})
.then(data => {
this.$vux.loading.hide();
if (data.code === 0) {
if (paymentType === 7) {
var transMessageOutput = data.response;
var transInfo =
transMessageOutput.weixinTransParameters;
if (
data.msg === "" ||
data.msg === undefined ||
data.msg == null
transInfo.prepayid !== "" &&
transInfo.prepayid !== undefined &&
transInfo.prepayid != null
) {
data.msg = "操作失败,请刷新重试";
window.location.href = transInfo.mwebUrl;
}
this.$vux.toast.text(data.msg, "middle");
} else {
setTimeout(function() {
window.location.href =
"/mall/web/order_index";
"/v2/order-list";
}, 2000);
}
});
}
});
} else if (data.code === 666) {
this.$vux.toast.text(
"您还没登录,请先登录!",
"middle"
);
setTimeout(function() {
window.location.href = "/mall/web/user/login";
}, 2000);
} else {
if (
data.msg === "" ||
data.msg === undefined ||
data.msg == null
) {
data.msg = "操作失败,请刷新重试";
}
this.$vux.toast.text(data.msg, "middle");
setTimeout(function() {
window.location.href = "/v2/order-list";
}, 2000);
}
});
}
},
addOrder() {
let goodsNo = this.info.goodsNo;

Loading…
Cancel
Save