mirror of
https://github.com/crmeb/CRMEB.git
synced 2025-12-17 06:52:49 +00:00
小程序新增页面分享绑定推荐人
This commit is contained in:
parent
1735d62f71
commit
ca23e0e6ec
@ -20,10 +20,10 @@ class RoutineQrcode extends ModelBasic {
|
|||||||
* @param int $thirdId
|
* @param int $thirdId
|
||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
public static function setRoutineQrcodeForever($thirdId = 0,$thirdType = 'spread',$page = '',$imgUrl = ''){
|
public static function setRoutineQrCodeForever($thirdId = 0,$thirdType = 'spread',$page = '',$imgUrl = ''){
|
||||||
$data['third_type'] = $thirdType;
|
$data['third_type'] = $thirdType;
|
||||||
$data['third_id'] = $thirdId;
|
$data['third_id'] = $thirdId;
|
||||||
$data['status'] = 0;
|
$data['status'] = 1;
|
||||||
$data['add_time'] = time();
|
$data['add_time'] = time();
|
||||||
$data['page'] = $page;
|
$data['page'] = $page;
|
||||||
$data['url_time'] = '';
|
$data['url_time'] = '';
|
||||||
@ -70,5 +70,30 @@ class RoutineQrcode extends ModelBasic {
|
|||||||
return self::where('id',$id)->where('status',1)->field($field)->find();
|
return self::where('id',$id)->where('status',1)->field($field)->find();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO 根据用户编号和二维码类型查看分销二维码是否存在
|
||||||
|
* @param int $thirdId
|
||||||
|
* @param string $thirdType
|
||||||
|
* @return int|string
|
||||||
|
* @throws \think\Exception
|
||||||
|
*/
|
||||||
|
public static function getRoutineQrCodeCount($thirdId = 0,$thirdType = 'spread'){
|
||||||
|
return self::where('third_id',$thirdId)->where('third_type',$thirdType)->count();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO 根据用户编号和二维码类型获取分销二维码
|
||||||
|
* @param int $thirdId
|
||||||
|
* @param string $thirdType
|
||||||
|
* @return bool|mixed|object
|
||||||
|
* @throws \think\Exception
|
||||||
|
*/
|
||||||
|
public static function getRoutineQrCode($thirdId = 0,$thirdType = 'spread',$page = '',$imgUrl = ''){
|
||||||
|
if(!$thirdId) return false;
|
||||||
|
$count = self::getRoutineQrCodeCount($thirdId,$thirdType);
|
||||||
|
if($count) return self::where('third_id',$thirdId)->where('third_type',$thirdType)->find();
|
||||||
|
else return self::setRoutineQrCodeForever($thirdId,$thirdType,$page,$imgUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -85,28 +85,24 @@ Page({
|
|||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad: function (options) {
|
onLoad: function (options) {
|
||||||
// console.log(options);
|
|
||||||
// return ;
|
|
||||||
app.globalData.openPages = '/pages/product-con/index?id=' + options.id;
|
|
||||||
app.setBarColor();
|
|
||||||
var that = this;
|
var that = this;
|
||||||
app.setUserInfo();
|
var pages = getCurrentPages();
|
||||||
that.getCartCount();
|
if (pages.length != 2 && !options.hasOwnProperty('id')) return false;
|
||||||
that.setData({
|
app.globalData.openPages = '/pages/product-con/index?id=' + options.id + '&scene=' + app.globalData.uid;
|
||||||
id: options.id
|
app.setBarColor();
|
||||||
})
|
that.setData({ id: options.id });
|
||||||
var header = {
|
that.getProductInfo();
|
||||||
'content-type': 'application/x-www-form-urlencoded',
|
},
|
||||||
};
|
getProductInfo:function(){
|
||||||
|
var that = this;
|
||||||
|
var header = { 'content-type': 'application/x-www-form-urlencoded' };
|
||||||
wx.request({
|
wx.request({
|
||||||
url: app.globalData.url + '/routine/auth_api/details?uid=' + app.globalData.uid,
|
url: app.globalData.url + '/routine/auth_api/details?uid=' + app.globalData.uid,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data:{
|
data: { id: that.data.id },
|
||||||
id:that.data.id
|
|
||||||
},
|
|
||||||
header: header,
|
header: header,
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
if(res.data.code == 200){
|
if (res.data.code == 200) {
|
||||||
var image = "productSelect.image";
|
var image = "productSelect.image";
|
||||||
var store_name = "productSelect.store_name";
|
var store_name = "productSelect.store_name";
|
||||||
var price = "productSelect.price";
|
var price = "productSelect.price";
|
||||||
@ -121,25 +117,28 @@ Page({
|
|||||||
reply: res.data.data.reply,
|
reply: res.data.data.reply,
|
||||||
replyCount: res.data.data.replyCount,
|
replyCount: res.data.data.replyCount,
|
||||||
description: res.data.data.storeInfo.description,
|
description: res.data.data.storeInfo.description,
|
||||||
collect:res.data.data.storeInfo.userCollect,
|
collect: res.data.data.storeInfo.userCollect,
|
||||||
[image]: res.data.data.storeInfo.image,
|
[image]: res.data.data.storeInfo.image,
|
||||||
[stock]: res.data.data.storeInfo.stock,
|
[stock]: res.data.data.storeInfo.stock,
|
||||||
[store_name]: res.data.data.storeInfo.store_name,
|
[store_name]: res.data.data.storeInfo.store_name,
|
||||||
[price]: res.data.data.storeInfo.price,
|
[price]: res.data.data.storeInfo.price,
|
||||||
[unique]: ''
|
[unique]: ''
|
||||||
})
|
})
|
||||||
|
that.getCartCount();
|
||||||
that.downloadFilestoreImage();
|
that.downloadFilestoreImage();
|
||||||
that.downloadFilePromotionCode();
|
that.downloadFilePromotionCode();
|
||||||
WxParse.wxParse('description', 'html', that.data.description, that, 0);
|
WxParse.wxParse('description', 'html', that.data.description, that, 0);
|
||||||
}else{
|
} else {
|
||||||
|
if (app.globalData.uid == null) {//是否存在用户信息,如果不存在跳转到首页
|
||||||
|
setTimeout(function () { wx.navigateTo({ url: '/pages/loading/loading' }) }, 1500)
|
||||||
|
} else {
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: res.data.msg,
|
title: res.data.msg,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 1000
|
duration: 1000
|
||||||
})
|
});
|
||||||
setTimeout(function(){
|
setTimeout(function () { wx.navigateBack({}); }, 1200);
|
||||||
wx.navigateBack({});
|
}
|
||||||
},1200)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -257,7 +256,7 @@ Page({
|
|||||||
downloadFilePromotionCode:function(){
|
downloadFilePromotionCode:function(){
|
||||||
var that = this;
|
var that = this;
|
||||||
wx.request({
|
wx.request({
|
||||||
url: app.globalData.url + '/routine/auth_api/product_promotion_code?uid=' + app.globalData.uid,
|
url: app.globalData.url + '/routine/auth_api/product_promotion_routine_code?uid=' + app.globalData.uid,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
data: { id: that.data.id, },
|
data: { id: that.data.id, },
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
@ -287,7 +286,6 @@ Page({
|
|||||||
})
|
})
|
||||||
that.setData({ canvasStatus: true });
|
that.setData({ canvasStatus: true });
|
||||||
const arr2 = ['/images/posterbackgd.png', that.data.storeImage, that.data.PromotionCode];
|
const arr2 = ['/images/posterbackgd.png', that.data.storeImage, that.data.PromotionCode];
|
||||||
console.log(arr2);
|
|
||||||
if (arr2[2] == '') {
|
if (arr2[2] == '') {
|
||||||
wx.request({
|
wx.request({
|
||||||
url: app.globalData.url + '/routine/auth_api/product_promotion_code?uid=' + app.globalData.uid,
|
url: app.globalData.url + '/routine/auth_api/product_promotion_code?uid=' + app.globalData.uid,
|
||||||
@ -413,32 +411,6 @@ Page({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
goPhoto:function(){
|
|
||||||
var that = this;
|
|
||||||
wx.showActionSheet({
|
|
||||||
itemList: ['发送给朋友', '生成海报'],
|
|
||||||
success: function (res) {
|
|
||||||
if (res.tapIndex){
|
|
||||||
wx.request({
|
|
||||||
url: app.globalData.url + '/routine/auth_api/get_pages?uid=' + app.globalData.uid,
|
|
||||||
method: 'GET',
|
|
||||||
data: {
|
|
||||||
path: app.globalData.openPages,
|
|
||||||
productId: that.data.id
|
|
||||||
},
|
|
||||||
success: function (res) {
|
|
||||||
console.log(res);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}else{
|
|
||||||
that.onShareAppMessage();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
fail: function (res) {
|
|
||||||
console.log(res.errMsg)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
parameterShow: function () {
|
parameterShow: function () {
|
||||||
var that = this;
|
var that = this;
|
||||||
if (that.data.productSelect.unique != ''){
|
if (that.data.productSelect.unique != ''){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user