Commit 04b6c20b by 施宇

新增有效期

parent cbde107e
...@@ -24,6 +24,9 @@ Component({ ...@@ -24,6 +24,9 @@ Component({
}, },
isDelete: {//是否显示多选框 isDelete: {//是否显示多选框
type: Boolean type: Boolean
},
gq: {//是否显示已过期
type:Boolean
} }
}, },
......
...@@ -11,9 +11,14 @@ ...@@ -11,9 +11,14 @@
<text class="name ellipsis">{{item.goods_name||'--'}}</text> <text class="name ellipsis">{{item.goods_name||'--'}}</text>
</view> </view>
<block wx:if="{{xb==1}}"> <block wx:if="{{xb==1}}">
<block wx:if="{{gq&&(item.end_time < item.current_time)}}">
<text class="gq">已过期</text>
</block>
<block wx:else>
<text class="num-bj" wx:if="{{item.offer_num}}">{{item.offer_num}}个报价</text> <text class="num-bj" wx:if="{{item.offer_num}}">{{item.offer_num}}个报价</text>
<text class="no-bj" wx:else>等待报价</text> <text class="no-bj" wx:else>等待报价</text>
</block> </block>
</block>
<text class="price" wx:else> <text class="price" wx:else>
<block wx:if="{{!item.price||item.price=='0.00'||item.price=='0'}}"> <block wx:if="{{!item.price||item.price=='0.00'||item.price=='0'}}">
未回复 未回复
......
...@@ -24,11 +24,11 @@ ...@@ -24,11 +24,11 @@
margin-right: 24rpx; margin-right: 24rpx;
} }
.price-item .name, .price-item .price, .price-item .num-bj, .price-item .name, .price-item .price, .price-item .num-bj,
.price-item .no-bj { .price-item .no-bj,.price-item .gq {
font-weight: 600; font-weight: 600;
} }
.price-item .num-bj, .price-item .num-bj,
.price-item .no-bj{ .price-item .no-bj,.price-item .gq {
font-size: 28rpx; font-size: 28rpx;
} }
.price-item .num-bj{ .price-item .num-bj{
...@@ -37,6 +37,9 @@ ...@@ -37,6 +37,9 @@
.price-item .no-bj{ .price-item .no-bj{
color:#61A0F2; color:#61A0F2;
} }
.price-item .gq {
color:#686E73
}
.price-item .name, .price-item .company { .price-item .name, .price-item .company {
......
...@@ -26,6 +26,7 @@ Page({ ...@@ -26,6 +26,7 @@ Page({
isShowData: true, isShowData: true,
isClick: "", isClick: "",
headPic: '', headPic: '',
gq:false,
}, },
/** /**
...@@ -44,12 +45,14 @@ Page({ ...@@ -44,12 +45,14 @@ Page({
this.getInfo(); this.getInfo();
if (type == 1) { if (type == 1) {
this.setData({ this.setData({
priceType: 5 priceType: 5,
gq:true
}) })
this.getListData(false, true); this.getListData(false, true);
} else { } else {
this.setData({ this.setData({
priceType: 2 priceType: 2,
gq:false
}); });
}; };
getApp().globalData.bus.off('addFirstBj'); getApp().globalData.bus.off('addFirstBj');
...@@ -297,7 +300,12 @@ Page({ ...@@ -297,7 +300,12 @@ Page({
newArr = me.data.priceList; newArr = me.data.priceList;
} }
if (me.data.tabIndex != 3) { if (me.data.tabIndex != 3) {
let currentTime = new Date().toLocaleDateString();
let currentTimeStap = new Date(currentTime + ' 23:59:59').getTime() / 1000;
for (let key in res[str]) { for (let key in res[str]) {
if (str == 'inquiry_list'){
res[str][key].current_time = currentTimeStap
}
newArr.push(res[str][key]) newArr.push(res[str][key])
} }
} else { } else {
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
<text wx:else>当前信息不展示</text> <text wx:else>当前信息不展示</text>
</view> </view>
</view> </view>
<priceItem price-list="{{priceList}}" wx:if="{{priceList&&priceList.length!==0}}" price-type="{{priceType}}" xb="{{xb}}" is-click="{{isClick}}"></priceItem> <priceItem price-list="{{priceList}}" wx:if="{{priceList&&priceList.length!==0}}" price-type="{{priceType}}" xb="{{xb}}" is-click="{{isClick}}" gq="{{gq}}"></priceItem>
<view class="data-bottom row verCenter rowCenter" wx:if="{{isShowBottom}}"> <view class="data-bottom row verCenter rowCenter" wx:if="{{isShowBottom}}">
<text class="line"></text> <text class="line"></text>
<text class="text">我是有底线的</text> <text class="text">我是有底线的</text>
......
...@@ -3,7 +3,8 @@ import { ...@@ -3,7 +3,8 @@ import {
getData, getData,
chooseImg, chooseImg,
tips, tips,
fourPoint fourPoint,
getDay
} from '../../../utils/util.js'; } from '../../../utils/util.js';
import { import {
apis apis
...@@ -22,6 +23,8 @@ Page({ ...@@ -22,6 +23,8 @@ Page({
isShowTip: true, isShowTip: true,
array: ['RMB','USD'], array: ['RMB','USD'],
date:"", date:"",
startTime: getDay(1),
endTime: getDay(365)
}, },
bindPickerChange: function (e) { bindPickerChange: function (e) {
this.setData({ this.setData({
...@@ -46,7 +49,7 @@ Page({ ...@@ -46,7 +49,7 @@ Page({
tips('请填写数量'); tips('请填写数量');
return return
} else if (isNaN(Number(obj.number.trim()))) { } else if (isNaN(Number(obj.number.trim()))) {
tips('需求数量必须为数字'); tips('数量必须为数字');
return return
} else { } else {
if (!fourPoint(obj.price)) { if (!fourPoint(obj.price)) {
...@@ -61,12 +64,20 @@ Page({ ...@@ -61,12 +64,20 @@ Page({
return return
} }
} }
if(!this.data.date){
tips('请填写询价有效期');
return
}
} }
this.postData(obj); this.postData(obj);
}, },
postData: function(obj) { postData: function(obj) {
let me = this; let me = this;
let token = wx.getStorageSync('access_token'); let token = wx.getStorageSync('access_token');
let date = this.data.date;
date = date.replace(/-/g, '/');
let timeStap = new Date(date + ' 23:59:59').getTime() / 1000;
obj.end_time = timeStap;
obj.hq == 1 ? obj.delivery_time = '现货' : obj.delivery_time = obj.day; obj.hq == 1 ? obj.delivery_time = '现货' : obj.delivery_time = obj.day;
obj.currency = this.data.currency == 0?1:2; obj.currency = this.data.currency == 0?1:2;
obj.goods_images = this.data.imgUrl || ''; obj.goods_images = this.data.imgUrl || '';
......
...@@ -72,18 +72,17 @@ ...@@ -72,18 +72,17 @@
<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="{{startTime}}" end="{{endTime}}" bindchange="bindDateChange" class="form-item-right jz-item-right">
<text wx:if="{{date}}">{{date}}</text> <text wx:if="{{date}}">{{date}}</text>
<block wx:else> <block wx:else>
<text>请选择截止日期</text> <text>请选择截止日期</text>
<image src="/res/images/icons/left-icon.png"></image> <image src="/res/images/icons/left-icon.png"></image>
</block> </block>
</picker> </picker>
</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>
......
...@@ -38,6 +38,10 @@ ...@@ -38,6 +38,10 @@
</block> </block>
</text> </text>
</view> </view>
<view class="yxq row">
<text class="t-com">询价有效期:</text>
<text class="c-com">{{topInfo.end_time_date}}</text>
</view>
<view class="bz row"> <view class="bz row">
<text class="t-com">备注:</text> <text class="t-com">备注:</text>
<text class="c-com">{{topInfo.remark||'--'}}</text> <text class="c-com">{{topInfo.remark||'--'}}</text>
......
...@@ -101,3 +101,6 @@ ...@@ -101,3 +101,6 @@
padding-bottom:30rpx; padding-bottom:30rpx;
background-color: #fff; background-color: #fff;
} }
.xb-com-content .desc .left .yxq .t-com {
flex: 0 0 160rpx;
}
\ No newline at end of file
...@@ -57,6 +57,7 @@ Page({ ...@@ -57,6 +57,7 @@ Page({
for (let key in res.inquiry_list) { for (let key in res.inquiry_list) {
newArr.push(res.inquiry_list[key]) newArr.push(res.inquiry_list[key])
}; };
let nowDate = Date.parse(new Date()); let nowDate = Date.parse(new Date());
for (let i = 0; i < newArr.length; i++) { for (let i = 0; i < newArr.length; i++) {
let etime = newArr[i].add_time * 1000; let etime = newArr[i].add_time * 1000;
...@@ -106,7 +107,10 @@ Page({ ...@@ -106,7 +107,10 @@ Page({
if (res.errcode === 0) { if (res.errcode === 0) {
let newArr = []; let newArr = [];
if (me.data.xb == 1) { if (me.data.xb == 1) {
let currentTime = new Date().toLocaleDateString();
let currentTimeStap = new Date(currentTime + ' 23:59:59').getTime() / 1000;
for (let key in res.inquiry_list) { for (let key in res.inquiry_list) {
res.inquiry_list[key].current_time = currentTimeStap
newArr.push(res.inquiry_list[key]) newArr.push(res.inquiry_list[key])
} }
} else { } else {
...@@ -229,7 +233,7 @@ Page({ ...@@ -229,7 +233,7 @@ Page({
}) })
// } // }
}, },
toPrice:function(){ toPrice: function () {
if (judgeTokenNew()) { if (judgeTokenNew()) {
wx.navigateTo({ wx.navigateTo({
url: "/pages/tab/price/price" url: "/pages/tab/price/price"
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
<view class="h3 bold">暂无询报价信息</view> <view class="h3 bold">暂无询报价信息</view>
<view class="p" style="color:#61A0F2;padding:20rpx 0;" bindtap="toXj">您还可以发布询价。</view> <view class="p" style="color:#61A0F2;padding:20rpx 0;" bindtap="toXj">您还可以发布询价。</view>
</view> </view>
<priceItem price-list="{{priceList}}" wx:if="{{priceList&&priceList.length!==0}}" price-type="1" xb="{{xb}}"></priceItem> <priceItem price-list="{{priceList}}" wx:if="{{priceList&&priceList.length!==0}}" price-type="1" xb="{{xb}}" gq="{{true}}"></priceItem>
</view> </view>
</view> </view>
</view> </view>
......
...@@ -52,7 +52,10 @@ Page({ ...@@ -52,7 +52,10 @@ Page({
newArr = me.data.priceList; newArr = me.data.priceList;
} }
if (me.data.xb == 1){ if (me.data.xb == 1){
let currentTime = new Date().toLocaleDateString();
let currentTimeStap = new Date(currentTime + ' 23:59:59').getTime() / 1000;
for(let key in res.inquiry_list){ for(let key in res.inquiry_list){
res.inquiry_list[key].current_time = currentTimeStap
newArr.push(res.inquiry_list[key]) newArr.push(res.inquiry_list[key])
} }
}else{ }else{
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<text>快速发布询价</text> <text>快速发布询价</text>
</view> </view>
</view> </view>
<priceItem price-list="{{priceList}}" wx:if="{{priceList&&priceList.length!==0}}" price-type="1" xb="{{xb}}" ></priceItem> <priceItem price-list="{{priceList}}" wx:if="{{priceList&&priceList.length!==0}}" price-type="1" xb="{{xb}}" gq="{{true}}"></priceItem>
<view class="data-bottom row verCenter rowCenter" wx:if="{{isShowBottom}}"> <view class="data-bottom row verCenter rowCenter" wx:if="{{isShowBottom}}">
<text class="line"></text> <text class="line"></text>
<text class="text">我是有底线的</text> <text class="text">我是有底线的</text>
......
...@@ -382,7 +382,6 @@ const interval = (usedTime) => { ...@@ -382,7 +382,6 @@ const interval = (usedTime) => {
} }
const fourPoint = (num) => { //检测价格是否是数字或者是不大于四位小数点的小数 const fourPoint = (num) => { //检测价格是否是数字或者是不大于四位小数点的小数
let price = num.trim(); let price = num.trim();
console.log(price)
let reg = /^(([1-9][0-9]*)|(([0]\.\d{1,4}|[1-9][0-9]*\.\d{1,4})))$/; let reg = /^(([1-9][0-9]*)|(([0]\.\d{1,4}|[1-9][0-9]*\.\d{1,4})))$/;
if(!reg.test(price)){ if(!reg.test(price)){
tips('价格为整数或不超过4位小数'); tips('价格为整数或不超过4位小数');
...@@ -419,6 +418,39 @@ const reloginIm = (bool) => { ...@@ -419,6 +418,39 @@ const reloginIm = (bool) => {
} }
}) })
} }
//对月份进行处理
const doHandleMonth = (month) => {
let m = month;
if (month.toString().length == 1) {
m = "0" + month;
}
return m;
}
//获取当前时间的前几天或者后几天年月日
const getDay = (day) => {
let today = new Date();
let targetday_milliseconds = today.getTime() + 1000 * 60 * 60 * 24 * day;
today.setTime(targetday_milliseconds);
let tYear = today.getFullYear();
let tMonth = today.getMonth();
let tDate = today.getDate();
tMonth = doHandleMonth(tMonth + 1);
tDate = doHandleMonth(tDate);
return tYear + "-" + tMonth + "-" + tDate;
}
module.exports = { module.exports = {
getData: getData, getData: getData,
chooseImg: chooseImg, chooseImg: chooseImg,
...@@ -430,5 +462,6 @@ module.exports = { ...@@ -430,5 +462,6 @@ module.exports = {
matchReg: matchReg, matchReg: matchReg,
reloginIm: reloginIm, reloginIm: reloginIm,
fourPoint: fourPoint, fourPoint: fourPoint,
judgeTokenNew: judgeTokenNew judgeTokenNew: judgeTokenNew,
getDay: getDay
} }
\ 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