Commit 420c3544 by 施宇

询价列表修改

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