Commit b25f72bd by 谢中龙

优惠券对接成功

parent a942a3da
......@@ -61,14 +61,14 @@ wxService.page({
*/
onLoad: function (options) {
let currentUserInfo = wx.getStorageSync('guidBaseInfo');
if (!currentUserInfo) { //未登录成功
wx.redirectTo({
url: '/shoppingGuid/page/pages/welcomGuider/welcomGuider',
});
return ;
}
// currentUserInfo = { member: { qiyeInfo: { name : '张三'}}}
// if (!currentUserInfo) { //未登录成功
// wx.redirectTo({
// url: '/shoppingGuid/page/pages/welcomGuider/welcomGuider',
// });
// return ;
// }
currentUserInfo = { member: { qiyeInfo: { name : '张三'}}}
let userInfo = wx.getStorageSync('guidInfo');
if (currentUserInfo.member) {
......
......@@ -29,15 +29,15 @@
<view class='month-data'>
<view class='data-item'>
<text class='data-item-title'>当前完成(人)</text>
<text class='data-item-number'>{{enlistList.achieve}}</text>
<text class='data-item-number' style='color:#F7B500;'>{{enlistList.achieve}}</text>
</view>
<view class='data-item'>
<text class='data-item-title'>当周目标(人)</text>
<text class='data-item-number'>{{enlistList.task.target}}</text>
<text class='data-item-number' style='color:#666660;'>{{enlistList.task.target}}</text>
</view>
<view class='data-item'>
<text class='data-item-title'>完成率</text>
<text class='data-item-number'>{{enlistList.rate}}</text>
<text class='data-item-number' style='color:#FA6400;'>{{enlistList.rate}}</text>
</view>
</view>
</view>
......
// shoppingGuid/page/pages/home/home.js
const wxService = require('../../../../utils/wxService')
import { Integer } from '../../../../utils/integerDigitalConvertion'
const app = getApp();
const discountBg = 'https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/7_3_0/icon_dicount_coupon.png';
const dingeBg = 'https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/7_3_0/icon_dinge_coupon.png';
const diyongBg = 'https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/7_3_0/icon_diyong_coupon.png';
const defaultGoodsImg = 'https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/product_defalut.jpg';
wxService.page({
/**
......@@ -31,14 +40,21 @@ wxService.page({
],
currentGoodsType: 2,
goodsList: []
}
},
shareModel : {
title : '',
path : '',
imageUrl : ''
},
showModal : false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getCouponList();
this.getGoodsList();
},
/**
......@@ -103,6 +119,7 @@ wxService.page({
loadingText : this.data.loadingText
})
}
}
})
},
......@@ -152,9 +169,9 @@ wxService.page({
this.data.coupon.couponTypeArr[index].active = true;
this.data.coupon.currentCouponType = this.data.coupon.couponTypeArr[index].type;
this.data.coupon.couponList = [];
this.getCouponList();
this.setData({
coupon: this.data.coupon
});
......@@ -163,7 +180,118 @@ wxService.page({
//获取优惠券列表
getCouponList(){
wx.showLoading({
title: '加载中..',
});
let type = this.data.coupon.currentCouponType;
wxService.post(`/marketing/shoppingguide/coupon/page4c?pageSize=3&pageNo=1`,{
couponName : '',
type: type,
}).then(res => {
if(res){
let list = res.data.data.content ? res.data.data.content : [];
list.forEach(item => {
item.couponType = item.couponSetting.type;
item.couponBg = item.couponType == 1 ? diyongBg : (item.couponType == 2 ? discountBg : dingeBg);
});
this.data.coupon.couponList = list;
this.setData({
coupon: this.data.coupon,
});
}
});
},
//展示优惠券二维码
onTapShowQrcode(e) {
let item = e.currentTarget.dataset.item;
wx.setStorageSync('_guidCouponInfo', item);
wx.navigateTo({
url: '/shoppingGuid/page/pages/couponQrcode/couponQrcode',
});
},
//定向发送优惠券
onTapToSendConpon(e) {
let item = e.currentTarget.dataset.item;
let id = item.id;
let content = {
title: item.title,
id: id,
url: item.couponBg
}
let tentacleInfo = {
content: JSON.stringify(content),
contentId: item.id,
contentType: app.globalData.contants.SHARE_TYPE.PRODUCT_DETAIL, //内容类型 STAFF_RECOMMAND
title: item.title, //标题
type: 3// 1:门店,2:员工(暂时不做),3:会员,4:第三方外部渠道,5:智能营销
}
wxService.getTentacleContent(tentacleInfo).then(res => {
if (res && res.id) {
let tentacleId = res.id;
let inner_id = Integer.digit(item.id, 10, 64);
let inner_tentacleId = Integer.digit(tentacleId, 10, 64);
var path = 'subPackage/page/pages/scanCoupon/scanCoupon' + '?i=' + inner_id + '&t=' + inner_tentacleId;
this.data.shareModel.title = item.title;
this.data.shareModel.imageUrl = item.couponBg;
this.data.shareModel.path = item.path;
this.setData({
shareModel: this.data.shareModel,
showModal: true
});
}
});
},
//关闭模态框
onTapCancelShare() {
this.setData({
showModal: false
});
},
//群发
onTapToSendByGroup(e) {
let item = e.currentTarget.dataset.item;
let id = item.id;
let content = {
title: item.title,
id: item.id,
url: item.imageBg
}
let tentacleInfo = {
content: JSON.stringify(content),
contentId: item.id,
contentType: app.globalData.contants.SHARE_TYPE.PRODUCT_DETAIL, //内容类型 STAFF_RECOMMAND
title: item.title, //标题
type: 3// 1:门店,2:员工(暂时不做),3:会员,4:第三方外部渠道,5:智能营销
}
wxService.getTentacleContent(tentacleInfo).then(res => {
if (res && res.id) {
let tentacleId = res.id;
let inner_id = Integer.digit(item.couponId, 10, 64);
let inner_tentacleId = Integer.digit(tentacleId, 10, 64);
var path = 'subPackage/page/pages/scanCoupon/scanCoupon' + '?i=' + inner_id + '&t=' + inner_tentacleId;
//打开企业微信通讯录选择会员
wx.qy.shareToExternalContact({
appid: app.globalData.appId,//小程序的appid
title: item.couponName, //小程序消息的title
imgUrl: item.imageBg,//小程序消息的封面图
page: path, //小程序消息打开后的路径
success: function (r) {
wx.showToast({
title: '发送成功!'
});
},
fail: function (err) {
}
});
}
});
},
//跳转到更多商品列表
......@@ -182,6 +310,7 @@ wxService.page({
this.data.goods.goodsTypeArr[index].active = true;
this.data.goods.currentGoodsType = this.data.goods.goodsTypeArr[index].type;
this.data.goods.goodsList = [];
this.getGoodsList();
this.setData({
goods: this.data.goods
......@@ -189,6 +318,99 @@ wxService.page({
},
//获取商品列表
getGoodsList(){
wx.showLoading({
title: '加载中..',
});
wxService.post(`/merchant/share/productBonus/buyer/findPage?pageNo=1&pageSize=3`, {}).then(res => {
if(res){
let list = res.data.data.content ? res.data.data.content : [];
list.map(item => {
item.productImgUrl = item.productImgUrl ? item.productImgUrl : defaultGoodsImg;
});
this.data.goods.goodsList = list;
this.setData({
goods: this.data.goods
});
}
});
},
//定向发送
//定向转发商品给用户 分享功能
onTapToShare(e) {
let item = e.currentTarget.dataset.item;
// 生成触点对象
let content = {
title: item.productName,
id: item.productId,
url: item.productImgUrl
}
let tentacleInfo = {
content: JSON.stringify(content),
contentId: item.productId,
contentType: app.globalData.contants.SHARE_TYPE.PRODUCT_DETAIL, //内容类型
title: item.productName, //标题
type: 3// 1:门店,2:员工(暂时不做),3:会员,4:第三方外部渠道,5:智能营销
}
wxService.getTentacleContent(tentacleInfo).then(res => {
if (res && res.id) {
let tentacleId = res.id;
let inner_id = Integer.digit(item.productId, 10, 64);
let inner_tentacleId = Integer.digit(tentacleId, 10, 64);
var path = 'pages/productDetail/productDetail' + '?i=' + inner_id + '&t=' + inner_tentacleId;
this.data.shareModel.title = item.productName;
this.data.shareModel.imageUrl = item.productImgUrl;
this.data.shareModel.path = path;
this.setData({
shareModel: this.data.shareModel,
showModal: true,
});
}
});
},
//立即群发商品给用户
onTapToRecommandProduct(e) {
let item = e.currentTarget.dataset.item;
// 生成触点对象
let content = {
title: item.productName,
id: item.productId,
url: item.productImgUrl
}
let tentacleInfo = {
content: JSON.stringify(content),
contentId: item.productId,
contentType: app.globalData.contants.SHARE_TYPE.PRODUCT_DETAIL, //内容类型
title: item.productName, //标题
type: 3// 1:门店,2:员工(暂时不做),3:会员,4:第三方外部渠道,5:智能营销
}
wxService.getTentacleContent(tentacleInfo).then(res => {
if (res && res.id) {
let tentacleId = res.id;
let inner_id = Integer.digit(item.productId, 10, 64);
let inner_tentacleId = Integer.digit(tentacleId, 10, 64);
var path = 'pages/productDetail/productDetail' + '?i=' + inner_id + '&t=' + inner_tentacleId;
//打开企业微信通讯录选择会员
wx.qy.shareToExternalContact({
appid: app.globalData.appId,//小程序的appid
title: item.productName, //小程序消息的title
imgUrl: item.productImgUrl,//小程序消息的封面图
page: path, //小程序消息打开后的路径
success: function (res) {
wx.showToast({
title: '推荐成功!'
});
},
fail: function (err) {
console.log('error---------------', err);
}
});
}
});
},
......@@ -209,7 +431,19 @@ wxService.page({
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
this.getCouponList();
this.getGoodsList();
if (this.data.current == 1){
this.getRecruitRanking();
}
else if(this.data.current == 2){
this.getStoreRanking();
}
setTimeout(() => {
wx.stopPullDownRefresh();
},3000);
},
/**
......
{
"navigationBarTitleText": "导购首页",
"enablePullDownRefresh": true,
"usingComponents": {
"tab-bar" : "../../../component/tabBar/tabBar"
}
......
......@@ -40,32 +40,25 @@
</view>
</view>
<!-- list -->
<view class='coupon-list'>
<view class='coupon-list-item'>
<view class='top'>
<image src='https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/7_3_0/icon_dicount_coupon.png' mode='aspectFit'></image>
<view class='coupon-name'>打折券</view>
</view>
<view class='center'>定向发券</view>
<view class='bottom'>群发推荐</view>
</view>
<view class='coupon-list-item'>
<view class='top'>
<image src='https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/7_3_0/icon_dinge_coupon.png' mode='aspectFit'></image>
<view class='coupon-name'>定额券</view>
</view>
<view class='center'>定向发券</view>
<view class='bottom'>群发推荐</view>
</view>
<view class='coupon-list-item'>
<view class='coupon-list' wx:if="{{coupon.couponList.length > 0}}">
<view class='coupon-list-item'
wx:for="{{coupon.couponList}}"
wx:for-index="idx"
wx:for-item="item"
wx:key="coupon{{idx}}">
<view class='top'>
<image src='https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/7_3_0/icon_diyong_coupon.png' mode='aspectFit'></image>
<view class='coupon-name'>抵扣券</view>
<image src='{{item.couponBg}}' mode='aspectFit' data-item="{{item}}" bindtap='onTapShowQrcode'></image>
<view class='coupon-name'>{{item.title}}</view>
</view>
<view class='center'>定向发券</view>
<view class='bottom'>群发推荐</view>
<view class='center' data-item="{{item}}" bindtap='onTapToSendConpon'>定向发券</view>
<view class='bottom' data-item="{{item}}" bindtap='onTapToSendByGroup'>群发推荐</view>
</view>
</view>
<!-- empty -->
<view class='empty' wx:if="{{coupon.couponList.length == 0}}">商家还未设置优惠券哦~</view>
</view>
<!-- 爆款推荐 -->
<view class='mg-b-40'>
......@@ -87,44 +80,27 @@
</view>
<!-- list -->
<view class='goods-list'>
<view class='goods-item'>
<image class='goods-lf-icon'
src='https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/man_logo.jpeg' mode='aspectFit'></image>
<view class='goods-item'
wx:for="{{goods.goodsList}}"
wx:for-item="item"
wx:for-index="idx"
wx:key="goodslist{{idx}}"
data-index="{{idx}}">
<image class='goods-lf-icon' src='{{item.productImgUrl}}' mode='aspectFit'></image>
<view class='goods-rg-info'>
<view class='goods-title'>雅诗兰黛DW持妆气垫油皮亲妈BB霜 持久控油遮瑕防晒</view>
<view class='goods-second-title'>整日持妆 高遮瑕 高防晒</view>
<view class='goods-title'>{{item.productName}}</view>
<view class='goods-second-title'>这个是商品的描述</view>
<view class='goods-price'>
<view class='price'>
<view class='original-price'>¥126.08</view>
<view class='plus'>
<text>¥89.00</text>
<image src='/assets/imgs/7_1_0/plus-icon.png' mode='aspectFit'></image>
<image src='/assets/imgs/point.png' mode='aspectFit'></image>
<text>{{item.point}}</text>
</view>
</view>
<view class='goods-share'>
<view class='send-coupon'>定向发券</view>
<view class='send-coupon'>群发推荐</view>
</view>
</view>
</view>
</view>
<view class='goods-item'>
<image class='goods-lf-icon'
src='https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/man_logo.jpeg' mode='aspectFit'></image>
<view class='goods-rg-info'>
<view class='goods-title'>雅诗兰黛DW持妆气垫油皮亲妈BB霜 持久控油遮瑕防晒</view>
<view class='goods-second-title'>整日持妆 高遮瑕 高防晒</view>
<view class='goods-price'>
<view class='price'>
<view class='original-price'>¥126.08</view>
<view class='plus'>
<text>¥89.00</text>
<image src='/assets/imgs/7_1_0/plus-icon.png' mode='aspectFit'></image>
</view>
</view>
<view class='goods-share'>
<view class='send-coupon'>定向发券</view>
<view class='send-coupon'>群发推荐</view>
<view class='send-coupon' data-item="{{item}}" bindtap='onTapToShare'>定向发送</view>
<view class='send-coupon' data-item="{{item}}" bindtap='onTapToRecommandProduct'>群发推荐</view>
</view>
</view>
</view>
......@@ -185,3 +161,14 @@
<!-- tabbar -->
<tab-bar index="{{2}}" />
<!-- 分享 -->
<!-- 分享好友 -->
<view class='bg' style='display:{{showModal ? "block" : "none"}}' bindtap='onTapCancelShare'></view>
<view class='share-container {{showModal ? "sliderUp" : ""}}'>
<button open-type="share">
<view class='share-item'>
<image src='/assets/imgs/7_1_0/wx-icon.png' mode='aspectFit'></image>
<text>微信好友</text>
</view>
</button>
</view>
......@@ -134,8 +134,8 @@ view{
}
.status-bar .more-data image{
width: 24rpx;
height: 24rpx;
width: 22rpx;
height: 22rpx;
}
.coupon-list{
......@@ -180,6 +180,7 @@ view{
line-clamp: 2;
-webkit-box-orient: vertical;
font-size: 22rpx;
width: 80%;
}
.coupon-list .coupon-list-item .top image{
......@@ -247,6 +248,9 @@ view{
flex: 1;
padding: 15rpx 20rpx;
font-size: 24rpx;
display: flex;
flex-direction: column;
justify-content: space-around;
}
.goods-list .goods-item .goods-rg-info .goods-title{
......@@ -286,13 +290,14 @@ view{
.goods-list .goods-item .goods-rg-info .goods-price .price .plus{
display: flex;
align-items: center;
color: #000000;
color: #333333;
margin-bottom: 8rpx;
}
.goods-list .goods-item .goods-rg-info .goods-price .price .plus image{
width: 60rpx;
height: 36rpx;
margin-left: 8rpx;
width: 28rpx;
height: 28rpx;
margin-right: 8rpx;
}
.goods-list .goods-item .goods-rg-info .goods-share{
......
......@@ -72,7 +72,6 @@ view{
width: 100%;
height: auto;
padding: 20rpx;
/* box-shadow: 0 0 6rpx 4rpx rgba(0,0,0,0.1); */
margin-bottom: 20rpx;
position: relative;
border-radius: 10rpx;
......@@ -143,10 +142,19 @@ view{
.task-info .lf{
display: flex;
align-items: center;
max-width: 65%;
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 1;
line-clamp: 1;
-webkit-box-orient: vertical;
}
.task-info .lf image{
width: 28rpx;
width: 24rpx;
height: 24rpx;
margin-right: 10rpx;
}
......
......@@ -176,8 +176,10 @@ wxService.page({
});
let pageNum = this.data.coupon.pageNum,
pageSize = this.data.coupon.pageSize,
param = { couponName: '' };
wxService.post(`/marketing/shoppingguide/coupon/page4c?pageSize=${pageSize}&pageNo=${pageNum}`, param).then(res => {
type = this.data.coupon.currentCouponType,
param = { couponName: '', type: type};
wxService.post(`/marketing/shoppingguide/coupon/page4c?pageSize=${pageSize}&pageNo=${pageNum}`,
param).then(res => {
if (res) {
const { result, data } = res.data
wx.hideLoading();
......
......@@ -24,14 +24,14 @@
<image class='goods-lf-icon' src='{{item.productImgUrl}}' mode='aspectFit'></image>
<view class='goods-rg-info'>
<view class='goods-title'>{{item.productName}}</view>
<view class='goods-second-title'>整日持妆 高遮瑕 高防晒</view>
<view class='goods-second-title'>这个是说明</view>
<view class='goods-price'>
<view class='price'>
<view class='original-price'>¥126.08</view>
<view class='plus'>
<text>¥89.00</text>
<image src='/assets/imgs/7_1_0/plus-icon.png' mode='aspectFit'></image>
<image src='/assets/imgs/point.png' mode='aspectFit'></image>
<text>{{item.point}}</text>
</view>
<view class='original-price'>¥126.08</view>
</view>
<view class='goods-share'>
<view class='send-coupon' data-item="{{item}}" bindtap='onTapToShare'>定向发送</view>
......
......@@ -106,6 +106,9 @@ view{
flex: 1;
padding: 15rpx 20rpx;
font-size: 24rpx;
display: flex;
flex-direction: column;
justify-content: space-around;
}
.goods-list .goods-item .goods-rg-info .goods-title{
......@@ -145,13 +148,14 @@ view{
.goods-list .goods-item .goods-rg-info .goods-price .price .plus{
display: flex;
align-items: center;
color: #000000;
color: #333333;
margin-bottom: 8rpx;
}
.goods-list .goods-item .goods-rg-info .goods-price .price .plus image{
width: 60rpx;
height: 36rpx;
margin-left: 8rpx;
width: 28rpx;
height: 28rpx;
margin-right: 8rpx;
}
.goods-list .goods-item .goods-rg-info .goods-share{
......
......@@ -29,15 +29,15 @@
<view class='month-data'>
<view class='data-item'>
<text class='data-item-title'>当前完成(元)</text>
<text class='data-item-number'>{{saleDetail.achieve}}</text>
<text class='data-item-number' style='color:#F7B500;'>{{saleDetail.achieve}}</text>
</view>
<view class='data-item'>
<text class='data-item-title'>当周目标(元)</text>
<text class='data-item-number'>{{saleDetail.task.target}}</text>
<text class='data-item-number' style='color:#666660;'>{{saleDetail.task.target}}</text>
</view>
<view class='data-item'>
<text class='data-item-title'>完成率</text>
<text class='data-item-number'>{{saleDetail.rate}}</text>
<text class='data-item-number' style='color:#FA6400;'>{{saleDetail.rate}}</text>
</view>
</view>
</view>
......
......@@ -2,43 +2,42 @@
const wxService = require('../../../../utils/wxService')
import { Integer } from '../../../../utils/integerDigitalConvertion'
var app = getApp()
const discountBg = 'https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/7_3_0/icon_dicount_coupon.png';
const dingeBg = 'https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/7_3_0/icon_dinge_coupon.png';
const diyongBg = 'https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/7_3_0/icon_diyong_coupon.png';
const defaultGoodsImg = 'https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/product_defalut.jpg';
wxService.page({
/**
* 页面的初始数据
*/
data: {
navBar : [
{ name: '导购学院', type: 1, isActive: true },
{ name: '推荐商品', type: 2, isActive: false },
{ name: '优惠券福利', type: 3, isActive: false},
],
current : 1,
guidCollege : {
pageSize : 10,
pageNum : 1,
totalPage : 0,
list : [],
currentPage : 1,
noData : false,
coupon : {
couponTypeArr: [
{ name: '打折券', type: 2, active: true },
{ name: '定额券', type: 3, active: false },
{ name: '抵用券', type: 1, active: false }
],
currentCouponType: 2,
couponList : []
},
//推荐商品
recommandProducts : [],
recommandProductsNoData: false,
//优惠券
coupons : {
pageSize: 10,
pageNum: 1,
totalPage: 0,
list: [],
currentPage: 1,
noData : false
goods : {
goodsTypeArr: [
{ name: '最新', type: 2, active: true },
{ name: '最热🔥', type: 3, active: false },
{ name: '推荐👍', type: 1, active: false }
],
currentGoodsType: 2,
goodsList: []
},
showShareGoods : false,
shareGoodsObj : {
title: '',
path: '',
imageUrl: '',
showModal : false,
shareModel : {
title : '',
path : '',
imageUrl : ''
}
},
......@@ -46,8 +45,8 @@ wxService.page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
//首次进来先加载导购学院的列表
this.getGuidCollegeList();
this.getCouponList();
this.getGoodsList();
wx.hideShareMenu();
},
......@@ -56,53 +55,118 @@ wxService.page({
*/
onShow: function () {
this.setData({
showShareGoods : false,
showModal : false,
})
},
//跳转到更多商品列表
onTapToMoreProducts() {
wx.navigateTo({
url: '/shoppingGuid/page/pages/moreProducts/moreProducts?type=' + this.data.goods.currentGoodsType,
});
},
//跳转到优惠券列表
onTapToCouponList() {
wx.navigateTo({
url: '/shoppingGuid/page/pages/moreCoupons/moreCoupons?type=' + this.data.coupon.currentCouponType,
});
},
//点击事件
//分类点击
onTopBarTap(e) {
let index = e.currentTarget.dataset.index,
item = e.currentTarget.dataset.item;
this.data.navBar.forEach(nav => {
nav.isActive = false;
onTapChangeCouponType(e) {
let index = e.currentTarget.dataset.index;
this.data.coupon.couponTypeArr.map(item => {
item.active = false;
});
this.data.navBar[index].isActive = true;
this.data.current = this.data.navBar[index].type;
// tab 切换时 如果发现对应的列表没有加载过,则去加载
if (this.data.current == 1){
if (this.data.guidCollege.list.length == 0){
this.getGuidCollegeList();
}
}
else if (this.data.current == 2){
if (this.data.recommandProducts.length == 0) {
this.getRecommandProductList();
}
}
else if(this.data.current == 3){
if(this.data.coupons.list.length == 0){
this.getCouponActivityList();
}
}
this.data.coupon.couponTypeArr[index].active = true;
this.data.coupon.currentCouponType = this.data.coupon.couponTypeArr[index].type;
this.data.coupon.couponList = [];
this.getCouponList();
this.setData({
navBar: this.data.navBar,
current: this.data.current
coupon: this.data.coupon
});
},
//获取优惠券列表
getCouponList() {
wx.showLoading({
title: '加载中..',
});
let type = this.data.coupon.currentCouponType;
wxService.post(`/marketing/shoppingguide/coupon/page4c?pageSize=3&pageNo=1`, {
couponName: '',
type: type
}).then(res => {
if (res) {
let list = res.data.data.content ? res.data.data.content : [];
list.forEach(item => {
item.couponType = item.couponSetting.type;
item.couponBg = item.couponType == 1 ? diyongBg : (item.couponType == 2 ? discountBg : dingeBg);
});
this.data.coupon.couponList = list;
this.setData({
coupon: this.data.coupon,
});
}
});
},
//跳转导购学院详情
onTapToGuidCollegeInfo(e){
//展示优惠券二维码
onTapShowQrcode(e) {
let item = e.currentTarget.dataset.item;
let id = item.id;
wx.setStorageSync('_guidCouponInfo', item);
wx.navigateTo({
url: '/shoppingGuid/page/pages/guidCollegeInfo/guidCollegeInfo?id=' + id,
url: '/shoppingGuid/page/pages/couponQrcode/couponQrcode',
});
},
//定向发送优惠券
onTapToSendConpon(e){
onTapToSendConpon(e) {
let item = e.currentTarget.dataset.item;
let id = item.id;
let content = {
title: item.title,
id: id,
url: item.couponBg
}
let tentacleInfo = {
content: JSON.stringify(content),
contentId: item.id,
contentType: app.globalData.contants.SHARE_TYPE.PRODUCT_DETAIL, //内容类型 STAFF_RECOMMAND
title: item.title, //标题
type: 3// 1:门店,2:员工(暂时不做),3:会员,4:第三方外部渠道,5:智能营销
}
wxService.getTentacleContent(tentacleInfo).then(res => {
if (res && res.id) {
let tentacleId = res.id;
let inner_id = Integer.digit(item.id, 10, 64);
let inner_tentacleId = Integer.digit(tentacleId, 10, 64);
var path = 'subPackage/page/pages/scanCoupon/scanCoupon' + '?i=' + inner_id + '&t=' + inner_tentacleId;
this.data.shareModel.title = item.title;
this.data.shareModel.imageUrl = item.couponBg;
this.data.shareModel.path = item.path;
this.setData({
shareModel: this.data.shareModel,
showModal: true
});
}
});
},
//关闭模态框
onTapCancelShare() {
this.setData({
showModal: false
});
},
//群发
onTapToSendByGroup(e) {
let item = e.currentTarget.dataset.item;
let id = item.id;
let content = {
......@@ -125,8 +189,6 @@ wxService.page({
let inner_id = Integer.digit(item.couponId, 10, 64);
let inner_tentacleId = Integer.digit(tentacleId, 10, 64);
var path = 'subPackage/page/pages/scanCoupon/scanCoupon' + '?i=' + inner_id + '&t=' + inner_tentacleId;
console.log('-0-00', path)
//打开企业微信通讯录选择会员
wx.qy.shareToExternalContact({
appid: app.globalData.appId,//小程序的appid
......@@ -139,15 +201,48 @@ wxService.page({
});
},
fail: function (err) {
console.log('error---------------', err);
}
});
}
});
},
//立即推荐商品给用户
onTapToRecommandProduct(e){
//商品筛选
//筛选点击
onTapChangeGoodsType(e) {
let index = e.currentTarget.dataset.index;
this.data.goods.goodsTypeArr.map(item => {
item.active = false;
});
this.data.goods.goodsTypeArr[index].active = true;
this.data.goods.currentGoodsType = this.data.goods.goodsTypeArr[index].type;
this.data.goods.goodsList = [];
this.getGoodsList();
this.setData({
goods: this.data.goods
});
},
//获取商品列表
getGoodsList() {
wxService.post(`/merchant/share/productBonus/buyer/findPage?pageNo=1&pageSize=5`, {}).then(res => {
if (res) {
let list = res.data.data.content ? res.data.data.content : [];
list.map(item => {
item.productImgUrl = item.productImgUrl ? item.productImgUrl : defaultGoodsImg;
});
this.data.goods.goodsList = list;
this.setData({
goods: this.data.goods
});
}
});
},
//定向发送
//定向转发商品给用户 分享功能
onTapToShare(e) {
let item = e.currentTarget.dataset.item;
// 生成触点对象
let content = {
......@@ -169,31 +264,20 @@ wxService.page({
let inner_id = Integer.digit(item.productId, 10, 64);
let inner_tentacleId = Integer.digit(tentacleId, 10, 64);
var path = 'pages/productDetail/productDetail' + '?i=' + inner_id + '&t=' + inner_tentacleId;
// let path = 'pages/productDetail/productDetail';
// console.log('推荐商品path-----', path)
//打开企业微信通讯录选择会员
wx.qy.shareToExternalContact({
appid: app.globalData.appId,//小程序的appid
title: item.productName, //小程序消息的title
imgUrl: item.productImgUrl,//小程序消息的封面图
page: path, //小程序消息打开后的路径
success: function (res) {
//todo:
wx.showToast({
title: '推荐成功!'
});
},
fail: function (err) {
console.log('error---------------', err);
}
this.data.shareModel.title = item.productName;
this.data.shareModel.imageUrl = item.productImgUrl;
this.data.shareModel.path = path;
this.setData({
shareModel: this.data.shareModel,
showModal: true,
});
}
});
},
//定向转发商品给用户 分享功能
onTapToShare(e){
//立即群发商品给用户
onTapToRecommandProduct(e) {
let item = e.currentTarget.dataset.item;
// 生成触点对象
let content = {
......@@ -215,137 +299,27 @@ wxService.page({
let inner_id = Integer.digit(item.productId, 10, 64);
let inner_tentacleId = Integer.digit(tentacleId, 10, 64);
var path = 'pages/productDetail/productDetail' + '?i=' + inner_id + '&t=' + inner_tentacleId;
this.data.shareGoodsObj.title = item.productName;
this.data.shareGoodsObj.imageUrl = item.productImgUrl;
this.data.shareGoodsObj.path = path;
this.setData({
shareGoodsObj: this.data.shareGoodsObj,
showShareGoods : true,
//打开企业微信通讯录选择会员
wx.qy.shareToExternalContact({
appid: app.globalData.appId,//小程序的appid
title: item.productName, //小程序消息的title
imgUrl: item.productImgUrl,//小程序消息的封面图
page: path, //小程序消息打开后的路径
success: function (res) {
wx.showToast({
title: '推荐成功!'
});
},
fail: function (err) {
console.log('error---------------', err);
}
});
}
});
},
//取消分享
onTapCancelShare(){
this.setData({
showShareGoods: false,
});
},
//去商城
onTapToMall(){
wx.redirectTo({
url: '/pages/userCenter/userCenter',
})
},
//获取导购学院列表
getGuidCollegeList(){
wx.showLoading({
title: '加载中',
mask: true
})
let pageSize = this.data.guidCollege.pageSize,
pageNum = this.data.guidCollege.pageNum;
wxService.post(`/merchant/guideCollege/getPageInfoListC?pageSize=${pageSize}&pageNum=${pageNum}`,{
title : ''
}
).then(res => {
if (res) {
wx.hideLoading();
const { result, data } = res.data
if (result == 0) {
this.data.guidCollege.list = this.data.guidCollege.list.concat(data.content);
this.data.guidCollege.totalPage = data.totalPages;
if (this.data.guidCollege.list.length == 0) {
this.data.guidCollege.noData = true;
}
this.setData({
guidCollege: this.data.guidCollege
});
}
}
})
},
//获取推荐商品列表
getRecommandProductList(){
wx.showLoading({
title: '加载中',
mask: true
})
wxService.post(`/merchant/share/productBonus/buyer/findPage?pageNo=1&pageSize=20`, {}).then(res => {
if (res) {
const { result, data } = res.data
if (result == 0) {
wx.hideLoading()
let list = data.content;
list.forEach(item => {
item.productImgUrl = item.productImgUrl ?
item.productImgUrl : 'https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/1571636466%281%29.jpg';
});
if(list.length == 0){
this.data.recommandProductsNoData = true;
}
this.setData({
recommandProducts: list,
recommandProductsNoData: this.data.recommandProductsNoData
})
}
}
})
},
//获取优惠券券活动
getCouponActivityList(){
wx.showLoading({
title: '加载中',
mask: true
});
let pageNum = this.data.coupons.pageNum,
pageSize = this.data.coupons.pageSize,
param = { couponName: ''};
wxService.post(`/marketing/shoppingguide/coupon/page4c?pageSize=${pageSize}&pageNo=${pageNum}`, param).then(res => {
if (res) {
//https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/coupon_bg.png 正常
//https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/coupon_bg_cantUse.png //不可使用
const { result, data } = res.data
wx.hideLoading();
if (result == 0) {
let list = data.content ? data.content : [];
list.forEach(item => {
item.canUse = (item.couponSetting.status == 0 || item.couponSetting.status == 2) ? false : true;
item.imageBg = 'https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/coupon_bg.png';
item.typeText = item.couponSetting.typeDesc;
item.price = parseFloat(item.couponSetting.faceAmount / 100).toFixed(2);
item.couponType = item.couponSetting.type;
});
this.data.coupons.totalPage = Math.ceil(data.totalElements / this.data.coupons.pageSize);
this.data.coupons.list = this.data.coupons.list.concat(list);
if(this.data.coupons.list.length == 0){
this.data.coupons.noData = true;
}
this.setData({
coupons: this.data.coupons
});
}
}
})
},
//展示优惠券二维码
onTapShowQrcode(e){
let item = e.currentTarget.dataset.item;
wx.setStorageSync('_guidCouponInfo', item);
wx.navigateTo({
url: '/shoppingGuid/page/pages/couponQrcode/couponQrcode',
});
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
......@@ -357,27 +331,7 @@ wxService.page({
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
if(this.data.current == 1){ // 导购学院
if (this.data.guidCollege.totalPage > this.data.guidCollege.pageNum){
this.data.guidCollege.pageNum = this.data.guidCollege.pageNum + 1;
this.getGuidCollegeList();
}
else{
// wx.showToast({
// title: '没有更多数据啦~',
// icon : 'none'
// });
}
}
else if (this.data.current == 2){ //推荐商品
}
else if (this.data.current == 3){ //优惠券福利
if (this.data.coupons.pageNum < this.data.coupons.totalPage){
this.data.coupons.pageNum ++ ;
this.getCouponActivityList();
}
}
},
/**
......@@ -386,9 +340,9 @@ wxService.page({
onShareAppMessage: function (res) {
if (res.from == 'button'){
return {
title : this.data.shareGoodsObj.title,
path : this.data.shareGoodsObj.path,
imageUrl: this.data.shareGoodsObj.imageUrl
title : this.data.shareModel.title,
path: this.data.shareModel.path,
imageUrl: this.data.shareModel.imageUrl
}
}
}
......
......@@ -6,101 +6,83 @@
<view class='header'>优惠券</view>
<view class='status-bar'>
<view class='status-items'>
<view class='status-bar-item active'>打折券</view>
<view class='status-bar-item'>定额券</view>
<view class='status-bar-item'>抵用券</view>
<view class='status-bar-item {{item.active ? "active" : ""}}'
wx:for="{{coupon.couponTypeArr}}"
wx:for-item="item"
wx:for-index="idx"
bindtap='onTapChangeCouponType'
data-index="{{idx}}"
wx:key="tab{{idx}}">{{item.name}}</view>
</view>
<view class='more-data'>
<view class='more-data' bindtap='onTapToCouponList'>
<label>更多</label>
<image src='/assets/imgs/arrow-right-sku.png' mode='aspectFit'></image>
</view>
</view>
<!-- list -->
<view class='coupon-list'>
<view class='coupon-list-item'>
<view class='top'>
<image src='https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/7_3_0/icon_dicount_coupon.png' mode='aspectFit'></image>
<view class='coupon-name'>打折券</view>
</view>
<view class='center'>定向发券</view>
<view class='bottom'>群发推荐</view>
</view>
<view class='coupon-list-item'>
<view class='top'>
<image src='https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/7_3_0/icon_dinge_coupon.png' mode='aspectFit'></image>
<view class='coupon-name'>定额券</view>
</view>
<view class='center'>定向发券</view>
<view class='bottom'>群发推荐</view>
</view>
<view class='coupon-list-item'>
<view class='coupon-list' wx:if="{{coupon.couponList.length > 0}}">
<view class='coupon-list-item'
wx:for="{{coupon.couponList}}"
wx:for-index="idx"
wx:for-item="item"
wx:key="coupon{{idx}}">
<view class='top'>
<image src='https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/7_3_0/icon_diyong_coupon.png' mode='aspectFit'></image>
<view class='coupon-name'>抵扣券</view>
<image src='{{item.couponBg}}' mode='aspectFit' data-item="{{item}}" bindtap='onTapShowQrcode'></image>
<view class='coupon-name'>{{item.title}}</view>
</view>
<view class='center'>定向发券</view>
<view class='bottom'>群发推荐</view>
<view class='center' data-item="{{item}}" bindtap='onTapToSendConpon'>定向发券</view>
<view class='bottom' data-item="{{item}}" bindtap='onTapToSendByGroup'>群发推荐</view>
</view>
</view>
<!-- empty -->
<view class='empty' wx:if="{{coupon.couponList.length == 0}}">商家还未设置优惠券哦~</view>
</view>
<!-- 爆款推荐 -->
<view class='mg-b-40'>
<view class='header'>爆款推荐</view>
<view class='status-bar'>
<view class='status-items'>
<view class='status-bar-item active'>最新</view>
<view class='status-bar-item'>最热🔥</view>
<view class='status-bar-item'>推荐👍</view>
<view class='status-bar-item {{item.active ? "active" : ""}}'
wx:for="{{goods.goodsTypeArr}}"
wx:for-item="item"
bindtap='onTapChangeGoodsType'
wx:for-index="idx"
wx:key="goods{{idx}}"
data-index="{{idx}}">{{item.name}}</view>
</view>
<view class='more-data'>
<view class='more-data' bindtap='onTapToMoreProducts'>
<label>更多</label>
<image src='/assets/imgs/arrow-right-sku.png' mode='aspectFit'></image>
</view>
</view>
<!-- list -->
<view class='goods-list'>
<view class='goods-item'>
<image class='goods-lf-icon'
src='https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/man_logo.jpeg' mode='aspectFit'></image>
<view class='goods-item'
wx:for="{{goods.goodsList}}"
wx:for-item="item"
wx:for-index="idx"
wx:key="goodslist{{idx}}"
data-index="{{idx}}">
<image class='goods-lf-icon' src='{{item.productImgUrl}}' mode='aspectFit'></image>
<view class='goods-rg-info'>
<view class='goods-title'>雅诗兰黛DW持妆气垫油皮亲妈BB霜 持久控油遮瑕防晒</view>
<view class='goods-second-title'>整日持妆 高遮瑕 高防晒</view>
<view class='goods-title'>{{item.productName}}</view>
<view class='goods-second-title'>这个是商品的描述</view>
<view class='goods-price'>
<view class='price'>
<view class='original-price'>¥126.08</view>
<view class='plus'>
<text>¥89.00</text>
<image src='/assets/imgs/7_1_0/plus-icon.png' mode='aspectFit'></image>
</view>
</view>
<view class='goods-share'>
<view class='send-coupon'>定向发券</view>
<view class='send-coupon'>群发推荐</view>
</view>
</view>
</view>
</view>
<view class='goods-item'>
<image class='goods-lf-icon'
src='https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/man_logo.jpeg' mode='aspectFit'></image>
<view class='goods-rg-info'>
<view class='goods-title'>雅诗兰黛DW持妆气垫油皮亲妈BB霜 持久控油遮瑕防晒</view>
<view class='goods-second-title'>整日持妆 高遮瑕 高防晒</view>
<view class='goods-price'>
<view class='price'>
<view class='original-price'>¥126.08</view>
<view class='plus'>
<text>¥89.00</text>
<image src='/assets/imgs/7_1_0/plus-icon.png' mode='aspectFit'></image>
</view>
</view>
<view class='goods-share'>
<view class='send-coupon'>定向发券</view>
<view class='send-coupon'>群发推荐</view>
<view class='send-coupon' data-item="{{item}}" bindtap='onTapToShare'>定向发送</view>
<view class='send-coupon' data-item="{{item}}" bindtap='onTapToRecommandProduct'>群发推荐</view>
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 内容运营 -->
......@@ -137,3 +119,14 @@
<!-- tabbar -->
<tab-bar index="{{3}}" />
<!-- 分享 -->
<!-- 分享好友 -->
<view class='bg' style='display:{{showModal ? "block" : "none"}}' bindtap='onTapCancelShare'></view>
<view class='share-container {{showModal ? "sliderUp" : ""}}'>
<button open-type="share">
<view class='share-item'>
<image src='/assets/imgs/7_1_0/wx-icon.png' mode='aspectFit'></image>
<text>微信好友</text>
</view>
</button>
</view>
\ No newline at end of file
......@@ -89,8 +89,8 @@ view{
}
.status-bar .more-data image{
width: 24rpx;
height: 24rpx;
width: 22rpx;
height: 22rpx;
}
.coupon-list{
......@@ -202,6 +202,9 @@ view{
flex: 1;
padding: 15rpx 20rpx;
font-size: 24rpx;
display: flex;
flex-direction: column;
justify-content: space-around;
}
.goods-list .goods-item .goods-rg-info .goods-title{
......@@ -241,13 +244,14 @@ view{
.goods-list .goods-item .goods-rg-info .goods-price .price .plus{
display: flex;
align-items: center;
color: #000000;
color: #333333;
margin-bottom: 8rpx;
}
.goods-list .goods-item .goods-rg-info .goods-price .price .plus image{
width: 60rpx;
height: 36rpx;
margin-left: 8rpx;
width: 28rpx;
height: 28rpx;
margin-right: 8rpx;
}
.goods-list .goods-item .goods-rg-info .goods-share{
......
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