Browse Source

第一个版本的bug修改

featrue/v4.5
xpz2018 4 years ago
parent
commit
c0ef1b482c
6 changed files with 54 additions and 25 deletions
  1. 18
      pages/formate.wxs
  2. 33
      pages/mall/fragment/index.js
  3. 4
      pages/mall/fragment/index.wxml
  4. 2
      pages/ztbvip/index.wxml
  5. 9
      submodel/pages/goods/product-item/index.wxml
  6. 13
      submodel/pages/paper/detail/index.wxml

18
pages/formate.wxs

@ -102,7 +102,22 @@ function formateDescripe(value) {
} }
return '- -' return '- -'
} }
function formatePrice3(value, kg) {
if(isEmpty(value)){
return ''
}
if (value || value !== 0) {
if(value < 0){
value = -value
}
if(kg){
return (parseFloat(value)).toFixed(3)
} else {
return (parseFloat(value) * 1000).toFixed(0)
}
}
return ''
}
module.exports = { module.exports = {
numberFormat: numberFormat, //暴露接口调用 numberFormat: numberFormat, //暴露接口调用
numberFormat2: numberFormat2, //暴露接口调用 numberFormat2: numberFormat2, //暴露接口调用
@ -113,6 +128,7 @@ module.exports = {
formateAmount: formateAmount, formateAmount: formateAmount,
formatePrice: formatePrice, formatePrice: formatePrice,
formatePrice2: formatePrice2, formatePrice2: formatePrice2,
formatePrice3: formatePrice3,
substring: substring, substring: substring,
forWeight: forWeight, forWeight: forWeight,
formateDrice: formateDrice, formateDrice: formateDrice,

33
pages/mall/fragment/index.js

@ -5,7 +5,6 @@ const event = require('../../../utils/event')
const storage = require('../../../utils/storage') const storage = require('../../../utils/storage')
const util = require('../../../utils/util') const util = require('../../../utils/util')
const app = getApp() const app = getApp()
var form = {sortBy: 0, pageNum: 1, pageSize: 10, categoryId: '', cityId: ''}
var typeList = [] var typeList = []
Component({ Component({
@ -30,6 +29,7 @@ Component({
tabList: [], tabList: [],
tabIndex: 0, tabIndex: 0,
requesting: true, requesting: true,
form : {sortBy: 0, pageNum: 1, pageSize: 10, categoryId: '', cityId: ''},
orderList: [], orderList: [],
popover: false, popover: false,
sortList: [ sortList: [
@ -57,13 +57,14 @@ Component({
getPreferList().then(result => { getPreferList().then(result => {
this.setData({ momentList: result.data.records.slice(0, 3) }) this.setData({ momentList: result.data.records.slice(0, 3) })
}) })
typeList = []
getCategoryType().then(result => { getCategoryType().then(result => {
typeList = result.data typeList = result.data
var tabList = [] var tabList = []
for (let index = 0; index < typeList.length; index++) { for (let index = 0; index < typeList.length; index++) {
tabList.push(typeList[index].categoryName) tabList.push(typeList[index].categoryName)
} }
form.categoryId = typeList[0].categoryId
this.data.form.categoryId = typeList[0].categoryId
this.setData({ tabList }) this.setData({ tabList })
}) })
} }
@ -76,7 +77,7 @@ Component({
if(!this.data.bannerList.length){ if(!this.data.bannerList.length){
getBannerList(1).then(result => { getBannerList(1).then(result => {
this.setData({ bannerList: result.data }) this.setData({ bannerList: result.data })
storage.put('ztb-banner-list', JSON.stringify(result.data))
storage.put('ztb-banner-list', JSON.stringify(result.data), 43200)
}) })
} }
}, },
@ -87,10 +88,9 @@ Component({
console.log('mall>>fragment>>onEvent', message) console.log('mall>>fragment>>onEvent', message)
if(message.what == 888 && app.globalData.userInfo){ if(message.what == 888 && app.globalData.userInfo){
this.initLogin() this.initLogin()
this.fetchAgentList()
} else if(message.what == 444){ } else if(message.what == 444){
form.cityId = app.nowCity.cityCode
this.setData({ cityName: app.nowCity.cityName })
this.data.form.cityId = app.nowCity.cityCode
this.setData({ cityName: app.nowCity.cityName, ['form.cityId']: app.nowCity.cityCode })
this.fetchAgentList() this.fetchAgentList()
} }
}, },
@ -100,6 +100,7 @@ Component({
this.setData({ messageNumber: result.data.messageNumber + result.data.notificationNumber }) this.setData({ messageNumber: result.data.messageNumber + result.data.notificationNumber })
}) })
} }
this.fetchAgentList()
}, },
postInfo: function(e){ postInfo: function(e){
var item = this.data.momentList[e.currentTarget.dataset.index] var item = this.data.momentList[e.currentTarget.dataset.index]
@ -123,6 +124,10 @@ Component({
util.navigateTo('/pages/html/message/index') util.navigateTo('/pages/html/message/index')
} else if(e.currentTarget.id == 'search'){ } else if(e.currentTarget.id == 'search'){
wx.navigateTo({url: `/pages/mall/search-list/index?tab=1` }) wx.navigateTo({url: `/pages/mall/search-list/index?tab=1` })
} else if(e.currentTarget.id == 'empty'){
if(this.data.tabList.length && !this.data.form.cityId.length){
wx.navigateTo({url: `/pages/home/city-select/index?type=1` })
}
} }
}, },
tapBanner: function(e){ tapBanner: function(e){
@ -138,7 +143,7 @@ Component({
return return
} }
this.data.tabIndex = Number(detail.index) this.data.tabIndex = Number(detail.index)
form.categoryId = typeList[Number(detail.index)].categoryId
this.data.form.categoryId = typeList[Number(detail.index)].categoryId
this.fetchAgentList() this.fetchAgentList()
}, },
topBubble: function(e){ topBubble: function(e){
@ -149,7 +154,7 @@ Component({
if(!util.isEmpty(e.currentTarget.dataset.index)){ if(!util.isEmpty(e.currentTarget.dataset.index)){
this.data.sortIndex = Number(e.currentTarget.dataset.index) this.data.sortIndex = Number(e.currentTarget.dataset.index)
if(this.data.popover){ if(this.data.popover){
form.sortBy = this.data.sortIndex
this.data.form.sortBy = this.data.sortIndex
this.fetchAgentList() this.fetchAgentList()
} }
} }
@ -157,11 +162,19 @@ Component({
}, },
//*************************************************fetchAgentList************************************************// //*************************************************fetchAgentList************************************************//
fetchAgentList: function () { fetchAgentList: function () {
if(util.isEmpty(form.categoryId)){
if(util.isEmpty(this.data.form.categoryId)){
this.setData({ requesting: false, orderList: [] })
return
}
if(util.isEmpty(this.data.form.cityId)){
this.setData({ requesting: false, orderList: [], ['form.cityId']: '' })
return
}
if(this.data.requesting){
return return
} }
this.setData({ requesting: true, orderList: [] }) this.setData({ requesting: true, orderList: [] })
getMomentList(form).then(result => {
getMomentList(this.data.form).then(result => {
if (result.data.records.length) { if (result.data.records.length) {
this.setData({ orderList: result.data.records, requesting: false }) this.setData({ orderList: result.data.records, requesting: false })
} else { } else {

4
pages/mall/fragment/index.wxml

@ -95,9 +95,9 @@
<information-item item="{{item}}"></information-item> <information-item item="{{item}}"></information-item>
</view> </view>
</view> </view>
<view class="bg-white list-empty" style="height: 336rpx;border-radius: 0rpx 0rpx 24rpx 24rpx" wx:else>
<view id="empty" class="bg-white list-empty" style="height: 336rpx;border-radius: 0rpx 0rpx 24rpx 24rpx" bindtap="gridTap" wx:else>
<image class="img-empty" src="/assets/image/list_empty.png"></image> <image class="img-empty" src="/assets/image/list_empty.png"></image>
<view class="text-empty" style="margin-top: 24rpx;">暂无数据</view>
<view class="text-empty" style="margin-top: 24rpx;">{{(!form.cityId && tabList.length) ? '暂无定位城市,请选择一个所在城市' : '暂无数据'}}</view>
</view> </view>
<view class="flex flex-center" style="padding: 24rpx;"> <view class="flex flex-center" style="padding: 24rpx;">
<view id="moment" class="btn-more" catchtap="gridTap">查看更多行情</view> <view id="moment" class="btn-more" catchtap="gridTap">查看更多行情</view>

2
pages/ztbvip/index.wxml

@ -36,7 +36,7 @@
<view style="min-width: 208rpx;margin-left: 32rpx;height: 280rpx;" wx:for="{{iconList}}" wx:key="index" data-index="{{index}}" bindtap="onGridTap"> <view style="min-width: 208rpx;margin-left: 32rpx;height: 280rpx;" wx:for="{{iconList}}" wx:key="index" data-index="{{index}}" bindtap="onGridTap">
<view class="{{item.id == divIndex? 'openVip22':'openVip21'}}" style="position: relative;margin-top: 24rpx;"> <view class="{{item.id == divIndex? 'openVip22':'openVip21'}}" style="position: relative;margin-top: 24rpx;">
<view style="padding:24rpx 0rpx;text-align: center"> <view style="padding:24rpx 0rpx;text-align: center">
<view class="text-cut text-bold" style="font-size:36rpx;color:#333333;height: 60rpx;">{{item.days}}{{item.title}}</view>
<view class="text-cut text-bold" style="font-size:36rpx;color:#333333;height: 60rpx;">{{item.title}}</view>
<view class="text-price text-bold text-center" style="height: 72rpx;font-size:50rpx;color:#F5222D">{{item.realPrice}}</view> <view class="text-price text-bold text-center" style="height: 72rpx;font-size:50rpx;color:#F5222D">{{item.realPrice}}</view>
<view style="height:40rpx;font-size:24rpx;color:#999999;text-decoration:line-through">原价:¥{{item.bidPrice}}</view> <view style="height:40rpx;font-size:24rpx;color:#999999;text-decoration:line-through">原价:¥{{item.bidPrice}}</view>
<view style="height: 16rpx;"></view> <view style="height: 16rpx;"></view>

9
submodel/pages/goods/product-item/index.wxml

@ -15,10 +15,11 @@
</view> </view>
<view class="flex flex-center" style="margin-top:16rpx;justify-content: flex-start"> <view class="flex flex-center" style="margin-top:16rpx;justify-content: flex-start">
<text class="text-xs text-gray" wx:if="{{item.bidType == 2}}">起拍单价</text> <text class="text-xs text-gray" wx:if="{{item.bidType == 2}}">起拍单价</text>
<text class="page-price" wx:if="{{formate.formatePrice(item.unitPrice, kg)!=''}}">¥{{formate.formatePrice(item.unitPrice, kg)}}</text>
<view class="text-df" style="color: rgba(255, 66, 43, 1);margin-left:8rpx" wx:if="{{formate.formatePrice(item.unitPrice, kg)!=''}}">{{ kg? '元/KG' : '元/吨' }}
</view>
<text class="page-price" wx:if="{{formate.formatePrice(item.unitPrice, kg)==''}}">价格面议</text>
<text class="page-price" wx:if="{{item.unitPrice > 0}}">
<text>¥{{formate.formatePrice3(item.unitPrice, kg)}}</text>
<text class="text-df">{{ kg? '元/KG' : '元/吨' }}</text>
</text>
<text class="page-price" wx:else>价格面议</text>
</view> </view>
<view style="height:32px"> <view style="height:32px">
<view class="page-outline">{{item.description || ''}}</view> <view class="page-outline">{{item.description || ''}}</view>

13
submodel/pages/paper/detail/index.wxml

@ -37,13 +37,12 @@
<view class="flex flex-center"> <view class="flex flex-center">
<image style="width:72rpx;height:36rpx;" src="/submodel/images/ico_tag{{orderInfo.bidType == 2 ? '2' : '1'}}.png"> <image style="width:72rpx;height:36rpx;" src="/submodel/images/ico_tag{{orderInfo.bidType == 2 ? '2' : '1'}}.png">
</image> </image>
<view class="detail-price" style="margin-left:8rpx"
wx:if="{{formate.formatePrice(orderInfo.unitPrice, kg)!=''}}">
¥{{ formate.formatePrice(orderInfo.unitPrice, kg) }}</view>
<view class="detail-price" style="margin-left:8rpx" wx:if="{{formate.formatePrice3(orderInfo.unitPrice, kg)!=''}}">
¥{{ formate.formatePrice3(orderInfo.unitPrice, kg) }}</view>
<view class="text-df" style="color: rgba(255, 66, 43, 1);margin-left:8rpx;margin-top:8rpx" <view class="text-df" style="color: rgba(255, 66, 43, 1);margin-left:8rpx;margin-top:8rpx"
wx:if="{{formate.formatePrice(orderInfo.unitPrice, kg)!=''}}">{{ kg? '元/KG' : '元/吨' }}</view>
<view class="text-df" style="color: rgba(255, 66, 43, 1);margin-left:8rpx;margin-top:8rpx"
wx:if="{{formate.formatePrice(orderInfo.unitPrice, kg)==''}}">价格面议</view>
wx:if="{{formate.formatePrice3(orderInfo.unitPrice, kg)!=''}}">{{ kg? '元/KG' : '元/吨' }}</view>
<view class="detail-price" style="color: rgba(255, 66, 43, 1);margin-left:8rpx;margin-top:8rpx"
wx:if="{{formate.formatePrice3(orderInfo.unitPrice, kg)==''}}">价格面议</view>
</view> </view>
<view class="text-name" style="margin-top:12rpx">{{orderInfo.secondCategoryName}}</view> <view class="text-name" style="margin-top:12rpx">{{orderInfo.secondCategoryName}}</view>
</view> </view>
@ -138,7 +137,7 @@
<text class="text-blue" style="font-size:32rpx">¥{{amount}}</text> <text class="text-blue" style="font-size:32rpx">¥{{amount}}</text>
</view> </view>
<view style="width:100%"> <view style="width:100%">
<wux-button block type="positive" bind:click="offerProject" wx:if="{{orderInfo.bidType == 1}}">立即购买</wux-button>
<wux-button block type="positive" disabled="{{orderInfo.unitPrice <= 0}}" bind:click="offerProject" wx:if="{{orderInfo.bidType == 1}}">立即购买</wux-button>
<wux-button block type="assertive" bind:click="offerProject" <wux-button block type="assertive" bind:click="offerProject"
wx:if="{{orderInfo.bidType == 2 && orderInfo.biddingActivityId}}">{{offered?'修改':'立即'}}报价</wux-button> wx:if="{{orderInfo.bidType == 2 && orderInfo.biddingActivityId}}">{{offered?'修改':'立即'}}报价</wux-button>
</view> </view>

Loading…
Cancel
Save