Commit 7b21446e by 施宇

11

parent e19081f5
...@@ -43,10 +43,10 @@ App({ ...@@ -43,10 +43,10 @@ App({
closed: false, closed: false,
curOpenOpt: {}, curOpenOpt: {},
open(opt) { open(opt) {
/* wx.showLoading({ // /* wx.showLoading({
title: '正在初始化客户端...', // title: '正在初始化客户端...',
mask: true // mask: true
}) */ // }) */
this.curOpenOpt = opt; this.curOpenOpt = opt;
WebIM.conn.open(opt); WebIM.conn.open(opt);
this.closed = false; this.closed = false;
...@@ -67,9 +67,9 @@ App({ ...@@ -67,9 +67,9 @@ App({
success(res) { success(res) {
if(res.data){ if(res.data){
wx.switchTab({ // wx.switchTab({
url: '/pages/tab/home/home' // url: '/pages/tab/home/home'
}); // });
} }
} }
......
...@@ -32,6 +32,7 @@ Component({ ...@@ -32,6 +32,7 @@ Component({
emitevent: function (e) { emitevent: function (e) {
let token = wx.getStorageSync('access_token'); let token = wx.getStorageSync('access_token');
let inquiryItemsId = e.currentTarget.dataset.inquiryitemsid; let inquiryItemsId = e.currentTarget.dataset.inquiryitemsid;
let goodId = e.currentTarget.dataset.goodid;
let offerId = e.currentTarget.dataset.offerid; let offerId = e.currentTarget.dataset.offerid;
let xb = e.currentTarget.dataset.xb; let xb = e.currentTarget.dataset.xb;
let type = e.currentTarget.dataset.type;//1代表询价 2代表报价 3代表商品 let type = e.currentTarget.dataset.type;//1代表询价 2代表报价 3代表商品
...@@ -48,8 +49,10 @@ Component({ ...@@ -48,8 +49,10 @@ Component({
}) })
} }
} else if (priceType == 2){ } else if (priceType == 2){//搜索页面商品跳转
wx.navigateTo({
url: "/pages/detail/good/index?goodId=" + goodId + '&type=2'
})
} else if (priceType == 3) { } else if (priceType == 3) {
if (type == 1) { if (type == 1) {
wx.navigateTo({ wx.navigateTo({
...@@ -57,9 +60,15 @@ Component({ ...@@ -57,9 +60,15 @@ Component({
}) })
} else if (type == 2) { } else if (type == 2) {
wx.navigateTo({ wx.navigateTo({
url: "/pages/list/bj/index?inquiryItemsId=" + inquiryItemsId + '&offerId=' + offerId url: "/pages/detail/xj/index?inquiryItemsId=" + inquiryItemsId + '&offerId=' + offerId
}) })
} }
}else if(priceType == 4){
} else if (priceType ==5){//tab页商品跳转
wx.navigateTo({
url: "/pages/detail/good/index?goodId=" + goodId + '&type=1'
})
} }
} else { } else {
wx.showToast({ wx.showToast({
......
<!--components/priceItem/priceItem.wxml--> <!--components/priceItem/priceItem.wxml-->
<wxs module="dateUtil" src="../../utils/timeUtil.wxs"></wxs>
<block> <block>
<wxs module="dateUtil" src="../../utils/timeUtil.wxs"></wxs>
<!-- 询报价展示 --> <!-- 询报价展示 -->
<block wx:if="{{priceType==1}}"> <block wx:if="{{priceType==1}}">
<view class="price-item" wx:for="{{priceList}}" wx:key="*this" bindtap="emitevent" data-inquiryitemsid="{{item['inquiry_items_id']}}" data-offerid="{{item['offer_id']}} " data-type="{{xb}}" data-pricetype="1"> <view class="price-item" wx:for="{{priceList}}" wx:key="*this" bindtap="emitevent" data-inquiryitemsid="{{item['inquiry_items_id']}}" data-offerid="{{item['offer_id']}} " data-type="{{xb}}" data-pricetype="1">
<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>
...@@ -40,29 +40,43 @@ ...@@ -40,29 +40,43 @@
</block> </block>
<!-- 搜索页的商品展示 --> <!-- 搜索页的商品展示 -->
<block wx:if="{{priceType==2}}"> <block wx:if="{{priceType==2}}">
<view class="price-item" wx:for="{{priceList}}" wx:key="*this" bindtap="emitevent"> <view class="price-item" wx:for="{{priceList}}" wx:key="*this" bindtap="emitevent" data-goodid="{{item.goods_id}}" data-pricetype="2">
<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 bao" wx:if="{{item.type==1}}">贸易商</text> <text class="mark bao">
<text class="mark bao" wx:elif="{{item.type==2}}">代理商</text> <block wx:if="{{item.company_type!=''}}">
<text class="mark bao" wx:else>原厂</text> <block wx:if="{{item.company_type==1}}">贸易商</block>
<text class="company ellipsis">{{item.company}}</text> <block wx:elif="{{item.company_type==2}}">代理商</block>
<block wx:elif="{{item.company_type==3}}">原厂</block>
<block wx:elif="{{item.company_type==4}}">制造商</block>
<block wx:elif="{{item.company_type==5}}">个人用户</block>
</block>
<block wx:else>--</block>
</text>
<text class="company ellipsis">{{item.company_name || '--'}}</text>
</view> </view>
<text class="time">{{item.time}}</text> <text class="time">{{dateUtil.dateFormat(item.update_time*1000)}}</text>
</view> </view>
<view class="item-middle row verCenter bothSide item-middle2 nowrap"> <view class="item-middle row verCenter bothSide item-middle2 nowrap">
<text class="name ellipsis">{{item.name}}</text> <text class="name ellipsis">{{item.goods_name}}</text>
<text class="price">¥{{item.price}}</text> <text class="price">
<block wx:if="{{item.currency == 1}}">
¥{{item.price}}
</block>
<block wx:else>
${{item.price}}
</block>
</text>
</view> </view>
<view class="item-footer row verCenter nowrap"> <view class="item-footer row verCenter nowrap">
<text class="brand ellipsis"><text>品牌:</text>{{item.brand}}</text> <text class="brand ellipsis"><text>品牌:</text>{{item.brand_name}}</text>
<text class="num bold"><text class="nobold">库存:</text>{{item.num}}PCS</text> <text class="num"><text>库存:</text>{{item.stock}} PCS</text>
</view> </view>
</view> </view>
</block> </block>
<!-- 搜索页面询报价展示 --> <!-- 搜索页面询报价展示 -->
<block wx:if="{{priceType==3}}"> <block wx:if="{{priceType==3}}">
<view class="price-item" wx:for="{{priceList}}" wx:key="*this" bindtap="emitevent" data-inquiryitemsid="{{item['inquiry_items_id']}}" data-offerid="{{item['offer_id']}} " data-type="{{xb}}" data-pricetype="3"> <view class="price-item" wx:for="{{priceList}}" wx:key="*this" bindtap="emitevent" data-inquiryitemsid="{{item['inquiry_items_id']}}" data-offerid="{{item['offer_id']}} " data-type="{{xb}}" data-pricetype="3">
<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>
...@@ -123,8 +137,8 @@ ...@@ -123,8 +137,8 @@
</view> </view>
</block> </block>
<!-- 商品管理 --> <!-- 商品管理 -->
<block wx:if="{{priceType == 5}}"> <block wx:if="{{priceType == 5}}" >
<view class="price-item" wx:for="{{priceList}}" wx:key="*this" bindtap="emitevent"> <view class="price-item" wx:for="{{priceList}}" wx:key="*this" bindtap="emitevent" data-goodid="{{item.goods_id}}" data-pricetype="5">
<view class="item-header row verCenter bothSide nowrap"> <view class="item-header row verCenter bothSide nowrap">
<view class="row verCenter"> <view class="row verCenter">
<text class="name ellipsis good-name">{{item.goods_name}}</text> <text class="name ellipsis good-name">{{item.goods_name}}</text>
......
// pages/detail/good/index.js // pages/detail/good/index.js
import { getData } from '../../../utils/util.js';
import { apis } from '../../../utils/api.js';
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
info: null,
editOrShow:-1,//1编辑 2在线沟通
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
let goodId = options.goodId || '';
let type = options.type||'';
this.getData(goodId,type)
},
getData: function (goodId, type) {
let me = this;
let token = wx.getStorageSync('access_token');
let url = "";
if (type == 1) {
url = apis.goodsInfo;
} else if (type == 2) {
url = apis.goodsSearch;
} else {
return;
}
getData(url, 'get', {
"goods_id/eq": goodId,
"token": token,
}, function (res) {
if (res.errcode == 0) {
if (res.total == 0) {
me.setData({
info: {}
})
} else {
let userId = wx.getStorageSync('user_id');
let targetId = res.goods_list[goodId]['user_id'];
if(type == 1){
me.setData({
editOrShow: 1
})
}else if(type == 2){
if (userId == targetId) {
me.setData({
editOrShow: 1
})
} else {
me.setData({
editOrShow: 2
})
}
}
me.setData({
info: res.goods_list[goodId]
})
}
} else {
me.setData({
info: {}
})
}
}, true)
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
......
<!--pages/detail/good/index.wxml--> <!--pages/detail/good/index.wxml-->
<wxs module="dateUtil" src="../../../utils/timeUtil.wxs"></wxs>
<view class="detail-view"> <view class="detail-view">
<view class="t-desc"> <view class="t-desc">
<view class="top row bothSide verCenter"> <view class="t-desc-content" wx:if="{{info}}">
<view class="company row verCenter"> <view class="top row bothSide verCenter">
<text class="name bold">深圳市德卡科技股份有限公司深圳</text> <view class="company row verCenter">
</view> <text class="name bold">{{info.company_name||'--'}}</text>
<text class="icon iconfont iconiconxiantiaoshouji6"></text> </view>
</view> <text class="icon iconfont iconiconxiantiaoshouji6"></text>
<view class="bottom row">
<view class="yes">
<text class="icon iconfont iconiconxiantiaoshouji11"></text>
<text>公司认证</text>
</view> </view>
<view class="yes"> <view class="bottom row">
<text class="icon iconfont iconiconxiantiaoshouji11"></text> <view class="yes" wx:if="{{info.auth_type!=''}}">
<text>贸易商</text> <text class="icon iconfont iconiconxiantiaoshouji11"></text>
<text>
<block wx:if="{{info.auth_type==0}}">未认证</block>
<block wx:elif="{{info.auth_type==1}}">个人认证</block>
<block wx:elif="{{info.auth_type==2}}">企业认证</block>
</text>
</view>
<view class="yes" wx:if="{{info.company_type!=''}}">
<text class="icon iconfont iconiconxiantiaoshouji11"></text>
<text>
<block wx:if="{{info.company_type==1}}">贸易商</block>
<block wx:elif="{{info.company_type==2}}">代理商</block>
<block wx:elif="{{info.company_type==3}}">原厂</block>
<block wx:elif="{{info.company_type==4}}">制造商</block>
<block wx:elif="{{info.company_type==5}}">个人用户</block>
</text>
</view>
</view> </view>
</view> </view>
</view> </view>
<view class="xb-com-content"> <view class="xb-com-content">
<view class="title row bothSide verCenter nowrap px-hr-bottom"> <view wx:if="{{info}}">
<text class="name bold ellipsis">STM32F407ZGT6STM32F407ZGT6STM32F407ZGT6</text> <view class="title row bothSide verCenter nowrap px-hr-bottom">
<text class="price bold">¥100.0120</text> <text class="name bold ellipsis">{{info.goods_name}}</text>
</view> <text class="price bold">
<view class="desc row bothSide"> <block wx:if="{{info.currency == 1}}">¥{{info.price}}</block>
<view class="left"> <block wx:else>${{info.price}}</block>
<view class="brand row"> </text>
<text class="t-com">品牌:</text> </view>
<text class="c-com">Texas Instruments</text> <view class="desc row bothSide">
</view> <view class="left">
<view class="fz row"> <view class="brand row">
<text class="t-com">封装:</text> <text class="t-com">品牌:</text>
<text class="c-com">LQFP-64</text> <text class="c-com">{{info.brand_name}}</text>
</view> </view>
<view class="hq row"> <view class="fz row">
<text class="t-com">货期:</text> <text class="t-com">封装:</text>
<text class="c-com">现货</text> <text class="c-com">{{info.encap}}</text>
</view> </view>
<view class="num row"> <view class="hq row">
<text class="t-com">库存:</text> <text class="t-com">货期:</text>
<text class="c-com bold">100,000 PCS</text> <text class="c-com">{{info.delivery_time}}</text>
</view> </view>
<view class="bjsj row"> <view class="num row">
<text class="t-com">更新时间:</text> <text class="t-com">库存:</text>
<text class="c-com">2019-05-10 10:15</text> <text class="c-com bold">{{info.stock}} PCS</text>
</view>
<view class="bjsj row">
<text class="t-com">更新时间:</text>
<text class="c-com">{{dateUtil.dateFormat(info.update_time*1000)}}</text>
</view>
</view> </view>
<cover-image class="right" src="{{info.goods_images?info.goods_images:'/res/images/imgs/iclogo.png'}}"></cover-image>
</view> </view>
<cover-image class="right" src="/res/images/imgs/iclogo.png"></cover-image>
</view> </view>
</view> </view>
<!-- <view class="zxgt btn-com btn-com-y"> <view class="zxgt btn-com btn-com-y" wx:if="{{editOrShow==2}}">
<text class="icon iconfont iconiconxiantiaoshouji11"></text> <text class="icon iconfont iconiconxiantiaoshouji11"></text>
<text class="gt-t">在线沟通</text> <text class="gt-t">在线沟通</text>
</view> --> </view>
<view class="zxgt btn-com btn-com-b"> <view class="zxgt btn-com btn-com-b" wx:if="{{editOrShow==1}}">
<text class="gt-t">编辑商品</text> <text class="gt-t">编辑商品</text>
</view> </view>
</view> </view>
\ No newline at end of file
// pages/detail/xj/index.js // pages/detail/xj/index.js
import { getData } from '../../../utils/util.js';
import { apis } from '../../../utils/api.js';
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
info: null
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
let inquiryItemsId = options.inquiryItemsId || '';
}, let offerId = options.offerId || '';
this.getData(inquiryItemsId, offerId)
},
getData: function (inquiryItemsId, offerId) {
let me = this;
let token = wx.getStorageSync('access_token');
getData(apis.inquiryMyOffer, 'get', {
"offer_id/eq": offerId,
"inquiry_items_id/eq": inquiryItemsId,
"token": token,
}, function (res) {
if (res.errcode == 0) {
if (res.total == 0) {
me.setData({
info: {}
})
} else {
me.setData({
info: res.data[0]
})
}
} else {
me.setData({
info: {}
})
}
}, true)
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
......
<!--pages/detail/xj/index.wxml--> <!--pages/detail/xj/index.wxml-->
<wxs module="dateUtil" src="../../../utils/timeUtil.wxs"></wxs>
<view class="detail-view"> <view class="detail-view">
<view class="t-desc"> <view class="t-desc">
<view class="top row bothSide verCenter"> <view class="t-desc-content" wx:if="{{info}}">
<view class="company row verCenter"> <view class="top row bothSide verCenter">
<text class="bao">报价</text> <view class="company row verCenter">
<text class="name bold">深圳市德卡科技股份有限公司深圳</text> <text class="bao">报价</text>
<text class="name bold">{{info.company_name||'--'}}</text>
</view>
<text class="icon iconfont iconiconxiantiaoshouji6"></text>
</view> </view>
<text class="icon iconfont iconiconxiantiaoshouji6"></text>
</view> <view class="bottom row">
<view class="bottom row"> <view class="yes" wx:if="{{info.auth_type!=''}}">
<view class="yes"> <text class="icon iconfont iconiconxiantiaoshouji11"></text>
<text class="icon iconfont iconiconxiantiaoshouji11"></text> <text>
<text>公司认证</text> <block wx:if="{{info.auth_type==0}}">未认证</block>
</view> <block wx:elif="{{info.auth_type==1}}">个人认证</block>
<view class="yes"> <block wx:elif="{{info.auth_type==2}}">企业认证</block>
<text class="icon iconfont iconiconxiantiaoshouji11"></text> </text>
<text>贸易商</text> </view>
<view class="yes" wx:if="{{info.company_type!=''}}">
<text class="icon iconfont iconiconxiantiaoshouji11"></text>
<text>
<block wx:if="{{info.company_type==1}}">贸易商</block>
<block wx:elif="{{info.company_type==2}}">代理商</block>
<block wx:elif="{{info.company_type==3}}">原厂</block>
<block wx:elif="{{info.company_type==4}}">制造商</block>
<block wx:elif="{{info.company_type==5}}">个人用户</block>
</text>
</view>
</view> </view>
</view> </view>
</view> </view>
<view class="xb-com-content"> <view class="xb-com-content">
<view class="title row bothSide verCenter nowrap px-hr-bottom"> <view wx:if="{{info}}">
<text class="name bold ellipsis">STM32F407ZGT6STM32</text> <view class="title row bothSide verCenter nowrap px-hr-bottom">
<text class="price bold">¥100.0120</text> <text class="name bold ellipsis">{{info.goods_name}}</text>
</view> <text class="price bold">
<view class="desc desc-xj-detail"> <block wx:if="{{info.currency == 1}}">¥{{info.price}}</block>
<view class="brand row"> <block wx:else>${{info.price}}</block>
<text class="t-com">品牌:</text> </text>
<text class="c-com">Texas Instruments</text>
</view>
<view class="fz row">
<text class="t-com">封装:</text>
<text class="c-com">LQFP-64</text>
</view>
<view class="num row">
<text class="t-com">数量:</text>
<text class="c-com bold">100,000 PCS</text>
</view>
<view class="hq row">
<text class="t-com">货期:</text>
<text class="c-com">现货</text>
</view>
<view class="bz row">
<text class="t-com">备注:</text>
<text class="c-com">有货的请尽快回复,比较急着要货</text>
</view> </view>
<view class="bjsj row"> <view class="desc desc-xj-detail">
<text class="t-com">报价时间:</text> <view class="brand row">
<text class="c-com">2019-05-10 10:15</text> <text class="t-com">品牌:</text>
<text class="c-com">{{info.brand_name}}</text>
</view>
<view class="fz row">
<text class="t-com">封装:</text>
<text class="c-com">{{info.encap}}</text>
</view>
<view class="num row">
<text class="t-com">数量:</text>
<text class="c-com bold">{{info.number}} PCS</text>
</view>
<view class="hq row">
<text class="t-com">货期:</text>
<text class="c-com">{{info.delivery_time}}</text>
</view>
<view class="bz row">
<text class="t-com">备注:</text>
<text class="c-com">{{info.remark||'--'}}</text>
</view>
<view class="bjsj row">
<text class="t-com">报价时间:</text>
<text class="c-com">{{dateUtil.dateFormat(info.add_time*1000)}}</text>
</view>
</view> </view>
</view> </view>
</view> </view>
<view class="zxgt btn-com btn-com-y"> <view class="zxgt btn-com btn-com-y" wx:if="{{info}}">
<text class="icon iconfont iconiconxiantiaoshouji11"></text> <text class="icon iconfont iconiconxiantiaoshouji11"></text>
<text class="gt-t">在线沟通</text> <text class="gt-t">在线沟通</text>
</view> </view>
......
...@@ -5,7 +5,9 @@ Page({ ...@@ -5,7 +5,9 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
key: "",
historyList:[],
rmList:[]
}, },
/** /**
...@@ -63,9 +65,30 @@ Page({ ...@@ -63,9 +65,30 @@ Page({
onShareAppMessage: function () { onShareAppMessage: function () {
}, },
confirmTap:function(){ bindKeyInput: function (e) {
wx.navigateTo({ this.setData({
url: "/pages/search/result/index", key: e.detail.value
}) })
},
confirmTap: function () {
let val = this.data.key;
if (!val.length) {
wx.showToast({
title: '搜索内容不能为空',
icon: 'none',
duration: 2000
});
} else if (val.length < 3) {
wx.showToast({
title: '请至少输入3个字符',
icon: 'none',
duration: 2000
});
} else {
wx.navigateTo({
url: "/pages/search/result/index?key="+val
})
}
} }
}) })
\ No newline at end of file
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
<view class="search-view"> <view class="search-view">
<view class="search-com"> <view class="search-com">
<text class="icon iconfont iconiconxiantiaoshouji8"></text> <text class="icon iconfont iconiconxiantiaoshouji8"></text>
<input placeholder='请输入芯片型号' placeholder-class="placeholderClass" auto-focus bindconfirm="confirmTap"></input> <input placeholder='请输入芯片型号' placeholder-class="placeholderClass" auto-focus bindconfirm="confirmTap" bindinput="bindKeyInput"></input>
</view> </view>
<view class="rm_search"> <view class="rm_search" wx:if="{{rmList.length}}">
<text class="title beforeLine">热门搜索</text> <text class="title beforeLine">热门搜索</text>
<view class="rm_ls_content row"> <view class="rm_ls_content row" >
<view class="search-item">LM358</view> <view class="search-item">LM358</view>
<view class="search-item">TJA1027</view> <view class="search-item">TJA1027</view>
<view class="search-item">贴片电阻330k</view> <view class="search-item">贴片电阻330k</view>
...@@ -15,10 +15,10 @@ ...@@ -15,10 +15,10 @@
<view class="search-item">ECW-FA2J155J</view> <view class="search-item">ECW-FA2J155J</view>
</view> </view>
</view> </view>
<view class="ls_search"> <view class="ls_search" wx:if="{{historyList.length}}">
<view class="title_view row bothSide verCenter"> <view class="title_view row bothSide verCenter">
<text class="title beforeLine">搜索历史</text> <text class="title beforeLine">搜索历史</text>
<text class="icon iconfont iconiconxiantiaoshouji7"></text> <text class="icon iconfont iconiconxiantiaoshouji7" ></text>
</view> </view>
<view class="rm_ls_content row"> <view class="rm_ls_content row">
<view class="search-item">LM358</view> <view class="search-item">LM358</view>
......
// pages/searchresult/index.js // pages/searchresult/index.js
let arr = [ import { getData } from '../../../utils/util.js';
{ import { apis } from '../../../utils/api.js';
type: 2,
name: "STM32F407ZGT6",
price: "100.012",
brand: "Texas InstrumentsTexas",
num: "100,000",
desc: "深圳地区原装现货深圳地区原装现货",
time: "05-10 10:15",
company:"深圳市猎芯科技有限公司"
},
{
type: 1,
name: "STM32F407ZGT6",
price: "100.012",
brand: "Texas InstrumentsTexas",
num: "100,000",
desc: "深圳地区原装现货深圳地区原装现货",
time: "05-10 10:15",
company: "朗新科技股份有限公司"
},
{
type: 3,
name: "STM32F407ZGT6",
price: "100.012",
brand: "Texas InstrumentsTexas",
num: "100,000",
desc: "深圳地区原装现货深圳地区原装现货",
time: "05-10 10:15",
company: "深圳邦马特科技有限公司"
}
];
let arr1 = [{
company: "深圳邦马特科技有限公司深圳邦马特科技有限公司深圳邦马特科技有限公司",
time: "05-10 10:15",
name: "STM32F407ZGT6",
count:5,
brand: "Texas InstrumentsTexasInstrumentsTexasInstrumentsTexasInstrumentsTexas",
num: "100,00000",
desc: "深圳地区原装现货深圳地区原装现货深圳地区原装现货深圳地区原装现货",
}, {
company: "深圳邦马特科技有限公司",
time: "05-10 10:15",
name: "STM32F407ZGT6",
count: 5,
brand: "Texas InstrumentsTexas",
num: "100,000",
desc: "深圳地区原装现货深圳地区原装现货",
}, {
company: "深圳邦马特科技有限公司",
time: "05-10 10:15",
name: "STM32F407ZGT6",
count: 5,
brand: "Texas InstrumentsTexas",
num: "100,000",
desc: "深圳地区原装现货深圳地区原装现货",
}, {
company: "深圳邦马特科技有限公司",
time: "05-10 10:15",
name: "STM32F407ZGT6",
count: 5,
brand: "Texas InstrumentsTexas",
num: "100,000",
desc: "深圳地区原装现货深圳地区原装现货",
}]
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
priceList: undefined, priceList: null,
isGet: false, tabIndex: 1,
tabIndex:1, type: 2,
type:2 limit: 10,//每页的条数
p: 1,//当前页面
total: 1,
key: "",
confirmKey:"",
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
let seft = this; let key = options.key;
this.setData({
key: key,
confirmKey:key
});
this.getData()
wx.showLoading({ },
title: '加载中', bindKeyInput: function (e) {
this.setData({
key: e.detail.value
}) })
setTimeout(() => {
wx.hideLoading()
seft.setData({ priceList: [] })
}, 2000)
}, },
bindKeyConfirm: function () {
let val = this.data.key;
if (!val.length) {
wx.showToast({
title: '搜索内容不能为空',
icon: 'none',
duration: 2000
});
} else if (val.length < 3) {
wx.showToast({
title: '请至少输入3个字符',
icon: 'none',
duration: 2000
});
} else {
this.setData({
priceList: null,
p: 1,
total: 1,
confirmKey: val
});
this.getData()
}
},
getData: function () {
let me = this;
let url, token = wx.getStorageSync('access_token');
let str = "";
let params = {
offset: me.data.limit,
p: me.data.p,
"goods_name/like": me.data.confirmKey
};
if (me.data.tabIndex == 1) {
url = apis.goodsSearch
str = "goods_list"
} else {
url = apis.inquirySearch;
str = "inquiry_list"
}
if (token) {
params.token = token
}
getData(url, 'get', params, function (res) {
if (res.errcode === 0) {
let newArr = [];
if (me.data.p > 1) {
newArr = me.data.priceList;
}
for (let key in res[str]) {
newArr.push(res[str][key])
}
me.setData({
priceList: newArr,
total: res.total,
});
} else {
if (me.data.p == 1) {
me.setData({
priceList: []
})
}
}
}, true)
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
...@@ -135,20 +139,21 @@ Page({ ...@@ -135,20 +139,21 @@ Page({
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom: function () { onReachBottom: function () {
if (this.data.isGet) { let allPage = Math.ceil(this.data.total / this.data.limit);
let p = this.data.p;
if (p == allPage) {
wx.showToast({
title: '数据到底啦',
icon: 'none',
duration: 2000
});
return return
} else { } else {
wx.showLoading({ this.setData({
title: '加载中', p: p + 1
}) });
this.setData({ isGet: true }); console.log(this.data.p)
let arr = this.data.priceList.concat(this.data.priceList); this.getData();
let seft = this;
setTimeout(() => {
wx.hideLoading();
seft.setData({ priceList: arr, isBottom: false, isGet: false })
}, 2000)
} }
}, },
...@@ -158,33 +163,39 @@ Page({ ...@@ -158,33 +163,39 @@ Page({
onShareAppMessage: function () { onShareAppMessage: function () {
}, },
switchTab:function(e){ switchTab: function (e) {
let i = e.currentTarget.dataset.index; let i = e.currentTarget.dataset.index;
if(i == this.data.tabIndex){ if (i == this.data.tabIndex) {
return return
}else{ } else {
if(i == 1){ this.setData({
priceList: null,
p: 1,
total: 1,
tabIndex: i,
})
if (i == 1) {
this.setData({ this.setData({
tabIndex: i,
priceList: arr,
type: 2 type: 2
}); });
}else{ } else {
this.setData({ this.setData({
tabIndex: i, type: 3,
priceList: arr1,
type: 3
}); });
} }
this.getData();
} }
}, },
toXj:function(){ toXj: function () {
wx.navigateTo({ wx.navigateTo({
url: "/pages/form/xj/index" url: "/pages/form/xj/index"
}) })
},
toSp: function () {
wx.navigateTo({
url: "/pages/form/good/index"
})
} }
}) })
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<view class="searchresult-view"> <view class="searchresult-view">
<view class="search-com"> <view class="search-com">
<text class="icon iconfont iconiconxiantiaoshouji8"></text> <text class="icon iconfont iconiconxiantiaoshouji8"></text>
<input placeholder='请输入芯片型号' placeholder-class="placeholderClass" bindtap="toSearch"></input> <input placeholder='请输入芯片型号' placeholder-class="placeholderClass" value="{{key}}" bindinput="bindKeyInput" bindconfirm="bindKeyConfirm"></input>
</view> </view>
<view class="switch-tab-com row"> <view class="switch-tab-com row">
<view bindtap="switchTab" class="{{tabIndex == 1&&'active'}}" data-index="1"> <view bindtap="switchTab" class="{{tabIndex == 1&&'active'}}" data-index="1">
...@@ -18,17 +18,32 @@ ...@@ -18,17 +18,32 @@
<view wx:if="{{priceList&&priceList.length==0}}" class="nodata"> <view wx:if="{{priceList&&priceList.length==0}}" class="nodata">
<cover-image src="/res/images/imgs/nodata.png" class="img"></cover-image> <cover-image src="/res/images/imgs/nodata.png" class="img"></cover-image>
<view class="h3 bold">未搜索到相关信息</view> <view class="h3 bold">未搜索到相关信息</view>
<view class="p">您还可以发布询价。</view> <view class="p">
<view class="nodata_fb btn-com btn-com-b" bindtap="toXj"> <text wx:if="{{tabIndex == 2}}">您还可以发布询价。</text>
<text wx:if="{{tabIndex == 1}}">您还可以新增商品。</text>
</view>
<view class="nodata_fb btn-com btn-com-b" bindtap="toXj" wx:if="{{tabIndex == 2}}">
<text>快速发布询价</text> <text>快速发布询价</text>
</view> </view>
<view class="nodata_fb btn-com btn-com-b" bindtap="toSp" wx:if="{{tabIndex == 1}}">
<text class="icon iconfont iconiconxiantiaoshouji15"></text>
<text>新增商品</text>
</view>
</view> </view>
<priceItem price-list="{{priceList}}" wx:if="{{priceList&&priceList.length!==0}}" price-type="{{type}}" xb="1"></priceItem> <priceItem price-list="{{priceList}}" wx:if="{{priceList&&priceList.length!==0}}" price-type="{{type}}" xb="1"></priceItem>
</view> </view>
<view class="fast_fb btn-com btn-com-b" wx:if="{{priceList&&priceList.length!==0}}" bindtap="toXj"> <view class="fast_fb_view" wx:if="{{priceList&&priceList.length!==0&&tabIndex == 2}}">
<text>快速发布询价</text> <view class="fast_fb btn-com btn-com-b" bindtap="toXj">
<text>快速发布询价</text>
</view>
</view>
<view class="fast_fb_view" wx:if="{{priceList&&priceList.length!==0&&tabIndex == 1}}">
<view class="fast_fb btn-com btn-com-b" bindtap="toSp">
<text class="icon iconfont iconiconxiantiaoshouji15"></text>
<text>新增商品</text>
</view>
</view> </view>
<view class="concat_custom" wx:if="{{priceList&&priceList.length==0}}"> <view class="concat_custom" wx:if="{{priceList&&priceList.length==0&&tabIndex == 2}}">
<text class="icon iconfont iconiconxiantiaoshouji11"></text> <text class="icon iconfont iconiconxiantiaoshouji11"></text>
<text>联系客服帮您找</text> <text>联系客服帮您找</text>
</view> </view>
......
...@@ -3,14 +3,26 @@ ...@@ -3,14 +3,26 @@
.searchresult-view { .searchresult-view {
min-height: 100%; min-height: 100%;
position: relative; position: relative;
padding-bottom: 234rpx;
box-sizing: border-box; box-sizing: border-box;
padding:174rpx 0 158rpx;
} }
.searchresult-view .search-com, .searchresult-view .switch-tab-com {
position: fixed;
top: 0;
left: 0;
right: 0;
background-color: #fff;
z-index: 2;
}
.searchresult-view .switch-tab-com {
top: 86rpx;
/* border-bottom:1px solid #f5f9fc; */
}
.fast_fb { .fast_fb {
position: absolute; margin-top:20rpx;
bottom: 68rpx;
left:0;
right:0;
} }
.nodata .p { .nodata .p {
...@@ -18,7 +30,16 @@ ...@@ -18,7 +30,16 @@
} }
.nodata_fb { .nodata_fb {
margin-top:40rpx; margin-top: 40rpx;
}
.fast_fb_view {
position: fixed;
left: 0;
bottom: 0;
right: 0;
background-color: #fff;
height: 158rpx;
} }
.concat_custom { .concat_custom {
...@@ -27,12 +48,17 @@ ...@@ -27,12 +48,17 @@
left: 0; left: 0;
right: 0; right: 0;
text-align: center; text-align: center;
color:#61A0F2; color: #61a0f2;
font-size: 28rpx; font-size: 28rpx;
} }
.concat_custom .icon{
.concat_custom .icon {
font-size: 40rpx; font-size: 40rpx;
margin-right:16rpx; margin-right: 16rpx;
vertical-align: sub; vertical-align: sub;
} }
.nodata_fb .icon,.fast_fb .icon {
margin-right: 8rpx;
font-size: 32rpx;
}
\ No newline at end of file
// pages/tab/home/home.js // pages/tab/home/home.js
let arr = [
{
type: 2,
name: "STM32F407ZGT6STM32F407ZGT6",
price: "100.012",
brand: "Texas InstrumentsTexasInstrumentsTexas",
num: "100,000",
desc: "深圳地区原装现货深圳地区原装现货深圳地区原装现货深圳地区原装现货",
time: "05-10 10:15"
},
{
type: 1,
name: "STM32F407ZGT6",
price: "100.012",
brand: "Texas InstrumentsTexas",
num: "100,000",
desc: "深圳地区原装现货深圳地区原装现货",
time: "05-10 10:15"
},
{
type: 2,
name: "STM32F407ZGT6",
price: "100.012",
brand: "Texas InstrumentsTexas",
num: "100,000",
desc: "深圳地区原装现货深圳地区原装现货",
time: "05-10 10:15"
},
{
type: 1,
name: "STM32F407ZGT6",
price: "100.012",
brand: "Texas InstrumentsTexas",
num: "100,000",
desc: "深圳地区原装现货深圳地区原装现货",
time: "05-10 10:15"
}
]
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
priceList: undefined, priceList: null,
isGet:false, xjList:null,
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
let seft = this;
wx.showLoading({
title: '加载中',
})
setTimeout(()=>{
wx.hideLoading()
seft.setData({ priceList: arr })
},2000)
}, },
/** /**
...@@ -106,21 +57,7 @@ Page({ ...@@ -106,21 +57,7 @@ Page({
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom: function () { onReachBottom: function () {
if(this.data.isGet){
return
}else{
wx.showLoading({
title: '加载中',
})
this.setData({ isGet: true });
let arr = this.data.priceList.concat(this.data.priceList);
let seft = this;
setTimeout(() => {
wx.hideLoading();
seft.setData({ priceList: arr, isBottom: false, isGet:false })
}, 2000)
}
}, },
/** /**
......
...@@ -37,11 +37,6 @@ ...@@ -37,11 +37,6 @@
<text class="adv-num ellipsis">STM32F103CR22DSTM32F103CR22DSTM32F103CR22DSTM32F103CR22DSTM32F103CR22D</text> <text class="adv-num ellipsis">STM32F103CR22DSTM32F103CR22DSTM32F103CR22DSTM32F103CR22DSTM32F103CR22D</text>
<text class="adv-time">2分钟前</text> <text class="adv-time">2分钟前</text>
</view> </view>
<view class="adv row verCenter">
<text class="adv-mark">询价</text>
<text class="adv-num ellipsis">STM32F103CR22D</text>
<text class="adv-time">2分钟前</text>
</view>
</view> </view>
<view class="more-item"> <view class="more-item">
<text class="icon iconfont iconiconxiantiaoshouji6"></text> <text class="icon iconfont iconiconxiantiaoshouji6"></text>
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
"list": [] "list": []
}, },
"miniprogram": { "miniprogram": {
"current": 2, "current": 6,
"list": [ "list": [
{ {
"id": -1, "id": -1,
...@@ -70,6 +70,34 @@ ...@@ -70,6 +70,34 @@
"pathName": "pages/list/xj/index", "pathName": "pages/list/xj/index",
"query": "inquiryItemsId=156327106368454", "query": "inquiryItemsId=156327106368454",
"scene": null "scene": null
},
{
"id": -1,
"name": "pages/detail/xj/index",
"pathName": "pages/detail/xj/index",
"query": "inquiryItemsId=156335056150058&offerId=156335275965152 ",
"scene": null
},
{
"id": -1,
"name": "pages/search/index/index",
"pathName": "pages/search/index/index",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/search/result/index",
"pathName": "pages/search/result/index",
"query": "key=lm358&type=1",
"scene": null
},
{
"id": -1,
"name": "pages/detail/good/index",
"pathName": "pages/detail/good/index",
"query": "goodId=156039271518289&type=2",
"scene": null
} }
] ]
} }
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
color: #fff; color: #fff;
font-size: 26rpx; font-size: 26rpx;
padding: 24rpx 24rpx 62rpx; padding: 24rpx 24rpx 62rpx;
min-height: 132rpx;
box-sizing: border-box;
} }
.company { .company {
...@@ -43,6 +45,7 @@ ...@@ -43,6 +45,7 @@
.xb-com-content { .xb-com-content {
top: -22rpx; top: -22rpx;
min-height: 400rpx;
} }
.xb-com-content .desc { .xb-com-content .desc {
...@@ -52,12 +55,15 @@ ...@@ -52,12 +55,15 @@
.xb-com-content .desc .left .bjsj .t-com { .xb-com-content .desc .left .bjsj .t-com {
flex: 0 0 130rpx; flex: 0 0 130rpx;
} }
.bjsj .c-com, .bz .c-com { .bjsj .c-com, .bz .c-com {
color: #8a9299; color: #8a9299;
} }
.desc-xj-detail view{
padding-top:16rpx; .desc-xj-detail view {
padding-top: 16rpx;
} }
.zxgt { .zxgt {
position: absolute; position: absolute;
bottom: 94rpx; bottom: 94rpx;
......
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