Commit 1c6b94ec by 李伟康

提交

1 parent ed89e10b
......@@ -161,28 +161,21 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log(options,'=========')
this.setData({
tabIndex: options.tabIndex,
orderStatusPart: orderStatusPartEnum[options.tabIndex],
})
const {
userInfo,
tabIndex
} = this.data
if (userInfo) {
if (tabIndex != options?.tabIndex) delete options.tabIndex
this.setData(options)
this.clearData()
}
},
onShow(){
if(this.refresh) this.clearData()
onShow() {
if (this.refresh) this.clearData()
},
onHide(){
onHide() {
this.refresh = true
},
clearData() {
async clearData() {
const res = await wx.p.router.intercept()
if (res) return
this.setData({
listFlag: false,
list: [],
......
......@@ -39,8 +39,11 @@ Component({
*/
methods: {
goOrder(e) {
let tabIndex = e.currentTarget.dataset.key + 1
wx.p.router.go('/packageMine/pages/order/index/index',{
let {
key
} = e.currentTarget.dataset,
tabIndex = key || 0
wx.p.router.go('/packageMine/pages/order/index/index', {
tabIndex
})
}
......
......@@ -10,7 +10,7 @@
</view>
</view>
<view class="btnBox">
<view class="independentBox" wx:for="{{orderList}}" wx:key="index" bindtap="goOrder" data-key="{{index}}">
<view class="independentBox" wx:for="{{orderList}}" wx:key="index" bindtap="goOrder" data-key="{{index + 1}}">
<view class="order-img">
<glsx-image webp src="mine/{{item.imageUrl}}.png"></glsx-image>
</view>
......
......@@ -36,7 +36,6 @@
</view>
</view>
<!-- 会员卡 -->
<block wx:if="{{memberInfo}}">
<block wx:if="{{memberFlag}}">
<block wx:if="{{!isMember}}">
<view class="member-box">
......@@ -69,7 +68,6 @@
</view> -->
</block>
</block>
</block>
<!-- 我的券包 -->
<view class="coupon-box box flex" bindtap="jump" data-url="/packageMine/pages/coupon/index/index">
我的卡券
......
......@@ -40,7 +40,7 @@ class Router {
/**
* 跳转到switchTab
*/
switchTab(route,events = {}){
switchTab(route, events = {}) {
this._to(route, events, 'switchTab');
}
_to(route, events, to, success) {
......@@ -82,6 +82,10 @@ class Router {
if (Object.keys(data).length !== 0)
data.on('getData', (res) => callBack(res));
}
/**
*
* @param {*} auto 是否自动跳转到登录,默认自动跳转
*/
async intercept(auto = true) {
const authStatus = wx.$authStatus;
if (authStatus) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!