Browse Source

纸通宝2.15开发完成

featrue/v4.2
huziyuan 5 years ago
parent
commit
43789b4535
34 changed files with 1248 additions and 138 deletions
  1. 2
      app.json
  2. BIN
      assets/image/noattention.png
  3. 52
      pages/agent/factory/index.js
  4. 2
      pages/agent/factory/index.wxml
  5. 123
      pages/agent/index/index.js
  6. 3
      pages/agent/index/index.json
  7. 43
      pages/agent/index/index.wxml
  8. 64
      pages/agent/index/index.wxss
  9. 9
      pages/agent/order/index.wxml
  10. 16
      pages/api/ztb.js
  11. 129
      pages/home/attentionPaperList/index.js
  12. 7
      pages/home/attentionPaperList/index.json
  13. 41
      pages/home/attentionPaperList/index.wxml
  14. 62
      pages/home/attentionPaperList/index.wxss
  15. 114
      pages/home/businessLicense/index.js
  16. 5
      pages/home/businessLicense/index.json
  17. 32
      pages/home/businessLicense/index.wxml
  18. 58
      pages/home/businessLicense/index.wxss
  19. 216
      pages/home/info/index.js
  20. 3
      pages/home/info/index.json
  21. 68
      pages/home/info/index.wxml
  22. 79
      pages/home/tab1/index.js
  23. 5
      pages/home/tab1/index.wxml
  24. 3
      pages/home/tab1/index.wxss
  25. 44
      pages/home/tab2/index.js
  26. 2
      pages/home/tab2/index.wxml
  27. 54
      pages/home/tab3/index.js
  28. 4
      pages/home/tab3/index.wxml
  29. 77
      pages/home/tab4/index.js
  30. 6
      pages/home/tab4/index.json
  31. 16
      pages/home/tab4/index.wxml
  32. 18
      pages/home/tab4/index.wxss
  33. 28
      pages/index/index.js
  34. 1
      pages/login/index.js

2
app.json

@ -17,6 +17,8 @@
"pages/home/tab2/index",
"pages/home/tab3/index",
"pages/home/tab4/index",
"pages/home/attentionPaperList/index",
"pages/home/businessLicense/index",
"pages/shop/create/index",
"pages/shop/detail/index",
"pages/shop/order/index",

BIN
assets/image/noattention.png

Before After
Width: 378  |  Height: 294  |  Size: 63 KiB

52
pages/agent/factory/index.js

@ -1,6 +1,7 @@
// pages/mall/factory/index.js
import {
getFactoryPriceDetail
getFactoryPriceDetail,
userPushFollowMill
} from "../../api/ztb"
import {
getPreferList
@ -35,7 +36,7 @@ Page({
pageNum: 1
},
attentionStatus: 1
hasFollowed: false
},
/**
* 生命周期函数--监听页面加载
@ -63,7 +64,8 @@ Page({
this.data.cateId = result.data.paperCategoryList[this.data.cateIndex].categoryId
}
this.setData({
factoryDetail: result.data
factoryDetail: result.data,
hasFollowed:result.data.hasFollowed
})
wx.hideLoading()
}).catch(err => {
@ -200,17 +202,51 @@ Page({
event.remove('EventMessage', this)
},
onAttentionChange: function (e) {
if (e.currentTarget.dataset.cid == 1) {
var model = {
follow: null,
paperMillId: this.data.id
}
if (e.currentTarget.dataset.cid == false) {
//关注
this.setData({
attentionStatus: 2,
hasFollowed: true,
})
model.follow = true
this.userPushFollowMillFct(model)
setTimeout(() => event.emit('factoryDetails', { what: 1101, desc: 'factoryDetails' }), 1000)
}
if (e.currentTarget.dataset.cid == 2) {
if (e.currentTarget.dataset.cid == true) {
//取消关注
this.setData({
attentionStatus: 1,
hasFollowed: false,
})
model.follow = false
this.userPushFollowMillFct(model)
setTimeout(() => event.emit('factoryDetails', { what: 1101, desc: 'factoryDetails' }), 1000)
}
util.showToast(this.data.attentionStatus+'')
},
userPushFollowMillFct: function (model) {
userPushFollowMill(model).then(res => {
this.getFactoryPriceDetailFct({id:this.data.id})
})
},
getFactoryPriceDetailFct:function(options){
getFactoryPriceDetail(options.id).then(result => {
if (result.data.paperCategoryList && result.data.paperCategoryList.length) {
this.data.cateId = result.data.paperCategoryList[this.data.cateIndex].categoryId
}
this.setData({
factoryDetail: result.data,
hasFollowed:result.data.hasFollowed
})
wx.hideLoading()
}).catch(err => {
wx.hideLoading()
util.showToast(err)
})
}
})

2
pages/agent/factory/index.wxml

@ -9,7 +9,7 @@
<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="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>
<text class="{{hasFollowed == false ? 'text-blue' : 'text-red'}}" data-cid="{{hasFollowed}}" bindtap="onAttentionChange">{{hasFollowed == false ? '关注' : '取消关注'}}</text>
</view>
<view class="text-xs text-gray" style="margin-top:4rpx">
<text>{{factoryDetail.locProvinceName + factoryDetail.locCityName + factoryDetail.locDistrictName}}</text>

123
pages/agent/index/index.js

@ -1,8 +1,11 @@
// pages/agent/index/index.js
import {
getFactoryPrice,
getFactoryCity
getFactoryCity,
getBaseInfo,
updateUserInfo
} from "../../api/ztb"
const event = require('../../../utils/event')
const app = getApp()
Page({
@ -25,13 +28,13 @@ Page({
form: {
cityId: '',
enableSalesAgent: 1,
pageNum: 1
pageNum: 1,
listType: 0
},
form2: {
pageNum: 1
},
bidType: 1,
bidTypeHight: 210,
isSetProxyTag: false, //是否已经选择过代卖标签
},
/**
@ -45,6 +48,62 @@ Page({
})
this.fetchRegionList()
this.fetchPapersList()
event.on('attentionPaperList', this, this.onEvent)
event.on('factoryDetails', this, this.onEvent)
},
onEvent: function (message) {
if (message.what == 1100 || message.what == 1101) {
this.data.form = {
cityId: '',
enableSalesAgent: 1,
pageNum: 1,
listType: 1
}
this.setData({
bidType: 2
})
this.data.orderList = []
this.fetchPapersList()
}
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
// this.fetchPapersList()
this.wuxDialog = this.wuxDialog || this.selectComponent('#wux-dialog')
var that = this
getBaseInfo().then(result => {
this.setData({
isSetProxyTag: result.data.isSetProxyTag
})
if (this.data.isSetProxyTag == false) {
this.updateUserInfoFct({
isSetProxyTag: true
})
this.wuxDialog.open({
resetOnClose: true,
title: '温馨提示',
content: '是否选择关注您常卖的纸厂?',
buttons: [{
text: '取消'
}, {
text: '确定',
type: 'primary',
onTap(e) {
wx.navigateTo({
url: '/pages/home/attentionPaperList/index'
})
}
}]
})
}
})
},
updateUserInfoFct: function (model) {
updateUserInfo(model).then(result => {})
},
fetchRegionList: function () {
getFactoryCity().then(result => {
@ -61,10 +120,6 @@ Page({
scrolled: this.data.cateList.length >= 5
})
})
},
//获取纸厂列表
fetchRegionList2: function () {
},
onTabChangeTop: function (e) {
if (this.data.bidType == Number(e.currentTarget.dataset.index)) {
@ -76,10 +131,27 @@ Page({
pageIndex: 0,
['bidType']: tabIndex
})
console.log(this.bidType)
if (this.data.bidType == 1) {
this.onRefreshList()
this.setData({
bidTypeHight: 210,
'form.listType': 0,
'form.cityId': '',
'form.enableSalesAgent': 1,
'form.pageNum': 1,
})
} else {
this.setData({
bidTypeHight: 50,
'form.listType': 1,
'form.cityId': '',
'form.enableSalesAgent': 1,
'form.pageNum': 1,
})
}
this.onRefreshList()
},
onTabChange: function ({
detail
@ -102,18 +174,11 @@ Page({
})
this.fetchPapersList()
},
// 下拉刷新关注...
onRefreshList2: function () {
this.setData({
['form2.pageNum']: 1,
})
this.fetchPapersList()
},
// 获取特价列表
fetchPapersList: function () {
if (this.data.requesting || this.data.finished) {
return
}
// if (this.data.requesting || this.data.finished) {
// return
// }
if (this.data.loading) {
this.data.requesting = true
} else {
@ -151,7 +216,8 @@ Page({
this.setData({
finished: true,
requesting: false,
loading: false
loading: false,
pageNum: 1
})
}
}).catch(err => {
@ -159,9 +225,20 @@ Page({
this.setData({
requesting: false,
finished: true,
loading: false
loading: false,
})
})
},
goattentionIndex: function () {
wx.navigateTo({
url: '/pages/home/attentionPaperList/index'
})
},
onUnload: function () {
event.remove('attentionPaperList', this)
event.remove('factoryDetails', this)
}
})

3
pages/agent/index/index.json

@ -8,6 +8,7 @@
"wux-tabi": "/components/tabi/index",
"wux-image": "/components/image/index",
"wux-divider": "/components/divider/index",
"agent-item": "/pages/agent/agent-item/index"
"agent-item": "/pages/agent/agent-item/index",
"wux-dialog": "/components/dialog/index"
}
}

43
pages/agent/index/index.wxml

@ -4,18 +4,18 @@
<view slot="content">纸厂代卖</view>
</cu-custom>
<view class="nav bg-white fixed" style="top:{{CustomBar}}px;height:210rpx;" wx:if="{{tabList.length}}">
<view class="nav bg-white fixed" style="top:{{CustomBar}}px;height:{{bidTypeHight}}rpx;" 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 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>
<wux-tabi wx:if="{{bidType == 1}}" scroll="{{scrolled}}" tab-data="{{tabList}}" tab-index="{{tabIndex}}" bind:change="onTabChange"></wux-tabi>
</view>
<view class="bg-white" style="height:210rpx;width:100%"></view>
<view class="bg-white" style="height:{{bidTypeHight}}rpx;width:100%"></view>
<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}}">
@ -86,14 +86,31 @@
</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>
<refresh-view wx:if="{{bidType == 2}}" bind:refresh="onRefreshList" height="{{height}}" triggered="{{requesting}}" scrollTop="{{top}}" bind:scrolltolower="fetchPapersList">
<view class="bj" wx:if="{{!orderList.length}}">
<view class="bgImgView">
<image class="imgsj" src="/assets/image/noattention.png" />
</view>
<view class="midText">
<text class="midText2">暂无关注</text>
</view>
<view class="midText3">
<text class="midText4">可前往纸厂列表添加关注</text>
</view>
<view class="bottomBtn">
<wux-button block type="positive" data-page="{{pageIndex}}" data-index="{{index}}" bind:click="goattentionIndex">添加关注</wux-button>
</view>
</view>
<view wx:else>
<view wx:if="{{form2.pageNum>1}}" style="padding:20rpx">
<view wx:for-item="pageItem" wx:for-index="pageIndex" wx:for="{{orderList}}" wx:key="pageIndex">
<view wx:for="{{pageItem}}" wx:key="index">
<view style="height:16rpx" wx:if="{{pageIndex != 0 || index != 0 }}"></view>
<agent-item item="{{item}}"></agent-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>
@ -102,4 +119,6 @@
</wux-divider>
</view>
</view>
</refresh-view>
</refresh-view>
<wux-dialog id="wux-dialog" />

64
pages/agent/index/index.wxss

@ -1 +1,63 @@
/* pages/agent/index/index.wxss */
/* pages/agent/index/index.wxss */
.bj{
height: 1300rpx;
background-color: white;
}
.bgImgView {
width: 100%;
height: 548rpx;
padding: 160rpx 186rpx 94rpx 186rpx;
background-color: white;
}
.imgsj {
height: 294rpx;
width: 378rpx;
}
.midText {
width: 100%;
height: 67rpx;
padding: 0rpx 279rpx 0rpx 279rpx;
}
.midText2 {
font-size: 48rpx;
color: #000000;
letter-spacing: 0;
text-align: left;
}
.midText3 {
width: 100%;
height: 45px;
padding: 0rpx 199rpx 0rpx 199rpx;
margin-top: 12rpx;
}
.midText4 {
font-size: 32rpx;
color: rgba(0, 0, 0, 0.75);
letter-spacing: 0;
text-align: left;
}
.bg-blue{
color: #FFFFFF;
background-color: #008AFF;
}
.offer-btn {
width: 480rpx;
height: 88rpx;
background: linear-gradient(312deg, rgba(38, 125, 214, 1) 0%, rgba(0, 138, 255, 1) 100%);
box-shadow: 0px 10px 13px -8px rgba(35, 126, 217, 0.53);
border-radius: 10rpx;
color: white;
font-size: 32rpx;
margin-left: 32rpx;
}
.bottomBtn{
width: 100%;
height: 88rpx;
padding:0rpx 135rpx 0rpx 135rpx;
}

9
pages/agent/order/index.wxml

@ -54,12 +54,9 @@
<text class="text-black">货到时间:</text>
<text class="text-gray">{{item.deliveryTime}}</text>
</view>
<view class="flex flex-justify text-df" style="margin-top:8rpx">
<text class="text-black">货车车牌:</text>
<text class="text-gray">00000001</text>
<text class="text-gray">00000002</text>
<text class="text-gray">00000003</text>
<text class="text-gray">00000004</text>
<view class="flex flex-justify text-df" style="margin-top:8rpx" wx:if="{{item.orderItems}}" wx:for="{{item.orderItems}}" wx:for-item="cell" wx:key="index">
<text class="text-black">货车车牌{{index+1}}:{{cell.logisticcsInfo.plateNumber}}</text>
<text class="text-gray" >{{cell.status==50?'待预约':(cell.status==51?'待送货':(cell.status==52?'结算中':(cell.status==53?'已完成':(cell.status==54?'已关闭':'---'))))}}</text>
</view>
</view>
</view>

16
pages/api/ztb.js

@ -118,6 +118,16 @@ const getBiddingActivityList = (params) => mGet(`/recycle-service/get/bidding-ac
const getStoreWater = (params) => mGet(`/recycle-service/get/store-water`, params, zconfig)
const getStoreTradeList = (params) => mGet(`/recycle-service/get/store-order-trade-list`, params, zconfig)
//获取废品品类列表,不传params返回一级品类,传一级品类返回二级品类
const getLategoriesList = (params) => mGet(`/recycle-service/scrap-category/get/categories-list`, params, zconfig)
//提交用户信息
const updateUserInfo = (params) => mPost(`/recycle-service/user/update/user-info`, params, zconfig)
//提交用户信息
const updateUserInfoZtb = (params) => mPost(`/recycle-service/user/update/user-info`, params, zconfig)
//用户关注,取消关注纸厂
const userPushFollowMill = (params) => mPost(`/recycle-service/user/push/follow-mill`, params, zconfig)
export {
zconfig,
loginToken,
@ -207,5 +217,9 @@ export {
updatePurchaseStatus,
getBiddingActivityList,
getStoreWater,
getStoreTradeList
getStoreTradeList,
getLategoriesList,
updateUserInfo,
updateUserInfoZtb,
userPushFollowMill
}

129
pages/home/attentionPaperList/index.js

@ -0,0 +1,129 @@
// pages/home/tab4/index.js
import {
getFactoryPrice,
userPushFollowMill
} from '../../api/ztb'
const event = require('../../../utils/event.js')
const storage = require('../../../utils/storage')
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
loopRequesting:false,
form: {
paperMillIds: [],
},
model: {
paperMillIds: [],
cityId: '',
enableSalesAgent: 1,
pageNum: 1,
listType: 0,
pageSize:1000
},
categoryListone: [],
safeBottom: app.globalData.safeBottom,
userInfo: null,
loading:true
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({ safeBottom: app.globalData.safeBottom, userInfo: app.globalData.userInfo })
this.getFactoryPriceFct(this.data.model)
},
toMyInfo: function () {
event.emit('attentionPaperList', { what: 1100, desc: 'attentionPaperList' })
wx.navigateBack({
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
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'
})
},
getFactoryPriceFct:function(model){
getFactoryPrice(model).then(res=>{
this.setData({
categoryListone:res.data.records,
loading:false
})
})
},
checkboxChange: function (e) {
console.log(e)
this.setData({
'form.paperMillIds':e.detail.value,
'form.follow':true
})
},
bindtap: function (e) {
console.log(e)
},
submitForm:function(){
userPushFollowMill(this.data.form).then(result => {
this.data.loopRequesting = false
setTimeout(() => this.toMyInfo(), 1000)
}).catch(err => {
this.data.loopRequesting = false
})
}
})

7
pages/home/attentionPaperList/index.json

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

41
pages/home/attentionPaperList/index.wxml

@ -0,0 +1,41 @@
<!--pages/home/attentionPaperList/index.wxml-->
<cu-custom bgColor="bg-white" isBack="{{true}}">
<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>
</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>
<scroll-view scroll-y="true" style='height:500rpx;margin-top:15rpx'>
<view class="bg-white list-empty" style="height:{{height}}rpx" wx:if="{{!categoryListone.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 class="bottom">
<view>
<checkbox-group bindchange="checkboxChange">
<checkbox wx:for="{{ categoryListone }}" wx:key="index" style="width:100%;margin-top:15rpx" value="{{item.paperMillId}}" checked="{{item.hasFollowed}}">{{item.name}}</checkbox>
</checkbox-group>
</view>
</view>
</scroll-view>
<!-- <view style="width:100%;height:130rpx;padding-top:10rpx;padding-right:10rpx">
<button class="cu-btn bg-red round shadow-blur page-btn" disabled="{{loopRequesting}}" bindtap="submitForm">确认</button>
</view> -->
<view class="cu-bar bg-white foot" style="height:{{120 + safeBottom}}rpx;padding: 32rpx 32rpx {{safeBottom + 32}}rpx 32rpx;">
<button class="cu-btn bg-red round shadow-blur page-btn" bindtap="submitForm">确认</button>
</view>
</view>

62
pages/home/attentionPaperList/index.wxss

@ -0,0 +1,62 @@
/* pages/home/attentionPaperList/index.wxss */
page{
background-color: white;
}
.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;
}
.bg-blue{
color: #FFFFFF;
background-color: #008AFF;
}
.page-btn {
height: 90rpx;
width: 100%;
background: linear-gradient(312deg, rgba(38, 125, 214, 1) 0%, rgba(0, 138, 255, 1) 100%);
box-shadow: 0px 10px 13px -8px rgba(35, 126, 217, 0.53);
color: white;
font-size: 32rpx;
}

114
pages/home/businessLicense/index.js

@ -0,0 +1,114 @@
// pages/home/businessLicense/index.js
import {
updateUserInfo,
getBaseInfo
} from '../../api/ztb'
const util = require('../../../utils/util')
Page({
/**
* 页面的初始数据
*/
data: {
fileList:[],
imgLength:0,
form:{
imgList:''
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getUerInfoFct()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
onImageChange: function (e) {
var that=this
if (e.detail) {
var list = []
e.detail.forEach(element => {
if (!util.isEmpty(element.url)) {
list.push(element.url)
}
})
that.data.form['imgList'] = list
that.updateUserInfoFct({businessLicenseUrl:e.detail[0].url})
that.setData({
imgLength: list.length
})
}
},
updateUserInfoFct: function (model) {
console.log(model)
updateUserInfo(model).then(result => {
}).catch(err => {
})
},
getUerInfoFct: function () {
var that=this
getBaseInfo().then(res => {
that.data.form['imgList'] = res.data.businessLicenseUrl
var list=[]
if(res.data.businessLicenseUrl){
list.push(res.data.businessLicenseUrl)
}
that.setData({
imgLength: list.length,
fileList:[{ url: res.data.businessLicenseUrl, status: 8 }]
})
})
}
})

5
pages/home/businessLicense/index.json

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

32
pages/home/businessLicense/index.wxml

@ -0,0 +1,32 @@
<!--pages/home/businessLicense/index.wxml-->
<cu-custom bgColor="bg-white" isBack="{{true}}">
<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>
</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 style="display:{{!focus ? 'block' : 'none'}}">
<view class="cu-bar bg-white margin-top">
<view class="action text-bold" style="color:#333333">{{!disabled?'营业执照(上传1张)':'营业执照'}}</view>
<view class="action text-sg">{{imgLength}}{{!disabled? '/1':'张'}}</view>
</view>
<wux-uploader count="1" fileList="{{fileList}}" bindcustomevent="onImageChange"></wux-uploader>
</view>
</view>
</view>

58
pages/home/businessLicense/index.wxss

@ -0,0 +1,58 @@
/* pages/home/businessLicense/index.wxss */
page{
background-color: white;
}
.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;
}
.wux-badge {
position: absolute;
width: 120px;
height: 120px;
opacity: 0.8;
right: 0;
bottom: 0;
z-index: 10;
}

216
pages/home/info/index.js

@ -1,6 +1,7 @@
import {
zconfig,
getBaseInfo
getBaseInfo,
updateUserInfoZtb
} from '../../api/ztb'
import {
updateUserInfo
@ -100,9 +101,11 @@ Page({
linkPhone: res.data.mobile,
companyAddress: res.data.fullAddress,
userType: res.data.userType,
realName: res.data.realName || res.data.userName
realName: res.data.realName || res.data.userName,
})
})
this.cascaderView = this.cascaderView || this.selectComponent('#wux-cascader')
this.pickerView = this.pickerView || this.selectComponent('#picker-view')
},
uploadFile: function (path) {
var that = this
@ -140,27 +143,106 @@ Page({
}
})
},
showDialog: function (e) {
showDialog: function (e1) {
this.wuxDialog = this.wuxDialog || this.selectComponent('#wux-dialog')
var that = this
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('请输入昵称')
var placeholderName = ''
if (e1.currentTarget.dataset.tag == '打包站名') {
placeholderName = that.data.userInfo.packageFactoryName
} else if (e1.currentTarget.dataset.tag == '打包站占地面积') {
placeholderName = that.data.userInfo.packageFactoryArea
} else if (e1.currentTarget.dataset.tag == '工厂人数') {
placeholderName = that.data.userInfo.numberOfEmployee
} else if (e1.currentTarget.dataset.tag == '打包机数') {
placeholderName = that.data.userInfo.numberOfPackageMachine
} else if (e1.currentTarget.dataset.tag == '昵称') {
placeholderName = that.data.userInfo.nickname
}
this.wuxDialog.prompt({
resetOnClose: true,
title: e1.currentTarget.dataset.tag,
placeholder: placeholderName || '请输入' + e1.currentTarget.dataset.tag,
maxlength: 18,
onConfirm(e, response) {
//非头像,昵称需要调用ztb修改用户信息接口
if (util.isEmpty(response)) {
util.showToast('请输入' + e1.currentTarget.dataset.tag)
return
} else
if (e1.currentTarget.dataset.tag == '打包站名') {
that.updateUserInfoFct({
packageFactoryName: response
})
} else
if (e1.currentTarget.dataset.tag == '打包站占地面积') {
if (parseInt(response)>0 && parseInt(response)==Number(response)) {
that.updateUserInfoFct({
packageFactoryArea: response
})
} else {
util.showToast('请输入正整数')
return
}
} else
if (e1.currentTarget.dataset.tag == '工厂人数') {
if (parseInt(response)>0 && parseInt(response)==Number(response)) {
that.updateUserInfoFct({
numberOfEmployee: response
})
} else {
util.showToast('请输入正整数')
return
}
} else
if (e1.currentTarget.dataset.tag == '打包机数') {
if (parseInt(response)>0 && parseInt(response)==Number(response)) {
that.updateUserInfoFct({
numberOfPackageMachine: response
})
} else {
util.showToast('请输入正整数')
return
}
} else {
//修改头像,昵称去UEC(user中的updateMemberInfo)
that.updateMemberInfo({
nickname: response
})
},
})
}
},
})
},
updateUserInfoFct: function (model) {
if (model) {
wx.showLoading({
title: '处理中',
mask: true
})
}
updateUserInfoZtb(model).then(result => {
wx.hideLoading()
if (model.packageFactoryName) {
this.setData({
['userInfo.packageFactoryName']: model.packageFactoryName
})
} else if (model.packageFactoryArea) {
this.setData({
['userInfo.packageFactoryArea']: model.packageFactoryArea
})
} else if (model.numberOfEmployee) {
this.setData({
['userInfo.numberOfEmployee']: model.numberOfEmployee
})
} else if (model.numberOfPackageMachine) {
this.setData({
['userInfo.numberOfPackageMachine']: model.numberOfPackageMachine
})
}
}).catch(err => {
wx.hideLoading()
})
},
updateMemberInfo: function (form) {
if (form.nickname) {
@ -222,5 +304,111 @@ Page({
visible: false
})
},
//通过事件执行更换执照方法比如点击头像执行该方法
updatalicenseUrl() {
var that = this;
wx.chooseImage({
count: 1, // 默认9
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success: function (res) {
// 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
var imgPaths = res.tempFilePaths
that.updataheadservice2(imgPaths[0]);
}
})
},
//上传执照
updataheadservice2(imgPaths) {
var that = this;
wx.uploadFile({
header: {
'user-token': app.globalData.userToken
},
url: zconfig.baseUrl + '/recycle-user-center/file-uploading/upload/image', //你的服务器地址
filePath: imgPaths, //要上传文件资源的路径
name: 'image', //文件对应的 key,开发者在服务端可以通过这个 key 获取文件的二进制内容
formData: {
adminid: app.globalData.adminid //HTTP 请求中其他额外的参数比如 用户id
},
success(res) {
var jsonStr = res.data;
jsonStr = jsonStr.replace(" ", "");
if (typeof jsonStr != 'object') {
jsonStr = jsonStr.replace(/\ufeff/g, ""); //重点
var jj = JSON.parse(jsonStr);
res.data = jj;
}
that.setData({
licenseUrl: res.data.data
})
that.preservationheadimg2(res.data.data)
}
})
},
//保存用户执照
preservationheadimg2(imgUrl) {
updateUserInfo({
licenseUrl: this.data.licenseUrl
}).then(res => {
if (res.code == 0) {
util.showToast('修改执照成功!')
this.getUserInfoData()
} else {
util.showToast('执照上传失败')
}
})
},
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
})
},
toBusinessLicense: function () {
wx.navigateTo({
url: '/pages/home/businessLicense/index'
})
},
toTab4: function () {
wx.navigateTo({
url: '/pages/home/tab4/index'
})
},
toTab3: function () {
wx.navigateTo({
url: '/pages/home/tab3/index'
})
},
toTab2: function () {
wx.navigateTo({
url: '/pages/home/tab2/index'
})
},
toTab1: function () {
wx.navigateTo({
url: '/pages/home/tab1/index'
})
},
})

3
pages/home/info/index.json

@ -5,6 +5,7 @@
"wux-cell": "/components/cell/index",
"wux-image": "/components/image/index",
"wux-dialog": "/components/dialog/index",
"wux-cropper": "/components/image-cropper/index"
"wux-cropper": "/components/image-cropper/index",
"wux-cascader": "/components/cascader/index"
}
}

68
pages/home/info/index.wxml

@ -19,8 +19,8 @@
<view class="flex flex-column flex-center" style="margin-left:24rpx;align-items:flex-start">
<view class="flex flex-center">
<text class="text-black" style="white-space: nowrap">姓名:{{linkman || ''}}</text>
<image class="img-auth2" src="{{userInfo.isAuth == 1 ? '/assets/image/icon_author.png' : '/assets/image/icon_unauthor.png'}}"></image>
<text class="{{userInfo.isAuth == 1 ? 'text-blue' : 'text-gray'}}">{{userInfo.isAuth == 1 ? '已认证' : '未实名认证'}}</text>
<!-- <image class="img-auth2" src="{{userInfo.isAuth == 1 ? '/assets/image/icon_author.png' : '/assets/image/icon_unauthor.png'}}"></image>
<text class="{{userInfo.isAuth == 1 ? 'text-blue' : 'text-gray'}}">{{userInfo.isAuth == 1 ? '已认证' : '未实名认证'}}</text> -->
</view>
<view class="flex flex-center" style="font-size:13px;margin-top:10rpx">
<text class="text-black" style="white-space: nowrap;float:right">联系电话:{{linkPhone}}</text>
@ -51,53 +51,73 @@
<view slot="header" class="text-gray">公司地址</view>
<view slot="footer" style="width:500rpx">{{companyAddress}}</view>
</wux-cell>
<wux-cell wx:if="{{userType == 1}}" is-link data-cid='nickname' bind:click="showDialog">
<wux-cell wx:if="{{userType == 1}}" is-link data-cid='nickname' data-tag='昵称' bind:click="showDialog">
<view slot="header" class="text-gray">昵称</view>
<view slot="footer" class="{{userInfo.nickname? 'text-black':'text-gray'}}">{{userInfo.nickname || '点击修改昵称'}}</view>
</wux-cell>
<wux-cell wx:if="{{userType == 1}}" is-link data-cid='card' bind:click="showDialog">
<wux-cell is-link="{{!userInfo.isAuth}}" url="/pages/home/idcard/index" bind:click="toAuth">
<view slot="header" class="text-gray">实名认证</view>
<view slot="footer" class="text-black">{{userInfo.isAuth ? '已认证' : '未认证'}}</view>
</wux-cell>
<wux-cell wx:if="{{userType == 1}}" is-link data-cid='card' data-tag='从业身份' bindtap="toTab1">
<view slot="header" class="text-gray">从业身份</view>
<view slot="footer" class="{{userInfo.card? 'text-black':'text-gray'}}">{{userInfo.card || '点击修改从业身份'}}</view>
<view slot="footer" class="{{userInfo.identityTag? 'text-black':'text-gray'}}">{{userInfo.identityTag || '点击修改从业身份'}}</view>
</wux-cell>
<wux-cell wx:if="{{userType == 1}}" is-link data-cid='city' bind:click="showDialog">
<wux-cell wx:if="{{userType == 1}}" is-link data-cid='city' bindtap="toTab2">
<view slot="header" class="text-gray">所在城市</view>
<view slot="footer" class="{{userInfo.city? 'text-black':'text-gray'}}">{{userInfo.city || '点击修改所在城市'}}</view>
<view slot="footer" class="text-sg {{userInfo.locateCityTag?'text-blue':'input-grey'}}">{{userInfo.locateCityTag.provinceName+userInfo.locateCityTag.cityName||'请选择所在地区'}}</view>
</wux-cell>
<wux-cell wx:if="{{userType == 1}}" is-link data-cid='age' bind:click="showDialog">
<wux-cell wx:if="{{userType == 1}}" is-link data-cid='age' data-tag='从业经验' bindtap="toTab3">
<view slot="header" class="text-gray">从业经验</view>
<view slot="footer" class="{{userInfo.age? 'text-black':'text-gray'}}">{{userInfo.age || '点击修改从业经验'}}</view>
<view slot="footer" class="{{userInfo.experienceTag? 'text-black':'text-gray'}}">{{userInfo.experienceTag || '点击修改从业经验'}}</view>
</wux-cell>
<wux-cell wx:if="{{userType == 1}}" is-link data-cid='type' bind:click="showDialog">
<wux-cell wx:if="{{userType == 1}}" is-link data-cid='type' data-tag='希望采购品类' bindtap="toTab4">
<view slot="header" class="text-gray">希望采购品类</view>
<view slot="footer" class="{{userInfo.type? 'text-black':'text-gray'}}">{{userInfo.type || '点击修改希望采购品类'}}</view>
<view slot="footer" class="{{userInfo.numberOfPurchaseCategoriesTag? 'text-black':'text-gray'}}">{{userInfo.numberOfPurchaseCategoriesTag || '点击修改希望采购品类'}}</view>
</wux-cell>
<wux-cell wx:if="{{userType == 1}}" is-link data-cid='type2' bind:click="showDialog">
<wux-cell wx:if="{{userType == 1}}" is-link data-cid='type2' data-tag='希望出货品类' bind:click="showDialog">
<view slot="header" class="text-gray">希望出货品类</view>
<view slot="footer" class="{{userInfo.type2? 'text-black':'text-gray'}}">{{userInfo.type2 || '点击修改希望出货品类'}}</view>
<view slot="footer" class="{{userInfo.numberOfProxyCategoriesTag? 'text-black':'text-gray'}}">{{userInfo.numberOfProxyCategoriesTag || '点击修改希望出货品类'}}</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 wx:if="{{userType == 1}}" is-link data-cid='numberMoon' data-tag='打包站名' bind:click="showDialog">
<view slot="header" class="text-gray">打包站名</view>
<view slot="footer" class="{{userInfo.packageFactoryName? 'text-black':'text-gray'}}">{{userInfo.packageFactoryName || '点击修改打包站名'}}</view>
</wux-cell>
<!-- <wux-cell is-link="{{!userInfo.isAuth}}" url="/pages/home/idcard/index" bind:click="toAuth">
<view slot="header" class="text-gray">实名认证</view>
<view slot="footer" class="text-black">{{userInfo.isAuth ? '已认证' : '未认证'}}</view>
</wux-cell> -->
<wux-cell wx:if="{{userType == 1}}" is-link data-cid='numberMoon' data-tag='打包站占地面积' bind:click="showDialog">
<view slot="header" class="text-gray">打包站占地面积</view>
<view slot="footer" class="{{userInfo.packageFactoryArea? 'text-black':'text-gray'}}">{{userInfo.packageFactoryArea || '点击修改打包站占地面积'}}</view>
</wux-cell>
<wux-cell wx:if="{{userType == 1}}" is-link data-cid='numberMoon' data-tag='工厂人数' bind:click="showDialog">
<view slot="header" class="text-gray">工厂人数</view>
<view slot="footer" class="{{userInfo.numberOfEmployee? 'text-black':'text-gray'}}">{{userInfo.numberOfEmployee || '点击修改工厂人数'}}</view>
</wux-cell>
<wux-cell wx:if="{{userType == 1}}" is-link data-cid='numberMoon' data-tag='打包机数' bind:click="showDialog">
<view slot="header" class="text-gray">打包机数</view>
<view slot="footer" class="{{userInfo.numberOfPackageMachine? 'text-black':'text-gray'}}">{{userInfo.numberOfPackageMachine || '点击修改工厂人数'}}</view>
</wux-cell>
<wux-cell wx:if="{{userType == 1}}" is-link data-cid='numberMoon' data-tag='营业执照' bind:click="toBusinessLicense">
<view slot="header" class="text-gray">营业执照</view>
<view slot="footer" class="{{userInfo.businessLicenseUrl? 'text-black':'text-gray'}}">{{userInfo.businessLicenseUrl==null?'未上传':'查看'}}</view>
</wux-cell>
</wux-cell-group>
<view class="bg-white margin-top" style="padding: 1rpx 30rpx;" wx:if="{{licenseUrl}}">
<!-- <view class="bg-white" style="padding: 1rpx 30rpx;">
<view style="padding: 20rpx 0rpx;">
<text class="lg text-sg text-black" decode="{{true}}">营业执照</text>
</view>
<view class="grid col-3 grid-square">
<view class="bg-img" wx:if="{{licenseUrl}}" bindtap="viewImage" data-url="{{licenseUrl}}">
<view class="bg-img" bindtap="viewImage" data-url="{{licenseUrl}}">
<image src='{{licenseUrl}}' mode='aspectFill'></image>
<view class="cu-tag bg-red" catchtap="updatalicenseUrl">
<text class="cuIcon-close"></text>
</view>
</view>
</view>
</view>
</view> -->
<wux-cropper wx:if="{{visible}}" srcList="{{srcList}}" bindclose="closeCallback" bindcroped="onCropback"></wux-cropper>
<wux-dialog id="wux-dialog" />
<wux-dialog id="wux-dialog" />
<wux-cascader id="wux-cascader" value="{{region}}" options="{{ options }}" bind:close="onRegionChange" />

79
pages/home/tab1/index.js

@ -1,4 +1,8 @@
// pages/home/tab1/index.js
import {
updateUserInfo,
getBaseInfo
} from '../../api/ztb'
const storage = require('../../../utils/storage')
Page({
@ -6,7 +10,8 @@ Page({
* 页面的初始数据
*/
data: {
bidType:1
bidType: 0,
identityTag: ''
},
@ -14,14 +19,18 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getUerInfoFct()
},
toNextTab:function(){
wx.redirectTo({ url: '/pages/home/tab2/index' })
toNextTab: function () {
wx.navigateTo({
url: '/pages/home/tab2/index'
})
},
toMyInfo:function(){
storage.put('userIsLoginFirst', '1')
wx.redirectTo({ url: '/pages/index/index' })
toMyInfo: function () {
wx.redirectTo({
url: '/pages/index/index'
})
},
/**
* 生命周期函数--监听页面初次渲染完成
@ -84,5 +93,61 @@ Page({
this.setData({
['bidType']: tabIndex
})
var model = {
identityTag: ''
}
if (this.data.bidType == 1) {
model.identityTag = '打包站'
this.submitForm(model)
}
if (this.data.bidType == 2) {
model.identityTag = '废品站'
this.submitForm(model)
}
if (this.data.bidType == 3) {
model.identityTag = '废纸厂'
this.submitForm(model)
}
},
submitForm: function (model) {
console.log(model)
updateUserInfo(model).then(result => {
this.data.loopRequesting = false
setTimeout(() => this.toNextTab(), 200)
}).catch(err => {
this.data.loopRequesting = false
})
},
bindblur: function (e) {
var model = {
identityTag: e.detail.value
}
this.submitForm(model)
},
getUerInfoFct: function () {
getBaseInfo().then(res => {
if (res.data.identityTag == '打包站') {
this.setData({
bidType: 1
})
} else if (res.data.identityTag == '废品站') {
this.setData({
bidType: 2
})
} else if (res.data.identityTag == '造纸厂') {
this.setData({
bidType: 3
})
} else {
this.setData({
bidType: 4,
identityTag: res.data.identityTag
})
}
})
}
})

5
pages/home/tab1/index.wxml

@ -1,5 +1,6 @@
<!--pages/home/tab1/index.wxml-->
<cu-custom bgColor="bg-white" isBack="{{true}}" intercept="{{true}}" bindcustomevent="backspace">
<!-- intercept="{{true}}" bindcustomevent="backspace" -->
<cu-custom bgColor="bg-white" isBack="{{true}}">
<view slot="content">身份</view>
</cu-custom>
@ -56,6 +57,6 @@
</view>
</view>
<view class="otherInpt" wx:if="{{bidType == 4}}" >
<input placeholder="请输入你的身份" bindinput="bindinput" />
<input placeholder="请输入你的身份" value="{{identityTag}}" bindblur="bindblur" />
</view>
</view>

3
pages/home/tab1/index.wxss

@ -1,4 +1,7 @@
/* pages/home/tab1/index.wxss */
page{
background-color: white;
}
.bj {
background-color: white;
min-height: 900rpx;

44
pages/home/tab2/index.js

@ -1,4 +1,8 @@
// pages/home/tab2/index.js
import {
updateUserInfo,
getBaseInfo
} from '../../api/ztb'
const storage = require('../../../utils/storage')
import regions from '../../../utils/region'
Page({
@ -8,14 +12,10 @@ Page({
*/
data: {
options: regions,
region: [440000, '', ''],
region: [440000, ''],
form: {
bidType: 1,
imgList: [],
secondCategoryId: null,
stock: null,
dopantRate: null,
waterRate: null
areaStr:''
},
cateName: '',
dopantName: '',
@ -32,17 +32,17 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getUerInfoFct()
this.cascaderView = this.cascaderView || this.selectComponent('#wux-cascader')
this.pickerView = this.pickerView || this.selectComponent('#picker-view')
},
toNextTab: function () {
wx.redirectTo({
wx.navigateTo({
url: '/pages/home/tab3/index'
})
},
toMyInfo: function () {
storage.put('userIsLoginFirst', '1')
wx.redirectTo({
url: '/pages/index/index'
})
@ -113,17 +113,35 @@ Page({
},
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 })
this.setData({
'form.areaStr':e.detail.options[0].label+e.detail.options[1].label
})
this.submitForm({locateCityTag:this.data.form.locCityId})
}
this.setData({ picking: false })
},
submitForm: function (model) {
console.log(model)
updateUserInfo(model).then(result => {
this.data.loopRequesting = false
setTimeout(() => this.toNextTab(), 200)
}).catch(err => {
this.data.loopRequesting = false
})
},
getUerInfoFct: function () {
getBaseInfo().then(res => {
this.setData({
region:[res.data.locateCityTag.provinceId,res.data.locateCityTag.cityId,res.data.locateCityTag.districtId],
'form.areaStr':res.data.locateCityTag.provinceName+res.data.locateCityTag.cityName
})
console.log(this.data.region)
})
}
})

2
pages/home/tab2/index.wxml

@ -1,5 +1,5 @@
<!--pages/home/tab2/index.wxml-->
<cu-custom bgColor="bg-white" isBack="{{true}}" intercept="{{true}}" bindcustomevent="backspace">
<cu-custom bgColor="bg-white" isBack="{{true}}">
<view slot="content">城市</view>
</cu-custom>

54
pages/home/tab3/index.js

@ -1,4 +1,8 @@
// pages/home/tab3/index.js
import {
updateUserInfo,
getBaseInfo
} from '../../api/ztb'
const storage = require('../../../utils/storage')
Page({
@ -6,22 +10,22 @@ Page({
* 页面的初始数据
*/
data: {
bidType: 1
bidType: 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getUerInfoFct()
},
toNextTab: function () {
wx.redirectTo({
wx.navigateTo({
url: '/pages/home/tab4/index'
})
},
toMyInfo: function () {
storage.put('userIsLoginFirst', '1')
wx.redirectTo({
url: '/pages/index/index'
})
@ -91,5 +95,49 @@ Page({
this.setData({
['bidType']: tabIndex
})
var model={
experienceTag:''
}
if (this.data.bidType == 1) {
model.experienceTag = '1年以下'
this.submitForm(model)
}
if (this.data.bidType == 2) {
model.experienceTag = '1~5年'
this.submitForm(model)
}
if (this.data.bidType == 3) {
model.experienceTag = '5年以上'
this.submitForm(model)
}
},
submitForm: function (model) {
console.log(model)
updateUserInfo(model).then(result => {
this.data.loopRequesting = false
setTimeout(() => this.toNextTab(), 200)
}).catch(err => {
this.data.loopRequesting = false
})
},
getUerInfoFct: function () {
getBaseInfo().then(res => {
if (res.data.experienceTag == '1年以下') {
this.setData({
bidType: 1
})
} else if (res.data.experienceTag == '1~5年') {
this.setData({
bidType: 2
})
} else if (res.data.experienceTag == '5年以上') {
this.setData({
bidType: 3
})
}
})
}
})

4
pages/home/tab3/index.wxml

@ -1,5 +1,5 @@
<!--pages/home/tab3/index.wxml-->
<cu-custom bgColor="bg-white" isBack="{{true}}" intercept="{{true}}" bindcustomevent="backspace">
<cu-custom bgColor="bg-white" isBack="{{true}}">
<view slot="content">经验</view>
</cu-custom>
@ -37,7 +37,5 @@
<text>5年以上</text>
</view>
</view>
</view>
</view>

77
pages/home/tab4/index.js

@ -1,4 +1,8 @@
// pages/home/tab4/index.js
import {
getLategoriesList,
updateUserInfo
} from '../../api/ztb'
const storage = require('../../../utils/storage')
Page({
@ -6,6 +10,41 @@ Page({
* 页面的初始数据
*/
data: {
loopRequesting:false,
form: {
purchaseCategoriesTag: []
},
categoryListone: [{
name: '黑卡',
id: '1',
array: [{
name: '黄纸边',
sid: '1'
}, {
name: '坑卡A',
sid: '2'
}]
}, {
name: '白费',
id: '2',
array: [{
name: '坑卡B',
sid: '3'
}, {
name: '黄皮纸',
sid: '4'
}]
}, {
name: '特种纸',
id: '3',
array: [{
name: '坑卡B',
sid: '3'
}, {
name: '黄皮纸',
sid: '4'
}]
}]
},
@ -13,11 +52,13 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getLategoriesListFct()
},
toMyInfo:function(){
storage.put('userIsLoginFirst', '1')
wx.redirectTo({ url: '/pages/index/index' })
toMyInfo: function () {
wx.redirectTo({
url: '/pages/index/index'
})
},
/**
@ -68,9 +109,35 @@ Page({
onShareAppMessage: function () {
},
backspace:function(){
backspace: function () {
// console.log('点击返回被触发4')
wx.redirectTo({ url: '/pages/home/tab3/index' })
wx.redirectTo({
url: '/pages/home/tab3/index'
})
},
getLategoriesListFct: function () {
getLategoriesList({categoryType:0}).then(res => {
this.setData({
categoryListone:res.data
})
})
},
checkboxChange: function (e) {
console.log(e)
this.setData({
'form.purchaseCategoriesTag':e.detail.value
})
},
bindtap: function (e) {
console.log(e)
},
submitForm:function(){
updateUserInfo(this.data.form).then(result => {
this.data.loopRequesting = false
setTimeout(() => this.toMyInfo(), 1000)
}).catch(err => {
this.data.loopRequesting = false
})
}
})

6
pages/home/tab4/index.json

@ -1,3 +1,7 @@
{
"usingComponents": {}
"usingComponents": {
"wux-cascader": "/components/cascader/index",
"wux-accordion-group": "/components/accordion-group/index",
"wux-accordion": "/components/accordion/index"
}
}

16
pages/home/tab4/index.wxml

@ -1,12 +1,11 @@
<!--pages/home/tab4/index.wxml-->
<cu-custom bgColor="bg-white" isBack="{{true}}" intercept="{{true}}" bindcustomevent="backspace">
<cu-custom bgColor="bg-white" isBack="{{true}}">
<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">
@ -20,6 +19,17 @@
<text>你希望采购的品类是?</text>
</view>
<view class="bottom">
<view>
<wux-accordion-group title="">
<checkbox-group bindchange="checkboxChange">
<wux-accordion wx:for="{{ categoryListone }}" wx:key="index" title="{{index+1+'、'+item.categoryName}}">
<checkbox style="width:100%;margin-top:15rpx" wx:for="{{ item.childCategoryDtoList }}" wx:for-item="cell" wx:key="index" value="{{cell.categoryId}}" checked="{{cell.isSelected}}">{{cell.categoryName}}</checkbox>
</wux-accordion>
</checkbox-group>
</wux-accordion-group>
</view>
</view>
<view style="width:100%;height:130rpx;padding-top:10rpx;padding-right:10rpx">
<button class="cu-btn offer-btn" disabled="{{loopRequesting}}" bindtap="submitForm">确认</button>
</view>
</view>

18
pages/home/tab4/index.wxss

@ -1,4 +1,7 @@
/* pages/home/tab1/index.wxss */
page{
background-color: white;
}
.bj {
background-color: white;
min-height: 900rpx;
@ -44,3 +47,18 @@
padding: 48rpx;
}
.bg-blue{
color: #FFFFFF;
background-color: #008AFF;
}
.offer-btn {
width: 90%;
height: 90rpx;
background: linear-gradient(312deg, rgba(38, 125, 214, 1) 0%, rgba(0, 138, 255, 1) 100%);
box-shadow: 0px 10px 13px -8px rgba(35, 126, 217, 0.53);
border-radius: 23px;
color: white;
font-size: 32rpx;
margin-left: 32rpx;
}

28
pages/index/index.js

@ -1,5 +1,5 @@
import { config, getUserInfo} from "../api/user"
import { zconfig, loginToken, getBaseInfo, getPopupInfo } from "../api/ztb"
import { zconfig, loginToken, getBaseInfo, getPopupInfo,updateUserInfo } from "../api/ztb"
import { pconfig } from "../api/payment"
import { mconfig } from "../api/moment"
import { sconfig, getOrderExists } from "../api/saas"
@ -20,7 +20,9 @@ Page({
inited: false,
path: null,
landInfo: null,
visible: false
visible: false,
hasShowedLoginTag:false,//是否已展示过登陆标签填写页面
},
/************************************** 初始化流程 ********************************************/
onLoad: function (options) {
@ -120,6 +122,9 @@ Page({
pconfig.header = { 'Authorization': 'QNT ' + result.data.token }
mconfig.header = { 'Authorization': 'QNT ' + result.data.token }
getBaseInfo().then(result => {
this.setData({
hasShowedLoginTag:result.data.hasShowedLoginTag
})
app.globalData.userInfo = result.data
// 登录流程完成;
if(!util.isEmpty(result.data.userToken)){
@ -168,14 +173,23 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
var userIsLoginFirst = storage.get('userIsLoginFirst')
if(this.data.inited){
this.onResume()
}
wx.navigateTo({ url: '/pages/home/tab1/index' })
// if(userIsLoginFirst=='1'){
// wx.navigateTo({ url: '/pages/home/tab1/index' })
// }
// wx.navigateTo({ url: '/pages/home/tab1/index' })
getBaseInfo().then(result => {
this.setData({
hasShowedLoginTag:result.data.hasShowedLoginTag
})
if(this.data.hasShowedLoginTag==false){
this.updateUserInfoFct({hasShowedLoginTag:true})
wx.navigateTo({ url: '/pages/home/tab1/index' })
}
})
},
updateUserInfoFct: function (model) {
updateUserInfo(model).then(result => {
})
},
onEvent: function (message) {
if(message.what == 250){

1
pages/login/index.js

@ -98,7 +98,6 @@ Page({
}
// 登录流程完成;
getBaseInfo().then(result => {
storage.put('userIsLoginFirst', '0')
app.globalData.userInfo = result.data
if (!util.isEmpty(result.data.userToken)) {
this.handleUserToken(result.data.userToken)

Loading…
Cancel
Save