|
@@ -1,7 +1,6 @@
|
|
|
const _Http = getApp().globalData.http,
|
|
|
MFT = require("../../utils/matchingFeilType"),
|
|
|
checkFile = require("../../utils/checkFile");
|
|
|
-import Dialog from '@vant/weapp/dialog/dialog';
|
|
|
Page({
|
|
|
/**
|
|
|
* 页面的初始数据
|
|
@@ -9,7 +8,9 @@ Page({
|
|
|
data: {
|
|
|
sat_sharematerialid: null,
|
|
|
detailsData: {},
|
|
|
- dataType: 0
|
|
|
+ dataType: 0,
|
|
|
+ addNewCount: 0,
|
|
|
+ popupShow: false
|
|
|
},
|
|
|
|
|
|
/**
|
|
@@ -35,17 +36,13 @@ Page({
|
|
|
this.setData({
|
|
|
detailsData: res.data
|
|
|
});
|
|
|
-
|
|
|
//分享进入
|
|
|
- if (wx.getLaunchOptionsSync().scene == 1154) {
|
|
|
- this.addNew(false)
|
|
|
- } else if ([1007, 1008].includes(wx.getLaunchOptionsSync().scene)) Dialog.confirm({
|
|
|
- title: '提示',
|
|
|
- message: '请帮助完善信息',
|
|
|
- })
|
|
|
- .then(this.addNew)
|
|
|
- .catch(this.addNew)
|
|
|
-
|
|
|
+ if ([1007, 1008, 1155].includes(wx.getLaunchOptionsSync().scene)) this.setData({
|
|
|
+ "shareData.userid": options.userid,
|
|
|
+ "shareData.systemclient": "wechatsaletool",
|
|
|
+ "shareData.sat_sharematerialid": options.id,
|
|
|
+ popupShow: true
|
|
|
+ })
|
|
|
} else {
|
|
|
wx.showToast({
|
|
|
title: res.msg,
|
|
@@ -53,9 +50,21 @@ Page({
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
+ /* 获取手机号 */
|
|
|
+ getphonenumber({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ this.setData({
|
|
|
+ "shareData.code_phone": detail.code ? detail.code : '',
|
|
|
+ addNewCount: this.data.addNewCount + 1
|
|
|
+ })
|
|
|
+ this.handleAddNew();
|
|
|
+ },
|
|
|
/* 新增拉新用户 */
|
|
|
async addNew(gain = true) {
|
|
|
- let name = '微信用户';
|
|
|
+ let name = '微信用户',
|
|
|
+ channel = null,
|
|
|
+ that = this;
|
|
|
if (gain) name = await new Promise((res, rej) => {
|
|
|
wx.getUserProfile({
|
|
|
desc: '用于完善用户资料',
|
|
@@ -69,9 +78,6 @@ Page({
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
-
|
|
|
- let channel = null,
|
|
|
- that = this;
|
|
|
switch (wx.getLaunchOptionsSync().scene) {
|
|
|
case 1007:
|
|
|
channel = '单人会话分享'
|
|
@@ -79,30 +85,34 @@ Page({
|
|
|
case 1008:
|
|
|
channel = '群聊会话分享'
|
|
|
break;
|
|
|
- case 1154:
|
|
|
+ case 1155:
|
|
|
channel = '朋友圈分享'
|
|
|
break;
|
|
|
default:
|
|
|
channel = '其他方式'
|
|
|
break;
|
|
|
- }
|
|
|
-
|
|
|
+ };
|
|
|
wx.login({
|
|
|
success(res) {
|
|
|
- _Http.base({
|
|
|
- "classname": "saletool.sharematerial.sharematerial",
|
|
|
- "method": "addNew",
|
|
|
- "content": {
|
|
|
- "sat_sharematerialid": that.data.sat_sharematerialid,
|
|
|
- "fname": name,
|
|
|
- "channel": channel,
|
|
|
- "code": res.code,
|
|
|
- "systemclient": "wechatsaletool"
|
|
|
- }
|
|
|
- }, false).then(res => {
|
|
|
- console.log("记录分享", res)
|
|
|
+ that.setData({
|
|
|
+ "shareData.fname": name,
|
|
|
+ "shareData.channel": channel,
|
|
|
+ "shareData.code_login": res.code,
|
|
|
+ addNewCount: that.data.addNewCount + 1
|
|
|
})
|
|
|
+ that.handleAddNew();
|
|
|
}
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleAddNew() {
|
|
|
+ if (this.data.addNewCount != 2) return;
|
|
|
+ _Http.base({
|
|
|
+ "classname": "saletool.sharematerial.sharematerial",
|
|
|
+ "method": "addNew",
|
|
|
+ "content": this.data.shareData
|
|
|
+ }, false)
|
|
|
+ this.setData({
|
|
|
+ popupShow: false
|
|
|
})
|
|
|
},
|
|
|
openFile(e) {
|
|
@@ -127,7 +137,7 @@ Page({
|
|
|
this.updateShareLog(data.sat_sharematerialid);
|
|
|
resolve({
|
|
|
title: data.title,
|
|
|
- path: `/pages/promotional/details?id=${data.sat_sharematerialid}&type=${data.type}`,
|
|
|
+ path: `/pages/promotional/details?id=${data.sat_sharematerialid}&type=${data.type}&userid=${wx.getStorageSync('userMsg').userid}`,
|
|
|
imageUrl: data.cover
|
|
|
})
|
|
|
})
|
|
@@ -139,7 +149,7 @@ Page({
|
|
|
let data = this.data.detailsData;
|
|
|
return {
|
|
|
title: data.title,
|
|
|
- path: `/pages/promotional/details?id=${data.sat_sharematerialid}&type=${data.type}`,
|
|
|
+ path: `/pages/promotional/details?id=${data.sat_sharematerialid}&type=${data.type}&userid=${wx.getStorageSync('userMsg').userid}`,
|
|
|
imageUrl: data.cover
|
|
|
}
|
|
|
}
|