Browse Source

Merge branch 'featrue/v4.2' of http://git.qniao.cn/libo/ztb-mini into featrue/v4.2

featrue/v4.2
xpz2018 5 years ago
parent
commit
b8c2f9a7a2
30 changed files with 1373 additions and 154 deletions
  1. 4
      app.json
  2. BIN
      assets/image/dbcicon.png
  3. BIN
      assets/image/fzcicon.png
  4. BIN
      assets/image/qticon.png
  5. BIN
      assets/image/tabBj.png
  6. BIN
      assets/image/zzcicon.png
  7. 137
      pages/agent/factory/index.js
  8. 4
      pages/agent/factory/index.wxml
  9. 71
      pages/agent/index/index.js
  10. 34
      pages/agent/index/index.wxml
  11. 182
      pages/home/info/index.js
  12. 26
      pages/home/info/index.wxml
  13. 88
      pages/home/tab1/index.js
  14. 3
      pages/home/tab1/index.json
  15. 61
      pages/home/tab1/index.wxml
  16. 94
      pages/home/tab1/index.wxss
  17. 129
      pages/home/tab2/index.js
  18. 5
      pages/home/tab2/index.json
  19. 31
      pages/home/tab2/index.wxml
  20. 91
      pages/home/tab2/index.wxss
  21. 95
      pages/home/tab3/index.js
  22. 3
      pages/home/tab3/index.json
  23. 43
      pages/home/tab3/index.wxml
  24. 79
      pages/home/tab3/index.wxss
  25. 76
      pages/home/tab4/index.js
  26. 3
      pages/home/tab4/index.json
  27. 25
      pages/home/tab4/index.wxml
  28. 46
      pages/home/tab4/index.wxss
  29. 5
      pages/index/index.js
  30. 192
      pages/login/index.js

4
app.json

@ -13,6 +13,10 @@
"pages/home/idcard/index", "pages/home/idcard/index",
"pages/home/info/index", "pages/home/info/index",
"pages/home/pinfo/index", "pages/home/pinfo/index",
"pages/home/tab1/index",
"pages/home/tab2/index",
"pages/home/tab3/index",
"pages/home/tab4/index",
"pages/shop/create/index", "pages/shop/create/index",
"pages/shop/detail/index", "pages/shop/detail/index",
"pages/shop/order/index", "pages/shop/order/index",

BIN
assets/image/dbcicon.png

Before After
Width: 48  |  Height: 48  |  Size: 1.1 KiB

BIN
assets/image/fzcicon.png

Before After
Width: 48  |  Height: 48  |  Size: 922 B

BIN
assets/image/qticon.png

Before After
Width: 48  |  Height: 48  |  Size: 956 B

BIN
assets/image/tabBj.png

Before After
Width: 310  |  Height: 258  |  Size: 41 KiB

BIN
assets/image/zzcicon.png

Before After
Width: 48  |  Height: 48  |  Size: 1006 B

137
pages/agent/factory/index.js

@ -1,6 +1,10 @@
// pages/mall/factory/index.js // pages/mall/factory/index.js
import { getFactoryPriceDetail } from "../../api/ztb"
import { getPreferList } from "../../api/moment"
import {
getFactoryPriceDetail
} from "../../api/ztb"
import {
getPreferList
} from "../../api/moment"
const event = require('../../../utils/event') const event = require('../../../utils/event')
const util = require('../../../utils/util') const util = require('../../../utils/util')
const app = getApp() const app = getApp()
@ -18,7 +22,7 @@ Page({
scrollTop: 0, scrollTop: 0,
toView: null, toView: null,
id: null, id: null,
tabList: [ '报价信息', '讨论', '收货标准', '注意事项' ],
tabList: ['报价信息', '讨论', '收货标准', '注意事项'],
tabIndex: 0, tabIndex: 0,
factoryDetail: null, factoryDetail: null,
cateIndex: 0, cateIndex: 0,
@ -29,31 +33,38 @@ Page({
finished: false, finished: false,
form: { form: {
pageNum: 1 pageNum: 1
}
},
attentionStatus: 1
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
this.setData({
this.setData({
safeBottom: app.globalData.safeBottom, safeBottom: app.globalData.safeBottom,
fragmentHeight: app.globalData.fragmentHeight - 90,
height: app.globalData.fragmentHeight,
fragmentHeight: app.globalData.fragmentHeight - 90,
height: app.globalData.fragmentHeight,
kg: app.globalData.kg, kg: app.globalData.kg,
stickyTop: app.globalData.CustomBar, stickyTop: app.globalData.CustomBar,
daytimes: util.formatDate(new Date(), 'Y-M-D') daytimes: util.formatDate(new Date(), 'Y-M-D')
// tabIndex: options.tabIndex ? parseInt(options.tabIndex) : 0 // tabIndex: options.tabIndex ? parseInt(options.tabIndex) : 0
}) })
event.on('EventMessage', this, this.onEvent) event.on('EventMessage', this, this.onEvent)
if(options.id){
if (options.id) {
this.data.id = options.id this.data.id = options.id
this.data.form.millPaperId = options.id this.data.form.millPaperId = options.id
wx.showLoading({ title: '加载中', mask: true })
wx.showLoading({
title: '加载中',
mask: true
})
getFactoryPriceDetail(options.id).then(result => { getFactoryPriceDetail(options.id).then(result => {
if(result.data.paperCategoryList && result.data.paperCategoryList.length){
if (result.data.paperCategoryList && result.data.paperCategoryList.length) {
this.data.cateId = result.data.paperCategoryList[this.data.cateIndex].categoryId this.data.cateId = result.data.paperCategoryList[this.data.cateIndex].categoryId
} }
this.setData({ factoryDetail: result.data })
this.setData({
factoryDetail: result.data
})
wx.hideLoading() wx.hideLoading()
}).catch(err => { }).catch(err => {
wx.hideLoading() wx.hideLoading()
@ -66,65 +77,90 @@ Page({
this.onRefreshList() this.onRefreshList()
} }
}, },
onFixedChange: function({detail}){
onFixedChange: function ({
detail
}) {
this.data.fixed = detail.fixed this.data.fixed = detail.fixed
}, },
onScroll: function({detail}) {
this.setData({ scrollTop: detail.scrollTop })
onScroll: function ({
detail
}) {
this.setData({
scrollTop: detail.scrollTop
})
}, },
stopTouchMove: function(e){
stopTouchMove: function (e) {
return false return false
}, },
onTabChange: function({detail}){
if(this.data.tabIndex == Number(detail.index)){
onTabChange: function ({
detail
}) {
if (this.data.tabIndex == Number(detail.index)) {
return return
} }
if(this.data.fixed){
this.setData({ tabIndex: parseInt(detail.index), toView: 'sticky' })
if (this.data.fixed) {
this.setData({
tabIndex: parseInt(detail.index),
toView: 'sticky'
})
} else { } else {
this.setData({ tabIndex: parseInt(detail.index) })
this.setData({
tabIndex: parseInt(detail.index)
})
} }
if(this.data.tabIndex == 1 && !this.data.momentList.length){
if (this.data.tabIndex == 1 && !this.data.momentList.length) {
this.fetchMomentList() this.fetchMomentList()
} }
}, },
checkTag: function(e){
if(!e.currentTarget.dataset){
checkTag: function (e) {
if (!e.currentTarget.dataset) {
return return
} }
if(!e.currentTarget.dataset.index && e.currentTarget.dataset.index != 0){
if (!e.currentTarget.dataset.index && e.currentTarget.dataset.index != 0) {
return return
} }
if(this.data.cateIndex == e.currentTarget.dataset.index){
if (this.data.cateIndex == e.currentTarget.dataset.index) {
return return
} }
this.setData({cateIndex : e.currentTarget.dataset.index})
this.setData({
cateIndex: e.currentTarget.dataset.index
})
}, },
saleGood: function(e){
if(!app.globalData.userInfo){
wx.navigateTo({ url: '/pages/login/index' })
saleGood: function (e) {
if (!app.globalData.userInfo) {
wx.navigateTo({
url: '/pages/login/index'
})
return return
} }
var item = this.data.factoryDetail.paperCategoryList[this.data.cateIndex] var item = this.data.factoryDetail.paperCategoryList[this.data.cateIndex]
if(util.isEmpty(item.unitPrice)){
if (util.isEmpty(item.unitPrice)) {
util.showToast('该纸品暂无报价,无法卖货') util.showToast('该纸品暂无报价,无法卖货')
return return
} }
wx.navigateTo({ url: '/pages/agent/edit/index?id=' + this.data.factoryDetail.paperMillId + '&categoryId=' + item.categoryId })
wx.navigateTo({
url: '/pages/agent/edit/index?id=' + this.data.factoryDetail.paperMillId + '&categoryId=' + item.categoryId
})
}, },
postMoment: function(){
postMoment: function () {
util.navigateTo('/pages/article/publish/index?factoryId=' + this.data.factoryDetail.paperMillId + '&name=' + this.data.factoryDetail.name) util.navigateTo('/pages/article/publish/index?factoryId=' + this.data.factoryDetail.paperMillId + '&name=' + this.data.factoryDetail.name)
}, },
//*************************************************momentList************************************************// //*************************************************momentList************************************************//
onRefreshList: function () { onRefreshList: function () {
this.setData({ momentList: [], ['form.pageNum']: 1, finished: false })
this.setData({
momentList: [],
['form.pageNum']: 1,
finished: false
})
this.fetchMomentList() this.fetchMomentList()
}, },
fetchMomentList: function(){
fetchMomentList: function () {
if (this.data.requesting || this.data.finished) { if (this.data.requesting || this.data.finished) {
return return
} }
this.setData({ requesting: true })
this.setData({
requesting: true
})
getPreferList(this.data.form).then(result => { getPreferList(this.data.form).then(result => {
if (result.data.records.length) { if (result.data.records.length) {
var respList = result.data.records var respList = result.data.records
@ -138,10 +174,15 @@ Page({
finished finished
}) })
} else { } else {
this.setData({ finished: true, requesting: false })
this.setData({
finished: true,
requesting: false
})
} }
}).catch(err => { }).catch(err => {
this.setData({ requesting: false })
this.setData({
requesting: false
})
}) })
}, },
onShareAppMessage: function () { onShareAppMessage: function () {
@ -150,10 +191,26 @@ Page({
path: 'pages/index/index?url=/pages/agent/factory/index&key=id&value=' + this.data.factoryDetail.paperMillId path: 'pages/index/index?url=/pages/agent/factory/index&key=id&value=' + this.data.factoryDetail.paperMillId
} }
}, },
toService: function(){
wx.navigateTo({ url: '/pages/home/service/index'})
toService: function () {
wx.navigateTo({
url: '/pages/home/service/index'
})
}, },
onUnload: function(){
onUnload: function () {
event.remove('EventMessage', this) event.remove('EventMessage', this)
},
onAttentionChange: function (e) {
if (e.currentTarget.dataset.cid == 1) {
this.setData({
attentionStatus: 2,
})
}
if (e.currentTarget.dataset.cid == 2) {
this.setData({
attentionStatus: 1,
})
}
util.showToast(this.data.attentionStatus+'')
} }
}) })

4
pages/agent/factory/index.wxml

@ -8,7 +8,9 @@
<view class="bg-white flex" style="padding:30rpx" > <view class="bg-white flex" style="padding:30rpx" >
<wux-image width="{{54}}" height="{{54}}" wux-class="image" shape="rounded" src="{{factoryDetail.logoImg}}" /> <wux-image width="{{54}}" height="{{54}}" wux-class="image" shape="rounded" src="{{factoryDetail.logoImg}}" />
<view class="flex flex-column flex-center" style="margin-left:24rpx;align-items:flex-start"> <view class="flex flex-column flex-center" style="margin-left:24rpx;align-items:flex-start">
<view class="text-sg text-bold" style="white-space: nowrap">{{factoryDetail.name}}</view>
<view class="text-sg text-bold" style="white-space: nowrap">{{factoryDetail.name}}
<text class="{{attentionStatus == 1 ? 'text-blue' : 'text-red'}}" data-cid="{{attentionStatus}}" bindtap="onAttentionChange">{{attentionStatus == 1 ? '关注' : '取消关注'}}</text>
</view>
<view class="text-xs text-gray" style="margin-top:4rpx"> <view class="text-xs text-gray" style="margin-top:4rpx">
<text>{{factoryDetail.locProvinceName + factoryDetail.locCityName + factoryDetail.locDistrictName}}</text> <text>{{factoryDetail.locProvinceName + factoryDetail.locCityName + factoryDetail.locDistrictName}}</text>
<text class="text-gray" style="margin: 0rpx 8rpx" wx:if="{{factoryDetail.cumulativeWeight > 0}}">|</text> <text class="text-gray" style="margin: 0rpx 8rpx" wx:if="{{factoryDetail.cumulativeWeight > 0}}">|</text>

71
pages/agent/index/index.js

@ -1,5 +1,8 @@
// pages/agent/index/index.js // pages/agent/index/index.js
import { getFactoryPrice, getFactoryCity } from "../../api/ztb"
import {
getFactoryPrice,
getFactoryCity
} from "../../api/ztb"
const app = getApp() const app = getApp()
Page({ Page({
@ -23,28 +26,65 @@ Page({
cityId: '', cityId: '',
enableSalesAgent: 1, enableSalesAgent: 1,
pageNum: 1 pageNum: 1
}
},
form2: {
pageNum: 1
},
bidType: 1,
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
this.setData({ height: app.globalData.fragmentHeight - 90, kg: app.globalData.kg, CustomBar: app.globalData.CustomBar })
this.setData({
height: app.globalData.fragmentHeight - 90,
kg: app.globalData.kg,
CustomBar: app.globalData.CustomBar
})
this.fetchRegionList() this.fetchRegionList()
this.fetchPapersList() this.fetchPapersList()
}, },
fetchRegionList: function(){
fetchRegionList: function () {
getFactoryCity().then(result => { getFactoryCity().then(result => {
//成功回调 //成功回调
this.data.cateList = [{cityId: '', cityName: '全部'}].concat(result.data)
this.data.cateList = [{
cityId: '',
cityName: '全部'
}].concat(result.data)
for (let index = 0; index < this.data.cateList.length; index++) { for (let index = 0; index < this.data.cateList.length; index++) {
this.data.tabList.push(this.data.cateList[index].cityName) this.data.tabList.push(this.data.cateList[index].cityName)
} }
this.setData({ tabList: this.data.tabList, scrolled: this.data.cateList.length >= 5 })
this.setData({
tabList: this.data.tabList,
scrolled: this.data.cateList.length >= 5
})
})
},
//获取纸厂列表
fetchRegionList2: function () {
},
onTabChangeTop: function (e) {
if (this.data.bidType == Number(e.currentTarget.dataset.index)) {
return
}
var tabIndex = Number(e.currentTarget.dataset.index)
this.data.firstCategoryId = ''
this.setData({
pageIndex: 0,
['bidType']: tabIndex
}) })
console.log(this.bidType)
if (this.data.bidType == 1) {
this.onRefreshList()
}
}, },
onTabChange: function ({detail}) {
if(this.data.tabIndex == Number(detail.index)){
onTabChange: function ({
detail
}) {
if (this.data.tabIndex == Number(detail.index)) {
return return
} }
this.data.tabIndex = Number(detail.index) this.data.tabIndex = Number(detail.index)
@ -62,6 +102,13 @@ Page({
}) })
this.fetchPapersList() this.fetchPapersList()
}, },
// 下拉刷新关注...
onRefreshList2: function () {
this.setData({
['form2.pageNum']: 1,
})
this.fetchPapersList()
},
// 获取特价列表 // 获取特价列表
fetchPapersList: function () { fetchPapersList: function () {
if (this.data.requesting || this.data.finished) { if (this.data.requesting || this.data.finished) {
@ -70,7 +117,9 @@ Page({
if (this.data.loading) { if (this.data.loading) {
this.data.requesting = true this.data.requesting = true
} else { } else {
this.setData({ requesting: true })
this.setData({
requesting: true
})
} }
getFactoryPrice(this.data.form).then(result => { getFactoryPrice(this.data.form).then(result => {
if (result.data.records.length) { if (result.data.records.length) {
@ -78,7 +127,7 @@ Page({
let nowList = `orderList[${this.data.orderList.length}]` let nowList = `orderList[${this.data.orderList.length}]`
var num = result.data.current var num = result.data.current
var finished = result.data.current >= result.data.pages var finished = result.data.current >= result.data.pages
if(this.data.form.pageNum == 1){
if (this.data.form.pageNum == 1) {
this.setData({ this.setData({
[nowList]: respList, [nowList]: respList,
total: result.data.total, total: result.data.total,
@ -113,6 +162,6 @@ Page({
loading: false loading: false
}) })
}) })
}
}
}) })

34
pages/agent/index/index.wxml

@ -4,12 +4,20 @@
<view slot="content">纸厂代卖</view> <view slot="content">纸厂代卖</view>
</cu-custom> </cu-custom>
<view class="nav bg-white fixed" style="top:{{CustomBar}}px;height:90rpx;" wx:if="{{tabList.length}}">
<wux-tabi scroll="{{scrolled}}" tab-data="{{tabList}}" tab-index="{{tabIndex}}" bind:change="onTabChange"></wux-tabi>
<view class="nav bg-white fixed" style="top:{{CustomBar}}px;height:210rpx;" wx:if="{{tabList.length}}">
<view class="flex bg-white" style="height:80rpx;padding:6rpx 6rpx 0rpx 6rpx;border-bottom: 2rpx solid #eee">
<view data-index="1" class="flex flex-center flex-column" style="flex:1;" bindtap="onTabChangeTop">
<view class="text-bold" style="font-size:24rpx;color:{{bidType == 1 ? '#008AFF' : '#333'}}">全部</view>
</view>
<view data-index="2" class="flex flex-center flex-column" style="flex:1;" bindtap="onTabChangeTop">
<view class="text-bold" style="font-size:24rpx;color:{{bidType == 2 ? '#008AFF' : '#333'}}">关注</view>
</view>
</view>
<wux-tabi wx:if="{{bidType == 1}}" scroll="{{scrolled}}" tab-data="{{tabList}}" tab-index="{{tabIndex}}" bind:change="onTabChange"></wux-tabi>
</view> </view>
<view class="bg-white" style="height:90rpx;width:100%"></view>
<view class="bg-white" style="height:210rpx;width:100%"></view>
<refresh-view bind:refresh="onRefreshList" height="{{height}}" triggered="{{requesting}}" scrollTop="{{top}}" bind:scrolltolower="fetchPapersList">
<refresh-view wx:if="{{bidType == 1}}" bind:refresh="onRefreshList" height="{{height}}" triggered="{{requesting}}" scrollTop="{{top}}" bind:scrolltolower="fetchPapersList">
<view class="bg-white list-empty" style="height:{{height}}rpx" wx:if="{{!orderList.length}}"> <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}}" /> <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> <image class="img-empty" src="/assets/image/list_empty.png" wx:else></image>
@ -77,3 +85,21 @@
</view> </view>
</view> </view>
</refresh-view> </refresh-view>
<refresh-view wx:if="{{bidType == 2}}" bind:refresh="onRefreshList2" height="{{height}}" triggered="{{requesting}}" scrollTop="{{top}}" bind:scrolltolower="fetchPapersList2">
<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:if="{{form2.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>

182
pages/home/info/index.js

@ -1,5 +1,10 @@
import { zconfig, getBaseInfo } from '../../api/ztb'
import { updateUserInfo } from '../../api/user'
import {
zconfig,
getBaseInfo
} from '../../api/ztb'
import {
updateUserInfo
} from '../../api/user'
const util = require('../../../utils/util') const util = require('../../../utils/util')
const app = getApp() const app = getApp()
@ -11,25 +16,71 @@ Page({
backStatus: true, backStatus: true,
nickName: '', //用户昵称 nickName: '', //用户昵称
avatarUrl: '', //用户头像 avatarUrl: '', //用户头像
banckCardList: [
{ id: 1, name: '个体回收户' },
{ id: 2, name: '打包站' },
{ id: 3, name: '废品站' },
{ id: 4, name: '印刷' },
{ id: 6, name: '包装厂' },
{ id: 7, name: '纸箱纸板厂' },
{ id: 8, name: '后加工' },
{ id: 5, name: '其他' }
banckCardList: [{
id: 1,
name: '个体回收户'
},
{
id: 2,
name: '打包站'
},
{
id: 3,
name: '废品站'
},
{
id: 4,
name: '印刷'
},
{
id: 6,
name: '包装厂'
},
{
id: 7,
name: '纸箱纸板厂'
},
{
id: 8,
name: '后加工'
},
{
id: 5,
name: '其他'
}
], ],
cardList: [
{ value: '1', text: '个体回收户' },
{ value: '2', text: '打包站' },
{ value: '3', text: '废品站' },
{ value: '4', text: '印刷' },
{ value: '6', text: '包装厂' },
{ value: '7', text: '纸箱纸板厂' },
{ value: '8', text: '后加工' },
{ value: '5', text: '其他' }
cardList: [{
value: '1',
text: '个体回收户'
},
{
value: '2',
text: '打包站'
},
{
value: '3',
text: '废品站'
},
{
value: '4',
text: '印刷'
},
{
value: '6',
text: '包装厂'
},
{
value: '7',
text: '纸箱纸板厂'
},
{
value: '8',
text: '后加工'
},
{
value: '5',
text: '其他'
}
], ],
userInfo: null, userInfo: null,
userType: 1, userType: 1,
@ -49,14 +100,21 @@ Page({
linkPhone: res.data.mobile, linkPhone: res.data.mobile,
companyAddress: res.data.fullAddress, companyAddress: res.data.fullAddress,
userType: res.data.userType, userType: res.data.userType,
realName:res.data.realName || res.data.userName
realName: res.data.realName || res.data.userName
}) })
}) })
}, },
uploadFile: function (path) { uploadFile: function (path) {
var that = this var that = this
wx.showLoading({ title: '上传中', mask: true })
var header = { ...zconfig.header, 'X-APP-ID': app.xAppId, appversion: app.version }
wx.showLoading({
title: '上传中',
mask: true
})
var header = {
...zconfig.header,
'X-APP-ID': app.xAppId,
appversion: app.version
}
this.task = wx.uploadFile({ this.task = wx.uploadFile({
url: zconfig.baseUrl + '/recycle-user-center/file-uploading/upload/image', url: zconfig.baseUrl + '/recycle-user-center/file-uploading/upload/image',
filePath: path, filePath: path,
@ -68,7 +126,9 @@ Page({
resp = JSON.parse(result.data) resp = JSON.parse(result.data)
} }
if (resp && resp.code === 0) { if (resp && resp.code === 0) {
that.updateMemberInfo({avatar: resp.data})
that.updateMemberInfo({
avatar: resp.data
})
} else { } else {
wx.hideLoading() wx.hideLoading()
util.showToast('头像上传失败,请重新上传') util.showToast('头像上传失败,请重新上传')
@ -80,46 +140,60 @@ Page({
} }
}) })
}, },
showDialog: function(){
showDialog: function (e) {
this.wuxDialog = this.wuxDialog || this.selectComponent('#wux-dialog') this.wuxDialog = this.wuxDialog || this.selectComponent('#wux-dialog')
var that = this var that = this
this.wuxDialog.prompt({
resetOnClose: true,
title: '修改昵称',
placeholder: that.data.userInfo.nickname || '请输入昵称',
maxlength: 18,
onConfirm(e, response) {
if(util.isEmpty(response)){
util.showToast('请输入昵称')
return
}
that.updateMemberInfo({nickname: response})
},
})
if (e.currentTarget.dataset.cid === 'nickname') {
this.wuxDialog.prompt({
resetOnClose: true,
title: '修改昵称',
placeholder: that.data.userInfo.nickname || '请输入昵称',
maxlength: 18,
onConfirm(e, response) {
if (util.isEmpty(response)) {
util.showToast('请输入昵称')
return
}
that.updateMemberInfo({
nickname: response
})
},
})
}
}, },
updateMemberInfo: function(form){
if(form.nickname){
wx.showLoading({ title: '处理中', mask: true })
updateMemberInfo: function (form) {
if (form.nickname) {
wx.showLoading({
title: '处理中',
mask: true
})
} }
updateUserInfo(form).then(result => { updateUserInfo(form).then(result => {
wx.hideLoading() wx.hideLoading()
if(form.nickname){
this.setData({['userInfo.nickname']: form.nickname})
} else if(form.avatar){
this.setData({avatarUrl: form.avatar})
if (form.nickname) {
this.setData({
['userInfo.nickname']: form.nickname
})
} else if (form.avatar) {
this.setData({
avatarUrl: form.avatar
})
} }
}).catch(err => { }).catch(err => {
wx.hideLoading() wx.hideLoading()
util.showToast(err) util.showToast(err)
}) })
}, },
toAuth: function(){
if(this.data.userInfo && !this.data.userInfo.isAuth){
wx.navigateTo({ url: '/pages/home/idcard/index' })
toAuth: function () {
if (this.data.userInfo && !this.data.userInfo.isAuth) {
wx.navigateTo({
url: '/pages/home/idcard/index'
})
} }
}, },
//通过事件执行更换头像方法比如点击头像执行该方法 //通过事件执行更换头像方法比如点击头像执行该方法
chooseImage: function() {
chooseImage: function () {
var that = this var that = this
wx.chooseImage({ wx.chooseImage({
count: 1, // 默认9 count: 1, // 默认9
@ -137,12 +211,16 @@ Page({
}, },
//裁剪图片回调 //裁剪图片回调
onCropback: function (event) { onCropback: function (event) {
this.setData({ visible: false })
this.setData({
visible: false
})
this.uploadFile(event.detail[0]) this.uploadFile(event.detail[0])
}, },
//关闭回调 //关闭回调
closeCallback: function () { closeCallback: function () {
this.setData({ visible: false })
}
this.setData({
visible: false
})
},
}) })

26
pages/home/info/index.wxml

@ -51,10 +51,34 @@
<view slot="header" class="text-gray">公司地址</view> <view slot="header" class="text-gray">公司地址</view>
<view slot="footer" style="width:500rpx">{{companyAddress}}</view> <view slot="footer" style="width:500rpx">{{companyAddress}}</view>
</wux-cell> </wux-cell>
<wux-cell wx:if="{{userType == 1}}" is-link bind:click="showDialog">
<wux-cell wx:if="{{userType == 1}}" is-link data-cid='nickname' bind:click="showDialog">
<view slot="header" class="text-gray">昵称</view> <view slot="header" class="text-gray">昵称</view>
<view slot="footer" class="{{userInfo.nickname? 'text-black':'text-gray'}}">{{userInfo.nickname || '点击修改昵称'}}</view> <view slot="footer" class="{{userInfo.nickname? 'text-black':'text-gray'}}">{{userInfo.nickname || '点击修改昵称'}}</view>
</wux-cell> </wux-cell>
<wux-cell wx:if="{{userType == 1}}" is-link data-cid='card' bind:click="showDialog">
<view slot="header" class="text-gray">从业身份</view>
<view slot="footer" class="{{userInfo.card? 'text-black':'text-gray'}}">{{userInfo.card || '点击修改从业身份'}}</view>
</wux-cell>
<wux-cell wx:if="{{userType == 1}}" is-link data-cid='city' bind:click="showDialog">
<view slot="header" class="text-gray">所在城市</view>
<view slot="footer" class="{{userInfo.city? 'text-black':'text-gray'}}">{{userInfo.city || '点击修改所在城市'}}</view>
</wux-cell>
<wux-cell wx:if="{{userType == 1}}" is-link data-cid='age' bind:click="showDialog">
<view slot="header" class="text-gray">从业经验</view>
<view slot="footer" class="{{userInfo.age? 'text-black':'text-gray'}}">{{userInfo.age || '点击修改从业经验'}}</view>
</wux-cell>
<wux-cell wx:if="{{userType == 1}}" is-link data-cid='type' bind:click="showDialog">
<view slot="header" class="text-gray">希望采购品类</view>
<view slot="footer" class="{{userInfo.type? 'text-black':'text-gray'}}">{{userInfo.type || '点击修改希望采购品类'}}</view>
</wux-cell>
<wux-cell wx:if="{{userType == 1}}" is-link data-cid='type2' bind:click="showDialog">
<view slot="header" class="text-gray">希望出货品类</view>
<view slot="footer" class="{{userInfo.type2? 'text-black':'text-gray'}}">{{userInfo.type2 || '点击修改希望出货品类'}}</view>
</wux-cell>
<wux-cell wx:if="{{userType == 1}}" is-link data-cid='numberMoon' bind:click="showDialog">
<view slot="header" class="text-gray">月出货量</view>
<view slot="footer" class="{{userInfo.numberMoon? 'text-black':'text-gray'}}">{{userInfo.numberMoon || '点击修改月出货量'}}</view>
</wux-cell>
<!-- <wux-cell is-link="{{!userInfo.isAuth}}" url="/pages/home/idcard/index" bind:click="toAuth"> <!-- <wux-cell is-link="{{!userInfo.isAuth}}" url="/pages/home/idcard/index" bind:click="toAuth">
<view slot="header" class="text-gray">实名认证</view> <view slot="header" class="text-gray">实名认证</view>
<view slot="footer" class="text-black">{{userInfo.isAuth ? '已认证' : '未认证'}}</view> <view slot="footer" class="text-black">{{userInfo.isAuth ? '已认证' : '未认证'}}</view>

88
pages/home/tab1/index.js

@ -0,0 +1,88 @@
// pages/home/tab1/index.js
const storage = require('../../../utils/storage')
Page({
/**
* 页面的初始数据
*/
data: {
bidType:1
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
toNextTab:function(){
wx.redirectTo({ url: '/pages/home/tab2/index' })
},
toMyInfo:function(){
storage.put('userIsLoginFirst', '1')
wx.redirectTo({ url: '/pages/index/index' })
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
backspace: function () {
return
},
onTabChangeTop: function (e) {
if (this.data.bidType == Number(e.currentTarget.dataset.index)) {
return
}
var tabIndex = Number(e.currentTarget.dataset.index)
this.data.firstCategoryId = ''
this.setData({
['bidType']: tabIndex
})
},
})

3
pages/home/tab1/index.json

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

61
pages/home/tab1/index.wxml

@ -0,0 +1,61 @@
<!--pages/home/tab1/index.wxml-->
<cu-custom bgColor="bg-white" isBack="{{true}}" intercept="{{true}}" bindcustomevent="backspace">
<view slot="content">身份</view>
</cu-custom>
<view class="bj">
<view style="width:100%;height:130rpx;padding-top:10rpx;padding-right:10rpx">
<button class="cu-btn bg-red round shadow-blur vip-btn" bindtap="toMyInfo">跳出</button>
<button class="cu-btn bg-red round shadow-blur vip-btn" bindtap="toNextTab">下一页</button>
</view>
<view class="top">
<view class="topText">
<text>HI,\n欢迎使用纸通宝\n开启一站式废纸交易</text>
</view>
<view style="width:310rpx;height:258rpx;float:right">
<image src="/assets/image/tabBj.png" style="width:310rpx;height:258rpx"></image>
</view>
</view>
<view class="mid">
<text>你的从业身份是?</text>
</view>
<view class="bottom">
<view class="btson1" style="color:{{bidType == 1 ? '#008AFF' : '#333'}};border-color:{{bidType == 1 ? '#008AFF' : '#D8D8D8'}};" data-index="1" bindtap="onTabChangeTop">
<view style="width:48rpx;height:48rpx;float:left">
<image style="width:48rpx;height:48rpx;" src="/assets/image/dbcicon.png"></image>
</view>
<view style="width:114rpx;height:50rpx;float:right">
<text>打包站</text>
</view>
</view>
<view class="btson2" style="color:{{bidType == 2 ? '#008AFF' : '#333'}};border-color:{{bidType == 2 ? '#008AFF' : '#D8D8D8'}};" data-index="2" bindtap="onTabChangeTop">
<view style="width:183rpx;height:50rpx;background: #FFFFFF;">
<view style="width:48rpx;height:48rpx;float:left">
<image style="width:48rpx;height:48rpx;" src="/assets/image/fzcicon.png"></image>
</view>
<view style="width:114rpx;height:50rpx;float:right">
<text>废品站</text>
</view>
</view>
</view>
<view class="btson3" style="color:{{bidType == 3 ? '#008AFF' : '#333'}};border-color:{{bidType == 3 ? '#008AFF' : '#D8D8D8'}};" data-index="3" bindtap="onTabChangeTop">
<view style="width:48rpx;height:48rpx;float:left">
<image style="width:48rpx;height:48rpx;" src="/assets/image/zzcicon.png"></image>
</view>
<view style="width:114rpx;height:50rpx;float:right">
<text>造纸厂</text>
</view>
</view>
<view class="btson4" style="color:{{bidType == 4 ? '#008AFF' : '#333'}};border-color:{{bidType == 4 ? '#008AFF' : '#D8D8D8'}};" data-index="4" bindtap="onTabChangeTop">
<view style="width:48rpx;height:48rpx;float:left">
<image style="width:48rpx;height:48rpx;" src="/assets/image/qticon.png"></image>
</view>
<view style="width:114rpx;height:50rpx;float:right">
<text>其他</text>
</view>
</view>
</view>
<view class="otherInpt" wx:if="{{bidType == 4}}" >
<input placeholder="请输入你的身份" bindinput="bindinput" />
</view>
</view>

94
pages/home/tab1/index.wxss

@ -0,0 +1,94 @@
/* pages/home/tab1/index.wxss */
.bj {
background-color: white;
min-height: 900rpx;
}
.vip-btn {
/* height: 90rpx; */
width: 180rpx;
background: #F5F5F5;
float: right;
color: rgba(0, 0, 0, 0.45);
font-size: 28rpx;
}
.top {
height: 258rpx;
width: 100%;
}
.topText {
width: 440rpx;
height: 258rpx;
float: left;
padding-left: 48rpx;
padding-top: 60rpx;
font-size: 44rpx;
color: #000000;
font-family: PingFangSC-Medium;
}
.mid {
height: 150rpx;
padding-top: 100rpx;
padding-left: 48rpx;
font-family: PingFangSC-Medium;
font-size: 36rpx;
color: #000000;
letter-spacing: 2px;
}
.bottom {
height: 410rpx;
padding: 48rpx;
}
.btson1 {
height: 147rpx;
width: 315rpx;
float: left;
overflow: hidden;
border: 3rpx solid #D8D8D8;
border-radius: 10rpx;
border-radius: 10rpx;
padding: 22px 33px 22px 33px;
}
.btson2 {
height: 147rpx;
width: 315rpx;
float: right;
overflow: hidden;
border: 3rpx solid #D8D8D8;
border-radius: 10rpx;
border-radius: 10rpx;
padding: 22px 33px 22px 33px;
}
.btson3 {
height: 147rpx;
width: 315rpx;
float: left;
margin-top: 20rpx;
overflow: hidden;
border: 3rpx solid #D8D8D8;
border-radius: 10rpx;
border-radius: 10rpx;
padding: 22px 33px 22px 33px;
}
.btson4 {
height: 147rpx;
width: 315rpx;
float: right;
margin-top: 20rpx;
overflow: hidden;
border: 3rpx solid #D8D8D8;
border-radius: 10rpx;
border-radius: 10rpx;
padding: 22px 33px 22px 33px;
}
.otherInpt{
padding-left: 48rpx;
}

129
pages/home/tab2/index.js

@ -0,0 +1,129 @@
// pages/home/tab2/index.js
const storage = require('../../../utils/storage')
import regions from '../../../utils/region'
Page({
/**
* 页面的初始数据
*/
data: {
options: regions,
region: [440000, '', ''],
form: {
bidType: 1,
imgList: [],
secondCategoryId: null,
stock: null,
dopantRate: null,
waterRate: null
},
cateName: '',
dopantName: '',
waterName: '',
intervalName: '',
sumAmount: 0,
keyboard: 0,
toView: '',
focus: false,
picking: false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.cascaderView = this.cascaderView || this.selectComponent('#wux-cascader')
this.pickerView = this.pickerView || this.selectComponent('#picker-view')
},
toNextTab: function () {
wx.redirectTo({
url: '/pages/home/tab3/index'
})
},
toMyInfo: function () {
storage.put('userIsLoginFirst', '1')
wx.redirectTo({
url: '/pages/index/index'
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
backspace: function () {
console.log('点击返回被触发2')
wx.redirectTo({
url: '/pages/home/tab1/index'
})
},
showRegion: function () {
if (this.data.disabled) {
return
}
this.cascaderView.showPicker(this.data.region)
this.setData({
picking: true
})
},
onRegionChange: function (e) {
if (e.detail && e.detail.options) {
this.setData({
['form.areaStr']: e.detail.options.map((n) => n.label).join(' '),
region: e.detail.value
})
this.data.form['locProvinceId'] = e.detail.value[0]
this.data.form['locProvinceName'] = e.detail.options[0].label
this.data.form['locCityId'] = e.detail.value[1]
this.data.form['locCityName'] = e.detail.options[1].label
this.data.form['locDistrictId'] = e.detail.value[2]
this.data.form['locDistrictName'] = e.detail.options[2].label
}
this.setData({ picking: false })
},
})

5
pages/home/tab2/index.json

@ -0,0 +1,5 @@
{
"usingComponents": {
"wux-cascader": "/components/cascader/index"
}
}

31
pages/home/tab2/index.wxml

@ -0,0 +1,31 @@
<!--pages/home/tab2/index.wxml-->
<cu-custom bgColor="bg-white" isBack="{{true}}" intercept="{{true}}" bindcustomevent="backspace">
<view slot="content">城市</view>
</cu-custom>
<view class="bj">
<view style="width:100%;height:130rpx;padding-top:10rpx;padding-right:10rpx">
<button class="cu-btn bg-red round shadow-blur vip-btn" bindtap="toMyInfo">跳出</button>
<button class="cu-btn bg-red round shadow-blur vip-btn" bindtap="toNextTab">下一页</button>
</view>
<view class="top">
<view class="topText">
<text>HI,\n欢迎使用纸通宝\n开启一站式废纸交易</text>
</view>
<view style="width:310rpx;height:258rpx;float:right">
<image src="/assets/image/tabBj.png" style="width:310rpx;height:258rpx"></image>
</view>
</view>
<view class="mid">
<text>你所在的城市是?</text>
</view>
<view class="bottomPCC">
</view>
<view class="bottom" bindtap="showRegion">
<view class="text-sg {{form.areaStr?'text-blue':'input-grey'}}">{{form.areaStr||'请选择所在地区'}}</view>
</view>
</view>
<wux-cascader id="wux-cascader" value="{{region}}" options="{{ options }}" bind:close="onRegionChange" />
<!-- <wux-cascader visible="{{ visible }}" controlled value="{{ cateValue }}" options="{{ cateList }}"
bind:close="onCategory" bind:load="onLoadOptions" /> -->

91
pages/home/tab2/index.wxss

@ -0,0 +1,91 @@
/* pages/home/tab1/index.wxss */
.bj {
background-color: white;
min-height: 900rpx;
}
.vip-btn {
/* height: 90rpx; */
width: 180rpx;
background: #F5F5F5;
float: right;
color: rgba(0, 0, 0, 0.45);
font-size: 28rpx;
}
.top {
height: 258rpx;
width: 100%;
}
.topText {
width: 440rpx;
height: 258rpx;
float: left;
padding-left: 48rpx;
padding-top: 60rpx;
font-size: 44rpx;
color: #000000;
font-family: PingFangSC-Medium;
}
.mid {
height: 150rpx;
padding-top: 100rpx;
padding-left: 48rpx;
font-family: PingFangSC-Medium;
font-size: 36rpx;
color: #000000;
letter-spacing: 2px;
}
.bottom {
height: 410rpx;
padding: 48rpx;
}
.btson1 {
height: 147rpx;
width: 315rpx;
float: left;
overflow: hidden;
border: 3rpx solid #D8D8D8;
border-radius: 10rpx;
border-radius: 10rpx;
padding: 22px 33px 22px 33px;
}
.btson2 {
height: 147rpx;
width: 315rpx;
float: right;
overflow: hidden;
border: 3rpx solid #D8D8D8;
border-radius: 10rpx;
border-radius: 10rpx;
padding: 22px 33px 22px 33px;
}
.btson3 {
height: 147rpx;
width: 315rpx;
float: left;
margin-top: 20rpx;
overflow: hidden;
border: 3rpx solid #D8D8D8;
border-radius: 10rpx;
border-radius: 10rpx;
padding: 22px 33px 22px 33px;
}
.btson4 {
height: 147rpx;
width: 315rpx;
float: right;
margin-top: 20rpx;
overflow: hidden;
border: 3rpx solid #D8D8D8;
border-radius: 10rpx;
border-radius: 10rpx;
padding: 22px 33px 22px 33px;
}

95
pages/home/tab3/index.js

@ -0,0 +1,95 @@
// pages/home/tab3/index.js
const storage = require('../../../utils/storage')
Page({
/**
* 页面的初始数据
*/
data: {
bidType: 1
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
toNextTab: function () {
wx.redirectTo({
url: '/pages/home/tab4/index'
})
},
toMyInfo: function () {
storage.put('userIsLoginFirst', '1')
wx.redirectTo({
url: '/pages/index/index'
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
backspace: function () {
console.log('点击返回被触发3')
wx.redirectTo({
url: '/pages/home/tab2/index'
})
},
onTabChangeTop: function (e) {
if (this.data.bidType == Number(e.currentTarget.dataset.index)) {
return
}
var tabIndex = Number(e.currentTarget.dataset.index)
this.data.firstCategoryId = ''
this.setData({
['bidType']: tabIndex
})
},
})

3
pages/home/tab3/index.json

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

43
pages/home/tab3/index.wxml

@ -0,0 +1,43 @@
<!--pages/home/tab3/index.wxml-->
<cu-custom bgColor="bg-white" isBack="{{true}}" intercept="{{true}}" bindcustomevent="backspace">
<view slot="content">经验</view>
</cu-custom>
<view class="bj">
<view style="width:100%;height:130rpx;padding-top:10rpx;padding-right:10rpx">
<button class="cu-btn bg-red round shadow-blur vip-btn" bindtap="toMyInfo">跳出</button>
<button class="cu-btn bg-red round shadow-blur vip-btn" bindtap="toNextTab">下一页</button>
</view>
<view class="top">
<view class="topText">
<text>HI,\n欢迎使用纸通宝\n开启一站式废纸交易</text>
</view>
<view style="width:310rpx;height:258rpx;float:right">
<image src="/assets/image/tabBj.png" style="width:310rpx;height:258rpx"></image>
</view>
</view>
<view class="mid">
<text>你的从业经验是?</text>
</view>
<view class="bottom">
<view class="btson1" style="color:{{bidType == 1 ? '#008AFF' : '#333'}};border-color:{{bidType == 1 ? '#008AFF' : '#D8D8D8'}};" data-index="1" bindtap="onTabChangeTop">
<view style="width:162rpx;height:50rpx;padding-left:20rpx;float:right">
<text>1年以下</text>
</view>
</view>
<view class="btson2" style="color:{{bidType == 2 ? '#008AFF' : '#333'}};border-color:{{bidType == 2 ? '#008AFF' : '#D8D8D8'}};" data-index="2" bindtap="onTabChangeTop">
<view style="width:183rpx;height:50rpx;background: #FFFFFF;">
<view style="width:162rpx;height:50rpx;padding-left:20rpx;float:right">
<text>1~5年</text>
</view>
</view>
</view>
<view class="btson3" style="color:{{bidType == 3 ? '#008AFF' : '#333'}};border-color:{{bidType == 3 ? '#008AFF' : '#D8D8D8'}};" data-index="3" bindtap="onTabChangeTop">
<view style="width:162rpx;height:50rpx;padding-left:20rpx;float:right">
<text>5年以上</text>
</view>
</view>
</view>
</view>

79
pages/home/tab3/index.wxss

@ -0,0 +1,79 @@
/* pages/home/tab1/index.wxss */
.bj {
background-color: white;
min-height: 900rpx;
}
.vip-btn {
/* height: 90rpx; */
width: 180rpx;
background: #F5F5F5;
float: right;
color: rgba(0, 0, 0, 0.45);
font-size: 28rpx;
}
.top {
height: 258rpx;
width: 100%;
}
.topText {
width: 440rpx;
height: 258rpx;
float: left;
padding-left: 48rpx;
padding-top: 60rpx;
font-size: 44rpx;
color: #000000;
font-family: PingFangSC-Medium;
}
.mid {
height: 150rpx;
padding-top: 100rpx;
padding-left: 48rpx;
font-family: PingFangSC-Medium;
font-size: 36rpx;
color: #000000;
letter-spacing: 2px;
}
.bottom {
height: 410rpx;
padding: 48rpx;
}
.btson1 {
height: 147rpx;
width: 315rpx;
float: left;
overflow: hidden;
border: 3rpx solid #D8D8D8;
border-radius: 10rpx;
border-radius: 10rpx;
padding: 22px 35px 22px 35px;
}
.btson2 {
height: 147rpx;
width: 315rpx;
float: right;
overflow: hidden;
border: 3rpx solid #D8D8D8;
border-radius: 10rpx;
border-radius: 10rpx;
padding: 22px 35px 22px 35px;
}
.btson3 {
height: 147rpx;
width: 315rpx;
float: left;
margin-top: 20rpx;
overflow: hidden;
border: 3rpx solid #D8D8D8;
border-radius: 10rpx;
border-radius: 10rpx;
padding: 22px 35px 22px 35px;
}

76
pages/home/tab4/index.js

@ -0,0 +1,76 @@
// pages/home/tab4/index.js
const storage = require('../../../utils/storage')
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
toMyInfo:function(){
storage.put('userIsLoginFirst', '1')
wx.redirectTo({ url: '/pages/index/index' })
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
backspace:function(){
// console.log('点击返回被触发4')
wx.redirectTo({ url: '/pages/home/tab3/index' })
},
})

3
pages/home/tab4/index.json

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

25
pages/home/tab4/index.wxml

@ -0,0 +1,25 @@
<!--pages/home/tab4/index.wxml-->
<cu-custom bgColor="bg-white" isBack="{{true}}" intercept="{{true}}" bindcustomevent="backspace">
<view slot="content">采购品类</view>
</cu-custom>
<view class="bj">
<view style="width:100%;height:130rpx;padding-top:10rpx;padding-right:10rpx">
<button class="cu-btn bg-red round shadow-blur vip-btn" bindtap="toMyInfo">跳出</button>
<button class="cu-btn bg-red round shadow-blur vip-btn" bindtap="toNextTab">下一页</button>
</view>
<view class="top">
<view class="topText">
<text>HI,\n欢迎使用纸通宝\n开启一站式废纸交易</text>
</view>
<view style="width:310rpx;height:258rpx;float:right">
<image src="/assets/image/tabBj.png" style="width:310rpx;height:258rpx"></image>
</view>
</view>
<view class="mid">
<text>你希望采购的品类是?</text>
</view>
<view class="bottom">
</view>
</view>

46
pages/home/tab4/index.wxss

@ -0,0 +1,46 @@
/* pages/home/tab1/index.wxss */
.bj {
background-color: white;
min-height: 900rpx;
}
.vip-btn {
/* height: 90rpx; */
width: 180rpx;
background: #F5F5F5;
float: right;
color: rgba(0, 0, 0, 0.45);
font-size: 28rpx;
}
.top {
height: 258rpx;
width: 100%;
}
.topText {
width: 440rpx;
height: 258rpx;
float: left;
padding-left: 48rpx;
padding-top: 60rpx;
font-size: 44rpx;
color: #000000;
font-family: PingFangSC-Medium;
}
.mid {
height: 150rpx;
padding-top: 100rpx;
padding-left: 48rpx;
font-family: PingFangSC-Medium;
font-size: 36rpx;
color: #000000;
letter-spacing: 2px;
}
.bottom {
height: 410rpx;
padding: 48rpx;
}

5
pages/index/index.js

@ -168,9 +168,14 @@ Page({
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function () {
var userIsLoginFirst = storage.get('userIsLoginFirst')
if(this.data.inited){ if(this.data.inited){
this.onResume() this.onResume()
} }
wx.navigateTo({ url: '/pages/home/tab1/index' })
// if(userIsLoginFirst=='1'){
// wx.navigateTo({ url: '/pages/home/tab1/index' })
// }
}, },
onEvent: function (message) { onEvent: function (message) {
if(message.what == 250){ if(message.what == 250){

192
pages/login/index.js

@ -1,10 +1,30 @@
//获取应用实例 //获取应用实例
import { $wuxCountDown } from '../../components/index'
import { config, postCaptcha, loginCaptcha, loginPwd, wechatApplet, loginWechat } from "../api/user"
import { zconfig, loginToken, getBaseInfo } from "../api/ztb"
import { pconfig } from "../api/payment"
import { mconfig } from "../api/moment"
import { sconfig, getOrderExists } from "../api/saas"
import {
$wuxCountDown
} from '../../components/index'
import {
config,
postCaptcha,
loginCaptcha,
loginPwd,
wechatApplet,
loginWechat
} from "../api/user"
import {
zconfig,
loginToken,
getBaseInfo
} from "../api/ztb"
import {
pconfig
} from "../api/payment"
import {
mconfig
} from "../api/moment"
import {
sconfig,
getOrderExists
} from "../api/saas"
const storage = require('../../utils/storage') const storage = require('../../utils/storage')
const util = require('../../utils/util') const util = require('../../utils/util')
const event = require('../../utils/event') const event = require('../../utils/event')
@ -31,19 +51,25 @@ Page({
}, },
onLoad: function (options) { onLoad: function (options) {
if (options.mobile) { if (options.mobile) {
this.setData({ ['form.mobile']: options.mobile })
this.setData({
['form.mobile']: options.mobile
})
} }
this.wxLogin() this.wxLogin()
var check = storage.get('AgreeCheck') var check = storage.get('AgreeCheck')
app.globalData.kg = storage.get('ztb-kg') app.globalData.kg = storage.get('ztb-kg')
if (check) { if (check) {
this.setData({check: true})
this.setData({
check: true
})
} }
}, },
wxLogin: function(){
wxLogin: function () {
wx.login({ wx.login({
success: res => { success: res => {
wechatApplet({ authCode: res.code }).then(result => {
wechatApplet({
authCode: res.code
}).then(result => {
storage.put('tmpAuthToken', result.data.tmpAuthToken, 98) storage.put('tmpAuthToken', result.data.tmpAuthToken, 98)
}) })
} }
@ -55,21 +81,37 @@ Page({
return return
} }
app.globalData.token = authorization app.globalData.token = authorization
config.header = { 'Authorization': 'QNT ' + authorization }
loginToken({loginToken: app.globalData.token}).then(result => {
zconfig.header = { 'Authorization': 'QNT ' + result.data.token }
pconfig.header = { 'Authorization': 'QNT ' + result.data.token }
mconfig.header = { 'Authorization': 'QNT ' + result.data.token }
config.header = {
'Authorization': 'QNT ' + authorization
}
loginToken({
loginToken: app.globalData.token
}).then(result => {
zconfig.header = {
'Authorization': 'QNT ' + result.data.token
}
pconfig.header = {
'Authorization': 'QNT ' + result.data.token
}
mconfig.header = {
'Authorization': 'QNT ' + result.data.token
}
// 登录流程完成; // 登录流程完成;
getBaseInfo().then(result => { getBaseInfo().then(result => {
app.globalData.userInfo = result.data
if(!util.isEmpty(result.data.userToken)){
storage.put('userIsLoginFirst', '0')
app.globalData.userInfo = result.data
if (!util.isEmpty(result.data.userToken)) {
this.handleUserToken(result.data.userToken) this.handleUserToken(result.data.userToken)
} else { } else {
this.setData({ loging: false})
this.setData({
loging: false
})
wx.hideLoading() wx.hideLoading()
wx.navigateBack() wx.navigateBack()
event.emit('EventMessage', { what: 888, desc: 'Logined' })
event.emit('EventMessage', {
what: 888,
desc: 'Logined'
})
} }
}).catch(err => { }).catch(err => {
wx.hideLoading() wx.hideLoading()
@ -77,7 +119,9 @@ Page({
app.globalData.token = null app.globalData.token = null
storage.remove('Authorization') storage.remove('Authorization')
config.header = null config.header = null
this.setData({ loging: false})
this.setData({
loging: false
})
}) })
}).catch(err => { }).catch(err => {
wx.hideLoading() wx.hideLoading()
@ -85,18 +129,24 @@ Page({
app.globalData.token = null app.globalData.token = null
storage.remove('Authorization') storage.remove('Authorization')
config.header = null config.header = null
this.setData({ loging: false})
this.setData({
loging: false
})
}) })
}, },
handleUserToken: function(userToken){
handleUserToken: function (userToken) {
storage.put('userToken', userToken) storage.put('userToken', userToken)
sconfig.header = {'user-token': userToken }
sconfig.header = {
'user-token': userToken
}
getOrderExists().then(result => { getOrderExists().then(result => {
wx.hideLoading() wx.hideLoading()
if (Number(result.data) != 1 || !app.release) { if (Number(result.data) != 1 || !app.release) {
wx.navigateBack() wx.navigateBack()
} else { } else {
wx.reLaunch({ url: '/pages/paper/index' })
wx.reLaunch({
url: '/pages/paper/index'
})
} }
}).catch(err => { }).catch(err => {
wx.hideLoading() wx.hideLoading()
@ -104,15 +154,21 @@ Page({
app.globalData.token = null app.globalData.token = null
storage.remove('Authorization') storage.remove('Authorization')
config.header = null config.header = null
this.setData({ loging: false})
this.setData({
loging: false
})
wx.navigateBack() wx.navigateBack()
}) })
}, },
changePwd: function () { changePwd: function () {
if (this.data.pwdType === 'password') { if (this.data.pwdType === 'password') {
this.setData({ pwdType: 'text' })
this.setData({
pwdType: 'text'
})
} else { } else {
this.setData({ pwdType: 'password' })
this.setData({
pwdType: 'password'
})
} }
}, },
bindInput: function (e) { bindInput: function (e) {
@ -121,19 +177,29 @@ Page({
var enable = false var enable = false
if ((/^1\d{10}$/.test(e.detail.value)) && e.detail.value.length == 11) { if ((/^1\d{10}$/.test(e.detail.value)) && e.detail.value.length == 11) {
enable = true enable = true
this.setData({ mobileEnable: enable })
this.setData({
mobileEnable: enable
})
} }
} }
if ((/^1\d{10}$/.test(this.data.form.account)) && this.data.form.account.length == 11) { if ((/^1\d{10}$/.test(this.data.form.account)) && this.data.form.account.length == 11) {
if (this.data.type == 1 && !util.isEmpty(this.data.form.captcha)) { if (this.data.type == 1 && !util.isEmpty(this.data.form.captcha)) {
this.setData({ loginEnable: false })
this.setData({
loginEnable: false
})
} else if (this.data.type == 0 && !util.isEmpty(this.data.form.password)) { } else if (this.data.type == 0 && !util.isEmpty(this.data.form.password)) {
this.setData({ loginEnable: false })
this.setData({
loginEnable: false
})
} else { } else {
this.setData({ loginEnable: true })
this.setData({
loginEnable: true
})
} }
} else { } else {
this.setData({ loginEnable: true })
this.setData({
loginEnable: true
})
} }
}, },
loginForm: function () { loginForm: function () {
@ -149,7 +215,10 @@ Page({
util.showToast('请输入密码') util.showToast('请输入密码')
return return
} }
wx.showLoading({ title: '登录中', mask: true })
wx.showLoading({
title: '登录中',
mask: true
})
if (this.data.type == 1) { if (this.data.type == 1) {
loginCaptcha(this.data.form).then(result => { loginCaptcha(this.data.form).then(result => {
storage.put('Authorization', result.data.token) storage.put('Authorization', result.data.token)
@ -172,9 +241,17 @@ Page({
}, },
changeType: function () { changeType: function () {
if (this.data.type == 1) { if (this.data.type == 1) {
this.setData({ type: 0, ['form.captcha']: null, loginEnable: true })
this.setData({
type: 0,
['form.captcha']: null,
loginEnable: true
})
} else { } else {
this.setData({ type: 1, ['form.password']: null, loginEnable: true })
this.setData({
type: 1,
['form.password']: null,
loginEnable: true
})
} }
}, },
fetchCode: function (e) { fetchCode: function (e) {
@ -183,19 +260,33 @@ Page({
return return
} }
if (this.second && this.second.interval) return !1 if (this.second && this.second.interval) return !1
wx.showLoading({ title: '正在获取', mask: true })
postCaptcha({ verifiableAccount: this.data.form.account, verifiableAccountType: 1, purpose: 1 }).then(result => {
wx.showLoading({
title: '正在获取',
mask: true
})
postCaptcha({
verifiableAccount: this.data.form.account,
verifiableAccountType: 1,
purpose: 1
}).then(result => {
wx.hideLoading() wx.hideLoading()
this.setData({ codeEnable: false })
this.setData({
codeEnable: false
})
util.showToast('验证码已经发送') util.showToast('验证码已经发送')
this.wuxCountDown = new $wuxCountDown({ this.wuxCountDown = new $wuxCountDown({
date: +(new Date) + 60000, date: +(new Date) + 60000,
onEnd() { onEnd() {
this.setData({ second: '重新获取验证码', codeEnable: true })
this.setData({
second: '重新获取验证码',
codeEnable: true
})
}, },
render(date) { render(date) {
const sec = this.leadingZeros(date.sec, 2) + ' 秒 ' const sec = this.leadingZeros(date.sec, 2) + ' 秒 '
date.sec !== 0 && this.setData({ second: sec })
date.sec !== 0 && this.setData({
second: sec
})
}, },
}) })
}).catch(error => { }).catch(error => {
@ -204,20 +295,31 @@ Page({
}) })
}, },
readAgreement: function () { readAgreement: function () {
wx.navigateTo({ url: '/pages/html/agreement/index' })
wx.navigateTo({
url: '/pages/html/agreement/index'
})
}, },
onGotUserInfo: function (e) { onGotUserInfo: function (e) {
this.setData({ loging: true })
loginWechat({ encryptedData: e.detail.encryptedData, iv: e.detail.iv }).then(result => {
this.setData({
loging: true
})
loginWechat({
encryptedData: e.detail.encryptedData,
iv: e.detail.iv
}).then(result => {
storage.put('Authorization', result.data.token) storage.put('Authorization', result.data.token)
app.globalData.token = result.data.token app.globalData.token = result.data.token
this.fetchUserInfo() this.fetchUserInfo()
}).catch(error => { }).catch(error => {
wx.hideLoading() wx.hideLoading()
this.setData({ loging: false })
this.setData({
loging: false
})
if (error && error.data) { if (error && error.data) {
if (error.code == 200101) { if (error.code == 200101) {
this.setData({ wxflag: true })
this.setData({
wxflag: true
})
} }
this.data.userInfo = e.detail.userInfo this.data.userInfo = e.detail.userInfo
this.data.form.tmpAuthToken = error.data.tmpAuthToken this.data.form.tmpAuthToken = error.data.tmpAuthToken

Loading…
Cancel
Save