From a5af0b9302240529d88511466439a8e467c4cec7 Mon Sep 17 00:00:00 2001
From: wangzhen <37717239@qq.com>
Date: Fri, 5 Feb 2021 22:35:30 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=AA=E4=BA=BA=E8=B5=84?=
=?UTF-8?q?=E6=96=99=E9=A1=B5=E9=9D=A2UI.wz?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app.json | 4 +-
pages/home/enterprise/enterprise.js | 424 ++++++++++++++++++++++++++
pages/home/enterprise/enterprise.json | 11 +
pages/home/enterprise/enterprise.wxml | 74 +++++
pages/home/enterprise/enterprise.wxss | 80 +++++
pages/home/info/index.js | 12 +
pages/home/info/index.wxml | 69 +----
pages/home/personal/personal.js | 424 ++++++++++++++++++++++++++
pages/home/personal/personal.json | 11 +
pages/home/personal/personal.wxml | 60 ++++
pages/home/personal/personal.wxss | 80 +++++
11 files changed, 1187 insertions(+), 62 deletions(-)
create mode 100644 pages/home/enterprise/enterprise.js
create mode 100644 pages/home/enterprise/enterprise.json
create mode 100644 pages/home/enterprise/enterprise.wxml
create mode 100644 pages/home/enterprise/enterprise.wxss
create mode 100644 pages/home/personal/personal.js
create mode 100644 pages/home/personal/personal.json
create mode 100644 pages/home/personal/personal.wxml
create mode 100644 pages/home/personal/personal.wxss
diff --git a/app.json b/app.json
index 8e7ee48..d33ea8c 100644
--- a/app.json
+++ b/app.json
@@ -87,7 +87,9 @@
"pages/html/rules/index",
"pages/html/notice/index",
"pages/html/integral/index",
- "pages/payment/index"
+ "pages/payment/index",
+ "pages/home/personal/personal",
+ "pages/home/enterprise/enterprise"
],
"permission": {
"scope.userLocation": {
diff --git a/pages/home/enterprise/enterprise.js b/pages/home/enterprise/enterprise.js
new file mode 100644
index 0000000..c2d0225
--- /dev/null
+++ b/pages/home/enterprise/enterprise.js
@@ -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'
+ })
+ },
+
+})
\ No newline at end of file
diff --git a/pages/home/enterprise/enterprise.json b/pages/home/enterprise/enterprise.json
new file mode 100644
index 0000000..2635487
--- /dev/null
+++ b/pages/home/enterprise/enterprise.json
@@ -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"
+ }
+}
\ No newline at end of file
diff --git a/pages/home/enterprise/enterprise.wxml b/pages/home/enterprise/enterprise.wxml
new file mode 100644
index 0000000..c1243da
--- /dev/null
+++ b/pages/home/enterprise/enterprise.wxml
@@ -0,0 +1,74 @@
+
+
+ 企业信息
+
+
+
+
+
+
+ 公司名称
+ {{realName || ''}}
+
+
+ 公司性质
+ {{identityStr}}
+
+
+
+ 公司地址
+ {{companyAddress}}
+
+
+ 工厂名
+ {{userInfo.packageFactoryName || '点击修改打包站名'}}
+
+
+ 打包站占地面积
+ {{userInfo.packageFactoryArea || '点击修改打包站占地面积'}}
+
+
+ 工厂人数
+ {{userInfo.numberOfEmployee || '点击修改工厂人数'}}
+
+
+ 打包机数
+ {{userInfo.numberOfPackageMachine || '点击修改工厂打包机数'}}
+
+
+
+ 营业执照
+ {{userInfo.businessLicenseUrl==null?'未上传':'查看'}}
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/home/enterprise/enterprise.wxss b/pages/home/enterprise/enterprise.wxss
new file mode 100644
index 0000000..e20cbfc
--- /dev/null
+++ b/pages/home/enterprise/enterprise.wxss
@@ -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;
+}
\ No newline at end of file
diff --git a/pages/home/info/index.js b/pages/home/info/index.js
index c2d0225..36a1691 100644
--- a/pages/home/info/index.js
+++ b/pages/home/info/index.js
@@ -395,6 +395,18 @@ Page({
url: '/pages/home/tab4/index'
})
},
+
+ goPersonalInfo: function () {
+ wx.navigateTo({
+ url: '/pages/home/personal/personal'
+ })
+ },
+
+ goEnterpriseInfo: function () {
+ wx.navigateTo({
+ url: '/pages/home/enterprise/enterprise'
+ })
+ },
toTab5: function () {
wx.navigateTo({
url: '/pages/home/tab5/index'
diff --git a/pages/home/info/index.wxml b/pages/home/info/index.wxml
index df4537f..e941433 100644
--- a/pages/home/info/index.wxml
+++ b/pages/home/info/index.wxml
@@ -13,7 +13,7 @@