Browse Source

no message

featrue/v4.5
xpz2018 4 years ago
parent
commit
476c3a185a
8 changed files with 30 additions and 162 deletions
  1. 1
      app.json
  2. 19
      pages/agent/detail/index.js
  3. 8
      pages/agent/factory/index.js
  4. 108
      pages/purchase/ability/index.js
  5. 11
      pages/purchase/ability/index.json
  6. 33
      pages/purchase/ability/index.wxml
  7. 2
      pages/purchase/ability/index.wxss
  8. 10
      pages/purchase/detail/index.js

1
app.json

@ -63,7 +63,6 @@
"pages/withdrawal/vcheckout/index",
"pages/withdrawal/payment/index",
"pages/purchase/index/index",
"pages/purchase/ability/index",
"pages/purchase/create/index",
"pages/purchase/detail/index",
"pages/message/index/index",

19
pages/agent/detail/index.js

@ -3,6 +3,7 @@ import { getProxyOrderInfo, cancelProxyOrder, cancelReservation, cancelProxyOrde
const util = require('../../../utils/util')
const math = require('../../../utils/math')
const event = require('../../../utils/event')
const tdsdk = require('../../../libs/tdweapp')
const app = getApp()
Page({
@ -72,14 +73,11 @@ Page({
orderInfoStepLs[index1].orderItemTimeList[i] = element1.orderItemTimeList[i]
}
});
this.setData({
orderInfoStep: orderInfoStepLs
})
this.setData({ orderInfoStep: orderInfoStepLs })
wx.hideLoading()
}).catch(err => {
wx.hideLoading()
util.showToast(err)
console.log(err)
})
},
getStr: function (index) {
@ -200,9 +198,7 @@ Page({
})
},
editOrder: function () {
wx.navigateTo({
url: '/pages/agent/edit/index?orderId=' + this.data.orderInfo.orderId
})
wx.navigateTo({ url: '/pages/agent/edit/index?orderId=' + this.data.orderInfo.orderId })
},
clipboard: function () {
wx.setClipboardData({
@ -211,6 +207,15 @@ Page({
util.showToast('复制成功')
}
})
},
onShow: function () {
tdsdk.Page.onShow()
},
onHide: function(){
tdsdk.Page.onHide()
},
onUnload: function () {
tdsdk.Page.onUnload()
}
})

8
pages/agent/factory/index.js

@ -2,6 +2,7 @@
import { getFactoryPriceDetail, userPushFollowMill } from "../../../api/ztb"
import { getPreferList } from "../../../api/moment"
const event = require('../../../utils/event')
const tdsdk = require('../../../libs/tdweapp.js')
const util = require('../../../utils/util')
const app = getApp()
@ -197,7 +198,14 @@ Page({
url: '/pages/home/service/index'
})
},
onShow: function () {
tdsdk.Page.onShow()
},
onHide: function(){
tdsdk.Page.onHide()
},
onUnload: function () {
tdsdk.Page.onUnload()
event.remove('EventMessage', this)
},
onAttentionChange: function (e) {

108
pages/purchase/ability/index.js

@ -1,108 +0,0 @@
// pages/agent/index/index.js
import { paperCategoryList, getProductList } from "../../../api/ztb"
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
height: app.globalData.fragmentHeight - 100,
kg: app.globalData.kg,
loading: true,
requesting: false,
finished: false,
cateList: [],
cateScroll: false,
top: 0,
orderList: [],
form: {
firstCategoryId: '',
pageNum: 1,
pageSize:15
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({ height: app.globalData.fragmentHeight, kg: app.globalData.kg, CustomBar: app.globalData.CustomBar })
this.fetchCateList()
this.fetchGoodsList()
},
fetchCateList: function(){
paperCategoryList({ type: 1 }).then(result => {
var cateList = [{id: '', name: '全部'}].concat(result.data)
this.setData({ cateList: cateList, cateScroll: cateList.length >= 5 })
})
},
onCategoryChange: function (e) {
if (this.data.form.firstCategoryId == e.detail.key) {
return
}
this.setData({ ['form.firstCategoryId']: e.detail.key })
this.onRefreshList()
},
// 下拉刷新...
onRefreshList: function () {
if (this.data.requesting) {
return
}
this.setData({
orderList: [],
['form.pageNum']: 1,
loading: true,
finished: false
})
this.fetchGoodsList()
},
// 获取特价列表
fetchGoodsList: function () {
if (this.data.requesting || this.data.finished) {
return
}
if (this.data.loading) {
this.data.requesting = true
} else {
this.setData({ requesting: true })
}
getProductList(this.data.form).then(result => {
//成功回调
if (result.data.records.length) {
var respList = result.data.records
let nowList = `orderList[${this.data.orderList.length}]`
var num = result.data.current
var finished = result.data.current >= result.data.pages
if(this.data.form.pageNum == 1){
this.setData({
[nowList]: respList,
total: result.data.total,
['form.pageNum']: (num + 1),
top: 0,
finished,
requesting: false,
loading: false
})
} else {
this.setData({
[nowList]: respList,
total: result.data.total,
['form.pageNum']: (num + 1),
finished,
requesting: false,
loading: false
})
}
} else {
this.setData({ finished: true, requesting: false, loading: false })
}
}).catch(err => {
this.setData({ requesting: false, loading: false })
})
},
lookItem: function (e) {
var item = this.data.orderList[e.currentTarget.dataset.page][e.currentTarget.dataset.index]
wx.navigateTo({ url: '/pages/purchase/detail/index?id=' + item.id })
}
})

11
pages/purchase/ability/index.json

@ -1,11 +0,0 @@
{
"usingComponents": {
"wux-skeleton": "/components/skeleton/index",
"wux-skeleton-avatar": "/components/skeleton-avatar/index",
"wux-skeleton-paragraph": "/components/skeleton-paragraph/index",
"refresh-view": "/components/refresher/index",
"wux-image": "/components/image/index",
"wux-divider": "/components/divider/index",
"purchase-item": "/pages/purchase/purchase-item/index"
}
}

33
pages/purchase/ability/index.wxml

@ -1,33 +0,0 @@
<!--pages/agent/index/index.wxml-->
<wxs module="formate" src="../../../pages/formate.wxs"></wxs>
<cu-custom bgColor="bg-white" isBack="{{true}}">
<view slot="content">采购商品</view>
</cu-custom>
<refresh-view bind:refresh="onRefreshList" height="{{height}}" triggered="{{requesting}}" scrollTop="{{top}}" bind:scrolltolower="fetchGoodsList">
<view class="bg-white list-empty" style="height:{{height}}rpx" wx:if="{{!orderList.length}}">
<view class="load-spinner text-gray" style="margin-bottom:24px" wx:if="{{loading}}" />
<image class="img-empty" src="/assets/image/list_empty.png" wx:else></image>
<view class="text-empty">{{loading? '正在加载' : '暂无数据'}}</view>
</view>
<view wx:else>
<view wx:for-item="pageItem" wx:for-index="pageIndex" wx:for="{{orderList}}" wx:key="pageIndex">
<view wx:for="{{pageItem}}" wx:key="index">
<view class="bg-white" style="padding: 0rpx 32rpx" wx:if="{{pageIndex != 0 || index != 0 }}">
<wux-divider show-text="{{ false }}"></wux-divider>
</view>
<!-- <wux-divider show-text="{{ false }}" wx:if="{{pageIndex != 0 || index != 0 }}"></wux-divider> -->
<purchase-item item="{{item}}"></purchase-item>
</view>
</view>
<!--加载更多的UI-->
<view wx:if="{{form.pageNum>1}}" style="padding:20rpx">
<wux-divider>
<view class="loadmore">
<text class="icon--refresher" wx:if="{{!finished}}"></text>
<text class="text-sm" style="margin-left:8rpx">{{finished?'到底啦~':'加载中...'}}</text>
</view>
</wux-divider>
</view>
</view>
</refresh-view>

2
pages/purchase/ability/index.wxss

@ -1,2 +0,0 @@
/* pages/agent/index/index.wxss */

10
pages/purchase/detail/index.js

@ -1,6 +1,7 @@
// pages/order/order-info/index.js
import { getPurchaseInfo } from "../../../api/ztb"
const util = require('../../../utils/util')
const tdsdk = require('../../../libs/tdweapp')
const app = getApp()
Page({
@ -144,4 +145,13 @@ Page({
success: function (res) {}
}
},
onShow: function () {
tdsdk.Page.onShow()
},
onHide: function(){
tdsdk.Page.onHide()
},
onUnload: function () {
tdsdk.Page.onUnload()
}
})
Loading…
Cancel
Save