Commit 1555f235 by 程南

样式修改

parent 416941cc
...@@ -13,183 +13,213 @@ const envInfo = require('config/index').envInfo ...@@ -13,183 +13,213 @@ const envInfo = require('config/index').envInfo
let isPlusVip = false let isPlusVip = false
App({ App({
onLaunch: function (e) { onLaunch: function (e) {
// console.log('onLaunch---',e); // console.log('onLaunch---',e);
// "navigationStyle": "custom" // "navigationStyle": "custom"
// 默认 false // 默认 false
wx.setStorageSync('reLoginErr', false) wx.setStorageSync('reLoginErr', false)
try { try {
this.isFromQiyeConsoleIn(this.options); this.isFromQiyeConsoleIn(this.options);
let res = wx.getSystemInfoSync(); // 获取当前运行环境 let res = wx.getSystemInfoSync(); // 获取当前运行环境
config.pixelRate = res.windowWidth / 750; config.pixelRate = res.windowWidth / 750;
config.platform = res.platform; config.platform = res.platform;
config.statusBarHeight = res.statusBarHeight; config.statusBarHeight = res.statusBarHeight;
const qyWeChat = res && res.environment || '' // 在企业微信固定返回wxwork,在微信不返回该字段,开发者可此判断当前是否在企业微信运行 const qyWeChat = res && res.environment || '' // 在企业微信固定返回wxwork,在微信不返回该字段,开发者可此判断当前是否在企业微信运行
wx.setStorageSync('_qyWeChat', qyWeChat) wx.setStorageSync('_qyWeChat', qyWeChat)
if (res.platform.toLowerCase() == 'devtools') { if (res.platform.toLowerCase() == 'devtools') {
config.capsuleHeight = 44; config.capsuleHeight = 44;
} }
if (res.platform.toLowerCase() == 'android') { if (res.platform.toLowerCase() == 'android') {
config.capsuleHeight = 48; config.capsuleHeight = 48;
} }
config.titleHeight = (config.capsuleHeight + config.statusBarHeight) / config.pixelRate; config.titleHeight = (config.capsuleHeight + config.statusBarHeight) / config.pixelRate;
if (res.statusBarHeight >= 44) { if (res.statusBarHeight >= 44) {
config.isHighHead = true; config.isHighHead = true;
} }
if (res.windowHeight > 750) config.isAllScreen = true; if (res.windowHeight > 750) config.isAllScreen = true;
config.systemHeight = res.windowHeight; config.systemHeight = res.windowHeight;
} catch (e) { } catch (e) {
// console.log(err); // console.log(err);
} }
},
//检查新版本 // this.loginSilently();
checkForUpdate(){ },
const updateManager = wx.getUpdateManager()
loginSilently() {
updateManager.onCheckForUpdate(function (res) { var _this = this;
// 请求完新版本信息的回调 wx.login({
// console.log('请求完新版本信息的回调 ---',res.hasUpdate) success: (res) => {
}); wx.setStorageSync('_loginCode', res.code);
let params = {
updateManager.onUpdateReady(function () { code: res.code,
wx.showModal({ wechatInfo: null,
title: '更新提示', brandId: _this.globalData.brandId,
content: '已有小程序新版本,是否重启应用?', authType : 'userInfo'
success: function (res) { }
if (res.confirm) { wxService.post(`/member/minaLogin`, params).then(response => {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 if (response) {
updateManager.applyUpdate() console.log('*****************************')
} let dataResp = response.data.data
wx.setStorageSync('token', dataResp.token)
wx.setStorageSync('_baseUserInfo', dataResp);
wx.reLaunch({
url: '/pages/userCenter/userCenter'
});
}
}).catch(err => {})
},
fail: (res) => {}
})
},
//检查新版本
checkForUpdate() {
const updateManager = wx.getUpdateManager()
updateManager.onCheckForUpdate(function (res) {
// 请求完新版本信息的回调
// console.log('请求完新版本信息的回调 ---',res.hasUpdate)
});
updateManager.onUpdateReady(function () {
wx.showModal({
title: '更新提示',
content: '已有小程序新版本,是否重启应用?',
success: function (res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate()
}
}
})
})
updateManager.onUpdateFailed(function () {
// 新版本下载失败
})
},
//判断是不是从企业微信控制台点击进来的
isFromQiyeConsoleIn(options) {
options = options ? options : {};
// console.log('场景值1 ========', options.scene)
let scene = wx.getLaunchOptionsSync().scene;
// console.log('场景值2 ========', scene)
//判断是不是在企业微信中通过工作台打开的
if (options.scene == 1119 || scene == 1119) {
wx.redirectTo({
url: '/shoppingGuid/page/pages/welcomGuider/welcomGuider',
});
return;
}
},
onShow: function (options = {}) {
//检查是不是有更新
this.checkForUpdate();
// console.log('this.options----', this.options)
const baseUserInfo = wx.getStorageSync('_baseUserInfo')
// 获取当前会员是否是体验者
const { member } = baseUserInfo
const curMemberTrial = member && member.trial || false
wx.setStorageSync('isExperiencer', curMemberTrial)
// console.log('调用微信开卡组件回调参数---', options)
if (options.referrerInfo && options.referrerInfo.extraData != null && options.referrerInfo.extraData != undefined) {
const { activate_ticket, card_id, code, errCode, wx_activate_after_submit_url } = options.referrerInfo.extraData
let urlData = wx_activate_after_submit_url.split("?");
let url = urlData[0];
let parmas = urlData[1];
// encodeURIComponent
// decodeURIComponent
wxService.router(`${url}`).search({
activate_ticket: encodeURIComponent(activate_ticket),
card_id,
code,
errCode,
wx_activate_after_submit_url: parmas
});
// 激活成功 变更 _baseUserInfo
baseUserInfo.wechatCardId = card_id
baseUserInfo.wechatCode = code
wx.setStorageSync('_baseUserInfo', baseUserInfo)
}
// 711_授权字体
// wx.loadFontFace({
// family: 'iconfont-711',
// source: 'url("https://cdn-alyun.bigaka.com/group1/M00/00/01/Cv6CDl0nE9aAdG45AC7AStq8LfA180.TTF")',
// success: function (res) {
// console.log(res.status) // loaded
// },
// fail: function (res) {
// console.log(res.status) // error
// }
// })
},
onHide: function () {
this.globalData.loginFirst = false
},
getUserInfo() {
return new Promise((resolve, reject) => {
const _baseUserInfo = wx.getStorageSync('_baseUserInfo')
if (_baseUserInfo) {
resolve(_baseUserInfo)
} else {
reject('_baseUserInfo is null')
}
})
},
checkFullSucreen() {
const self = this
wxService.getSystemInfo().then(res => {
if ((res.screenHeight - res.windowHeight - res.statusBarHeight - 32) > 72) {
// 处理相关逻辑
self.globalData.isFullSucreen = true
// setGlobalData('fullScreen', true)
}
})
},
globalData: {
userInfo: null,
userBaseInfo: null, // openid
systemInfo: wx.getSystemInfoSync(),
ctx: envInfo.ctx,
openCard: false,
appId: envInfo.appId,
userNo: null,
storeId: '',
storeName: '',
loginFirst: false,
imageUrl: envInfo.imgCtx, //图片地址
isFullSucreen: false, // 当前设备是否为 FullSucreen
commonFunc: commonFunc,
contants: contants,
isPlusVip: isPlusVip,
cityJson: cityJson,
brandId: envInfo.brandId,
themeColor: envInfo.themeColor,//主题颜色
},
//跳转10级
navigateTo(routerObj) {
//参数object : {url : ''}
if (!routerObj) {
console.error('跳转页面需要路径');
return;
}
if (Object.keys(routerObj).length == 0) {
console.error('跳转页面需要路径');
return;
}
if (getCurrentPages().length > 9) {
wx.redirectTo(routerObj);
}
else {
wx.navigateTo(routerObj)
} }
}) },
})
updateManager.onUpdateFailed(function () {
// 新版本下载失败
})
},
//判断是不是从企业微信控制台点击进来的
isFromQiyeConsoleIn(options){
options = options ? options : {};
// console.log('场景值1 ========', options.scene)
let scene = wx.getLaunchOptionsSync().scene;
// console.log('场景值2 ========', scene)
//判断是不是在企业微信中通过工作台打开的
if (options.scene == 1119 || scene == 1119) {
wx.redirectTo({
url: '/shoppingGuid/page/pages/welcomGuider/welcomGuider',
});
return;
}
},
onShow: function (options = {}) {
//检查是不是有更新
this.checkForUpdate();
// console.log('this.options----', this.options)
const baseUserInfo = wx.getStorageSync('_baseUserInfo')
// 获取当前会员是否是体验者
const { member } = baseUserInfo
const curMemberTrial = member && member.trial || false
wx.setStorageSync('isExperiencer', curMemberTrial)
// console.log('调用微信开卡组件回调参数---', options)
if (options.referrerInfo && options.referrerInfo.extraData != null && options.referrerInfo.extraData != undefined){
const { activate_ticket, card_id, code, errCode, wx_activate_after_submit_url } = options.referrerInfo.extraData
let urlData = wx_activate_after_submit_url.split("?");
let url = urlData[0];
let parmas = urlData[1];
// encodeURIComponent
// decodeURIComponent
wxService.router(`${url}`).search({
activate_ticket: encodeURIComponent(activate_ticket),
card_id,
code,
errCode,
wx_activate_after_submit_url: parmas
});
// 激活成功 变更 _baseUserInfo
baseUserInfo.wechatCardId = card_id
baseUserInfo.wechatCode = code
wx.setStorageSync('_baseUserInfo',baseUserInfo)
}
// 711_授权字体
// wx.loadFontFace({
// family: 'iconfont-711',
// source: 'url("https://cdn-alyun.bigaka.com/group1/M00/00/01/Cv6CDl0nE9aAdG45AC7AStq8LfA180.TTF")',
// success: function (res) {
// console.log(res.status) // loaded
// },
// fail: function (res) {
// console.log(res.status) // error
// }
// })
},
onHide: function () {
this.globalData.loginFirst = false
},
getUserInfo() {
return new Promise((resolve, reject) => {
const _baseUserInfo = wx.getStorageSync('_baseUserInfo')
if (_baseUserInfo) {
resolve(_baseUserInfo)
} else {
reject('_baseUserInfo is null')
}
})
},
checkFullSucreen () {
const self = this
wxService.getSystemInfo().then(res => {
if ((res.screenHeight - res.windowHeight - res.statusBarHeight - 32) > 72) {
     // 处理相关逻辑
self.globalData.isFullSucreen = true
// setGlobalData('fullScreen', true)
}
})
},
globalData: {
userInfo: null,
userBaseInfo: null, // openid
systemInfo: wx.getSystemInfoSync(),
ctx: envInfo.ctx,
openCard: false,
appId: envInfo.appId,
userNo: null,
storeId: '',
storeName: '',
loginFirst: false,
imageUrl: envInfo.imgCtx, //图片地址
isFullSucreen: false, // 当前设备是否为 FullSucreen
commonFunc: commonFunc,
contants: contants,
isPlusVip: isPlusVip,
cityJson: cityJson,
brandId: envInfo.brandId,
themeColor: envInfo.themeColor,//主题颜色
},
//跳转10级
navigateTo(routerObj){
//参数object : {url : ''}
if(!routerObj){
console.error('跳转页面需要路径');
return ;
}
if(Object.keys(routerObj).length == 0){
console.error('跳转页面需要路径');
return ;
}
if(getCurrentPages().length > 9){
wx.redirectTo(routerObj);
}
else{
wx.navigateTo(routerObj)
}
},
}) })
...@@ -38,23 +38,44 @@ Component({ ...@@ -38,23 +38,44 @@ Component({
const { couponList } = this.data const { couponList } = this.data
if (couponList.length) { if (couponList.length) {
couponList.map(coupon => { couponList.map(coupon => {
coupon.couponDTOS.forEach(item => { //处理coupon.couponDTOS有的时候
item.checked = false if(coupon.couponDTOS){
couponList[0].couponDTOS[0] ? couponList[0].couponDTOS[0].checked = true : item[0].checked = true coupon.couponDTOS.forEach(item => {
item.couponDiscount = coupon.couponDiscount item.checked = false
item.title = coupon.couponSettingDTO.title couponList[0].couponDTOS[0] ? couponList[0].couponDTOS[0].checked = true : item[0].checked = true
item.type = coupon.couponSettingDTO.type item.couponDiscount = coupon.couponDiscount
item.faceAmount = coupon.couponSettingDTO.faceAmount item.title = coupon.couponSettingDTO.title
item.takeCouponBgimg = coupon.couponSettingDetailDTO.style.takeCouponBgimg item.type = coupon.couponSettingDTO.type
// notice 格式 item.faceAmount = coupon.couponSettingDTO.faceAmount
item.newNotice = item && item.notice ? JSON.parse(item.notice) : '' item.takeCouponBgimg = coupon.couponSettingDetailDTO.style.takeCouponBgimg
for (let i in item.newNotice) { // notice 格式
if (item.newNotice[i].type == 1) { item.newNotice = item && item.notice ? JSON.parse(item.notice) : ''
item.newNotice[i].value = item.startTime.substring(0, 10) + ' 至 ' + item.endTime.substring(0, 10) for (let i in item.newNotice) {
if (item.newNotice[i].type == 1) {
item.newNotice[i].value = item.startTime.substring(0, 10) + ' 至 ' + item.endTime.substring(0, 10)
}
}
});
}
else{
coupon.couponDTOS = [];
coupon.newNotice = coupon.notice ? JSON.parse(coupon.notice) : ''
for (let i in coupon.newNotice) {
if (coupon.newNotice[i].type == 1) {
coupon.newNotice[i].value = coupon.startTime.substring(0, 10) + ' 至 ' + coupon.endTime.substring(0, 10)
} }
} }
}) let obj = {
}) id : coupon.cardNo,
checked : false,
couponDiscount : coupon.couponDiscount,
title : coupon.title,
takeCouponBgimg :coupon.takeCouponBgimg,
newNotice : coupon.newNotice,
}
coupon.couponDTOS = [obj];
}
});
wxService.nextTick(() => { wxService.nextTick(() => {
this.setData({ this.setData({
......
...@@ -53,6 +53,7 @@ wxService.page({ ...@@ -53,6 +53,7 @@ wxService.page({
}, },
orderStoreInfo: null, orderStoreInfo: null,
couponDiscountPreviews: [], couponDiscountPreviews: [],
coouponDiscount : 0,
//积分抵扣 //积分抵扣
pointDeductOpen : true,//是否开启积分抵扣 pointDeductOpen : true,//是否开启积分抵扣
deductCheckStatus : false,//是否勾选使用积分抵扣 deductCheckStatus : false,//是否勾选使用积分抵扣
...@@ -65,6 +66,11 @@ wxService.page({ ...@@ -65,6 +66,11 @@ wxService.page({
point : 0, point : 0,
pointAmount : 0 pointAmount : 0
}, },
//包邮券列表
postalCouponList : [],
currentPostalCoupon : null,
showSelectPostalCoupon : false,
}, },
//获取积分抵扣配置信息 //获取积分抵扣配置信息
...@@ -87,6 +93,26 @@ wxService.page({ ...@@ -87,6 +93,26 @@ wxService.page({
} }
}); });
}, },
//获取我的包邮券列表
getMyPostalCouponList(){
let params = {};
params.status = 1;
params.couponType = 2;
this.data.postalCouponList = [];
wxService.post(`/coupon/coupon/listWithMember4Mina?number=1&size=1000000`, params).then(res => {
if(!res) return false
const {result,data} = res.data
if(result == 0){
let list = data.content ? data.content : [];
this.data.postalCouponList = list;
this.setData({
postalCouponList : this.data.postalCouponList
});
}
});
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
...@@ -202,6 +228,7 @@ wxService.page({ ...@@ -202,6 +228,7 @@ wxService.page({
//获取备注信息 //获取备注信息
this.getLocalRemarkInfo(); this.getLocalRemarkInfo();
this.getMyPostalCouponList();
}, },
//获取备注信息 //获取备注信息
...@@ -363,6 +390,49 @@ wxService.page({ ...@@ -363,6 +390,49 @@ wxService.page({
// 实付款 // 实付款
this.setPayPrice(); this.setPayPrice();
}, },
//选择完包邮券
updatePostalCoupon(e){
if (!e.detail) {
this.setData({
currentPostalCoupon : null,
},() => {
this.reCallPreview();
});
}
else {
let detail = e.detail;
this.getCouponInfo(detail.id);
}
},
//获取优惠券详情
getCouponInfo(id){
wxService.post(`/coupon/coupon/get?cardNo=${id}`).then(res => {
const {result,data} = res.data
if(result == 0){
data.faceAmount = data.couponSetting.faceAmount;
data.postalDiscountPrice = '0.00';
data.couponSettingId = data.couponSetting.couponSettingId;
this.data.currentPostalCoupon = data;
}else{
this.data.currentPostalCoupon = null;
}
this.setData({
currentPostalCoupon : this.data.currentPostalCoupon,
} , () => {
//计算一下价格
this.reCallPreview();
});
});
},
//选择包邮券
onTapSelectPostalCoupon(){
this.setData({
showSelectPostalCoupon : true,
});
},
//计算显示订单价格 //计算显示订单价格
setPayPrice() { setPayPrice() {
const { const {
...@@ -370,25 +440,46 @@ wxService.page({ ...@@ -370,25 +440,46 @@ wxService.page({
orderInitPrice, orderInitPrice,
isSelect, isSelect,
plusMemberPrice, plusMemberPrice,
defalutCoupon defalutCoupon,
coouponDiscount
} = this.data; } = this.data;
let newCurrentCoupon = currentCoupon ? currentCoupon : 0 let newCurrentCoupon = currentCoupon ? currentCoupon : 0
let orderCoupon = parseFloat(newCurrentCoupon) // 优惠券价格 let orderCoupon = parseFloat(newCurrentCoupon) // 优惠券价格
let plusPrice = isSelect ? plusMemberPrice : 0 // plus let plusPrice = isSelect ? plusMemberPrice : 0 // plus
let calCouponPrice = orderCoupon ? orderCoupon : defalutCoupon let calCouponPrice = orderCoupon ? orderCoupon : defalutCoupon;
//获取包邮券信息
let postalCouponInfo = this.data.currentPostalCoupon;
let freight = this.data.currentOrderList.freight;
let postalDiscountPrice = 0;
if(postalCouponInfo){
//计算包邮券后运费
if(parseInt(freight*100) > postalCouponInfo.faceAmount){
postalDiscountPrice = parseFloat(postalCouponInfo.faceAmount/10/10).toFixed(2);
// postalCouponInfo.postalDiscountPrice = parseFloat(postalCouponInfo.faceAmount/10/10).toFixed(2);
}
else {
postalDiscountPrice = freight;
}
}
//获取计算优惠后的价格 //获取计算优惠后的价格
let promotionPrice = (orderInitPrice - calCouponPrice) > 0 ? (orderInitPrice - calCouponPrice) : 0; let promotionPrice = (orderInitPrice - coouponDiscount) > 0 ? (orderInitPrice - coouponDiscount) : 0;
//看一下积分是否勾选了 //看一下积分是否勾选了
if(this.data.deductCheckStatus){ if(this.data.deductCheckStatus){
promotionPrice = promotionPrice*1 - this.data.pointDeductMoney*1; promotionPrice = promotionPrice*1 - this.data.pointDeductMoney*1;
} }
//看一下是否使用了包邮券
if(this.data.currentPostalCoupon){
promotionPrice = promotionPrice*1 - postalDiscountPrice*1;
postalCouponInfo.postalDiscountPrice = postalDiscountPrice;
}
// 实际价格 - 优惠价 + plus // 实际价格 - 优惠价 + plus
this.setData({ this.setData({
// orderPrice: Math.round(orderInitPrice - orderCoupon) orderPrice: promotionPrice + plusPrice,
// orderPrice: orderInitPrice - orderCoupon + plusPrice currentPostalCoupon : postalCouponInfo,
orderPrice: promotionPrice + plusPrice
}) })
}, },
//提交按钮 //提交按钮
...@@ -731,6 +822,7 @@ wxService.page({ ...@@ -731,6 +822,7 @@ wxService.page({
} }
this.data.pointPayInfo = data.pointPayInfo; this.data.pointPayInfo = data.pointPayInfo;
this.data.coouponDiscount = data.coouponDiscount;
//如果没有couponId则认为是第一次进来没有自己选择优惠券 //如果没有couponId则认为是第一次进来没有自己选择优惠券
if (!this.data.couponId) { if (!this.data.couponId) {
...@@ -761,7 +853,8 @@ wxService.page({ ...@@ -761,7 +853,8 @@ wxService.page({
totalGoodsPrice: this.data.totalGoodsPrice, totalGoodsPrice: this.data.totalGoodsPrice,
avaliablePoint : this.data.avaliablePoint, avaliablePoint : this.data.avaliablePoint,
pointDeductMoney : this.data.pointDeductMoney, pointDeductMoney : this.data.pointDeductMoney,
deductCheckStatus : this.data.deductCheckStatus deductCheckStatus : this.data.deductCheckStatus,
coouponDiscount : this.data.coouponDiscount,
}, () => { }, () => {
// 实付款 // 实付款
this.setPayPrice() this.setPayPrice()
...@@ -775,7 +868,8 @@ wxService.page({ ...@@ -775,7 +868,8 @@ wxService.page({
totalGoodsPrice: this.data.totalGoodsPrice, totalGoodsPrice: this.data.totalGoodsPrice,
avaliablePoint : this.data.avaliablePoint, avaliablePoint : this.data.avaliablePoint,
pointDeductMoney : this.data.pointDeductMoney, pointDeductMoney : this.data.pointDeductMoney,
deductCheckStatus : this.data.deductCheckStatus deductCheckStatus : this.data.deductCheckStatus,
coouponDiscount : this.data.coouponDiscount,
}, () => { }, () => {
// 实付款 // 实付款
this.setPayPrice() this.setPayPrice()
...@@ -792,7 +886,8 @@ wxService.page({ ...@@ -792,7 +886,8 @@ wxService.page({
totalGoodsPrice: this.data.totalGoodsPrice, totalGoodsPrice: this.data.totalGoodsPrice,
avaliablePoint : this.data.avaliablePoint, avaliablePoint : this.data.avaliablePoint,
pointDeductMoney : this.data.pointDeductMoney, pointDeductMoney : this.data.pointDeductMoney,
deductCheckStatus : this.data.deductCheckStatus deductCheckStatus : this.data.deductCheckStatus,
coouponDiscount : this.data.coouponDiscount,
}, () => { }, () => {
// 实付款 // 实付款
this.setPayPrice() this.setPayPrice()
...@@ -921,14 +1016,17 @@ wxService.page({ ...@@ -921,14 +1016,17 @@ wxService.page({
}, },
//下单 //下单
order(isSelect, params) { order(isSelect, params) {
if (this.data.orderStoreInfo) { if(params.orderType == 1){
if (this.data.orderStoreInfo.storeId) { if (this.data.orderStoreInfo) {
params.storeId = this.data.orderStoreInfo.storeId; if (this.data.orderStoreInfo.storeId) {
} params.storeId = this.data.orderStoreInfo.storeId;
if (this.data.orderStoreInfo.storeInfo) { }
params.storeInfo = this.data.orderStoreInfo.storeInfo; if (this.data.orderStoreInfo.storeInfo) {
params.storeInfo = this.data.orderStoreInfo.storeInfo;
}
} }
} }
//处理积分抵扣 //处理积分抵扣
if(this.data.deductCheckStatus){ if(this.data.deductCheckStatus){
params.pointPayInfo = this.data.pointPayInfo; params.pointPayInfo = this.data.pointPayInfo;
...@@ -940,6 +1038,11 @@ wxService.page({ ...@@ -940,6 +1038,11 @@ wxService.page({
} }
} }
//处理包邮券信息
if(this.data.currentPostalCoupon){
params.postCouponSettingId = this.data.currentPostalCoupon.couponSettingId;
}
let _this = this; let _this = this;
let url = isSelect ? '/sale/payment/merged/buyer/bill' : '/sale/trade/buyer/bill' let url = isSelect ? '/sale/payment/merged/buyer/bill' : '/sale/trade/buyer/bill'
wxService.post(`${url}`, params).then(res => { wxService.post(`${url}`, params).then(res => {
......
...@@ -163,12 +163,26 @@ ...@@ -163,12 +163,26 @@
<view bindtap="selectCoupon"> <view bindtap="selectCoupon">
<text class="price-label">优惠券</text> <text class="price-label">优惠券</text>
<view class="select-coupon"> <view class="select-coupon">
<text class="{{defalutCoupon ? 'coupon-price' : 'no-coupon'}}">{{defalutCoupon ? (currentCoupon ? '-' + currentCoupon : '-' + defalutCoupon): (currentOrderList.couponDiscountPreviews.length == 0 ? '无可使用优惠券' : '选择优惠券')}}</text> <!-- coouponDiscount -->
<text class="{{defalutCoupon ? 'coupon-price' : 'no-coupon'}}">{{
currentOrderList.couponDiscountPreviews.length == 0 ? '无可使用优惠券' : (
coouponDiscount ? '-' + coouponDiscount : '选择优惠券'
)}}</text>
<image class="arrow-right" src="/assets/imgs/7_1_0/arrow-right.png" /> <image class="arrow-right" src="/assets/imgs/7_1_0/arrow-right.png" />
</view> </view>
</view> </view>
</view> </view>
<!-- 包邮券 -->
<view class="postal-coupon" bindtap="onTapSelectPostalCoupon" wxLif="{{currentOrderList.freight > 0}}">
<text class="price-label">包邮券</text>
<view class="postal-info" >
<text class="{{currentPostalCoupon ? 'show-price' : ''}}">{{postalCouponList.length == 0 ? '无可用包邮券' : (
currentPostalCoupon ? '-' + currentPostalCoupon.postalDiscountPrice : '选择包邮券'
)}}</text>
<image class="arrow-right" mode="aspectFit" src="/assets/imgs/7_1_0/arrow-right.png" />
</view>
</view>
<!-- 运费 -->
<view class="coupon"> <view class="coupon">
<view> <view>
<text class="price-label">运费</text> <text class="price-label">运费</text>
...@@ -177,6 +191,7 @@ ...@@ -177,6 +191,7 @@
</view> </view>
</view> </view>
</view> </view>
<!-- 积分 -->
<view class="coupon" wx:if="{{isSelect}}"> <view class="coupon" wx:if="{{isSelect}}">
<view> <view>
<text class="price-label">{{plusMemberName}}</text> <text class="price-label">{{plusMemberName}}</text>
...@@ -251,5 +266,7 @@ ...@@ -251,5 +266,7 @@
<!-- <go-home/> --> <!-- <go-home/> -->
<!-- <floatNav bind:getAuth="_getUserInfo" bind:updatePage="updatePage" /> --> <!-- <floatNav bind:getAuth="_getUserInfo" bind:updatePage="updatePage" /> -->
<select-coupon show="{{showSelectCoupon}}" bind:updateCoupon="updateCoupon" coupon-list="{{couponDiscountPreviews}}" /> <select-coupon show="{{showSelectCoupon}}" bind:updateCoupon="updateCoupon" coupon-list="{{couponDiscountPreviews}}" />
<!-- 选择包邮券 -->
<select-coupon show="{{showSelectPostalCoupon}}" bind:updateCoupon="updatePostalCoupon" coupon-list="{{postalCouponList}}" />
<!-- 积分抵扣规则 --> <!-- 积分抵扣规则 -->
<point-deduct-rule showDialog="{{pointDeductRuleShow}}" ruleImg="{{pointDeductRuleUrl}}"/> <point-deduct-rule showDialog="{{pointDeductRuleShow}}" ruleImg="{{pointDeductRuleUrl}}"/>
\ No newline at end of file
...@@ -542,4 +542,30 @@ ...@@ -542,4 +542,30 @@
width: 26rpx; width: 26rpx;
height: 26rpx; height: 26rpx;
margin-right: 10rpx; margin-right: 10rpx;
}
.postal-coupon{
display: flex;
align-items: center;
justify-content: space-between;
padding: 24rpx 20rpx;
border-bottom: 1px solid rgba(151, 151, 151, 0.3);
}
.postal-coupon .postal-info{
display: flex;
align-items: center;
justify-content: flex-end;
font-size: 22rpx;
color: #999999;
}
.postal-coupon .postal-info .show-price{
color: #cb3c3c !important;
}
.postal-coupon .postal-info image{
width: 13rpx;
height: 21rpx;
margin-left: 8rpx;
} }
\ No newline at end of file
...@@ -11,7 +11,8 @@ wxService.page({ ...@@ -11,7 +11,8 @@ wxService.page({
data: { data: {
couponDetail:{}, couponDetail:{},
cardno: '', cardno: '',
couponType : '', couponType : 'default',
payCouponInfo : {},
}, },
/** /**
...@@ -20,18 +21,22 @@ wxService.page({ ...@@ -20,18 +21,22 @@ wxService.page({
onShow () { onShow () {
}, },
onLoad(options) { onLoad(options) {
wx.hideShareMenu(); wx.hideShareMenu();
const {cardno,type} = options const {cardno,type} = options
this.data.couponType = type; this.data.couponType = type ? type : 'coupon';
this.getCouponDetail(cardno,type) this.getCouponDetail(cardno,type)
this.setData({ this.setData({
cardno : cardno, cardno : cardno,
couponType : type, couponType : this.data.couponType,
}); });
}, },
//页面卸载
onUnload(){
wx.removeStorageSync('payCoupon');
},
// 卡券详情 // 卡券详情
getCouponDetail(id,type){ getCouponDetail(id,type){
wx.showLoading({ wx.showLoading({
...@@ -52,11 +57,19 @@ wxService.page({ ...@@ -52,11 +57,19 @@ wxService.page({
}, },
//获取支付券详情 //获取支付券详情
getPayCardInfo(id){ getPayCardInfo(id){
let payCouponInfo = wx.getStorageSync('payCoupon');
if(payCouponInfo){
this.data.payCouponInfo = payCouponInfo;
let notice = payCouponInfo.detailInfo.detailInfo ? JSON.parse(payCouponInfo.detailInfo.detailInfo): [];
payCouponInfo.notice = notice;
this.setData({
payCouponInfo : this.data.payCouponInfo
});
}
}, },
//获取包邮券详情 //获取包邮券详情
getPostalVoucherInfo(id){ getPostalVoucherInfo(id){
this.getNormalCouponInfo(id);
}, },
//获取优惠券相信 //获取优惠券相信
getNormalCouponInfo(id){ getNormalCouponInfo(id){
...@@ -66,19 +79,22 @@ wxService.page({ ...@@ -66,19 +79,22 @@ wxService.page({
wx.hideLoading() wx.hideLoading()
data.coupon.startTime = data.coupon.startTime.substring(0,10) data.coupon.startTime = data.coupon.startTime.substring(0,10)
data.coupon.endTime = data.coupon.endTime.substring(0,10) data.coupon.endTime = data.coupon.endTime.substring(0,10)
data.couponSetting.notice = JSON.parse(data.couponSetting.notice) data.coupon_name = data.couponSetting.title;
data.couponSetting.notice = JSON.parse(data.couponSetting.notice);
data.indexImgUrl = data.couponDetail.style.takeCouponBgimg;
for (let i in data.couponSetting.notice){ for (let i in data.couponSetting.notice){
if (data.couponSetting.notice[i].type == 1){ if (data.couponSetting.notice[i].type == 1){
data.couponSetting.notice[i].value = data.coupon.startTime.substring(0, 10) + ' 至 ' + data.coupon.endTime.substring(0, 10) data.couponSetting.notice[i].value = data.coupon.startTime.substring(0, 10) + ' 至 ' + data.coupon.endTime.substring(0, 10)
} }
} }
this.setData({
couponDetail: data this.setData({
}) couponDetail: data
});
} }
}).finally(() => { }).finally(() => {
wx.hideLoading() wx.hideLoading()
}) });
}, },
//展示券码 //展示券码
......
<!--pages/couponDetail/couponDetail.wxml--> <!--pages/couponDetail/couponDetail.wxml-->
<view class='page-integral-detail'> <!-- 普通优惠券 -->
<view class='page-integral-detail' wx:if="{{couponType == 'coupon'}}">
<view class='coupon-wrap'> <view class='coupon-wrap'>
<view class='coupon-list'> <view class='coupon-list'>
<image class='coupon-bg' <image class='coupon-bg'
...@@ -12,9 +13,7 @@ ...@@ -12,9 +13,7 @@
<view class='coupon-name fs-28'>{{couponDetail.couponSetting.title}}</view> <view class='coupon-name fs-28'>{{couponDetail.couponSetting.title}}</view>
<view class='coupon-desc fs-28'>{{couponDetail.coupon.startTime}} 至 {{couponDetail.coupon.endTime}}</view> <view class='coupon-desc fs-28'>{{couponDetail.coupon.startTime}} 至 {{couponDetail.coupon.endTime}}</view>
</view> </view>
<view class='coupon-code fs-24' bindtap="handelPresentCouponCode" wx:if="{{!couponType}}">出示券码</view> <view class='coupon-code fs-24' bindtap="handelPresentCouponCode">出示券码</view>
<view class='coupon-code fs-24' wx:if="{{couponType == 1}}">支付券</view>
<view class='coupon-code fs-24' wx:if="{{couponType == 2}}">包邮券</view>
</view> </view>
<view class='integral-detail'> <view class='integral-detail'>
<!-- <view class='integral-list'> <!-- <view class='integral-list'>
...@@ -29,10 +28,61 @@ ...@@ -29,10 +28,61 @@
<!--<button type='primary' class="redeem-now" bindtap="handelPresentCouponCode">出示券码</button>--> <!--<button type='primary' class="redeem-now" bindtap="handelPresentCouponCode">出示券码</button>-->
</view> </view>
</view> </view>
<!-- 支付券 -->
<view class='page-integral-detail' wx:if="{{couponType == 1}}">
<view class='coupon-wrap'>
<view class='coupon-list'>
<image class='coupon-bg'
src='https://img3.bigaka.com/prd/3001/202003/20200309/300109875abd-15b0-4de3-9673-18d2d1ee4e20.png' />
<view class='coupon-img'>
<image wx:if="{{payCouponInfo.indexImgUrl}}" src='{{payCouponInfo.indexImgUrl}}' mode="aspectFit"/>
<image wx:else src='https://img3.bigaka.com/prd/3001/202003/20200309/30018086c13a-4579-47ed-a16e-c74cb8010c1d.png' />
</view>
<view class='coupon-info'>
<view class='coupon-name fs-28'>{{payCouponInfo.coupon_name}}</view>
<view class='coupon-desc fs-28'>{{payCouponInfo.startTime}} 至 {{payCouponInfo.endTime}}</view>
</view>
<view class='coupon-code fs-24'>支付券</view>
</view>
<view class='integral-detail'>
<view class='integral-list' wx:for="{{payCouponInfo.notice}}" wx:key="*this">
<text class='integral-title'>{{item.label}}</text>
<text class='integral-desc wpl'>{{item.value}}</text>
</view>
</view>
</view>
</view>
<!-- 包邮券 -->
<view class='page-integral-detail' wx:if="{{couponType == 2}}">
<view class='coupon-wrap'>
<view class='coupon-list'>
<image class='coupon-bg'
src='https://img3.bigaka.com/prd/3001/202003/20200309/300109875abd-15b0-4de3-9673-18d2d1ee4e20.png' />
<view class='coupon-img'>
<image wx:if="{{couponDetail.indexImgUrl}}" src='{{couponDetail.indexImgUrl}}' mode="aspectFit"/>
<image wx:else src='https://img3.bigaka.com/prd/3001/202003/20200309/30018086c13a-4579-47ed-a16e-c74cb8010c1d.png' />
</view>
<view class='coupon-info'>
<view class='coupon-name fs-28'>{{couponDetail.couponSetting.title}}</view>
<view class='coupon-desc fs-28'>{{couponDetail.coupon.startTime}} 至 {{couponDetail.coupon.endTime}}</view>
</view>
<view class='coupon-code fs-24'>包邮券</view>
</view>
<view class='integral-detail'>
<view class='integral-list' wx:for="{{couponDetail.couponSetting.notice}}" wx:key="*this">
<text class='integral-title'>{{item.label}}</text>
<text class='integral-desc wpl'>{{item.value}}</text>
</view>
</view>
</view>
</view>
<!--goHome--> <!--goHome-->
<go-home/> <go-home/>
<floatNav bind:getAuth="_getUserInfo" bind:updatePage="updatePage"/> <floatNav bind:getAuth="_getUserInfo" bind:updatePage="updatePage"/>
<view class="position-bottom" wx:if="{{!couponType}}"> <view class="position-bottom" wx:if="{{couponType == 'coupon'}}">
<button type='primary' class="redeem-now" bindtap='handelPresentCouponCode'>出示券码</button> <button type='primary' class="redeem-now" bindtap='handelPresentCouponCode'>出示券码</button>
</view> </view>
......
...@@ -36,16 +36,16 @@ wxService.page({ ...@@ -36,16 +36,16 @@ wxService.page({
}); });
// 所有可使用优惠券 // 所有可使用优惠券
if( current == 0 ){ // if( current == 0 ){
this.getCouponList(1,10,1) // this.getCouponList(1,10,1)
}else if( current == 1){ // }else if( current == 1){
//微信支付券 // //微信支付券
// this.getPayCouponList();
} // }
else if(current == 2){ // else if(current == 2){
//包邮券 // //包邮券
// this.getPosCouponList();
} // }
} , } ,
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
...@@ -59,11 +59,16 @@ wxService.page({ ...@@ -59,11 +59,16 @@ wxService.page({
onShow () { onShow () {
// 可使用 已失效 // 可使用 已失效
this.getCouponList(1,10,1); this.getCouponList(1,10,1);
//获取支付券
this.getPayCouponList();
//获取包邮券
this.getPosCouponList();
}, },
//跳转到卡券详情 //跳转到卡券详情
handelPresentCouponDetail(e) { handelPresentCouponDetail(e) {
let {cardno,type} = e.currentTarget.dataset let {cardno,type,item} = e.currentTarget.dataset
if(type){ if(type){
wx.setStorageSync('payCoupon', item);
wxService.router(`/pages/couponDetail/couponDetail`).search({cardno:cardno,type:type}); wxService.router(`/pages/couponDetail/couponDetail`).search({cardno:cardno,type:type});
} }
else{ else{
...@@ -85,17 +90,16 @@ wxService.page({ ...@@ -85,17 +90,16 @@ wxService.page({
let params = {}; let params = {};
params.status = 1; params.status = 1;
params.couponType = 1;
this.data.couponList = []; this.data.couponList = [];
wxService.post(`/coupon/coupon/listWithMember4Mina?number=1&size=1000000`, params).then(res => { wxService.post(`/coupon/coupon/listWithMember4Mina?number=1&size=1000000`, params).then(res => {
if(!res) return false if(!res) return false
const {result,data} = res.data const {result,data} = res.data
if(result == 0){ if(result == 0){
console.log(res)
wx.hideLoading() wx.hideLoading()
// 处理时间显示 // 处理时间显示
if(!data.content) return false if(!data.content) return false
data.content.forEach(item=> { data.content.forEach(item=> {
item.startTime = item.startTime.substring(0,10) item.startTime = item.startTime.substring(0,10)
item.endTime = item.endTime.substring(0,10) item.endTime = item.endTime.substring(0,10)
...@@ -110,6 +114,51 @@ wxService.page({ ...@@ -110,6 +114,51 @@ wxService.page({
wx.hideLoading(); wx.hideLoading();
}) })
}, },
//获取包邮券
getPosCouponList(){
let params = {};
params.status = 1;
params.couponType = 2;
this.data.couponList = [];
wxService.post(`/coupon/coupon/listWithMember4Mina?number=1&size=1000000`, params).then(res => {
if(!res) return false
const {result,data} = res.data
if(result == 0){
wx.hideLoading()
// 处理时间显示
if(!data.content) return false
data.content.forEach(item=> {
item.startTime = item.startTime.substring(0,10)
item.endTime = item.endTime.substring(0,10)
});
this.setData({
postalVoucherList: data.content,
});
}
});
},
//获取支付券列表
getPayCouponList(){
wxService.get(`/coupon/wechatCoupon/queryCouponList`).then(res => {
if(res){
let list = res.data.data ? res.data.data.arr : [];
this.data.payCouponList = list;
list.forEach(item => {
let detailInfo = item.detailInfo ? item.detailInfo : null;
if(detailInfo){
item.indexImgUrl = detailInfo.indexImgUrl;
item.couponName = detailInfo.couponName;
}
});
this.setData({
payCouponList : this.data.payCouponList
});
}
})
},
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
......
...@@ -64,16 +64,17 @@ ...@@ -64,16 +64,17 @@
data-cardNo="{{item.cardNo}}" data-cardNo="{{item.cardNo}}"
data-id="{{item.couponId}}" data-id="{{item.couponId}}"
data-type="1" data-type="1"
data-item="{{item}}"
bindtap="handelPresentCouponDetail" bindtap="handelPresentCouponDetail"
> >
<image class='coupon-bg' <image class='coupon-bg'
src='https://img3.bigaka.com/prd/3001/202003/20200309/300109875abd-15b0-4de3-9673-18d2d1ee4e20.png' /> src='https://img3.bigaka.com/prd/3001/202003/20200309/300109875abd-15b0-4de3-9673-18d2d1ee4e20.png' />
<view class='coupon-img'> <view class='coupon-img'>
<image wx:if="{{item.takeCouponBgimg}}" class='coupon-bg' src='{{item.takeCouponBgimg}}' /> <image wx:if="{{item.indexImgUrl}}" class='coupon-bg' src='{{item.indexImgUrl}}' mode="aspectFit"/>
<image wx:else src='https://img3.bigaka.com/prd/3001/202003/20200309/30018086c13a-4579-47ed-a16e-c74cb8010c1d.png' /> <image wx:else src='https://img3.bigaka.com/prd/3001/202003/20200309/30018086c13a-4579-47ed-a16e-c74cb8010c1d.png' mode="aspectFit"/>
</view> </view>
<view class='coupon-info'> <view class='coupon-info'>
<view class='coupon-name fs-28'>{{item.title}}</view> <view class='coupon-name fs-28'>{{item.coupon_name}}</view>
<view class='coupon-time fs-24'>{{item.startTime}} 至 {{item.endTime}}</view> <view class='coupon-time fs-24'>{{item.startTime}} 至 {{item.endTime}}</view>
<!-- <view class='coupon-desc fs-24'>{{item.notice}}</view> --> <!-- <view class='coupon-desc fs-24'>{{item.notice}}</view> -->
</view> </view>
......
...@@ -22,8 +22,8 @@ scroll-view{ ...@@ -22,8 +22,8 @@ scroll-view{
color: #666666; color: #666666;
} }
.nav-active{ .nav-active{
color: var(--themecolor); color: #05c35b;
border-bottom: 3rpx solid var(--themecolor); border-bottom: 3rpx solid #05c35b;
} }
.empty-wrap{ .empty-wrap{
width: 300rpx; width: 300rpx;
...@@ -83,7 +83,7 @@ scroll-view{ ...@@ -83,7 +83,7 @@ scroll-view{
left: 236rpx; left: 236rpx;
} }
.coupon-name{ .coupon-name{
color:var(--themecolor); color:#05c35b;
} }
.coupon-time{ .coupon-time{
color:#999999; color:#999999;
...@@ -136,8 +136,8 @@ scroll-view{ ...@@ -136,8 +136,8 @@ scroll-view{
text-align: center; text-align: center;
} }
.active{ .active{
color: var(--themecolor); color: #05c35b;
border-bottom: 4rpx solid var(--themecolor); border-bottom: 4rpx solid #05c35b;
} }
swiper { swiper {
width: 100%; width: 100%;
...@@ -150,7 +150,7 @@ swiper { ...@@ -150,7 +150,7 @@ swiper {
} }
.coupon-buy-records{ .coupon-buy-records{
background: var(--themecolor); background: #05c35b;
width: 100%; width: 100%;
height: 80rpx; height: 80rpx;
color: #ffffff; color: #ffffff;
......
...@@ -659,6 +659,12 @@ ...@@ -659,6 +659,12 @@
"pathName": "subPackageA/page/pages/payCardInfo/payCardInfo", "pathName": "subPackageA/page/pages/payCardInfo/payCardInfo",
"query": "id= 704753070554353664", "query": "id= 704753070554353664",
"scene": null "scene": null
},
{
"id": -1,
"name": "领券中心",
"pathName": "subPackage/page/pages/couponCenter/couponCenter",
"scene": null
} }
] ]
} }
......
// subPackageA/page/pages/moneyBuyCoupon/moneyBugCoupon.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file
<!--subPackageA/page/pages/moneyBuyCoupon/moneyBugCoupon.wxml-->
<text>subPackageA/page/pages/moneyBuyCoupon/moneyBugCoupon.wxml</text>
/* subPackageA/page/pages/moneyBuyCoupon/moneyBugCoupon.wxss */
\ No newline at end of file
...@@ -12,6 +12,6 @@ ...@@ -12,6 +12,6 @@
</view> </view>
</view> </view>
<empty text="暂无超值卡活动~" wx:else/> <empty text="暂无现金购买活动~" wx:else/>
<view class='no-more' wx:if="{{cardList.length > 5}}">-- 我也是有底线滴 --</view> <view class='no-more' wx:if="{{cardList.length > 5}}">-- 我也是有底线滴 --</view>
\ No newline at end of file
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