Commit d8546463 by 程默

Merge branch 'nativehome_tst' of http://code.mayi888.com/chengmo/mayi-mp-shop into nativehome_tst

parents 7d93cbf7 b559d7b3
import indexApi from "@/api/index";
export function getBcakUrlApi(data) {
return new Promise((resolve, reject) => {
data.fromAppid = 'VsEOuDJqBnGNyXZJWCQS'
indexApi.getSsoCallbackUrl(data).then(res => {
if (res.data.code == 200) {
resolve(res.data.data);
}
});
})
}
export function createdUserJWTApi(data) {
return new Promise((resolve, reject) => {
indexApi.createdUserJWT().then(res => {
if (res.data.code == 200) {
resolve(res.data.data);
}
});
})
}
...@@ -33,6 +33,22 @@ console.log(process.env,'-----------------config------') ...@@ -33,6 +33,22 @@ console.log(process.env,'-----------------config------')
}, },
get_multi_merchant_by_tags(data){ get_multi_merchant_by_tags(data){
return requestPOST(`${process.env.OLSHOP_URL}/shop/get_multi_merchant_by_tags`,data) return requestPOST(`${process.env.OLSHOP_URL}/shop/get_multi_merchant_by_tags`,data)
},
getSsoCallbackUrl(data) {
return requestPOST(
`${process.env.OLSHOP_URL}/common/getSsoCallbackUrl`,
{ data }
);
},
// 动态表单获取token 信息
createdUserJWT(data) {
return requestPOST(
`${process.env.OLSHOP_URL}/user/createUserJWT`,
{
data
}
);
} }
} }
\ No newline at end of file
...@@ -6,6 +6,7 @@ import goodsApi from "./api/goods" ...@@ -6,6 +6,7 @@ import goodsApi from "./api/goods"
import orderApi from "./api/order" import orderApi from "./api/order"
import promoteApi from "./api/promote"; import promoteApi from "./api/promote";
import indexApi from './api/index' import indexApi from './api/index'
import { createdUserJWTApi, getBcakUrlApi } from "./api/daoke";
import cartApi from './api/cart' import cartApi from './api/cart'
import classificationApi from "./api/classification"; import classificationApi from "./api/classification";
import spokesmanApi from './api/spokesman' import spokesmanApi from './api/spokesman'
...@@ -18,6 +19,7 @@ import fenxiaoModel from "@/utils/fenxiaoModel"; ...@@ -18,6 +19,7 @@ import fenxiaoModel from "@/utils/fenxiaoModel";
// themeMemberCardClick // themeMemberCardClick
// } from "@/utils/mayi"; // } from "@/utils/mayi";
import { $themeToLink, $themeAddToCard, $themeArticleLike } from "@/utils/mayi"; import { $themeToLink, $themeAddToCard, $themeArticleLike } from "@/utils/mayi";
import "@/utils/themeModule";
// import { themeToLinkInit } from "@/utils/themeModule"; // import { themeToLinkInit } from "@/utils/themeModule";
import shop from "./api/shop"; import shop from "./api/shop";
import spokesman from "@/api/spokesman"; import spokesman from "@/api/spokesman";
...@@ -38,12 +40,11 @@ Vue.prototype.$mpAnalytics = mpAnalytics; ...@@ -38,12 +40,11 @@ Vue.prototype.$mpAnalytics = mpAnalytics;
const app = new Vue(App) const app = new Vue(App)
app.$mount() app.$mount()
// 初始化
// themeToLinkInit({ homeNative: 2, getCoupon, themeMemberCardClick });
// glob挂载到 // glob挂载到
let mpApp = getApp(); let mpApp = getApp();
Vue.prototype.mpApp = mpApp Vue.prototype.mpApp = mpApp
// 初始化
mpApp.fenxiaoModel = new fenxiaoModel({ mpApp.fenxiaoModel = new fenxiaoModel({
query_login_spoken:spokesman.query_login_spoken, query_login_spoken:spokesman.query_login_spoken,
becomepokesmanCustomer:spokesman.becomepokesmanCustomer, becomepokesmanCustomer:spokesman.becomepokesmanCustomer,
...@@ -56,7 +57,17 @@ mpApp.fenxiaoModel = new fenxiaoModel({ ...@@ -56,7 +57,17 @@ mpApp.fenxiaoModel = new fenxiaoModel({
oneClickShopQuickCopy: spokesman.oneClickShopQuickCopy, oneClickShopQuickCopy: spokesman.oneClickShopQuickCopy,
apply_for_withdraw: spokesman.apply_for_withdraw apply_for_withdraw: spokesman.apply_for_withdraw
}); });
// 多主题方法初始化
global.themeToLinkInit({
homeNative: 2,
wx,
getCoupon,
themeMemberCardClick,
requireFun: {
createdUserJWT: createdUserJWTApi,
getBcakUrl: getBcakUrlApi
}
});
// 数据异步回调函数 // 数据异步回调函数
// 商城 // 商城
mpApp.shopCallBack = function () { } mpApp.shopCallBack = function () { }
......
...@@ -156,6 +156,7 @@ export function $themeAddToCard(item, callback) { ...@@ -156,6 +156,7 @@ export function $themeAddToCard(item, callback) {
} }
function toPage(backPath, backParams = "") { function toPage(backPath, backParams = "") {
console.log(backPath, backParams,'--------------------------159');
wx.navigateTo({ wx.navigateTo({
url: `../index/main?from=themeLink&backpath=${encodeURIComponent(backPath)}&params=${encodeURIComponent(backParams)}` url: `../index/main?from=themeLink&backpath=${encodeURIComponent(backPath)}&params=${encodeURIComponent(backParams)}`
}); });
...@@ -299,30 +300,27 @@ export function themeMemberCardClick (item) { ...@@ -299,30 +300,27 @@ export function themeMemberCardClick (item) {
}); });
} else { } else {
if (res.data.msg == "不能重复领卡") { if (res.data.msg == "不能重复领卡") {
let query = { cardId: cardData.id, userTel: userInfo.mobilephone }; console.log("---------------------------to-----1")
let url = `../index/main?from=themeLink&backpath=${encodeURIComponent("/personalCenter/membershipCard")}&params=${encodeURIComponent(query)}`; let backParams = `&cardId=${cardData.id}&userTel=${userInfo.mobilephone}`;
wx.navigateTo({url}); toPage("/personalCenter/membershipCard",backParams);
} else { } else {
wx.showToast({ title: res.data.msg, icon: "none" }); wx.showToast({ title: res.data.msg, icon: "none" });
}
} }
}
}); });
} else if (cardData.receiveWay == 1) { } else if (cardData.receiveWay == 1) {
// 自动领取 // 自动领取
console.log("自动领取"); console.log("自动领取");
} else if (cardData.receiveWay == 2) { } else if (cardData.receiveWay == 2) {
// 付费购买 // 付费购买
if (cardData.receiveStatus == 0) { if (cardData.receiveStatus == 0) {
let query= { cardId: cardData.id }; console.log("---------------------------to-----2")
let url = `../index/main?from=themeLink&backpath=${encodeURIComponent("/pay/payCard")}&params=${encodeURIComponent(query)}`; let backParams = `&cardId=${cardData.id}`;
wx.navigateTo({ url }); toPage("/pay/payCard", backParams);
} else { } else {
let query = { console.log("---------------------------to-----3")
cardId: cardData.id, let backParams = `&cardId=${cardData.id}&userTel=${userInfo.mobilephone}`;
userTel: userInfo.mobilephone toPage("/personalCenter/membershipCard", backParams);
};
let url = `../index/main?from=themeLink&backpath=${encodeURIComponent("/personalCenter/membershipCard")}&params=${encodeURIComponent(query)}`;
wx.navigateTo({ url });
} }
} else { } else {
console.error("无效的领取方式"); console.error("无效的领取方式");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment