Commit 420c3544 by 施宇

询价列表修改

parent e28c0117
// components/priceItem/priceItem.js
import {
judgeToken
judgeTokenNew
} from '../../utils/util.js';
Component({
/**
......@@ -46,19 +46,24 @@ Component({
let type = e.currentTarget.dataset.type; //1代表询价 2代表报价 3代表商品
let priceType = e.currentTarget.dataset.pricetype;
let isClick = e.currentTarget.dataset.isclick;
let userid = e.currentTarget.dataset.userid;
let storageUserid = wx.getStorageSync('user_id');
if (isClick === '0') {
return;
}
if (judgeToken(true)) {
if (judgeTokenNew()) {
if (priceType == 1) {
if (type == 1) {
//查看自己的询价(别人给自己报的价)
wx.navigateTo({
url: "/pages/list/xj/index?type=1&inquiryItemsId=" + inquiryItemsId
})
} else if (type == 2) {
//查看别人的询价(自己给别人报的价)
wx.navigateTo({
url: "/pages/list/xj/index?type=2&inquiryItemsId=" + inquiryItemsId + '&offerId=' + offerId
})
}
} else if (priceType == 2) { //搜索页面商品跳转
......@@ -66,15 +71,24 @@ Component({
url: "/pages/detail/good/index?goodId=" + goodId + '&type=2'
})
} else if (priceType == 3) {
if (type == 1) {
wx.navigateTo({
url: "/pages/list/xj/index?type=2&inquiryItemsId=" + inquiryItemsId
})
} else if (type == 2) {
if (userid == storageUserid){
//自己看自己的数据
wx.navigateTo({
url: "/pages/detail/xj/index?inquiryItemsId=" + inquiryItemsId + '&offerId=' + offerId
url: "/pages/list/xj/index?type=1&inquiryItemsId=" + inquiryItemsId
})
}else{
//自己看别人的数据
if (type == 1) {
wx.navigateTo({
url: "/pages/list/xj/index?type=2&inquiryItemsId=" + inquiryItemsId
})
} else if (type == 2) {
wx.navigateTo({
url: "/pages/detail/xj/index?inquiryItemsId=" + inquiryItemsId + '&offerId=' + offerId
})
}
}
} else if (priceType == 4) {
} else if (priceType == 5) { //个人主页商品跳转
......
......@@ -76,7 +76,7 @@
</block>
<!-- 搜索页面询报价展示 -->
<block wx:if="{{priceType==3}}">
<view class="price-item" wx:for="{{priceList}}" wx:key="{{index}}" catchtap="emitevent" data-inquiryitemsid="{{item['inquiry_items_id']}}" data-offerid="{{item['offer_id']}} " data-type="{{xb}}" data-pricetype="3" data-isclick="{{isClick}}">
<view class="price-item" wx:for="{{priceList}}" wx:key="{{index}}" catchtap="emitevent" data-inquiryitemsid="{{item['inquiry_items_id']}}" data-offerid="{{item['offer_id']}} " data-type="{{xb}}" data-pricetype="3" data-isclick="{{isClick}}" data-userid="{{item['user_id']}}">
<view class="item-header px-hr-bottom row verCenter bothSide nowrap">
<view class="row verCenter">
<text class="mark xun" wx:if="{{xb==1}}">询价</text>
......
......@@ -72,7 +72,7 @@
<input placeholder="请输入货期时间(天)" placeholder-class="placeholderClass" type="text" name="day"></input>
</view>
</view>
<view class="form-hr"></view>
<!-- <view class="form-hr"></view>
<view class="form-item row verCenter">
<text class="form-item-title form-item-title-165">*询价有效期</text>
<picker mode="date" value="{{date}}" start="2015-09-01" bindchange="bindDateChange" class="form-item-right jz-item-right">
......@@ -83,11 +83,7 @@
</block>
</picker>
<!-- <view class="form-item-right jz-item-right" bindtap="changeTime">
<text>请选择截止日期</text>
<image src="/res/images/icons/left-icon.png"></image>
</view> -->
</view>
</view> -->
<view class="form-hr"></view>
<view class="form-item row px-hr-bottom">
<text class="form-item-title form-item-title-135">备注</text>
......
// pages/tab/good/good.js
import {
getData,
judgeToken
judgeTokenNew
} from '../../../utils/util.js';
import {
apis
......@@ -32,7 +32,11 @@ Page({
onLoad: function (options) {
let me = this;
wx.removeStorageSync('deleteGoodsData');
if (judgeToken(true)) {
if (judgeTokenNew(() => {
wx.switchTab({
url: '/pages/tab/home/home'
});
},true)) {
this.getData();
};
getApp().globalData.bus.on('addGood', () => {
......@@ -66,7 +70,7 @@ Page({
if (res.errcode == 0) {
if (res.data.polish_status == 2) {//未刷新
me.setData({
isCl:false
isCl: false
})
} else {//已刷新
me.setData({
......@@ -78,13 +82,13 @@ Page({
},
//擦亮商品
cLGoods:function(){
if(!this.data.isCl){
cLGoods: function () {
if (!this.data.isCl) {
this.cLGoodsAjax()
}
},
//擦亮商品的请求
cLGoodsAjax:function(){
cLGoodsAjax: function () {
let token = wx.getStorageSync('access_token');
let me = this;
getData(apis.polishAll, 'get', {
......@@ -97,7 +101,7 @@ Page({
duration: 2000
})
me.setData({
isCl:true
isCl: true
})
} else {
wx.showToast({
......@@ -197,7 +201,14 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getUserInfo()
if (!judgeTokenNew(() => {
wx.switchTab({
url: '/pages/tab/home/home'
});
})) {
return;
}
this.getUserInfo();
},
/**
......
// pages/tab/home/home.js
import {
getData,
judgeToken,
judgeTokenNew,
interval
} from '../../../utils/util.js';
import {
......@@ -202,21 +202,21 @@ Page({
})
},
toWelfare: function () {
if (judgeToken(true)) {
if (judgeTokenNew()) {
wx.navigateTo({
url: "/pages/person/welfare/index"
})
}
},
toXj: function () {
if (judgeToken(true)) {
if (judgeTokenNew()) {
wx.navigateTo({
url: "/pages/form/xj/index"
})
}
},
fbGood: function () {
if (judgeToken(true)) {
if (judgeTokenNew()) {
wx.navigateTo({
url: "/pages/form/good/index",
})
......@@ -230,7 +230,7 @@ Page({
// }
},
toPrice:function(){
if (judgeToken(true)) {
if (judgeTokenNew()) {
wx.navigateTo({
url: "/pages/tab/price/price"
})
......
......@@ -26,9 +26,7 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if (!http.judgeToken(true)) {
return;
}
},
/**
......@@ -42,7 +40,13 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
if (!http.judgeTokenNew(() => {
wx.switchTab({
url: '/pages/tab/home/home'
});
})) {
return;
}
//获取数量统计
http.getData(apis.countBusiness, 'GET', {
token: wx.getStorageSync('access_token')
......
......@@ -2,7 +2,7 @@
let disp = require("../../../utils/broadcast");
// let WebIM = require("../../../utils/WebIM")["default"];
import {
judgeToken,
judgeTokenNew,
getData,
interval,
matchReg,
......@@ -31,7 +31,11 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if (judgeToken(true)) {
if (judgeTokenNew(() => {
wx.switchTab({
url: '/pages/tab/home/home'
});
}, true)) {
let me = this;
let my = wx.getStorageSync("myUsername");
//监听未读消息数
......@@ -153,6 +157,13 @@ Page({
*/
onShow: function () {
if (!judgeTokenNew(() => {
wx.switchTab({
url: '/pages/tab/home/home'
});
})) {
return;
}
let my = wx.getStorageSync("myUsername");
let token = wx.getStorageSync('access_token') || '';
let isShowModal = wx.getStorageSync('is_ShowModal')||''
......
......@@ -329,6 +329,31 @@ const judgeToken = (boolen) => {
return false;
}
};
//判断token是否存在的新的逻辑
const judgeTokenNew = (cancelFun,modalHide) => {
let token = wx.getStorageSync('access_token');
if (token) {
return true
} else {
if(!modalHide){
wx.showModal({
title: '提示',
content: '亲,请登录体验更多功能',
confirmText: '登录',
success(res) {
if (res.confirm) {
wx.reLaunch({
url: '/pages/person/auth/index'
});
} else if (res.cancel) {
cancelFun && cancelFun()
}
}
})
}
return false;
}
};
const interval = (usedTime) => {
let days = Math.floor(usedTime / (24 * 3600 * 1000));
//计算出小时数
......@@ -404,5 +429,6 @@ module.exports = {
interval: interval,
matchReg: matchReg,
reloginIm: reloginIm,
fourPoint: fourPoint
fourPoint: fourPoint,
judgeTokenNew: judgeTokenNew
}
\ 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 sign in to comment