|
|
@@ -369,11 +369,11 @@ import AddressWindow from "@components/AddressWindow";
|
|
|
import { postOrderConfirm, postOrderComputed, createOrder } from "@api/order";
|
|
|
import { storeListApi } from "@api/store";
|
|
|
import { getUser } from "@api/user";
|
|
|
-import { pay } from "@libs/wechat";
|
|
|
import { isWeixin } from "@utils";
|
|
|
import { mapGetters } from "vuex";
|
|
|
import cookie from "@utils/store/cookie";
|
|
|
import NavBar from "@components/NavBar";
|
|
|
+import WeChat from "@libs/pay";
|
|
|
const NAME = "OrderSubmission",
|
|
|
_isWeixin = isWeixin();
|
|
|
const LONGITUDE = "user_longitude";
|
|
|
@@ -563,6 +563,7 @@ export default {
|
|
|
this.computedPrice();
|
|
|
},
|
|
|
createOrder() {
|
|
|
+ var that = this;
|
|
|
let shipping_type = this.shipping_type;
|
|
|
if (!this.active) return this.$dialog.toast({ mes: "请选择支付方式" });
|
|
|
if (!this.addressInfo.id && !this.shipping_type)
|
|
|
@@ -617,22 +618,26 @@ export default {
|
|
|
});
|
|
|
break;
|
|
|
case "WECHAT_H5_PAY":
|
|
|
- this.$router.replace({
|
|
|
- path: "/order/detail/" + data.result.orderId
|
|
|
+ console.log(JSON.stringify(data));
|
|
|
+ var config = data.result.jsConfig;
|
|
|
+
|
|
|
+ WeChat.pay(config, function(success, ret) {
|
|
|
+ if (success) {
|
|
|
+ console.log(ret);
|
|
|
+ that.$router.replace({
|
|
|
+ path: "/order/detail/" + data.result.orderId
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ console.log("pay failed !", ret);
|
|
|
+ }
|
|
|
});
|
|
|
- setTimeout(() => {
|
|
|
- location.href = data.result.jsConfig.mweb_url;
|
|
|
- }, 100);
|
|
|
break;
|
|
|
case "WECHAT_PAY":
|
|
|
- pay(data.result.jsConfig).finally(() => {
|
|
|
- this.$router.replace({
|
|
|
- path: "/order/detail/" + data.result.orderId
|
|
|
- });
|
|
|
- });
|
|
|
+ break;
|
|
|
}
|
|
|
})
|
|
|
.catch(err => {
|
|
|
+ console.log(JSON.stringify(err));
|
|
|
this.$dialog.error(err.msg || "创建订单失败");
|
|
|
this.$dialog.loading.close();
|
|
|
this.$router.go(-1);
|