Commit ae572dfa by 谢中龙

新增领券功能

parent aada3d3d
......@@ -120,6 +120,7 @@ const prod_brand_config = {
isMall: isMall,// 商城或门户 true 商城 false 门户
orderingMustOpenCard : false, //下单是否必须卡开
isOpenSelfMention : true, // 是否开启门店自提
isNeedGetLocation : true,//是否开启小程序获取位置(提交订单时获取门店信息)
shareTitle: '【舞象星品荟-社交商城】',
logo: 'https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/logo_head.png',
},
......@@ -136,6 +137,7 @@ const prod_brand_config = {
isMall: isMall,
orderingMustOpenCard: true,
isOpenSelfMention: true, // 是否开启门店自提
isNeedGetLocation: false,//是否开启小程序获取位置(提交订单时获取门店信息)
shareTitle: '【泰华微商城】',
logo: 'https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/taihua_logo.png',
},
......@@ -151,6 +153,7 @@ const prod_brand_config = {
isMall: isMall,
orderingMustOpenCard: false,
isOpenSelfMention: false, // 是否开启门店自提
isNeedGetLocation: false,//是否开启小程序获取位置(提交订单时获取门店信息)
shareTitle: '【多多一上】',
logo: 'https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/duoduoyishang_logo.png',
},
......@@ -166,6 +169,7 @@ const prod_brand_config = {
isMall: isMall,
orderingMustOpenCard: false,
isOpenSelfMention: false, // 是否开启门店自提
isNeedGetLocation: false,//是否开启小程序获取位置(提交订单时获取门店信息)
shareTitle: '【雪岛书屋】',
logo: 'https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/logo_head.png',
},
......@@ -181,6 +185,7 @@ const prod_brand_config = {
isMall: isMall,
orderingMustOpenCard: false,
isOpenSelfMention: false, // 是否开启门店自提
isNeedGetLocation: false,//是否开启小程序获取位置(提交订单时获取门店信息)
shareTitle: '【苏州邻里】',
logo: 'https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/logo_head.png',
},
......@@ -196,6 +201,7 @@ const prod_brand_config = {
isMall: isMall,// 商城或门户 true 商城 false 门户
orderingMustOpenCard: false,//下单是否必须卡开
isOpenSelfMention: false, // 是否开启门店自提
isNeedGetLocation: false,//是否开启小程序获取位置(提交订单时获取门店信息)
shareTitle: '【LA RUTA DE VIA】',//分享海报上显示的小程序title
logo: 'https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/laru.jpg',//商户logo
},
......@@ -211,6 +217,7 @@ const prod_brand_config = {
isMall: isMall,
orderingMustOpenCard: false,
isOpenSelfMention: false, // 是否开启门店自提
isNeedGetLocation: false,//是否开启小程序获取位置(提交订单时获取门店信息)
shareTitle: '【hotwind热风微商城】',
logo: 'https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/hotwind_logo.png',
},
......@@ -226,6 +233,7 @@ const prod_brand_config = {
isMall: isMall,
orderingMustOpenCard: false,
isOpenSelfMention: false, // 是否开启门店自提
isNeedGetLocation: false,//是否开启小程序获取位置(提交订单时获取门店信息)
shareTitle: '【悦芙媞微商城】',
logo: 'https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/yufuti_logo.png',
},
......@@ -241,6 +249,7 @@ const prod_brand_config = {
isMall: isMall,
orderingMustOpenCard: false,
isOpenSelfMention: false, // 是否开启门店自提
isNeedGetLocation: false,//是否开启小程序获取位置(提交订单时获取门店信息)
shareTitle: '【阿特里里微商城】',
logo: 'https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/logo_head.png',
},
......@@ -256,6 +265,7 @@ const prod_brand_config = {
isMall: isMall,
orderingMustOpenCard: false,
isOpenSelfMention: false, // 是否开启门店自提
isNeedGetLocation: false,//是否开启小程序获取位置(提交订单时获取门店信息)
shareTitle: '【包鞋微商城】',
logo: 'https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/logo_head.png',
},
......@@ -271,6 +281,7 @@ const prod_brand_config = {
isMall: isMall,
orderingMustOpenCard: false,
isOpenSelfMention: false, // 是否开启门店自提
isNeedGetLocation: false,//是否开启小程序获取位置(提交订单时获取门店信息)
shareTitle: '【花在花园微商城】',
logo: 'https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/logo_head.png',
},
......@@ -286,10 +297,11 @@ const prod_brand_config = {
isMall: isMall,
orderingMustOpenCard: false,
isOpenSelfMention: false, // 是否开启门店自提
isNeedGetLocation: false,//是否开启小程序获取位置(提交订单时获取门店信息)
shareTitle: '【阿吉豆微商城】',
logo: 'https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/logo_head.png',
},
//
//【ACTREE】
2017: {
appId: 'wx2aae34874e88cdf5',
tunnelToken: '5b621e41ea6ed4ad302c5d07b8685c32',
......@@ -301,6 +313,7 @@ const prod_brand_config = {
isMall: isMall,
orderingMustOpenCard: true,
isOpenSelfMention: false, // 是否开启门店自提
isNeedGetLocation: false,//是否开启小程序获取位置(提交订单时获取门店信息)
shareTitle: '【ACTREE】',
logo: 'https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/actree_logo.png',
},
......@@ -390,6 +403,7 @@ let orderingMustOpenCard = PROJECT_ENV == 'prod' ? prod_brand_config[BRANCH_ID].
let isOpenSelfMention = PROJECT_ENV == 'prod' ? prod_brand_config[BRANCH_ID].isOpenSelfMention : true;
let shareTitle = PROJECT_ENV == 'prod' ? prod_brand_config[BRANCH_ID].shareTitle : '舞象商城';
let shareLogo = PROJECT_ENV == 'prod' ? prod_brand_config[BRANCH_ID].logo : defaultShareLogo;
let isNeedGetLocation = PROJECT_ENV == 'prod' ? prod_brand_config[BRANCH_ID].isNeedGetLocation : true;
//配置信息导出
const envInfo = (() => {
......@@ -408,6 +422,7 @@ const envInfo = (() => {
orderingMustOpenCard: orderingMustOpenCard,//下单时是否强校验必须开卡 true 必须开卡才可下单 false 不开卡可以下单
isOpenSelfMention: isOpenSelfMention,//门店是否开启门店自提功能
shareTitle: shareTitle,
isNeedGetLocation: isNeedGetLocation,
shareLogo: shareLogo,
speadProductsBanner: speadProductsBanner
}
......
......@@ -3,6 +3,7 @@ const wxService = require('../../utils/wxService')
const app = getApp()
const city = require('../../utils/city')
const utils = require('../../utils/util')
const envInfo = require('../../config/index').envInfo;
wxService.page({
/**
......@@ -43,7 +44,8 @@ wxService.page({
storeId : '',
storeAddress : '',
storeCode : ''
}
},
orderStoreInfo : null,
},
/**
......@@ -51,7 +53,52 @@ wxService.page({
*/
onLoad: function (options) {
wx.hideShareMenu();
this.getMyLocationInfo();
},
////获取位置信息并获取附近门店信息
getMyLocationInfo(cb) {
let _this = this;
if (!envInfo.isNeedGetLocation) {
return;
}
//获取本地缓存的地址信息
let myLocation = wx.getStorageSync('myLocation') ? wx.getStorageSync('myLocation') : null;
if (!myLocation){
wx.getLocation({
type: 'wgs84',
success(res) {
const latitude = res.latitude
const longitude = res.longitude
let obj = {
latitude: latitude,
longitude: longitude,
}
wx.setStorageSync('myLocation', obj);
_this.getMyStoreInfoByPosition(latitude, longitude);
}
});
return ;
}
this.getMyStoreInfoByPosition(myLocation.latitude,myLocation.longitude);
},
//获取附近门店信息
getMyStoreInfoByPosition(latitude, longitude){
wxService.post(`/sale/trade/buyer/getMemberStore?latitude=${latitude}&longitude=${longitude}`).then(res => {
if (res){
if (res.data.result == 0) {
let obj = res.data.data ? res.data.data : null;
if (obj) {
this.data.orderStoreInfo = {
storeId: obj.storeId,
storeInfo: obj.storeInfo
}
}
}
}
});
},
/**
* 生命周期函数--监听页面显示
......@@ -658,6 +705,15 @@ wxService.page({
},
//下单
order(isSelect,params){
if(this.data.orderStoreInfo){
if (this.data.orderStoreInfo.storeId){
params.storeId = this.data.orderStoreInfo.storeId;
}
if (this.data.orderStoreInfo.storeInfo){
params.storeInfo = this.data.orderStoreInfo.storeInfo;
}
}
let _this = this;
let url = isSelect ? '/sale/payment/merged/buyer/bill' : '/sale/trade/buyer/bill'
wxService.post(`${url}`, params).then(res => {
......
......@@ -58,9 +58,11 @@
margin-bottom: 60rpx;
font-size: 27rpx;
}
.integral-title,.integral-desc{
display: inline-block;
}
.integral-title{
color: #999999;
vertical-align: top;
......@@ -68,6 +70,7 @@
text-align: right;
width: 120rpx;
}
.integral-desc{
width: 500rpx;
color: #666666;
......
......@@ -51,6 +51,11 @@ wxService.page({
// y: utils.configSliderBlock(app).y,
// })
//是否开启获取地理位置
if (envInfo.isNeedGetLocation){
this.getMyLocationInfo();
}
// 判断环境是不是企业微信
let env = wx.getStorageSync('_qyWeChat');
this.setData({
......@@ -82,6 +87,23 @@ wxService.page({
}
},
////获取位置信息并获取附近门店信息
getMyLocationInfo() {
let _this = this;
wx.getLocation({
type: 'wgs84',
success(res) {
const latitude = res.latitude
const longitude = res.longitude
let obj = {
latitude: latitude,
longitude: longitude,
}
wx.setStorageSync('myLocation', obj);
}
})
},
//联系我插件
startmessage(e){
console.log('联系我插件信息startmessage----', e)
},
......
......@@ -8,12 +8,6 @@ wxService.page({
data: {
query: '',
integralCouponList: [], // 积分兑换优惠券列表
noMore: false,
isExchange: false,
exchangeId: '',
exchangePoint: 0,
dialogStockEmpty: false,
dialogUserLimit: false,
},
/**
......@@ -24,40 +18,56 @@ wxService.page({
this.initIntegralCouponList();
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
// 积分兑换优惠券列表
initIntegralCouponList() {
// 获取优惠券活动列表
initIntegralCouponList(refresh) {
wx.showLoading({
title: '加载中'
});
wxService.get(`/coupon/pointsRedemptionCouponSetting/getAllValid`).then(res => {
wxService.post(`/coupon/couponCenterActivity/buyer/getValidList`).then(res => {
if (res) {
const { result, data } = res.data
if (result == 0) {
wx.hideLoading()
this.data.integralCouponList = data ? data : [];
this.setData({
integralCouponList: data.reverse()
integralCouponList: this.data.integralCouponList
});
}
}
if(refresh){
wx.showToast({
title: '刷新成功',
});
wx.stopPullDownRefresh();
}
}).finally(() => {
wx.hideLoading();
})
},
//立即兑换优惠券
exchange(e) {
const { id, point } = e.currentTarget.dataset
wx.showLoading({
title: '领取中..',
});
const { id } = e.currentTarget.dataset;
wxService.post(`/coupon/couponCenterActivity/buyer/coupon/draw?id=${id}`).then(res => {
wx.hideLoading();
if(res){
if(res.data.result == 0){
wx.showToast({
title: '领取成功!',
title: '领取成功',
});
}
else{
wx.showToast({
title: '领取失败,请稍后再试',
icon : 'none'
});
}
}
});
},
//跳转到详情
......@@ -68,7 +78,9 @@ wxService.page({
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () { },
onPullDownRefresh: function () {
this.initIntegralCouponList(true);
},
/**
* 页面上拉触底事件的处理函数
......
{
"navigationBarTitleText": "领券中心",
"backgroundTextStyle": "dark",
"enablePullDownRefresh": true,
"usingComponents": {
"no-more": "/component/noMore/noMore",
"exchange-coupon-modal": "/component/exchange-coupon-modal/exchange-coupon-modal",
......
......@@ -9,16 +9,16 @@
wx:for-item="item"
wx:for-index="k"
wx:key="{{k}}"
data-id="{{item.id}}"
data-id="{{item.acvivityId}}"
>
<view class="coupon-item">
<view class='coupon-img-title' data-id="{{item.id}}" bindtap="goCouponDetail">
<view class='coupon-img-title' data-id="{{item.acvivityId}}" bindtap="goCouponDetail">
<view class='coupon-img'>
<image wx:if="{{item.thumbnail}}" src='{{item.thumbnail}}' mode="aspectFit"/>
<image wx:else src='/assets/imgs/qr-code.png' />
<image wx:if="{{item.listPicture}}" src='{{item.listPicture}}' mode="aspectFit"/>
<image wx:else src='https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/icon_get_coupon.png' />
</view>
<view class='coupon-info'>
<view class='coupon-name fs-28'>{{item.title}}</view>
<view class='coupon-name fs-28'>{{item.activityName}}</view>
<view class='coupon-desc text-align-left fs-24'>查看详情</view>
</view>
</view>
......@@ -28,9 +28,9 @@
open-type='getUserInfo'
class="clear-btn positionAbs"></button>
<view class='coupon-btn-click theme-color'
data-id="{{item.id}}"
data-point="{{item.point}}"
data-id="{{item.acvivityId}}"
bindtap='exchange'>立即领取</view>
<!-- <view class='ac-date'>{{item.startTime}}至{{item.endTime}}</view> -->
</view>
</view>
</view>
......@@ -38,14 +38,12 @@
<view class='empty-wrap' wx:if="{{!integralCouponList.length}}">
<view class='empty-info'>
<image class='empty-img' src='/assets/imgs/empty-coupon.png' />
<view class='empty-text'>没有任何劵活动</view>
<view class='empty-text'>没有任何劵活动</view>
</view>
</view>
</view>
</view>
<!-- 库存没了 -->
<dialog-stock-empty show="{{dialogStockEmpty}}"/>
<dialog-user-limit show="{{dialogUserLimit}}"/>
<go-guid />
<go-home/>
......
......@@ -103,6 +103,11 @@ page {
}
.ac-date{
font-size: 22rpx;
color: #999999;
}
.text-align-left{
text-align: left !important;
}
......
......@@ -6,14 +6,17 @@ wxService.page({
* 页面的初始数据
*/
data: {
activityId : null,
activityInfo : {}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let id = options.id;
this.data.activityId = id;
this.getACtivityInfo();
},
/**
......@@ -23,10 +26,58 @@ wxService.page({
},
//获取活动详情
getACtivityInfo(){
wxService.post(`/coupon/couponCenterActivity/buyer/getDetail?id=${this.data.activityId}`).then(res => {
if(res){
let obj = res.data.data ? res.data.data : null;
if (obj){
console.log(obj)
let arr = obj.definition ? JSON.parse(obj.definition) : [];
obj.desc = arr.filter(item => item.type == 2);
obj.hasExpDate = arr.filter(item => item.type == 1).length > 0 ;
this.data.activityInfo = obj;
this.setData({
activityInfo: this.data.activityInfo
});
}
}
})
},
//领取优惠券
onTapGetCoupon(){
wx.showLoading({
title: '领取中..',
});
let id = this.data.activityId;
wxService.post(`/coupon/couponCenterActivity/buyer/coupon/draw?id=${id}`).then(res => {
wx.hideLoading();
if (res) {
if (res.data.result == 0) {
wx.showToast({
title: '领取成功',
});
}
else {
wx.showToast({
title: '领取失败,请稍后再试',
icon: 'none'
});
}
}
});
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
let url = this.data.activityInfo.listPicture ? this.data.activityInfo.listPicture : 'https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/icon_get_coupon.png';
return {
title: `我分享给你一张“${this.data.activityInfo.couponName}”的优惠券,赶快领取吧~`,
path: `/subPackage/page/pages/couponCenterInfo/couponCenterInfo?id=${this.data.activityId}`,
imageUrl: url, // 可以更换分享的图片
}
}
})
\ No newline at end of file
......@@ -2,34 +2,38 @@
<view class="coupon-info-con">
<view class="coupon-info-bg" style="background-image:url('https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/coupon-bg.png')">
<view class="lf-coupon-Bg">
<image mode="aspectFit" src="https://img3.bigaka.com/test/1002/202003/20200302/100268e4d2cc-f33a-42a3-8ff8-2d4ff5d9c958.png"></image>
<image wx:if="{{activityInfo.listPicture}}" mode="aspectFit" src="{{activityInfo.listPicture}}"></image>
<image wx:else src='https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/icon_get_coupon.png' />
</view>
<view class="rg-coupon-info">
<view class="coupon-title">阿吉豆测试-满折</view>
<view class="coupon-date">有效期:2020-03-02 至 2020-04-01</view>
<view class="coupon-price theme-text-color">抵用券 50元</view>
<view class="coupon-title">{{activityInfo.couponName}}</view>
<view class="coupon-date">{{activityInfo.startTime}} 至 {{activityInfo.endTime}}</view>
<view class="coupon-price theme-text-color">
{{activityInfo.couponInfoDTO.couponSetting.typeDesc}} {{activityInfo.couponInfoDTO.couponSetting.faceAmountDesc}}
</view>
</view>
</view>
<!-- 活动说明 -->
<view class='integral-detail'>
<view class='integral-detail' wx:if="{{activityInfo.hasExpDate}}">
<view class='integral-list'>
<text class='integral-title'>活动标题</text>
<text class='integral-desc wpl'>这个是活动的说明信息</text>
<text class='integral-title'>有效时间</text>
<text class='integral-desc wpl'>{{activityInfo.startTime}}至{{activityInfo.endTime}}</text>
</view>
<view class='integral-list'>
<text class='integral-title'>活动时间</text>
<text class='integral-desc wpl'>这个活动时间活动时间活动时间</text>
</view>
<view class='integral-detail' style="margin-top:20rpx;" wx:if="{{activityInfo.desc.length > 0}}">
<view class='integral-list' wx:for="{{activityInfo.desc}}" wx:key="*this">
<text class='integral-title'>{{item.label}}</text>
<text class='integral-desc wpl'>{{item.value}}</text>
</view>
</view>
<!-- 按钮 -->
<view class="get-btn positionRe">
<button wx:if="{{!currentHasUserInfo}}"
bindgetuserinfo="_getUserInfo"
open-type='getUserInfo'
class="clear-btn positionAbs">立即领取</button>
<view wx:else class="view-btn">立即领取</view>
<view wx:else class="view-btn" bindtap="onTapGetCoupon">立即领取</view>
</view>
</view>
......@@ -58,29 +58,47 @@ view{
}
.coupon-date{
font-size: 24rpx;
font-size: 22rpx;
color: #999999;
margin-bottom: 5rpx;
}
.exp-intro{
margin-top: 60rpx;
}
.exp-intro .exp-intro-item{
display: flex;
font-size: 28rpx;
color: #333333;
}
.exp-intro .exp-intro-item .intro-title{
flex: 0;
min-width: 100rpx;
max-width: 100rpx;
}
.exp-intro .exp-intro-item .intro-desc{
flex: 1;
color: #999999;
}
.integral-detail{
margin-top: 60rpx;
}
.integral-list{
margin-bottom: 20rpx;
font-size: 28rpx;
font-size: 24rpx;
color: #999999;
}
.integral-title{
font-size: 24rpx;
color: #333333;
margin-right: 8rpx;
}
.integral-desc{
color: #999999;
}
.integral-title,.integral-desc{
display: inline-block;
}
......
......@@ -19,10 +19,19 @@ function currentLinkRouter(event, _this) {
});
} else if (curItemType.link.type == 3) {
// 预览
if (currentClickType.imageUrl.indexOf('http') > -1){
wx.previewImage({
current: `${currentClickType.imageUrl}`, // 当前显示图片的http链接
urls: [`${currentClickType.link.url}`] // 需要预览的图片http链接列表
})
}
else{
wx.previewImage({
current: `${app.globalData.imageUrl}/${currentClickType.imageUrl}`, // 当前显示图片的http链接
urls: [`${app.globalData.imageUrl}/${currentClickType.link.url}`] // 需要预览的图片http链接列表
})
}
} else if (curItemType.link.type == 4) {
if( currentClickType === '/pages/userCenter/userCenter') {
wxService.router(`${currentClickType}`).replace() // 是首页重定向
......
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