diff --git a/app.json b/app.json index f768ff7..27658e3 100644 --- a/app.json +++ b/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", diff --git a/assets/image/noattention.png b/assets/image/noattention.png new file mode 100644 index 0000000..692aacd Binary files /dev/null and b/assets/image/noattention.png differ diff --git a/pages/agent/factory/index.js b/pages/agent/factory/index.js index 8794d19..b3bb785 100644 --- a/pages/agent/factory/index.js +++ b/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) + }) } + }) \ No newline at end of file diff --git a/pages/agent/factory/index.wxml b/pages/agent/factory/index.wxml index 4838212..4c71470 100644 --- a/pages/agent/factory/index.wxml +++ b/pages/agent/factory/index.wxml @@ -9,7 +9,7 @@ {{factoryDetail.name}} - {{attentionStatus == 1 ? '关注' : '取消关注'}} + {{hasFollowed == false ? '关注' : '取消关注'}} {{factoryDetail.locProvinceName + factoryDetail.locCityName + factoryDetail.locDistrictName}} diff --git a/pages/agent/index/index.js b/pages/agent/index/index.js index bcd02a7..804da47 100644 --- a/pages/agent/index/index.js +++ b/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) + } }) \ No newline at end of file diff --git a/pages/agent/index/index.json b/pages/agent/index/index.json index d5cd34d..0faa308 100644 --- a/pages/agent/index/index.json +++ b/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" } } \ No newline at end of file diff --git a/pages/agent/index/index.wxml b/pages/agent/index/index.wxml index be1a8d4..9009924 100644 --- a/pages/agent/index/index.wxml +++ b/pages/agent/index/index.wxml @@ -4,18 +4,18 @@ 纸厂代卖 - + - - 全部 - 关注 + + 全部 + - + @@ -86,14 +86,31 @@ - - - - - {{loading? '正在加载' : '暂无数据'}} + + + + + + + 暂无关注 + + + 可前往纸厂列表添加关注 + + + 添加关注 + - + + + + + + + + 加载更多的UI + @@ -102,4 +119,6 @@ - \ No newline at end of file + + + \ No newline at end of file diff --git a/pages/agent/index/index.wxss b/pages/agent/index/index.wxss index 14f8cb0..3b89291 100644 --- a/pages/agent/index/index.wxss +++ b/pages/agent/index/index.wxss @@ -1 +1,63 @@ -/* pages/agent/index/index.wxss */ \ No newline at end of file +/* 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; +} \ No newline at end of file diff --git a/pages/agent/order/index.wxml b/pages/agent/order/index.wxml index fa79a4d..df60fc4 100644 --- a/pages/agent/order/index.wxml +++ b/pages/agent/order/index.wxml @@ -54,12 +54,9 @@ 货到时间: {{item.deliveryTime}} - - 货车车牌: - 00000001 - 00000002 - 00000003 - 00000004 + + 货车车牌{{index+1}}:{{cell.logisticcsInfo.plateNumber}} + {{cell.status==50?'待预约':(cell.status==51?'待送货':(cell.status==52?'结算中':(cell.status==53?'已完成':(cell.status==54?'已关闭':'---'))))}} diff --git a/pages/api/ztb.js b/pages/api/ztb.js index 9d3c3af..4038f67 100644 --- a/pages/api/ztb.js +++ b/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 } \ No newline at end of file diff --git a/pages/home/attentionPaperList/index.js b/pages/home/attentionPaperList/index.js new file mode 100644 index 0000000..b2e6d1f --- /dev/null +++ b/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 + }) + } +}) \ No newline at end of file diff --git a/pages/home/attentionPaperList/index.json b/pages/home/attentionPaperList/index.json new file mode 100644 index 0000000..51ec566 --- /dev/null +++ b/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" + } +} \ No newline at end of file diff --git a/pages/home/attentionPaperList/index.wxml b/pages/home/attentionPaperList/index.wxml new file mode 100644 index 0000000..a920215 --- /dev/null +++ b/pages/home/attentionPaperList/index.wxml @@ -0,0 +1,41 @@ + + + 关注纸厂 + + + + + + + + + HI,\n欢迎使用纸通宝\n开启一站式废纸交易 + + + + + + + 你经常卖的纸厂是? + + + + + + {{loading? '正在加载' : '暂无数据'}} + + + + + {{item.name}} + + + + + + + + + \ No newline at end of file diff --git a/pages/home/attentionPaperList/index.wxss b/pages/home/attentionPaperList/index.wxss new file mode 100644 index 0000000..d98beaf --- /dev/null +++ b/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; +} \ No newline at end of file diff --git a/pages/home/businessLicense/index.js b/pages/home/businessLicense/index.js new file mode 100644 index 0000000..4733d00 --- /dev/null +++ b/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 }] + }) + }) + } +}) \ No newline at end of file diff --git a/pages/home/businessLicense/index.json b/pages/home/businessLicense/index.json new file mode 100644 index 0000000..6adbfe2 --- /dev/null +++ b/pages/home/businessLicense/index.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "wux-uploader": "/components/uploader/index" + } +} \ No newline at end of file diff --git a/pages/home/businessLicense/index.wxml b/pages/home/businessLicense/index.wxml new file mode 100644 index 0000000..42daa46 --- /dev/null +++ b/pages/home/businessLicense/index.wxml @@ -0,0 +1,32 @@ + + + 营业执照 + + + + + + + + + HI,\n欢迎使用纸通宝\n开启一站式废纸交易 + + + + + + + 你的营业执照是? + + + + + {{!disabled?'营业执照(上传1张)':'营业执照'}} + {{imgLength}}{{!disabled? '/1':'张'}} + + + + + + + \ No newline at end of file diff --git a/pages/home/businessLicense/index.wxss b/pages/home/businessLicense/index.wxss new file mode 100644 index 0000000..d465167 --- /dev/null +++ b/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; +} \ No newline at end of file diff --git a/pages/home/info/index.js b/pages/home/info/index.js index a8a4510..888c6c2 100644 --- a/pages/home/info/index.js +++ b/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' + }) + }, }) \ No newline at end of file diff --git a/pages/home/info/index.json b/pages/home/info/index.json index 0dfa95a..2635487 100644 --- a/pages/home/info/index.json +++ b/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" } } \ No newline at end of file diff --git a/pages/home/info/index.wxml b/pages/home/info/index.wxml index 2837ed0..dd0b613 100644 --- a/pages/home/info/index.wxml +++ b/pages/home/info/index.wxml @@ -19,8 +19,8 @@ 姓名:{{linkman || ''}} - - {{userInfo.isAuth == 1 ? '已认证' : '未实名认证'}} + 联系电话:{{linkPhone}} @@ -51,53 +51,73 @@ 公司地址 {{companyAddress}} - + 昵称 {{userInfo.nickname || '点击修改昵称'}} - + + 实名认证 + {{userInfo.isAuth ? '已认证' : '未认证'}} + + 从业身份 - {{userInfo.card || '点击修改从业身份'}} + {{userInfo.identityTag || '点击修改从业身份'}} - + 所在城市 - {{userInfo.city || '点击修改所在城市'}} + {{userInfo.locateCityTag.provinceName+userInfo.locateCityTag.cityName||'请选择所在地区'}} - + 从业经验 - {{userInfo.age || '点击修改从业经验'}} + {{userInfo.experienceTag || '点击修改从业经验'}} - + 希望采购品类 - {{userInfo.type || '点击修改希望采购品类'}} + {{userInfo.numberOfPurchaseCategoriesTag || '点击修改希望采购品类'}} - + 希望出货品类 - {{userInfo.type2 || '点击修改希望出货品类'}} + {{userInfo.numberOfProxyCategoriesTag || '点击修改希望出货品类'}} - - 月出货量 - {{userInfo.numberMoon || '点击修改月出货量'}} + + 打包站名 + {{userInfo.packageFactoryName || '点击修改打包站名'}} - + + 打包站占地面积 + {{userInfo.packageFactoryArea || '点击修改打包站占地面积'}} + + + 工厂人数 + {{userInfo.numberOfEmployee || '点击修改工厂人数'}} + + + 打包机数 + {{userInfo.numberOfPackageMachine || '点击修改工厂人数'}} + + + + 营业执照 + {{userInfo.businessLicenseUrl==null?'未上传':'查看'}} + + + - + - \ No newline at end of file + + \ No newline at end of file diff --git a/pages/home/tab1/index.js b/pages/home/tab1/index.js index 2adfff0..46db387 100644 --- a/pages/home/tab1/index.js +++ b/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 + }) + + } + }) + } }) \ No newline at end of file diff --git a/pages/home/tab1/index.wxml b/pages/home/tab1/index.wxml index e3f239f..011360e 100644 --- a/pages/home/tab1/index.wxml +++ b/pages/home/tab1/index.wxml @@ -1,5 +1,6 @@ - + + 身份 @@ -56,6 +57,6 @@ - + \ No newline at end of file diff --git a/pages/home/tab1/index.wxss b/pages/home/tab1/index.wxss index f7b3f16..4132b1c 100644 --- a/pages/home/tab1/index.wxss +++ b/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; diff --git a/pages/home/tab2/index.js b/pages/home/tab2/index.js index d91cda1..fbbd5f3 100644 --- a/pages/home/tab2/index.js +++ b/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) + }) + } }) \ No newline at end of file diff --git a/pages/home/tab2/index.wxml b/pages/home/tab2/index.wxml index 2adab4b..32f02ef 100644 --- a/pages/home/tab2/index.wxml +++ b/pages/home/tab2/index.wxml @@ -1,5 +1,5 @@ - + 城市 diff --git a/pages/home/tab3/index.js b/pages/home/tab3/index.js index c1c67d3..728a94d 100644 --- a/pages/home/tab3/index.js +++ b/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 + }) + + } + }) + } }) \ No newline at end of file diff --git a/pages/home/tab3/index.wxml b/pages/home/tab3/index.wxml index 8942fd6..b34b479 100644 --- a/pages/home/tab3/index.wxml +++ b/pages/home/tab3/index.wxml @@ -1,5 +1,5 @@ - + 经验 @@ -37,7 +37,5 @@ 5年以上 - - \ No newline at end of file diff --git a/pages/home/tab4/index.js b/pages/home/tab4/index.js index 576b0b8..8eec31e 100644 --- a/pages/home/tab4/index.js +++ b/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 + }) + } }) \ No newline at end of file diff --git a/pages/home/tab4/index.json b/pages/home/tab4/index.json index 8835af0..51ec566 100644 --- a/pages/home/tab4/index.json +++ b/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" + } } \ No newline at end of file diff --git a/pages/home/tab4/index.wxml b/pages/home/tab4/index.wxml index ea67531..25b0145 100644 --- a/pages/home/tab4/index.wxml +++ b/pages/home/tab4/index.wxml @@ -1,12 +1,11 @@ - + 采购品类 - @@ -20,6 +19,17 @@ 你希望采购的品类是? - + + + + + {{cell.categoryName}} + + + + + + + \ No newline at end of file diff --git a/pages/home/tab4/index.wxss b/pages/home/tab4/index.wxss index 7fd2026..9e08e56 100644 --- a/pages/home/tab4/index.wxss +++ b/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; +} \ No newline at end of file diff --git a/pages/index/index.js b/pages/index/index.js index 4365d40..486df13 100644 --- a/pages/index/index.js +++ b/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){ diff --git a/pages/login/index.js b/pages/login/index.js index 85e5c40..5df84b3 100644 --- a/pages/login/index.js +++ b/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)