Commit 04b6c20b by 施宇

新增有效期

parent cbde107e
......@@ -24,6 +24,9 @@ Component({
},
isDelete: {//是否显示多选框
type: Boolean
},
gq: {//是否显示已过期
type:Boolean
}
},
......
......@@ -11,9 +11,14 @@
<text class="name ellipsis">{{item.goods_name||'--'}}</text>
</view>
<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="no-bj" wx:else>等待报价</text>
</block>
</block>
<text class="price" wx:else>
<block wx:if="{{!item.price||item.price=='0.00'||item.price=='0'}}">
未回复
......
......@@ -24,11 +24,11 @@
margin-right: 24rpx;
}
.price-item .name, .price-item .price, .price-item .num-bj,
.price-item .no-bj {
.price-item .no-bj,.price-item .gq {
font-weight: 600;
}
.price-item .num-bj,
.price-item .no-bj{
.price-item .no-bj,.price-item .gq {
font-size: 28rpx;
}
.price-item .num-bj{
......@@ -37,6 +37,9 @@
.price-item .no-bj{
color:#61A0F2;
}
.price-item .gq {
color:#686E73
}
.price-item .name, .price-item .company {
......
......@@ -26,6 +26,7 @@ Page({
isShowData: true,
isClick: "",
headPic: '',
gq:false,
},
/**
......@@ -44,12 +45,14 @@ Page({
this.getInfo();
if (type == 1) {
this.setData({
priceType: 5
priceType: 5,
gq:true
})
this.getListData(false, true);
} else {
this.setData({
priceType: 2
priceType: 2,
gq:false
});
};
getApp().globalData.bus.off('addFirstBj');
......@@ -297,7 +300,12 @@ Page({
newArr = me.data.priceList;
}
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]) {
if (str == 'inquiry_list'){
res[str][key].current_time = currentTimeStap
}
newArr.push(res[str][key])
}
} else {
......
......@@ -50,7 +50,7 @@
<text wx:else>当前信息不展示</text>
</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}}">
<text class="line"></text>
<text class="text">我是有底线的</text>
......
......@@ -3,7 +3,8 @@ import {
getData,
chooseImg,
tips,
fourPoint
fourPoint,
getDay
} from '../../../utils/util.js';
import {
apis
......@@ -22,6 +23,8 @@ Page({
isShowTip: true,
array: ['RMB','USD'],
date:"",
startTime: getDay(1),
endTime: getDay(365)
},
bindPickerChange: function (e) {
this.setData({
......@@ -46,7 +49,7 @@ Page({
tips('请填写数量');
return
} else if (isNaN(Number(obj.number.trim()))) {
tips('需求数量必须为数字');
tips('数量必须为数字');
return
} else {
if (!fourPoint(obj.price)) {
......@@ -61,12 +64,20 @@ Page({
return
}
}
if(!this.data.date){
tips('请填写询价有效期');
return
}
}
this.postData(obj);
},
postData: function(obj) {
let me = this;
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.currency = this.data.currency == 0?1:2;
obj.goods_images = this.data.imgUrl || '';
......
......@@ -72,18 +72,17 @@
<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">
<picker mode="date" value="{{date}}" start="{{startTime}}" end="{{endTime}}" bindchange="bindDateChange" class="form-item-right jz-item-right">
<text wx:if="{{date}}">{{date}}</text>
<block wx:else>
<text>请选择截止日期</text>
<image src="/res/images/icons/left-icon.png"></image>
</block>
</picker>
</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>
......
......@@ -38,6 +38,10 @@
</block>
</text>
</view>
<view class="yxq row">
<text class="t-com">询价有效期:</text>
<text class="c-com">{{topInfo.end_time_date}}</text>
</view>
<view class="bz row">
<text class="t-com">备注:</text>
<text class="c-com">{{topInfo.remark||'--'}}</text>
......
......@@ -101,3 +101,6 @@
padding-bottom:30rpx;
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({
for (let key in res.inquiry_list) {
newArr.push(res.inquiry_list[key])
};
let nowDate = Date.parse(new Date());
for (let i = 0; i < newArr.length; i++) {
let etime = newArr[i].add_time * 1000;
......@@ -106,7 +107,10 @@ Page({
if (res.errcode === 0) {
let newArr = [];
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) {
res.inquiry_list[key].current_time = currentTimeStap
newArr.push(res.inquiry_list[key])
}
} else {
......@@ -229,7 +233,7 @@ Page({
})
// }
},
toPrice:function(){
toPrice: function () {
if (judgeTokenNew()) {
wx.navigateTo({
url: "/pages/tab/price/price"
......
......@@ -67,7 +67,7 @@
<view class="h3 bold">暂无询报价信息</view>
<view class="p" style="color:#61A0F2;padding:20rpx 0;" bindtap="toXj">您还可以发布询价。</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>
......
......@@ -52,7 +52,10 @@ Page({
newArr = me.data.priceList;
}
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){
res.inquiry_list[key].current_time = currentTimeStap
newArr.push(res.inquiry_list[key])
}
}else{
......
......@@ -19,7 +19,7 @@
<text>快速发布询价</text>
</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}}">
<text class="line"></text>
<text class="text">我是有底线的</text>
......
......@@ -382,7 +382,6 @@ const interval = (usedTime) => {
}
const fourPoint = (num) => { //检测价格是否是数字或者是不大于四位小数点的小数
let price = num.trim();
console.log(price)
let reg = /^(([1-9][0-9]*)|(([0]\.\d{1,4}|[1-9][0-9]*\.\d{1,4})))$/;
if(!reg.test(price)){
tips('价格为整数或不超过4位小数');
......@@ -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 = {
getData: getData,
chooseImg: chooseImg,
......@@ -430,5 +462,6 @@ module.exports = {
matchReg: matchReg,
reloginIm: reloginIm,
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