Commit 6c8d519e by 赵雅纹

Merge branch 'dev_7.1.0' into fixbug-ZYW

parents b26877ef 0bb3098e
......@@ -8,7 +8,9 @@
padding: 200rpx 0;
box-sizing: border-box;
}
.wpl {
white-space:pre-line;
}
/* 主题色 */
.theme-color {
......
......@@ -25,7 +25,38 @@ Component({
attached() {
this.setData({
baseImgUrl: app.globalData.imageUrl
})
})
const { tabBar } = this.data
tabBar.forEach(item => {
// 存在 row 处理数据 8 商品 9 分类
let newRow = null
if (item.link) {
if(item.link.type == 2){
// 父组件 更新
const urls = getCurrentPages()
const currentPath = urls[0]
const pageId = item.link.url
console.log('currentPath', currentPath.route,item.link.url)
item.link.newPath = `/${currentPath.route}`
}
return
} else if (item.row) {
newRow = JSON.parse(item.row)
if (newRow.type == 8) {
newRow.newPath = '/pages/productDetail/productDetail'
} else if (newRow.type == 9) {
newRow.newPath = '/subPackage/page/pages/categoryPro/categoryPro'
} else {
newRow.newPath = ''
}
// item.row = JSON.stringify(newRow)
item.row = newRow
}
})
this.setData({ tabBar }, () => {
})
},
ready() {
this.setData({
......@@ -86,7 +117,8 @@ Component({
wxService.router(`${currentClickType}`)
}
} else if (curItemType.row) {
let rowObj = JSON.parse(curItemType.row)
// let rowObj = JSON.parse(curItemType.row)
let rowObj = curItemType.row
let currentClickRow = app.globalData.commonFunc.getLinkRow(rowObj.type, rowObj)
if (rowObj.type == 1) { }
......
......@@ -5,7 +5,8 @@
<block wx:for="{{tabBar.images}}" wx:key="{{index}}" wx:for-item="tab">
<view class="tab">
<!--当前页面需要授权 且未授权-->
<view wx:if="{{utils.hanlerLinkNeedAuth(tab.link.url)}}" class="btn-tab">
<!--<view wx:if="{{utils.hanlerLinkNeedAuth(tab.link.url)}}" class="btn-tab">-->
<view wx:if="{{tab.link ? utils.hanlerLinkNeedAuth(typeOf(tab.link.newPath) != undefined ? tab.link.newPath : tab.link.url) : utils.hanlerLinkNeedAuth(tab.row.newPath ? tab.row.newPath : tab.row.url)}}" class="btn-tab">
<view wx:if="{{!currentHasUserInfo}}" class="btn-tab">
<button
bindgetuserinfo="_getUserInfo"
......
......@@ -9,55 +9,86 @@ Component({
/**
* 组件的属性列表
*/
properties: {
currentHasUserInfo:{
type: Boolean,
type: false
},
picNav: {
type: Array,
value: [],
},
},
attached() {
this.setData({
baseImgUrl: app.globalData.imageUrl
})
},
properties: {
currentHasUserInfo: {
type: Boolean,
type: false
},
picNav: {
type: Array,
value: [],
},
},
attached() {
this.setData({
baseImgUrl: app.globalData.imageUrl
})
const { picNav } = this.data
picNav.forEach(item => {
// 存在 row 处理数据 8 商品 9 分类
let newRow = null
if (item.link) {
if(item.link.type == 2){
// 父组件 更新
const urls = getCurrentPages()
const currentPath = urls[0]
const pageId = item.link.url
console.log('currentPath', currentPath.route,item.link.url)
item.link.newPath = `/${currentPath.route}`
}
return
} else if (item.row) {
newRow = JSON.parse(item.row)
if (newRow.type == 8) {
newRow.newPath = '/pages/productDetail/productDetail'
} else if (newRow.type == 9) {
newRow.newPath = '/subPackage/page/pages/categoryPro/categoryPro'
} else {
newRow.newPath = ''
}
// item.row = JSON.stringify(newRow)
item.row = newRow
}
})
this.setData({ picNav }, () => {
})
},
/**
* 组件的初始数据
*/
data: {
imagewidth: 0,//缩放后的宽
imageheight: 0,//缩放后的高
isAuthorization: false,
isAuthorizationActiveText: '',
isAuthorizationType: 2,
baseImgUrl: ''
},
data: {
imagewidth: 0,//缩放后的宽
imageheight: 0,//缩放后的高
isAuthorization: false,
isAuthorizationActiveText: '',
isAuthorizationType: 2,
baseImgUrl: ''
},
/**
* 组件的方法列表
*/
methods: {
methods: {
_getUserInfo(res = {}) {
wxService.nextTick(() => {
this.triggerEvent('getAuth', res);
})
},
imageLoad(e) {
let imageSize = utils.imageUtil(e)
this.setData({
imagewidth: imageSize.imageWidth,
imageheight: imageSize.imageHeight
})
},
preview(event) {
const ev = event.currentTarget.dataset;
imageLoad(e) {
let imageSize = utils.imageUtil(e)
this.setData({
imagewidth: imageSize.imageWidth,
imageheight: imageSize.imageHeight
})
},
preview(event) {
const ev = event.currentTarget.dataset;
let curItemType = ev.item
// 获取当前帐号信息
// 获取当前帐号信息
const userInfo = wx.getStorageSync('_baseUserInfo')
// link row
// link row
if (curItemType.link) {
let currentClickType = app.globalData.commonFunc.getLink(curItemType.link.type, curItemType)
if (curItemType.link.type == 1) {
......@@ -85,10 +116,11 @@ Component({
wxService.router(`/${currentClickType}`)
} else if (curItemType.link.type == 7) {
// 集点详情
wxService.router(`${currentClickType}`)
wxService.router(`${currentClickType}`)
}
} else if (curItemType.row) {
let rowObj = JSON.parse(curItemType.row)
// let rowObj = JSON.parse(curItemType.row)
let rowObj = curItemType.row
let currentClickRow = app.globalData.commonFunc.getLinkRow(rowObj.type, rowObj)
if (rowObj.type == 1) { }
......@@ -102,16 +134,16 @@ Component({
// 商品
wxService.router(`/pages/productDetail/productDetail?id=${currentClickRow}`)
}
else if (rowObj.type == 9) {
else if (rowObj.type == 9) {
// 分类
wxService.router(`/subPackage/page/pages/categoryPro/categoryPro?${currentClickRow}`)
}
}
},
activeTocard(e) {
if (e.detail) {
wxService.openCard()
}
}
}
},
activeTocard(e) {
if (e.detail) {
wxService.openCard()
}
}
}
})
......@@ -7,29 +7,32 @@
wx:for-item="item"
class="nav-block"
>
<image
wx:if="{{currentHasUserInfo}}"
class="pic-img"
style="width: {{100}}%;height: {{100}}px;"
src="{{utils.formateUrl(item.imageUrl,baseImgUrl)}}"
data-appid="{{item.link.appid}}"
data-path="{{item.link.url}}"
data-link="{{item.link}}"
data-item="{{item}}"
bindload="imageLoad"
bindtap='preview'
/>
<!--当前页面需要授权 且未授权-->
<view wx:if="{{item.link ? utils.hanlerLinkNeedAuth(typeOf(item.link.newPath) != undefined ? item.link.newPath : item.link.url) : utils.hanlerLinkNeedAuth(item.row.newPath ? item.row.newPath : item.row.url)}}">
<button
wx:if="{{!currentHasUserInfo}}"
bindgetuserinfo="_getUserInfo"
data-jflag="false"
open-type='getUserInfo'
class='btn btn-primary btn-vip-code'
hover-class="btn-hover"
style="height:100%"
>
<image
class="pic-img"
style="width: {{100}}%;height: {{100}}px;"
src="{{utils.formateUrl(item.imageUrl,baseImgUrl)}}"
data-appid="{{item.link.appid}}"
data-path="{{item.link.url}}"
data-link="{{item.link}}"
data-item="{{item}}"
bindload="imageLoad"
bindtap='preview'
/>
</button>
<button
wx:if="{{!currentHasUserInfo}}"
bindgetuserinfo="_getUserInfo"
data-jflag="false"
open-type='getUserInfo'
class='btn btn-primary df'
hover-class="btn-hover"
style="height:100%"
>
<image
wx:if="{{currentHasUserInfo}}"
class="pic-img"
style="width: {{100}}%;height: {{100}}px;"
src="{{utils.formateUrl(item.imageUrl,baseImgUrl)}}"
......@@ -40,8 +43,20 @@
bindload="imageLoad"
bindtap='preview'
/>
</button>
</view>
<view wx:else>
<image
class="pic-img"
style="width: {{100}}%;height: {{100}}px;"
src="{{utils.formateUrl(item.imageUrl,baseImgUrl)}}"
data-appid="{{item.link.appid}}"
data-path="{{item.link.url}}"
data-link="{{item.link}}"
data-item="{{item}}"
bindload="imageLoad"
bindtap='preview'
/>
</view>
</view>
</view>
......@@ -14,8 +14,11 @@
overflow: hidden;
box-sizing: border-box;
flex-direction: row;
align-items: center;
/* align-items: center; */
}
.nav-block {
flex: 1
}
.btn-vip-code {
display: flex;
}
\ No newline at end of file
// component/selectCoupon/selectCoupon.js
const wxService = require('../../utils/wxService')
Component({
/**
* 组件的属性列表
......@@ -7,13 +9,18 @@ Component({
show: { // 显示标识
type: Boolean,
value: false
},
couponList: {
type: Array,
value: [],
observer: '_couponList'
}
},
/**
* 组件的初始数据
*/
data: {
checkedColor: 'rgb(203, 60, 60)',
isSelect:false
},
......@@ -21,21 +28,51 @@ Component({
* 组件的方法列表
*/
methods: {
selectCoupon() {
console.log('2222')
// 当前优惠券价格
this.setData({
isSelect: !this.data.isSelect
_couponList(newV, oldV) {
console.log('newV, oldV', newV)
if (newV !== oldV) {
newV.map(item => {
item.couponSettingDTO.notice = JSON.parse(item.couponSettingDTO.notice)
for (let i in item.couponSettingDTO.notice) {
if (item.couponSettingDTO.notice[i].type == 1) {
item.couponSettingDTO.notice[i].value = item.couponSettingDTO.startTime.substring(0, 10) + ' 至 ' + item.couponSettingDTO.endTime.substring(0, 10)
}
}
})
this._updateData({
couponList: newV
})
}
},
_updateData(data) {
if (data) {
this.setData(data)
}
},
selectCoupon(e) {
// 1 抵用券 2 折扣券
const { id,index,type } = e.currentTarget.dataset
const { couponList } = this.data
console.log('2222', id,index, type)
couponList.forEach(item=>{
item.checked = false
})
couponList[index].checked = true
wxService.nextTick(() => {
this.triggerEvent('updateCoupon', couponList[index].couponDiscount)
})
this.setData({
couponList
},()=>{
this.hidePopup()})
},
hidePopup: function () { // 隐藏弹出框
this.setData({
show: false
})
},
},
}
})
<view class="modal-container{{show ? ' active' : ''}}" bindtap="hidePopup"></view>
<view class="modal-container{{show ? ' active' : ''}}" bindtap="hidePopup" />
<view class="modal-content{{show ? ' active' : ''}}">
<!--{{couponList}}-->
<view class="modal-header">
<image src="/assets/imgs/7_1_0/arrow-right.png" class="modal-to-back" mode="widthFix" />
<text class="modal-title">选择优惠券</text>
<image
class="modal-close"
mode="widthFix"
src="/assets/imgs/7_1_0/close.png"
bindtap="hidePopup"
/>
</view>
<view class="modal-header">
<image src="/assets/imgs/7_1_0/arrow-right.png" class="modal-to-back" mode="widthFix"></image>
<text class="modal-title">选择优惠券</text>
<image class="modal-close" mode="widthFix" src="/assets/imgs/7_1_0/close.png" bindtap="hidePopup"></image>
</view>
<view class="modal-info" wx:if="{{couponList.length}}">
<block wx:for="{{couponList}}" wx:key="{{index}}" wx:for-item="item">
<view class="coupon-list" data-id="{{item.couponSettingDTO.couponSettingId}}" data-index="{{index}}" data-type="{{item.couponSettingDTO.type}}" bindtap="selectCoupon">
<image
wx:if="{{false}}"
class="coupon-bg"
src="/assets/imgs/7_1_0/coupon-bg.png"
mode="widthFix"
/>
<image class="coupon-bg" src="/assets/imgs/7_1_0/disabled-coupon.png" mode="widthFix" />
<view class="coupon-info">
<view class="left-price">
<image class="left-price-coupon-bg" src="{{item.couponSettingDetailDTO.style.takeCouponBgimg}}" />
</view>
<view class="right-info">
<view class="coupon-title">{{item.couponSettingDTO.title}}</view>
<view wx:for="{{item.couponSettingDTO.notice}}" wx:key="{{index}}">
<text class='coupon-time'>{{item.label}}</text>
<text class='coupon-desc wpl'>{{item.value}}</text>
</view>
</view>
<view class="modal-info">
<view class="coupon-list" bindtap="selectCoupon">
<image wx:if="{{false}}" class="coupon-bg" src="/assets/imgs/7_1_0/coupon-bg.png" mode="widthFix"></image>
<image class="coupon-bg" src="/assets/imgs/7_1_0/disabled-coupon.png" mode="widthFix"></image>
<view class="coupon-info">
<view class="left-price">
<view class="top-price">
<text>¥</text>
<text class="amount">50</text>
</view>
<view class="bottom-desc">
满99可用
</view>
<view class="select-radio">
<icon size="16" type="{{item.checked ? 'success' : 'circle'}}" color="{{checkedColor}}"></icon>
</view>
<view class="right-info">
<view class="coupon-title">新人礼包劵</view>
<view class="coupon-time">有效期</view>
<view class="coupon-desc">拼团及特殊商品不可用</view>
</view>
<view class="select-radio">
<view class="{{isSelect ? 'theme-color' : ''}} coupon-radio" >
<image wx:if="{{isSelect}}" class="tick-success" src="/assets/imgs/7_1_0/tick-success.png" mode="widthFix"></image>
</view>
</view>
</view>
</view>
<view class="empty-coupon">
暂无可用优惠券
</view>
</view>
<!-- <view class="select-radio">
<view class="{{isSelect ? 'theme-color' : ''}} coupon-radio">
<image
wx:if="{{isSelect}}"
class="tick-success"
src="/assets/imgs/7_1_0/tick-success.png"
mode="widthFix"
/>
</view>
</view>-->
</view>
</view>
</block>
</view>
<view wx:else class="empty-coupon">
暂无可用优惠券
</view>
</view>
......@@ -61,11 +61,18 @@
}
.coupon-bg{
width: 100%;
height: 174rpx;
position: absolute;
top: 0;
left: 0;
z-index: -1;
}
.left-price-coupon-bg {
height: 174rpx;
width: 174rpx;
position: absolute;
overflow: hidden;
}
.modal-info{
padding: 0 24rpx;
margin-top: 95rpx;
......@@ -77,8 +84,10 @@
font-size: 18rpx;
color:#CB3C3C;
position: absolute;
top: 36rpx;
left: 48rpx;
/* top: 36rpx;
left: 48rpx; */
width: 174rpx;
height: 174rpx;
}
.amount{
font-size: 54rpx;
......@@ -129,4 +138,27 @@
}
.theme-color{
border: none;
}
\ No newline at end of file
}
/* .integral-detail{
margin-top: 90rpx;
}
.integral-list{
margin-bottom: 60rpx;
font-size: 27rpx;
}
.integral-title,.integral-desc{
display: inline-block;
}
.integral-title{
color: #999999;
vertical-align: top;
margin-right: 50rpx;
text-align: right;
width: 120rpx;
}
.integral-desc{
width: 500rpx;
color: #666666;
} */
\ No newline at end of file
......@@ -19,7 +19,8 @@ wxService.page({
citys: null,
cityView: '',
multiIndex: [0, 0, 0],
selectCityName: ['', '']
selectCityName: ['', ''],
currentCoupon: '无可用优惠券'
},
/**
......@@ -62,7 +63,15 @@ wxService.page({
// 地址列表
this.getAddressList()
},
updateCoupon(e){
console.log('e', e.detail)
if(e.detail){
this.setData({
haveCoupon: true,
currentCoupon: e.detail
})
}
},
formSubmit(e) {
const { goodsAddress } = this.data
// 保存地址 && 支付
......
......@@ -122,7 +122,7 @@
<view>
<text class="price-label">优惠券</text>
<view class="select-coupon" bindtap="selectCoupon">
<text class="{{haveCoupon ? 'coupon-price' : 'no-coupon'}}">{{haveCoupon ? '-¥100' : '无可用优惠券'}}</text>
<text class="{{haveCoupon ? 'coupon-price' : 'no-coupon'}}">{{currentCoupon}}</text>
<image class="arrow-right" src="/assets/imgs/7_1_0/arrow-right.png" />
</view>
</view>
......@@ -160,5 +160,5 @@
</view>
<!--goHome-->
<go-home/>
<select-coupon show="{{showSelectCoupon}}" />
<select-coupon show="{{showSelectCoupon}}" bind:updateCoupon="updateCoupon" coupon-list="{{currentOrderList.couponDiscountPreviews}}"/>
......@@ -39,7 +39,7 @@
"list": []
},
"miniprogram": {
"current": 44,
"current": 17,
"list": [
{
"id": -1,
......
......@@ -30,15 +30,16 @@ function formateUrl(url, BASE_IMG_URL){
// 授权路径 我的/购物车/我的奖励/邀请好友/推广商品/我的地址/我的订单
function hanlerLinkNeedAuth(link){
var flag = false
if(link.indexOf('pages/my/my') > -1 ||
link.indexOf('pages/cart/cart') > -1 ||
link.indexOf('subPackage/page/pages/orderBenefit/orderBenefit') > -1 ||
link.indexOf('subPackage/page/pages/myInvite/myInvite') > -1 ||
link.indexOf('pages/extendProduct/extendProduct') > -1 ||
link.indexOf('pages/myAddress/myAddress') > -1 ||
link.indexOf('pages/order/order') > -1)
{
flag = true
if(typeof(link) != undefined && link) {
if(link.indexOf('pages/my/my') > -1 ||
link.indexOf('pages/cart/cart') > -1 ||
link.indexOf('subPackage/page/pages/orderBenefit/orderBenefit') > -1 ||
link.indexOf('subPackage/page/pages/myInvite/myInvite') > -1 ||
link.indexOf('pages/extendProduct/extendProduct') > -1 ||
link.indexOf('pages/myAddress/myAddress') > -1 ||
link.indexOf('pages/order/order') > -1) {
flag = true
}
}
return flag
}
......
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