|
|
@@ -77,7 +77,7 @@
|
|
|
</view>
|
|
|
<!-- 底部导航组件-end -->
|
|
|
<!-- 授权 -->
|
|
|
- <!-- <authorize-module v-if="showAuth" :shopInfo="shopInfo" @authSuccess="onAuthSuccess" @onGotUserInfo="onGotUserInfo" ></authorize-module> -->
|
|
|
+ <authorize-module v-if="showAuth" :shopInfo="shopInfo" @authGetTelSuccess="onauthGetTelSuccess" />
|
|
|
<!-- 授权-end -->
|
|
|
|
|
|
<!-- 购买或加入购物车弹窗 -->
|
|
|
@@ -200,10 +200,12 @@ export default {
|
|
|
checked: false, //是否选中协议
|
|
|
buyNum: 1, //购买数量
|
|
|
pfway: "1", // 批发
|
|
|
+ shopInfo: {}, // 商铺信息
|
|
|
showAuth: false,
|
|
|
|
|
|
userinfo: {},
|
|
|
goodsDa: {},
|
|
|
+ unid: '',
|
|
|
};
|
|
|
},
|
|
|
onLoad: function (e) {
|
|
|
@@ -211,6 +213,8 @@ export default {
|
|
|
this.goodsDa = e;
|
|
|
this.userinfo = uni.getStorageSync("userinfo");
|
|
|
this.loadData(e);
|
|
|
+
|
|
|
+ if(e.invite && !uni.getStorageSync("token")) this.login(e.invite);
|
|
|
},
|
|
|
onShow: function () {},
|
|
|
methods: {
|
|
|
@@ -239,16 +243,6 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
-
|
|
|
- //授权并登录
|
|
|
- onAuthSuccess: function () {
|
|
|
- var that = this;
|
|
|
- uni.showLoading({ mask: true });
|
|
|
- appEv.setData((res) => {
|
|
|
- uni.hideLoading();
|
|
|
- that.showAuth = false;
|
|
|
- });
|
|
|
- },
|
|
|
// 去购买
|
|
|
ToPayPage: function () {
|
|
|
if (!this.checked) {
|
|
|
@@ -320,30 +314,66 @@ export default {
|
|
|
this.$refs.shopping.close();
|
|
|
},
|
|
|
getProPage() {
|
|
|
- // if (this.type == 1 || this.type == 2) {
|
|
|
- // uni.navigateTo({
|
|
|
- // url: "/pages/protocol/index?type=" + this.type,
|
|
|
- // });
|
|
|
- // } else if (this.type == 4) {
|
|
|
- // uni.navigateTo({
|
|
|
- // url: "/pages/protocol/index?type=" + 3,
|
|
|
- // });
|
|
|
- // } else if (this.type == 3) {
|
|
|
- // uni.navigateTo({
|
|
|
- // url: "/pages/protocol/index?type=" + 5,
|
|
|
- // });
|
|
|
- // }
|
|
|
- console.log("aaaaaaaaaa");
|
|
|
uni.navigateTo({
|
|
|
url: "/pages/pay-agreement/index",
|
|
|
});
|
|
|
},
|
|
|
+
|
|
|
+
|
|
|
+ login(invite) {
|
|
|
+ let that = this;
|
|
|
+ // #ifdef MP-WEIXIN
|
|
|
+ wx.login({
|
|
|
+ success(res) {
|
|
|
+ if (res.code) {
|
|
|
+ post("appletLogin", {
|
|
|
+ invite,
|
|
|
+ code: res.code,
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ if (res.data.token) {
|
|
|
+ uni.setStorageSync("token", res.data.token);
|
|
|
+ that.getuserInfo();
|
|
|
+ } else {
|
|
|
+ that.unid = res.data.unid;
|
|
|
+ // setTimeout(() => {
|
|
|
+ that.shopInfo = app.globalData.shopInfo;
|
|
|
+ that.showAuth = true;
|
|
|
+ // }, 1000);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
+ // #endif
|
|
|
+ },
|
|
|
+ onauthGetTelSuccess(da) {
|
|
|
+ this.showAuth = false;
|
|
|
+ post("getMobile", {
|
|
|
+ unid: this.unid,
|
|
|
+ ...da.detail
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ uni.setStorageSync("token", res.data.token);
|
|
|
+ this.getuserInfo();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getuserInfo() {
|
|
|
+ post("/user/userinfo").then((res) => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ uni.setStorageSync("userinfo", res.data.data);
|
|
|
+ this.userinfo = res.data.data;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
},
|
|
|
onShareAppMessage: function () {
|
|
|
let userinfo = uni.getStorageSync("userinfo");
|
|
|
var path = "/pages/product/p_details?agentId=1" + '&id=' + this.goodsDa.id + '&type=' + this.goodsDa.type;
|
|
|
- if (userinfo.user_id) {
|
|
|
- path = "/pages/product/p_details?agentId=" + userinfo.user_id + '&id=' + this.goodsDa.id + '&type=' + this.goodsDa.type;
|
|
|
+ if (userinfo.invite) {
|
|
|
+ path = "/pages/product/p_details?invite=" + userinfo.invite + '&id=' + this.goodsDa.id + '&type=' + this.goodsDa.type;
|
|
|
}
|
|
|
var title = `让数字经济赋能美好生活!`;
|
|
|
return {
|