Commit 59bcb85a by 赵雅纹

Merge branch 'dev_7.1.0' into fixbug-ZYW

parents 303a9508 39c403a1
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
hover-class="btn-hover" hover-class="btn-hover"
style="height: 100%;" style="height: 100%;"
> >
<image class='tab-img' src="{{utils.formateUrl(currHomePageId == tab.redirectId ? tab.activeImageUrl: tab.imageUrl,baseImgUrl)}}" /> <image class='tab-img' src="{{utils.formateUrl(currHomePageId == (tab.link.type == '2' ? tab.link.url : '0') ? tab.activeImageUrl: tab.imageUrl,baseImgUrl)}}" />
</button> </button>
</view> </view>
<view <view
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
bindtap="handelToPage" bindtap="handelToPage"
> >
<button class='btn' style="height: 100%;"> <button class='btn' style="height: 100%;">
<image class='tab-img' src="{{utils.formateUrl(currHomePageId == tab.redirectId ? tab.activeImageUrl: tab.imageUrl,baseImgUrl)}}" /> <image class='tab-img' src="{{utils.formateUrl(currHomePageId == (tab.link.type == '2' ? tab.link.url : '0') ? tab.activeImageUrl: tab.imageUrl,baseImgUrl)}}" />
</button> </button>
</view> </view>
</view> </view>
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
bindtap="handelToPage" bindtap="handelToPage"
> >
<button class='btn' style="height: 100%"> <button class='btn' style="height: 100%">
<image class='tab-img' src="{{utils.formateUrl(currHomePageId == tab.redirectId ? tab.activeImageUrl: tab.imageUrl,baseImgUrl)}}" /> <image class='tab-img' src="{{utils.formateUrl(currHomePageId == (tab.link.type == '2' ? tab.link.url : '0') ? tab.activeImageUrl: tab.imageUrl,baseImgUrl)}}" />
</button> </button>
</view> </view>
</view> </view>
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
hover-class="btn-hover" hover-class="btn-hover"
style="height: 100%;" style="height: 100%;"
> >
<image class='tab-img' src="{{utils.formateUrl(currHomePageId == tab.redirectId ? tab.activeImageUrl: tab.imageUrl,baseImgUrl)}}" /> <image class='tab-img' src="{{utils.formateUrl(currHomePageId == (tab.link.type == '2' ? tab.link.url : '0') ? tab.activeImageUrl: tab.imageUrl,baseImgUrl)}}" />
</button> </button>
</view> </view>
<view <view
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
bindtap="handelToPage" bindtap="handelToPage"
> >
<button class='btn' style="height: 100%;"> <button class='btn' style="height: 100%;">
<image class='tab-img' src="{{utils.formateUrl(currHomePageId == tab.redirectId ? tab.activeImageUrl: tab.imageUrl,baseImgUrl)}}" /> <image class='tab-img' src="{{utils.formateUrl(currHomePageId == (tab.link.type == '2' ? tab.link.url : '0') ? tab.activeImageUrl: tab.imageUrl,baseImgUrl)}}" />
</button> </button>
</view> </view>
</view> </view>
...@@ -77,15 +77,9 @@ ...@@ -77,15 +77,9 @@
bindtap="handelToPage" bindtap="handelToPage"
> >
<button class='btn' style="height: 100%"> <button class='btn' style="height: 100%">
<image class='tab-img' src="{{utils.formateUrl(currHomePageId == tab.redirectId ? tab.activeImageUrl: tab.imageUrl,baseImgUrl)}}" /> <image class='tab-img' src="{{utils.formateUrl(currHomePageId == (tab.link.type == '2' ? tab.link.url : '0') ? tab.activeImageUrl: tab.imageUrl,baseImgUrl)}}" />
</button> </button>
</view> </view>
<!-- <button wx:if="{{currHomePageId == tab.redirectId}}">
<image class='tab-img' src='{{tab.activeImageUrl}}' />
</button>
<button wx:else>
<image class='tab-img' src='{{tab.imageUrl}}' />
</button>-->
</view> </view>
</block> </block>
</view> </view>
......
...@@ -74,6 +74,14 @@ Component({ ...@@ -74,6 +74,14 @@ Component({
}) })
}, },
methods: { methods: {
toPlusPay(e) {
const { row }= e.currentTarget.dataset
let toPlus = typeof(row) == 'string'? JSON.parse(row) : row
if(toPlus.type == 2) {
let pageId = toPlus.url
wxService.router(`/subPackage/page/pages/subPage/subPage`).search({ pageId })
}
},
_getUserInfo(res = {}) { _getUserInfo(res = {}) {
wxService.nextTick(() => { wxService.nextTick(() => {
this.triggerEvent('getAuth', res); this.triggerEvent('getAuth', res);
......
...@@ -58,6 +58,6 @@ ...@@ -58,6 +58,6 @@
</view> </view>
<!--plus--> <!--plus-->
<view class='df tc person-num' wx:if='{{currentMobile}}'> <view class='df tc person-num' wx:if='{{currentMobile}}'>
<image class="" src='{{currentPlusStyle.imageUrl}}' mode="widthFix" /> <image class="" src='{{currentPlusStyle.imageUrl}}' data-row="{{currentPlusStyle.row}}" mode="widthFix" bindtap="toPlusPay"/>
</view> </view>
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
var app = getApp() var app = getApp()
const wxService = require('../../utils/wxService') const wxService = require('../../utils/wxService')
const utils = require('../../utils/util') const utils = require('../../utils/util')
const utilLink = require('../../utils/currentLinkRouter')
const envInfo = require('../../config/index').envInfo const envInfo = require('../../config/index').envInfo
Component({ Component({
...@@ -19,7 +20,45 @@ Component({ ...@@ -19,7 +20,45 @@ Component({
} }
}, },
attached() { attached() {
const { categoryType } = this.data
let currentTab = categoryType.categorys
currentTab.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
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'
}
item.row = newRow
}
})
// 当前匹配路径是否需要授权 true 需要 false 不需要
currentTab.forEach(item => {
let checkUrl = ''
if (item.link) {
checkUrl = item.link.newPath ? item.link.newPath : item.link.url
} else if (item.row) {
checkUrl = item.row.newPath ? item.row.newPath : item.row.url
}
wxService.NoLoginPage(checkUrl).then(res => {
if(checkUrl) item.needAuth = res.needAuth
this.setData({ categoryList: currentTab })
})
})
}, },
/** /**
* 组件的初始数据 * 组件的初始数据
...@@ -28,6 +67,7 @@ Component({ ...@@ -28,6 +67,7 @@ Component({
// currentTab: 0, // currentTab: 0,
currentTab: 99, currentTab: 99,
isAuthorization: false, // false 不显示 true 显示 isAuthorization: false, // false 不显示 true 显示
categoryList:[]
}, },
/*组件所在页面的生命周期 */ /*组件所在页面的生命周期 */
pageLifetimes: { pageLifetimes: {
...@@ -62,84 +102,7 @@ Component({ ...@@ -62,84 +102,7 @@ Component({
}, },
// 设置tab active // 设置tab active
switchNav(event) { switchNav(event) {
const ev = event.currentTarget.dataset; utilLink.currentLinkRouter(event, this)
let cur = ev.current
let curItemType = ev.item
const userInfo = wx.getStorageSync('_baseUserInfo')
const {currentTab} = this.data
// 切换 active
if (currentTab == cur) {
return false
} else {
this.setData({
currentTab: cur
})
}
// link row
if (curItemType.link) {
let currentClickType = app.globalData.commonFunc.getLink(curItemType.link.type, curItemType)
if (curItemType.link.type == 1) {
// 触发父组件更新页面 外部小程序
this.setData({
isAuthorization: false
})
return false
} else if (!userInfo) {
this.setData({
isAuthorization: true
})
return false
} else if (userInfo && userInfo.member && !userInfo.member.mobile) {
wxService.openCard()
return false
}
if (curItemType.link.type == 2) {
// 触发父组件更新页面
wxService.nextTick(() => {
this.triggerEvent('updatePage', { pageId: currentClickType.url })
})
} else if (curItemType.link.type == 3) {
// 预览
wx.previewImage({
current: `${app.globalData.imageUrl}/${currentClickType.imageUrl}`, // 当前显示图片的http链接
urls: [`${app.globalData.imageUrl}/${currentClickType.link.url}`] // 需要预览的图片http链接列表
})
} else if (curItemType.link.type == 4) {
wxService.router(`${currentClickType}`)
} else if (curItemType.link.type == 5) {
if (currentClickType == 1) {
wxService.openCard()
} else if (currentClickType == 2) {
wxService.openCard()
}
} else if (curItemType.link.type == 6) {
wxService.router(`/${currentClickType}`)
} else if (curItemType.link.type == 7) {
// 集点详情
wxService.router(`${currentClickType}`)
}
} else if (curItemType.row) {
let rowObj = JSON.parse(curItemType.row)
let currentClickRow = app.globalData.commonFunc.getLinkRow(rowObj.type, rowObj)
if (rowObj.type == 1) { }
else if (rowObj.type == 2) { }
else if (rowObj.type == 3) { }
else if (rowObj.type == 4) { }
else if (rowObj.type == 5) { }
else if (rowObj.type == 6) { }
else if (rowObj.type == 7) { }
else if (rowObj.type == 8) {
// 商品
wxService.router(`/pages/productDetail/productDetail?id=${currentClickRow}`)
}
else if (rowObj.type == 9) {
// 分类
wxService.router(`/subPackage/page/pages/categoryPro/categoryPro?${currentClickRow}`)
}
}
}, },
switchTab(event) { switchTab(event) {
var cur = event.detail.current var cur = event.detail.current
......
<!--component/tabSort/tabSort.wxml--> <!--component/tabSort/tabSort.wxml-->
<view class="tab-sort" wx:if="{{categoryType.categorys}}"> <view class="tab-sort" wx:if="{{categoryList}}">
<scroll-view scroll-x class="scroll-view_H" scroll-with-animation="{{true}}"> <scroll-view scroll-x class="scroll-view_H" scroll-with-animation="{{true}}">
<block <block
wx:for="{{categoryType.categorys}}" wx:for="{{categoryList}}"
wx:for-index="idx" wx:for-index="idx"
wx:for-item="navItem" wx:for-item="navItem"
wx:key="idx" wx:key="idx"
> >
<view <view wx:if="{{navItem.needAuth}}" class="scroll-view-item {{currentTab == idx ?'active':''}}" style="width:{{navItemWidth}}%">
class="scroll-view-item {{currentTab == idx ?'active':''}}" <view wx:if="{{!currentHasUserInfo}}" class="scroll-view-item {{currentTab == idx ?'active':''}}" style="width: {{navItemWidth}}%;height: 80rpx;display: flex;">
style="width:{{navItemWidth}}%" <button
data-current="{{idx}}" bindgetuserinfo="_getUserInfo"
data-redirectId="{{navItem.redirectId}}" data-jflag="false"
data-item="{{navItem}}" open-type='getUserInfo'
bindtap="switchNav" class="scroll-view-item {{currentTab == idx ?'active':''}}"
> hover-class="btn-hover"
<view>{{navItem.title}}</view> >
{{navItem.title}}
</button>
</view>
<view wx:else class="scroll-view-item {{currentTab == idx ?'active':''}}" style="width:{{navItemWidth}}%">
<view
data-current="{{idx}}"
data-redirectId="{{navItem.redirectId}}"
data-item="{{navItem}}"
bindtap="switchNav"
>{{navItem.title}}
</view>
</view>
</view>
<view wx:else class="scroll-view-item {{currentTab == idx ?'active':''}}" style="width:{{navItemWidth}}%">
<view
data-current="{{idx}}"
data-redirectId="{{navItem.redirectId}}"
data-item="{{navItem}}"
bindtap="switchNav"
>{{navItem.title}}
</view>
</view> </view>
</block> </block>
</scroll-view> </scroll-view>
<!-- showQrcode 2 购物车 1 会员码 0 隐藏 --> <!-- showQrcode 2 购物车 1 会员码 0 隐藏 -->
......
...@@ -40,3 +40,14 @@ ...@@ -40,3 +40,14 @@
display: flex; display: flex;
align-items: center; align-items: center;
} }
button {
background-color: transparent;
border-radius:0;
padding: 0;
}
button::after{
border:none;
}
.button-hover, .button-active{
background-color:transparent;
}
\ No newline at end of file
...@@ -229,7 +229,7 @@ wxService.page({ ...@@ -229,7 +229,7 @@ wxService.page({
skuId: 0 skuId: 0
} }
trolleySku2BuyObj.count = item.count - 0 trolleySku2BuyObj.count = item.count - 0
trolleySku2BuyObj.skuId = item.skuId - 0 trolleySku2BuyObj.skuId = item.skuId
// skuIds.push(item.skuId) // skuIds.push(item.skuId)
trolleySku2Buy.push(trolleySku2BuyObj) trolleySku2Buy.push(trolleySku2BuyObj)
}) })
...@@ -243,25 +243,15 @@ wxService.page({ ...@@ -243,25 +243,15 @@ wxService.page({
} }
// 去下单页 && 参数 // 去下单页 && 参数
// let parmas = {
// trolleySku2Buy: JSON.stringify(trolleySku2Buy)
// }
let tradeDto = { let tradeDto = {
trolleySku2Buy:JSON.stringify(trolleySku2Buy) trolleySku2Buy:JSON.stringify(trolleySku2Buy)
} }
const parmas = tradeDto const parmas = tradeDto
wxService wxService
.router('/pages/confirmOrder/confirmOrder') .router('/pages/confirmOrder/confirmOrder')
.search(parmas) .search(parmas)
// let tradeDto = {
// couponId: '',
// trolleySku2Buy:JSON.stringify(trolleySku2Buy)
// }
// const parmas = tradeDto
// wxService // wxService
// .router('/pages/confirmOrder/confirmOrder') // .router('/pages/confirmOrder/confirmOrder')
// .search(parmas) // .search(parmas)
......
...@@ -23,6 +23,9 @@ wxService.page({ ...@@ -23,6 +23,9 @@ wxService.page({
wxAddress: false, wxAddress: false,
currentCoupon: '', currentCoupon: '',
orderPrice: null, // 订单金额 orderPrice: null, // 订单金额
orderInitPrice: 0,
plusMemberPrice: 0, // plus 默认价
plusMemberName:''
}, },
/** /**
...@@ -30,22 +33,15 @@ wxService.page({ ...@@ -30,22 +33,15 @@ wxService.page({
*/ */
onLoad: function (options) { onLoad: function (options) {
wx.hideShareMenu() wx.hideShareMenu()
console.log('-----------',options)
}, },
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function () {
const { memberId } = wx.getStorageSync('_baseUserInfo') const { memberId } = wx.getStorageSync('_baseUserInfo')
// const { couponId, trolleySku2Buy } = this.options
// let tradeDto = {
// couponId: couponId,
// trolleySku2Buy: JSON.parse(trolleySku2Buy)
// }
let pages = getCurrentPages(); let pages = getCurrentPages();
let currPage = pages[pages.length - 1]; let currPage = pages[pages.length - 1];
console.log('-----------', pages)
const { trolleySku2Buy } = this.options const { trolleySku2Buy } = this.options
...@@ -53,8 +49,6 @@ wxService.page({ ...@@ -53,8 +49,6 @@ wxService.page({
trolleySku2Buy: JSON.parse(trolleySku2Buy) trolleySku2Buy: JSON.parse(trolleySku2Buy)
} }
console.log('tradeDto', tradeDto)
// 下单 && 计算优惠价 // 下单 && 计算优惠价
this.setData({ trolleySku2Buy: tradeDto.trolleySku2Buy }, () => { this.setData({ trolleySku2Buy: tradeDto.trolleySku2Buy }, () => {
...@@ -97,11 +91,13 @@ wxService.page({ ...@@ -97,11 +91,13 @@ wxService.page({
this.setPayPrice() this.setPayPrice()
}, },
setPayPrice() { setPayPrice() {
const { currentCoupon, orderPrice } = this.data const { currentCoupon, orderInitPrice, isSelect, plusMemberPrice } = this.data
let orderCoupon = parseFloat(currentCoupon) let newCurrentCoupon = currentCoupon? currentCoupon : 0
let orderCoupon = parseFloat(newCurrentCoupon) // 优惠券价格
let plusPrice = isSelect ? plusMemberPrice : 0 // plus
this.setData({ this.setData({
orderPrice: Math.round(orderPrice - orderCoupon) // orderPrice: Math.round(orderInitPrice - orderCoupon)
orderPrice: orderInitPrice - orderCoupon - plusPrice
}) })
}, },
formSubmit(e) { formSubmit(e) {
...@@ -244,8 +240,31 @@ wxService.page({ ...@@ -244,8 +240,31 @@ wxService.page({
trolleySku2Buy trolleySku2Buy
} }
this.calPreferentialPrice(params) // 重新计算优惠价 this.calPreferentialPrice(params) // 重新计算优惠价
// 获取默认付费会员设置
this.getPremiumDefault()
}) })
})
},
// /premium/getDefault
getPremiumDefault() {
wx.showLoading({
title: '加载中'
})
wxService.get(`/sale/premium/getDefault`).then(res => {
if (res) {
const { result, data } = res.data
if (result == 0) {
wx.hideLoading()
this.setData({
plusMemberPrice: data.price,
plusMemberName: data.name
},()=>{
// 实付款
this.setPayPrice()
})
}
}
}) })
}, },
// 默认地址 // 默认地址
...@@ -264,7 +283,10 @@ wxService.page({ ...@@ -264,7 +283,10 @@ wxService.page({
wx.hideLoading() wx.hideLoading()
this.setData({ this.setData({
currentOrderList: data, currentOrderList: data,
orderPrice: data.amount orderInitPrice: data.amount
},()=>{
// 实付款
this.setPayPrice()
}) })
} }
} }
......
...@@ -117,7 +117,7 @@ ...@@ -117,7 +117,7 @@
<text class="price-label">plus会员价</text> <text class="price-label">plus会员价</text>
<text class="member-price">-¥20</text> <text class="member-price">-¥20</text>
</view> </view>
<text class="plus-member-price">¥289</text> <text class="plus-member-price">¥{{plusMemberPrice}}</text>
</view> </view>
</view> </view>
<view class="coupon"> <view class="coupon">
...@@ -131,10 +131,10 @@ ...@@ -131,10 +131,10 @@
</view> </view>
<view class="coupon" wx:if="{{isSelect}}"> <view class="coupon" wx:if="{{isSelect}}">
<view> <view>
<text class="price-label">VIP会员年费</text> <text class="price-label">{{plusMemberName}}</text>
<text class="vip-desc"> (不可使用任何优惠或积分)</text> <text class="vip-desc"> (不可使用任何优惠或积分)</text>
<view class="select-coupon"> <view class="select-coupon">
<text class="coupon-price">+¥100</text> <text class="coupon-price">+¥{{plusMemberPrice}}</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>
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
"list": [] "list": []
}, },
"miniprogram": { "miniprogram": {
"current": 13, "current": -1,
"list": [ "list": [
{ {
"id": -1, "id": -1,
...@@ -148,14 +148,7 @@ ...@@ -148,14 +148,7 @@
"scene": null "scene": null
}, },
{ {
"id": 17, "id": 18,
"name": "确认订单",
"pathName": "pages/confirmOrder/confirmOrder",
"query": "trolleySku2Buy=[{\"count\":1,\"skuId\":621372628724224000}]",
"scene": null
},
{
"id": -1,
"name": "购物车", "name": "购物车",
"pathName": "pages/cart/cart", "pathName": "pages/cart/cart",
"query": "", "query": "",
......
...@@ -38,8 +38,7 @@ function currentLinkRouter(event, _this) { ...@@ -38,8 +38,7 @@ function currentLinkRouter(event, _this) {
wxService.router(`${currentClickType}`) wxService.router(`${currentClickType}`)
} }
} else if (curItemType.row) { } else if (curItemType.row) {
// let rowObj = JSON.parse(curItemType.row) let rowObj = typeof(curItemType.row) == "string" ? JSON.parse(curItemType.row) : curItemType.row
let rowObj = curItemType.row
let currentClickRow = app.globalData.commonFunc.getLinkRow(rowObj.type, rowObj) let currentClickRow = app.globalData.commonFunc.getLinkRow(rowObj.type, rowObj)
if (rowObj.type == 1) { } if (rowObj.type == 1) { }
......
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