H5支持微信支付
This commit is contained in:
@ -141,6 +141,7 @@ export function handleOrderPayResults(data, type) {
|
|||||||
break;
|
break;
|
||||||
// APP支付
|
// APP支付
|
||||||
case "WECHAT_APP_PAY":
|
case "WECHAT_APP_PAY":
|
||||||
|
|
||||||
weappPay(data.result.jsConfig).finally(() => {
|
weappPay(data.result.jsConfig).finally(() => {
|
||||||
goOrderDetails(data.result.orderId, type)
|
goOrderDetails(data.result.orderId, type)
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,8 +1,38 @@
|
|||||||
import { getProvider } from "@/utils";
|
import { getProvider } from "@/utils";
|
||||||
|
import WechatJSSDK from "wechat-jssdk/dist/client.umd";
|
||||||
|
import { getWechatConfig, wechatAuth } from "@/api/public";
|
||||||
|
import { parseQuery } from "@/utils";
|
||||||
|
import cookie from "@/utils/store/cookie";
|
||||||
|
import store from "@/store";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
// 支付模块
|
// 支付模块
|
||||||
export const weappPay = (option) => {
|
export const weappPay = (option) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
console.log(option)
|
||||||
|
if (store.state.$deviceType == 'weixinh5') {
|
||||||
|
setTimeout(() => {
|
||||||
|
location.href = option.mweb_url;
|
||||||
|
}, 100);
|
||||||
|
resolve()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (store.state.$deviceType == 'weixin') {
|
||||||
|
pay(option).then(() => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '支付成功', icon: 'success', duration: 5000,
|
||||||
|
});
|
||||||
|
resolve()
|
||||||
|
})
|
||||||
|
.finally(res => {
|
||||||
|
//if(typeof(res) == "undefined") return
|
||||||
|
})
|
||||||
|
.catch(function () {
|
||||||
|
uni.showToast({ title: '支付失败', icon: 'none', duration: 5000 });
|
||||||
|
reject()
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
// 吊起微信支付
|
// 吊起微信支付
|
||||||
// getProvider('payment').then(provider => {
|
// getProvider('payment').then(provider => {
|
||||||
let orderInfo = {
|
let orderInfo = {
|
||||||
@ -44,13 +74,6 @@ export const weappPay = (option) => {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
import WechatJSSDK from "wechat-jssdk/dist/client.umd";
|
|
||||||
import { getWechatConfig, wechatAuth } from "@/api/public";
|
|
||||||
import { parseQuery } from "@/utils";
|
|
||||||
import cookie from "@/utils/store/cookie";
|
|
||||||
import store from "@/store";
|
|
||||||
import dayjs from "dayjs";
|
|
||||||
|
|
||||||
const STATE_KEY = "wx_authorize_state";
|
const STATE_KEY = "wx_authorize_state";
|
||||||
const WX_AUTH = "wx_auth";
|
const WX_AUTH = "wx_auth";
|
||||||
const BACK_URL = "login_back_url";
|
const BACK_URL = "login_back_url";
|
||||||
@ -178,6 +201,7 @@ function toPromise(fn, config = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function pay(config) {
|
export function pay(config) {
|
||||||
|
console.log(instance)
|
||||||
return toPromise(instance.chooseWXPay, config);
|
return toPromise(instance.chooseWXPay, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
main.js
2
main.js
@ -104,7 +104,7 @@ import { isWeixin } from '@/utils'
|
|||||||
if (isWeixin()) {
|
if (isWeixin()) {
|
||||||
Vue.prototype.$deviceType = 'weixin'
|
Vue.prototype.$deviceType = 'weixin'
|
||||||
store.commit('updateDevicetype', 'weixin')
|
store.commit('updateDevicetype', 'weixin')
|
||||||
// wechat().then(() => oAuth());
|
wechat().then(() => oAuth());
|
||||||
} else {
|
} else {
|
||||||
Vue.prototype.$deviceType = 'weixinh5'
|
Vue.prototype.$deviceType = 'weixinh5'
|
||||||
store.commit('updateDevicetype', 'weixinh5')
|
store.commit('updateDevicetype', 'weixinh5')
|
||||||
|
|||||||
@ -157,6 +157,13 @@
|
|||||||
},
|
},
|
||||||
"router" : {
|
"router" : {
|
||||||
"mode" : "history"
|
"mode" : "history"
|
||||||
|
},
|
||||||
|
"sdkConfigs" : {
|
||||||
|
"maps" : {
|
||||||
|
"qqmap" : {
|
||||||
|
"key" : ""
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -197,16 +197,16 @@ import {
|
|||||||
getProductDetail,
|
getProductDetail,
|
||||||
postCartAdd,
|
postCartAdd,
|
||||||
getCartCount,
|
getCartCount,
|
||||||
getProductCode
|
getProductCode,
|
||||||
} from "@/api/store";
|
} from "@/api/store";
|
||||||
import {
|
import {
|
||||||
getCoupon,
|
getCoupon,
|
||||||
getCollectAdd,
|
getCollectAdd,
|
||||||
getCollectDel,
|
getCollectDel,
|
||||||
getUserInfo
|
getUserInfo,
|
||||||
} from "@/api/user";
|
} from "@/api/user";
|
||||||
import { isWeixin, PosterCanvas, handleQrCode } from "@/utils";
|
import { isWeixin, PosterCanvas, handleQrCode } from "@/utils";
|
||||||
// import { wechatEvevt } from "@/libs/wechat";
|
import { wechatEvevt } from "@/libs/wechat";
|
||||||
import { imageBase64 } from "@/api/public";
|
import { imageBase64 } from "@/api/public";
|
||||||
import { mapGetters } from "vuex";
|
import { mapGetters } from "vuex";
|
||||||
|
|
||||||
@ -220,9 +220,9 @@ export default {
|
|||||||
CouponPop,
|
CouponPop,
|
||||||
ProductWindow,
|
ProductWindow,
|
||||||
StorePoster,
|
StorePoster,
|
||||||
ShareInfo
|
ShareInfo,
|
||||||
},
|
},
|
||||||
data: function() {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
shareInfoStatus: false,
|
shareInfoStatus: false,
|
||||||
weixinStatus: false,
|
weixinStatus: false,
|
||||||
@ -232,18 +232,18 @@ export default {
|
|||||||
image: "",
|
image: "",
|
||||||
title: "",
|
title: "",
|
||||||
price: "",
|
price: "",
|
||||||
code: ""
|
code: "",
|
||||||
},
|
},
|
||||||
posterImageStatus: false,
|
posterImageStatus: false,
|
||||||
animated: false,
|
animated: false,
|
||||||
coupon: {
|
coupon: {
|
||||||
coupon: false,
|
coupon: false,
|
||||||
list: []
|
list: [],
|
||||||
},
|
},
|
||||||
attr: {
|
attr: {
|
||||||
cartAttr: false,
|
cartAttr: false,
|
||||||
productAttr: [],
|
productAttr: [],
|
||||||
productSelect: {}
|
productSelect: {},
|
||||||
},
|
},
|
||||||
isOpen: false, //是否打开属性组件
|
isOpen: false, //是否打开属性组件
|
||||||
productValue: [],
|
productValue: [],
|
||||||
@ -263,23 +263,23 @@ export default {
|
|||||||
swiperRecommend: {
|
swiperRecommend: {
|
||||||
pagination: {
|
pagination: {
|
||||||
el: ".swiper-pagination",
|
el: ".swiper-pagination",
|
||||||
clickable: true
|
clickable: true,
|
||||||
},
|
},
|
||||||
autoplay: false,
|
autoplay: false,
|
||||||
loop: false,
|
loop: false,
|
||||||
speed: 1000,
|
speed: 1000,
|
||||||
observer: true,
|
observer: true,
|
||||||
observeParents: true
|
observeParents: true,
|
||||||
},
|
},
|
||||||
goodList: [],
|
goodList: [],
|
||||||
systemStore: {},
|
systemStore: {},
|
||||||
qqmapsdk: null,
|
qqmapsdk: null,
|
||||||
productConClass: "product-con",
|
productConClass: "product-con",
|
||||||
tempName: "全国包邮"
|
tempName: "全国包邮",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: mapGetters(["isLogin", "location"]),
|
computed: mapGetters(["isLogin", "location"]),
|
||||||
mounted: function() {
|
mounted: function () {
|
||||||
let url = handleQrCode();
|
let url = handleQrCode();
|
||||||
if (url && url.productId) {
|
if (url && url.productId) {
|
||||||
this.id = url.productId;
|
this.id = url.productId;
|
||||||
@ -287,6 +287,7 @@ export default {
|
|||||||
this.id = this._route.query.id;
|
this.id = this._route.query.id;
|
||||||
}
|
}
|
||||||
this.productCon();
|
this.productCon();
|
||||||
|
this.setOpenShare();
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
posterImageStatus(status) {
|
posterImageStatus(status) {
|
||||||
@ -296,7 +297,7 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.productConClass = "product-con";
|
this.productConClass = "product-con";
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
goShoppingCart() {
|
goShoppingCart() {
|
||||||
@ -304,48 +305,48 @@ export default {
|
|||||||
},
|
},
|
||||||
goCustomerList() {
|
goCustomerList() {
|
||||||
this.$yrouter.push({
|
this.$yrouter.push({
|
||||||
path: "/pages/user/CustomerList/index"
|
path: "/pages/user/CustomerList/index",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
goStoreList() {
|
goStoreList() {
|
||||||
this.$yrouter.push({
|
this.$yrouter.push({
|
||||||
path: "/pages/shop/StoreList/index"
|
path: "/pages/shop/StoreList/index",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
goEvaluateList(id) {
|
goEvaluateList(id) {
|
||||||
this.$yrouter.push({
|
this.$yrouter.push({
|
||||||
path: "/pages/shop/EvaluateList/index",
|
path: "/pages/shop/EvaluateList/index",
|
||||||
query: {
|
query: {
|
||||||
id
|
id,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
showChang: function(data) {
|
showChang: function (data) {
|
||||||
this.$yrouter.push({
|
this.$yrouter.push({
|
||||||
path: "/pages/map/index",
|
path: "/pages/map/index",
|
||||||
query: data
|
query: data,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
updateTitle() {
|
updateTitle() {
|
||||||
// document.title = this.storeInfo.storeName || this.$yroute.meta.title;
|
// document.title = this.storeInfo.storeName || this.$yroute.meta.title;
|
||||||
},
|
},
|
||||||
setShareInfoStatus: function() {
|
setShareInfoStatus: function () {
|
||||||
this.shareInfoStatus = !this.shareInfoStatus;
|
this.shareInfoStatus = !this.shareInfoStatus;
|
||||||
this.posters = false;
|
this.posters = false;
|
||||||
},
|
},
|
||||||
shareCode: function() {
|
shareCode: function () {
|
||||||
var that = this;
|
var that = this;
|
||||||
getProductCode(that.id).then(res => {
|
getProductCode(that.id).then((res) => {
|
||||||
that.posterData.code = res.data.code;
|
that.posterData.code = res.data.code;
|
||||||
that.listenerActionSheet();
|
that.listenerActionSheet();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
setPosterImageStatus: function() {
|
setPosterImageStatus: function () {
|
||||||
this.posterImageStatus = !this.posterImageStatus;
|
this.posterImageStatus = !this.posterImageStatus;
|
||||||
this.posters = false;
|
this.posters = false;
|
||||||
},
|
},
|
||||||
//产品详情接口;
|
//产品详情接口;
|
||||||
productCon: function() {
|
productCon: function () {
|
||||||
let that = this;
|
let that = this;
|
||||||
let from = this.location;
|
let from = this.location;
|
||||||
if (this.$deviceType == "app") {
|
if (this.$deviceType == "app") {
|
||||||
@ -353,7 +354,7 @@ export default {
|
|||||||
}
|
}
|
||||||
uni.showLoading({ title: "加载中", mask: true });
|
uni.showLoading({ title: "加载中", mask: true });
|
||||||
getProductDetail(that.id, from)
|
getProductDetail(that.id, from)
|
||||||
.then(res => {
|
.then((res) => {
|
||||||
res.data.storeInfo.description = res.data.storeInfo.description.replace(
|
res.data.storeInfo.description = res.data.storeInfo.description.replace(
|
||||||
/\<img/gi,
|
/\<img/gi,
|
||||||
'<img style="max-width:100%;height:auto;"'
|
'<img style="max-width:100%;height:auto;"'
|
||||||
@ -385,7 +386,7 @@ export default {
|
|||||||
var list = good_list.slice(i * 6, 6);
|
var list = good_list.slice(i * 6, 6);
|
||||||
if (list.length)
|
if (list.length)
|
||||||
goodArray.push({
|
goodArray.push({
|
||||||
list: list
|
list: list,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
that.mapKay = res.data.mapKay;
|
that.mapKay = res.data.mapKay;
|
||||||
@ -394,12 +395,12 @@ export default {
|
|||||||
that.DefaultSelect();
|
that.DefaultSelect();
|
||||||
that.getCartCount();
|
that.getCartCount();
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch((err) => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title:
|
title:
|
||||||
err.msg || err.response.data.msg || err.response.data.message,
|
err.msg || err.response.data.msg || err.response.data.message,
|
||||||
icon: "none",
|
icon: "none",
|
||||||
duration: 2000
|
duration: 2000,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
@ -407,7 +408,7 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
//默认选中属性;
|
//默认选中属性;
|
||||||
DefaultSelect: function() {
|
DefaultSelect: function () {
|
||||||
let productAttr = this.attr.productAttr;
|
let productAttr = this.attr.productAttr;
|
||||||
let value = [];
|
let value = [];
|
||||||
for (let i = 0; i < productAttr.length; i++) {
|
for (let i = 0; i < productAttr.length; i++) {
|
||||||
@ -462,7 +463,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
//购物车;
|
//购物车;
|
||||||
ChangeCartNum: function(changeValue) {
|
ChangeCartNum: function (changeValue) {
|
||||||
//changeValue:是否 加|减
|
//changeValue:是否 加|减
|
||||||
//获取当前变动属性
|
//获取当前变动属性
|
||||||
let productSelect = this.productValue[this.attrValue];
|
let productSelect = this.productValue[this.attrValue];
|
||||||
@ -495,52 +496,52 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
//将父级向子集多次传送的函数合二为一;
|
//将父级向子集多次传送的函数合二为一;
|
||||||
changeFun: function(opt) {
|
changeFun: function (opt) {
|
||||||
if (typeof opt !== "object") opt = {};
|
if (typeof opt !== "object") opt = {};
|
||||||
let action = opt.action || "";
|
let action = opt.action || "";
|
||||||
let value = opt.value === undefined ? "" : opt.value;
|
let value = opt.value === undefined ? "" : opt.value;
|
||||||
this[action] && this[action](value);
|
this[action] && this[action](value);
|
||||||
},
|
},
|
||||||
//打开优惠券插件;
|
//打开优惠券插件;
|
||||||
couponTap: function() {
|
couponTap: function () {
|
||||||
let that = this;
|
let that = this;
|
||||||
that.coupons();
|
that.coupons();
|
||||||
that.coupon.coupon = true;
|
that.coupon.coupon = true;
|
||||||
},
|
},
|
||||||
changecoupon: function(msg) {
|
changecoupon: function (msg) {
|
||||||
this.coupon.coupon = msg;
|
this.coupon.coupon = msg;
|
||||||
this.coupons();
|
this.coupons();
|
||||||
},
|
},
|
||||||
currentcoupon: function(res) {
|
currentcoupon: function (res) {
|
||||||
let that = this;
|
let that = this;
|
||||||
that.coupon.coupon = false;
|
that.coupon.coupon = false;
|
||||||
that.$set(that.coupon.list[res], "is_use", true);
|
that.$set(that.coupon.list[res], "is_use", true);
|
||||||
},
|
},
|
||||||
//可领取优惠券接口;
|
//可领取优惠券接口;
|
||||||
coupons: function() {
|
coupons: function () {
|
||||||
let that = this,
|
let that = this,
|
||||||
q = {
|
q = {
|
||||||
page: 1,
|
page: 1,
|
||||||
limit: 20
|
limit: 20,
|
||||||
};
|
};
|
||||||
getCoupon(q).then(res => {
|
getCoupon(q).then((res) => {
|
||||||
that.$set(that, "couponList", res.data || []);
|
that.$set(that, "couponList", res.data || []);
|
||||||
that.$set(that.coupon, "list", res.data);
|
that.$set(that.coupon, "list", res.data);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
//打开属性插件;
|
//打开属性插件;
|
||||||
selecAttrTap: function() {
|
selecAttrTap: function () {
|
||||||
this.attr.cartAttr = true;
|
this.attr.cartAttr = true;
|
||||||
this.isOpen = true;
|
this.isOpen = true;
|
||||||
},
|
},
|
||||||
changeattr: function(msg) {
|
changeattr: function (msg) {
|
||||||
// 修改了规格
|
// 修改了规格
|
||||||
console.log(msg);
|
console.log(msg);
|
||||||
this.attr.cartAttr = msg;
|
this.attr.cartAttr = msg;
|
||||||
this.isOpen = false;
|
this.isOpen = false;
|
||||||
},
|
},
|
||||||
//选择属性;
|
//选择属性;
|
||||||
ChangeAttr: function(res) {
|
ChangeAttr: function (res) {
|
||||||
// 修改了规格
|
// 修改了规格
|
||||||
console.log(res);
|
console.log(res);
|
||||||
let productSelect = this.productValue[res.value];
|
let productSelect = this.productValue[res.value];
|
||||||
@ -564,27 +565,27 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
//收藏商品
|
//收藏商品
|
||||||
setCollect: function() {
|
setCollect: function () {
|
||||||
let that = this,
|
let that = this,
|
||||||
id = that.storeInfo.id,
|
id = that.storeInfo.id,
|
||||||
category = "product";
|
category = "product";
|
||||||
if (that.storeInfo.userCollect) {
|
if (that.storeInfo.userCollect) {
|
||||||
getCollectDel(id, category).then(function() {
|
getCollectDel(id, category).then(function () {
|
||||||
that.storeInfo.userCollect = !that.storeInfo.userCollect;
|
that.storeInfo.userCollect = !that.storeInfo.userCollect;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
getCollectAdd(id, category).then(function() {
|
getCollectAdd(id, category).then(function () {
|
||||||
that.storeInfo.userCollect = !that.storeInfo.userCollect;
|
that.storeInfo.userCollect = !that.storeInfo.userCollect;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 点击加入购物车按钮
|
// 点击加入购物车按钮
|
||||||
joinCart: function() {
|
joinCart: function () {
|
||||||
//0=加入购物车
|
//0=加入购物车
|
||||||
this.goCat(0);
|
this.goCat(0);
|
||||||
},
|
},
|
||||||
// 加入购物车;
|
// 加入购物车;
|
||||||
goCat: function(news) {
|
goCat: function (news) {
|
||||||
let that = this,
|
let that = this,
|
||||||
productSelect = that.productValue[this.attrValue];
|
productSelect = that.productValue[this.attrValue];
|
||||||
//打开属性
|
//打开属性
|
||||||
@ -607,7 +608,7 @@ export default {
|
|||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "产品库存不足,请选择其它",
|
title: "产品库存不足,请选择其它",
|
||||||
icon: "none",
|
icon: "none",
|
||||||
duration: 2000
|
duration: 2000,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -618,18 +619,18 @@ export default {
|
|||||||
uniqueId:
|
uniqueId:
|
||||||
that.attr.productSelect !== undefined
|
that.attr.productSelect !== undefined
|
||||||
? that.attr.productSelect.unique
|
? that.attr.productSelect.unique
|
||||||
: ""
|
: "",
|
||||||
};
|
};
|
||||||
postCartAdd(q)
|
postCartAdd(q)
|
||||||
.then(function(res) {
|
.then(function (res) {
|
||||||
that.isOpen = false;
|
that.isOpen = false;
|
||||||
that.attr.cartAttr = false;
|
that.attr.cartAttr = false;
|
||||||
if (news) {
|
if (news) {
|
||||||
that.$yrouter.push({
|
that.$yrouter.push({
|
||||||
path: "/pages/order/OrderSubmission/index",
|
path: "/pages/order/OrderSubmission/index",
|
||||||
query: {
|
query: {
|
||||||
id: res.data.cartId
|
id: res.data.cartId,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@ -638,32 +639,32 @@ export default {
|
|||||||
duration: 2000,
|
duration: 2000,
|
||||||
complete: () => {
|
complete: () => {
|
||||||
that.getCartCount(true);
|
that.getCartCount(true);
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch((error) => {
|
||||||
that.isOpen = false;
|
that.isOpen = false;
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: error.response.data.msg,
|
title: error.response.data.msg,
|
||||||
icon: "none",
|
icon: "none",
|
||||||
duration: 2000
|
duration: 2000,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
//获取购物车数量
|
//获取购物车数量
|
||||||
getCartCount: function(isAnima) {
|
getCartCount: function (isAnima) {
|
||||||
let that = this;
|
let that = this;
|
||||||
const isLogin = that.isLogin;
|
const isLogin = that.isLogin;
|
||||||
if (isLogin) {
|
if (isLogin) {
|
||||||
getCartCount({
|
getCartCount({
|
||||||
numType: 0
|
numType: 0,
|
||||||
}).then(res => {
|
}).then((res) => {
|
||||||
that.CartCount = res.data.count;
|
that.CartCount = res.data.count;
|
||||||
//加入购物车后重置属性
|
//加入购物车后重置属性
|
||||||
if (isAnima) {
|
if (isAnima) {
|
||||||
that.animated = true;
|
that.animated = true;
|
||||||
setTimeout(function() {
|
setTimeout(function () {
|
||||||
that.animated = false;
|
that.animated = false;
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
@ -671,20 +672,75 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
//立即购买;
|
//立即购买;
|
||||||
tapBuy: function() {
|
tapBuy: function () {
|
||||||
// 1=直接购买
|
// 1=直接购买
|
||||||
this.goCat(1);
|
this.goCat(1);
|
||||||
},
|
},
|
||||||
listenerActionSheet: function() {
|
listenerActionSheet: function () {
|
||||||
if (isWeixin() === true) {
|
if (isWeixin() === true) {
|
||||||
this.weixinStatus = true;
|
this.weixinStatus = true;
|
||||||
}
|
}
|
||||||
this.posters = true;
|
this.posters = true;
|
||||||
},
|
},
|
||||||
listenerActionClose: function() {
|
listenerActionClose: function () {
|
||||||
this.posters = false;
|
this.posters = false;
|
||||||
|
},
|
||||||
|
setOpenShare: function () {
|
||||||
|
var data = this.storeInfo;
|
||||||
|
var href = location.href;
|
||||||
|
if (this.$deviceType == "weixin") {
|
||||||
|
if (this.isLogin) {
|
||||||
|
getUserInfo().then((res) => {
|
||||||
|
href =
|
||||||
|
href.indexOf("?") === -1
|
||||||
|
? href + "?spread=" + res.data.uid
|
||||||
|
: href + "&spread=" + res.data.uid;
|
||||||
|
var configAppMessage = {
|
||||||
|
desc: data.storeInfo,
|
||||||
|
title: data.storeName,
|
||||||
|
link: href,
|
||||||
|
imgUrl: data.image,
|
||||||
|
};
|
||||||
|
wechatEvevt(
|
||||||
|
["updateAppMessageShareData", "updateTimelineShareData"],
|
||||||
|
configAppMessage
|
||||||
|
)
|
||||||
|
.then((res) => {
|
||||||
|
console.log(res);
|
||||||
|
})
|
||||||
|
.catch((res) => {
|
||||||
|
console.log(res);
|
||||||
|
if (res.is_ready) {
|
||||||
|
res.wx.updateAppMessageShareData(configAppMessage);
|
||||||
|
res.wx.updateTimelineShareData(configAppMessage);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
var configAppMessage = {
|
||||||
|
desc: data.storeInfo,
|
||||||
|
title: data.storeName,
|
||||||
|
link: href,
|
||||||
|
imgUrl: data.image,
|
||||||
|
};
|
||||||
|
wechatEvevt(
|
||||||
|
["updateAppMessageShareData", "updateTimelineShareData"],
|
||||||
|
configAppMessage
|
||||||
|
)
|
||||||
|
.then((res) => {
|
||||||
|
console.log(res);
|
||||||
|
})
|
||||||
|
.catch((res) => {
|
||||||
|
console.log(res);
|
||||||
|
if (res.is_ready) {
|
||||||
|
res.wx.updateAppMessageShareData(configAppMessage);
|
||||||
|
res.wx.updateTimelineShareData(configAppMessage);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -150,15 +150,20 @@ export default {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "已取消绑定",
|
title: "操作成功",
|
||||||
icon: "none",
|
icon: "none",
|
||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
});
|
||||||
|
// uni.showToast({
|
||||||
|
// title: "已取消绑定",
|
||||||
|
// icon: "none",
|
||||||
|
// duration: 2000
|
||||||
|
// });
|
||||||
// that.$yrouter.replace({
|
// that.$yrouter.replace({
|
||||||
// path: "/pages/user/PersonalData/index"
|
// path: "/pages/user/PersonalData/index"
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
that.$yrouter.go(-1);
|
that.$yrouter.back();
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
|
|
||||||
// import MpvueRouterPatch from 'mpvue-router-patch'
|
// import MpvueRouterPatch from 'mpvue-router-patch'
|
||||||
// Vue.use(MpvueRouterPatch)
|
// Vue.use(MpvueRouterPatch)
|
||||||
import {
|
import {
|
||||||
wxappAuth,
|
wxappAuth,
|
||||||
getUserInfo
|
getUserInfo
|
||||||
} from "@/api/user";
|
} from "@/api/user";
|
||||||
import store from "../store";
|
import store from "@/store";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import cookie from "@/utils/store/cookie";
|
import cookie from "@/utils/store/cookie";
|
||||||
import stringify from "@/utils/querystring";
|
import stringify from "@/utils/querystring";
|
||||||
@ -174,7 +175,7 @@ export const login = () => {
|
|||||||
location.replace("/pages/home/index");
|
location.replace("/pages/home/index");
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
wechat().then(() => oAuth());
|
// wechat().then(() => oAuth());
|
||||||
}
|
}
|
||||||
// if (!code) {
|
// if (!code) {
|
||||||
// toAuth("wxc061dee8806ff712")
|
// toAuth("wxc061dee8806ff712")
|
||||||
|
|||||||
Reference in New Issue
Block a user