2 Commits
b6d43dedd0
...
709d4850fc
| Author | SHA1 | Message | Date |
|---|---|---|---|
|
|
709d4850fc |
Merge branch 'featrue/v4.3' of http://git.qniao.cn/libo/ztb-mini into featrue/v4.3
|
5 years ago |
|
|
a5af0b9302 |
修改个人资料页面UI.wz
|
5 years ago |
11 changed files with 1187 additions and 62 deletions
Split View
Diff Options
-
4app.json
-
424pages/home/enterprise/enterprise.js
-
11pages/home/enterprise/enterprise.json
-
74pages/home/enterprise/enterprise.wxml
-
80pages/home/enterprise/enterprise.wxss
-
12pages/home/info/index.js
-
69pages/home/info/index.wxml
-
424pages/home/personal/personal.js
-
11pages/home/personal/personal.json
-
60pages/home/personal/personal.wxml
-
80pages/home/personal/personal.wxss
@ -0,0 +1,424 @@ |
|||
import { |
|||
zconfig, |
|||
getBaseInfo, |
|||
updateUserInfoZtb |
|||
} from '../../api/ztb' |
|||
import { |
|||
updateUserInfo |
|||
} from '../../api/user' |
|||
const util = require('../../../utils/util') |
|||
const app = getApp() |
|||
|
|||
Page({ |
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
backStatus: true, |
|||
nickName: '', //用户昵称
|
|||
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: '其他' |
|||
} |
|||
], |
|||
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, |
|||
userType: 1, |
|||
srcList: null, |
|||
visible: false |
|||
}, |
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad: function (options) { |
|||
getBaseInfo().then(res => { |
|||
this.setData({ |
|||
userInfo: res.data, |
|||
nickName: res.data.realName, |
|||
avatarUrl: res.data.avatarUrl || '/assets/image/ygImg.png', |
|||
linkman: res.data.realName, |
|||
linkPhone: res.data.mobile, |
|||
companyAddress: res.data.fullAddress, |
|||
userType: res.data.userType, |
|||
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 |
|||
wx.showLoading({ |
|||
title: '上传中', |
|||
mask: true |
|||
}) |
|||
var header = { |
|||
...zconfig.header, |
|||
'X-APP-ID': app.xAppId, |
|||
appversion: app.version |
|||
} |
|||
this.task = wx.uploadFile({ |
|||
url: zconfig.baseUrl + '/recycle-user-center/file-uploading/upload/image', |
|||
filePath: path, |
|||
name: 'image', |
|||
header, |
|||
success: function (result) { |
|||
var resp = null |
|||
if (!util.isEmpty(result.data)) { |
|||
resp = JSON.parse(result.data) |
|||
} |
|||
if (resp && resp.code === 0) { |
|||
that.updateMemberInfo({ |
|||
avatar: resp.data |
|||
}) |
|||
} else { |
|||
wx.hideLoading() |
|||
util.showToast('头像上传失败,请重新上传') |
|||
} |
|||
}, |
|||
fail: function (res) { |
|||
wx.hideLoading() |
|||
util.showToast('头像上传失败,请重新上传') |
|||
} |
|||
}) |
|||
}, |
|||
showDialog: function (e1) { |
|||
this.wuxDialog = this.wuxDialog || this.selectComponent('#wux-dialog') |
|||
var that = this |
|||
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) { |
|||
wx.showLoading({ |
|||
title: '处理中', |
|||
mask: true |
|||
}) |
|||
} |
|||
updateUserInfo(form).then(result => { |
|||
wx.hideLoading() |
|||
if (form.nickname) { |
|||
this.setData({ |
|||
['userInfo.nickname']: form.nickname |
|||
}) |
|||
} else if (form.avatar) { |
|||
this.setData({ |
|||
avatarUrl: form.avatar |
|||
}) |
|||
} |
|||
}).catch(err => { |
|||
wx.hideLoading() |
|||
util.showToast(err) |
|||
}) |
|||
}, |
|||
toAuth: function () { |
|||
if (this.data.userInfo && !this.data.userInfo.isAuth) { |
|||
wx.navigateTo({ |
|||
url: '/pages/home/idcard/index' |
|||
}) |
|||
} |
|||
}, |
|||
//通过事件执行更换头像方法比如点击头像执行该方法
|
|||
chooseImage: function () { |
|||
var that = this |
|||
wx.chooseImage({ |
|||
count: 1, // 默认9
|
|||
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
|||
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
|
|||
success: function (res) { |
|||
// 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
|
|||
// that.uploadFile(res.tempFilePaths[0])
|
|||
that.setData({ |
|||
visible: true, |
|||
srcList: res.tempFilePaths |
|||
}) |
|||
} |
|||
}) |
|||
}, |
|||
//裁剪图片回调
|
|||
onCropback: function (event) { |
|||
this.setData({ |
|||
visible: false |
|||
}) |
|||
this.uploadFile(event.detail[0]) |
|||
}, |
|||
//关闭回调
|
|||
closeCallback: function () { |
|||
this.setData({ |
|||
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' |
|||
}) |
|||
}, |
|||
toTab5: function () { |
|||
wx.navigateTo({ |
|||
url: '/pages/home/tab5/index' |
|||
}) |
|||
}, |
|||
toTab6: function () { |
|||
wx.navigateTo({ |
|||
url: '/pages/home/tab6/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' |
|||
}) |
|||
}, |
|||
|
|||
}) |
|||
@ -0,0 +1,11 @@ |
|||
{ |
|||
"usingComponents": { |
|||
"wux-button": "/components/button/index", |
|||
"wux-cell-group": "/components/cell-group/index", |
|||
"wux-cell": "/components/cell/index", |
|||
"wux-image": "/components/image/index", |
|||
"wux-dialog": "/components/dialog/index", |
|||
"wux-cropper": "/components/image-cropper/index", |
|||
"wux-cascader": "/components/cascader/index" |
|||
} |
|||
} |
|||
@ -0,0 +1,74 @@ |
|||
<!--pages/home/info/index.wxml--> |
|||
<cu-custom bgColor="bg-white" isBack="{{true}}"> |
|||
<view slot="content">企业信息</view> |
|||
</cu-custom> |
|||
|
|||
<!-- <view class="bg-white flex flex-center flex-column" style="padding:48rpx"> |
|||
<view style="width: 120px;height: 120px;position: relative" bindtap="chooseImage"> |
|||
<wux-image width="{{120}}" height="{{120}}" wux-class="image" shape="circle" src="{{avatarUrl}}" /> |
|||
<image class="wux-badge" src="/assets/image/icon_carmera.png"></image> |
|||
</view> |
|||
</view> --> |
|||
<wux-cell-group> |
|||
<!-- <wux-cell> |
|||
<view slot="header" class="text-gray">姓名</view> |
|||
<view slot="footer">{{linkman || ''}}</view> |
|||
</wux-cell> --> |
|||
<wux-cell title="公司名称" wx:if="{{userType == 2}}"> |
|||
<view slot="header" class="text-gray">公司名称</view> |
|||
<view slot="footer">{{realName || ''}}</view> |
|||
</wux-cell> |
|||
<wux-cell title="公司性质" wx:if="{{userType == 2}}"> |
|||
<view slot="header" class="text-gray">公司性质</view> |
|||
<view slot="footer">{{identityStr}}</view> |
|||
</wux-cell> |
|||
<!-- <wux-cell> |
|||
<view slot="header" class="text-gray">联系电话</view> |
|||
<view slot="footer">{{linkPhone}}</view> |
|||
</wux-cell> --> |
|||
<wux-cell wx:if="{{userType == 2}}"> |
|||
<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='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 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" 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" 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> --> |
|||
|
|||
<wux-cropper wx:if="{{visible}}" srcList="{{srcList}}" bindclose="closeCallback" bindcroped="onCropback"></wux-cropper> |
|||
<wux-dialog id="wux-dialog" /> |
|||
<wux-cascader id="wux-cascader" value="{{region}}" options="{{ options }}" bind:close="onRegionChange" /> |
|||
@ -0,0 +1,80 @@ |
|||
/* pages/home/info/index.wxss */ |
|||
.wux-badge { |
|||
position: absolute; |
|||
width: 120px; |
|||
height: 120px; |
|||
opacity: 0.8; |
|||
right: 0; |
|||
bottom: 0; |
|||
z-index: 10; |
|||
} |
|||
|
|||
.wux-badge2 { |
|||
width: 120rpx; |
|||
height: 120rpx; |
|||
position: absolute; |
|||
z-index: 10; |
|||
left: 32rpx; |
|||
} |
|||
|
|||
.header-bg { |
|||
margin-top: 0px; |
|||
width: 100%; |
|||
height: 80px; |
|||
background: linear-gradient(314deg, rgba(50, 107, 250, 1) 0%, rgba(0, 138, 255, 1) 100%); |
|||
border-bottom-left-radius: 64rpx; |
|||
border-bottom-right-radius: 64rpx; |
|||
} |
|||
|
|||
.header-box { |
|||
width: 100%; |
|||
background: rgba(255, 255, 255, 1); |
|||
/* box-shadow: 0px 0px 15px -6px rgba(0, 0, 0, 0.32); |
|||
border-radius: 6px; */ |
|||
} |
|||
|
|||
.userinfo-avatar { |
|||
overflow: hidden; |
|||
width: 120rpx; |
|||
height: 120rpx; |
|||
border-radius: 12rpx; |
|||
border: 2px solid #fff; |
|||
box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.2); |
|||
} |
|||
|
|||
.account-bg { |
|||
background: linear-gradient(314deg, rgba(50, 107, 250, 1) 0%, rgba(0, 138, 255, 1) 100%); |
|||
border-radius: 6px; |
|||
} |
|||
|
|||
.money { |
|||
font-size: 44rpx; |
|||
font-family: SFProDisplay-Semibold, SFProDisplay; |
|||
font-weight: 600; |
|||
color: rgba(255, 255, 255, 1); |
|||
} |
|||
|
|||
.label { |
|||
font-size: 24rpx; |
|||
font-family: PingFang-SC-Regular, PingFang-SC; |
|||
font-weight: 400; |
|||
color: rgba(255, 255, 255, 1); |
|||
} |
|||
|
|||
.img-auth { |
|||
width: 32rpx; |
|||
height: 32rpx; |
|||
margin-left: 24rpx; |
|||
margin-right: 12rpx |
|||
} |
|||
|
|||
.img-auth2 { |
|||
width: 32rpx; |
|||
height: 32rpx; |
|||
margin-right: 12rpx |
|||
} |
|||
|
|||
.realName { |
|||
max-width: 100px; |
|||
white-space: nowrap; |
|||
} |
|||
@ -0,0 +1,424 @@ |
|||
import { |
|||
zconfig, |
|||
getBaseInfo, |
|||
updateUserInfoZtb |
|||
} from '../../api/ztb' |
|||
import { |
|||
updateUserInfo |
|||
} from '../../api/user' |
|||
const util = require('../../../utils/util') |
|||
const app = getApp() |
|||
|
|||
Page({ |
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
backStatus: true, |
|||
nickName: '', //用户昵称
|
|||
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: '其他' |
|||
} |
|||
], |
|||
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, |
|||
userType: 1, |
|||
srcList: null, |
|||
visible: false |
|||
}, |
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad: function (options) { |
|||
getBaseInfo().then(res => { |
|||
this.setData({ |
|||
userInfo: res.data, |
|||
nickName: res.data.realName, |
|||
avatarUrl: res.data.avatarUrl || '/assets/image/ygImg.png', |
|||
linkman: res.data.realName, |
|||
linkPhone: res.data.mobile, |
|||
companyAddress: res.data.fullAddress, |
|||
userType: res.data.userType, |
|||
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 |
|||
wx.showLoading({ |
|||
title: '上传中', |
|||
mask: true |
|||
}) |
|||
var header = { |
|||
...zconfig.header, |
|||
'X-APP-ID': app.xAppId, |
|||
appversion: app.version |
|||
} |
|||
this.task = wx.uploadFile({ |
|||
url: zconfig.baseUrl + '/recycle-user-center/file-uploading/upload/image', |
|||
filePath: path, |
|||
name: 'image', |
|||
header, |
|||
success: function (result) { |
|||
var resp = null |
|||
if (!util.isEmpty(result.data)) { |
|||
resp = JSON.parse(result.data) |
|||
} |
|||
if (resp && resp.code === 0) { |
|||
that.updateMemberInfo({ |
|||
avatar: resp.data |
|||
}) |
|||
} else { |
|||
wx.hideLoading() |
|||
util.showToast('头像上传失败,请重新上传') |
|||
} |
|||
}, |
|||
fail: function (res) { |
|||
wx.hideLoading() |
|||
util.showToast('头像上传失败,请重新上传') |
|||
} |
|||
}) |
|||
}, |
|||
showDialog: function (e1) { |
|||
this.wuxDialog = this.wuxDialog || this.selectComponent('#wux-dialog') |
|||
var that = this |
|||
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) { |
|||
wx.showLoading({ |
|||
title: '处理中', |
|||
mask: true |
|||
}) |
|||
} |
|||
updateUserInfo(form).then(result => { |
|||
wx.hideLoading() |
|||
if (form.nickname) { |
|||
this.setData({ |
|||
['userInfo.nickname']: form.nickname |
|||
}) |
|||
} else if (form.avatar) { |
|||
this.setData({ |
|||
avatarUrl: form.avatar |
|||
}) |
|||
} |
|||
}).catch(err => { |
|||
wx.hideLoading() |
|||
util.showToast(err) |
|||
}) |
|||
}, |
|||
toAuth: function () { |
|||
if (this.data.userInfo && !this.data.userInfo.isAuth) { |
|||
wx.navigateTo({ |
|||
url: '/pages/home/idcard/index' |
|||
}) |
|||
} |
|||
}, |
|||
//通过事件执行更换头像方法比如点击头像执行该方法
|
|||
chooseImage: function () { |
|||
var that = this |
|||
wx.chooseImage({ |
|||
count: 1, // 默认9
|
|||
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
|||
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
|
|||
success: function (res) { |
|||
// 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
|
|||
// that.uploadFile(res.tempFilePaths[0])
|
|||
that.setData({ |
|||
visible: true, |
|||
srcList: res.tempFilePaths |
|||
}) |
|||
} |
|||
}) |
|||
}, |
|||
//裁剪图片回调
|
|||
onCropback: function (event) { |
|||
this.setData({ |
|||
visible: false |
|||
}) |
|||
this.uploadFile(event.detail[0]) |
|||
}, |
|||
//关闭回调
|
|||
closeCallback: function () { |
|||
this.setData({ |
|||
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' |
|||
}) |
|||
}, |
|||
toTab5: function () { |
|||
wx.navigateTo({ |
|||
url: '/pages/home/tab5/index' |
|||
}) |
|||
}, |
|||
toTab6: function () { |
|||
wx.navigateTo({ |
|||
url: '/pages/home/tab6/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' |
|||
}) |
|||
}, |
|||
|
|||
}) |
|||
@ -0,0 +1,11 @@ |
|||
{ |
|||
"usingComponents": { |
|||
"wux-button": "/components/button/index", |
|||
"wux-cell-group": "/components/cell-group/index", |
|||
"wux-cell": "/components/cell/index", |
|||
"wux-image": "/components/image/index", |
|||
"wux-dialog": "/components/dialog/index", |
|||
"wux-cropper": "/components/image-cropper/index", |
|||
"wux-cascader": "/components/cascader/index" |
|||
} |
|||
} |
|||
@ -0,0 +1,60 @@ |
|||
<!--pages/home/info/index.wxml--> |
|||
<cu-custom bgColor="bg-white" isBack="{{true}}"> |
|||
<view slot="content">从业信息</view> |
|||
</cu-custom> |
|||
|
|||
<!-- <view class="bg-white flex flex-center flex-column" style="padding:48rpx"> |
|||
<view style="width: 120px;height: 120px;position: relative" bindtap="chooseImage"> |
|||
<wux-image width="{{120}}" height="{{120}}" wux-class="image" shape="circle" src="{{avatarUrl}}" /> |
|||
<image class="wux-badge" src="/assets/image/icon_carmera.png"></image> |
|||
</view> |
|||
</view> --> |
|||
<wux-cell-group> |
|||
<!-- <wux-cell> |
|||
<view slot="header" class="text-gray">姓名</view> |
|||
<view slot="footer">{{linkman || ''}}</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.identityTag? 'text-black':'text-gray'}}">{{userInfo.identityTag || '点击修改从业身份'}}</view> |
|||
</wux-cell> |
|||
<wux-cell wx:if="{{userType == 1}}" is-link data-cid='city' bindtap="toTab2"> |
|||
<view slot="header" class="text-gray">所在城市</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' data-tag='从业经验' bindtap="toTab3"> |
|||
<view slot="header" class="text-gray">从业经验</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' data-tag='希望采购品类' bindtap="toTab4"> |
|||
<view slot="header" class="text-gray">希望采购品类</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' data-tag='希望出货品类' bindtap="toTab5"> |
|||
<view slot="header" class="text-gray">希望出货品类</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='type2' data-tag='希望出货品类' bindtap="toTab6"> |
|||
<view slot="header" class="text-gray">月出货量</view> |
|||
<view slot="footer" class="{{userInfo.shipmentPerMonth? 'text-black':'text-gray'}}">{{userInfo.shipmentPerMonth || '点击月出货量'}}</view> |
|||
</wux-cell> |
|||
</wux-cell-group> |
|||
|
|||
<!-- <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" 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> --> |
|||
|
|||
<wux-cropper wx:if="{{visible}}" srcList="{{srcList}}" bindclose="closeCallback" bindcroped="onCropback"></wux-cropper> |
|||
<wux-dialog id="wux-dialog" /> |
|||
<wux-cascader id="wux-cascader" value="{{region}}" options="{{ options }}" bind:close="onRegionChange" /> |
|||
@ -0,0 +1,80 @@ |
|||
/* pages/home/info/index.wxss */ |
|||
.wux-badge { |
|||
position: absolute; |
|||
width: 120px; |
|||
height: 120px; |
|||
opacity: 0.8; |
|||
right: 0; |
|||
bottom: 0; |
|||
z-index: 10; |
|||
} |
|||
|
|||
.wux-badge2 { |
|||
width: 120rpx; |
|||
height: 120rpx; |
|||
position: absolute; |
|||
z-index: 10; |
|||
left: 32rpx; |
|||
} |
|||
|
|||
.header-bg { |
|||
margin-top: 0px; |
|||
width: 100%; |
|||
height: 80px; |
|||
background: linear-gradient(314deg, rgba(50, 107, 250, 1) 0%, rgba(0, 138, 255, 1) 100%); |
|||
border-bottom-left-radius: 64rpx; |
|||
border-bottom-right-radius: 64rpx; |
|||
} |
|||
|
|||
.header-box { |
|||
width: 100%; |
|||
background: rgba(255, 255, 255, 1); |
|||
/* box-shadow: 0px 0px 15px -6px rgba(0, 0, 0, 0.32); |
|||
border-radius: 6px; */ |
|||
} |
|||
|
|||
.userinfo-avatar { |
|||
overflow: hidden; |
|||
width: 120rpx; |
|||
height: 120rpx; |
|||
border-radius: 12rpx; |
|||
border: 2px solid #fff; |
|||
box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.2); |
|||
} |
|||
|
|||
.account-bg { |
|||
background: linear-gradient(314deg, rgba(50, 107, 250, 1) 0%, rgba(0, 138, 255, 1) 100%); |
|||
border-radius: 6px; |
|||
} |
|||
|
|||
.money { |
|||
font-size: 44rpx; |
|||
font-family: SFProDisplay-Semibold, SFProDisplay; |
|||
font-weight: 600; |
|||
color: rgba(255, 255, 255, 1); |
|||
} |
|||
|
|||
.label { |
|||
font-size: 24rpx; |
|||
font-family: PingFang-SC-Regular, PingFang-SC; |
|||
font-weight: 400; |
|||
color: rgba(255, 255, 255, 1); |
|||
} |
|||
|
|||
.img-auth { |
|||
width: 32rpx; |
|||
height: 32rpx; |
|||
margin-left: 24rpx; |
|||
margin-right: 12rpx |
|||
} |
|||
|
|||
.img-auth2 { |
|||
width: 32rpx; |
|||
height: 32rpx; |
|||
margin-right: 12rpx |
|||
} |
|||
|
|||
.realName { |
|||
max-width: 100px; |
|||
white-space: nowrap; |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save