| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243 |
- /*******************************************************************************
- * Copyright(c) 2022 dongke All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:
- * 2.功能描述:商户设置画面
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 姜永辉 2022-11-22 1.00 新建
- *******************************************************************************/
- const mixins = require('@/mixins/index.js')
- const Constants = require('@/utils/Constants.js');
- const app = getApp()
- Page({
- mixins: [mixins],
- /**
- * 页面的初始数据
- */
- data: {
- // 路由
- routeObjName: 'company',
- cardList: ['main'],
- contentObj: {
- main: [{
- code: 'cpName',
- type: 'str',
- readonly: 'true',
- required: 'true',
- title: mixins.$t('cpName')
- },
- {
- code: 'cpManager',
- type: 'str',
- readonly: 'true',
- required: 'true',
- title: mixins.$t('cpManager')
- },
- {
- code: 'cpPhone',
- type: 'phone',
- readonly: 'true',
- required: 'true',
- title: mixins.$t('cpPhone')
- },
- {
- code: 'cpSize',
- type: 'str',
- readonly: 'true',
- title: mixins.$t('cpSize')
- },
- {
- code: 'shopSize',
- type: 'str',
- readonly: 'true',
- title: mixins.$t('shopSize')
- },
- {
- code: 'feedback',
- type: 'textarea',
- readonly: 'true',
- title: mixins.$t('feedback')
- },
- ],
- },
- buttonFootList: [{
- code: 'close',
- title: mixins.$t('close')
- }],
- companyService: app.globalData['companyService'],
- },
- /**
- * @desc : 参数设置
- * @date : 2024/2/1 15:49
- * @author : 姜永辉
- */
- paramSetting(e) {
- let _this = this
- wx.navigateTo({
- url: this.data.route.companyParamSetting.url,
- events: {
- // 回调后,在这里给页面赋值
- bandData: function (e) {}
- },
- success: function (res) {
- // 通过eventChannel向被打开页面传送数据 TODO 测试例子url是写死的,实际中,需要从route中读取
- res.eventChannel.emit('params', {})
- }
- })
- },
- /**
- * @desc : 打印设置
- * @date : 2024/2/1 15:49
- * @author : 王英杰
- */
- printRmarkes() {
- let _this = this
- wx.navigateTo({
- url: this.data.route.printRmarkes.url,
- events: {
- // 回调后,在这里给页面赋值
- bandData: function (e) {}
- },
- success: function (res) {
- // 通过eventChannel向被打开页面传送数据 TODO 测试例子url是写死的,实际中,需要从route中读取
- res.eventChannel.emit('params', {})
- }
- })
- },
- /**
- * @desc : 页面初始信息加载
- * @param {*} e
- * @date : 2024/06/21 09:23
- * @author : 刘尧
- */
- loadInit(e) {
- if (app.globalData.user.flgInit) {
- const buttonFootList = [{
- code: 'updateCommanyOwner',
- title: mixins.$t('updateCommanyOwner')
- }]
- this.setData({
- buttonFootList: buttonFootList
- })
- }
- },
- /**
- * @desc : 底部按钮回调
- * @date : 2024/6/21 13:35
- * @author : 刘尧
- */
- openFormEdit(e) {
- switch (e.detail.name) {
- case "updateCommanyOwner":
- const contentObj = this.data.contentObj
- const index = contentObj.main.findIndex(res => res.code === "cpManager")
- contentObj.main[index].type = 'choose'
- contentObj.main[index].urlKey = 'updateCommanyOwner'
- contentObj.main[index].name = contentObj.main[index].code
- contentObj.main[index].required = true
- contentObj.main[index].readonly = false
- this.setData({
- contentObj: contentObj
- })
- break;
- case "save":
- this.save(e)
- break;
- case "close":
- this.close(e)
- break;
- }
- },
- /**
- * @desc : 参数设置
- * @author : 刘尧
- * @date : 2024/6/18 17:12
- */
- setParams(params) {
- params = JSON.parse(this.data.formData)
- params.svcIp = app.globalData.company.svcIp
- params.svcPort = app.globalData.company.svcPort
- return params
- },
- /**
- * @desc : 数据保存
- * @author : 刘尧
- * @date : 2024/6/18 17:12
- */
- saveData(params) {
- return this.excute(this.data.companyService, this.data.companyService.transferHead, params);
- },
- /**
- * @desc : 选择用户回调
- * @date : 2024/6/21 14:03
- * @author : 刘尧
- */
- chooseData(e) {
- const data = e.detail.data.data
- const formData = JSON.parse(this.data.formData)
- formData.owner = data.id
- formData.cpManager = data.name
- formData.cpPhone = data.staffPhone
- const contentObj = this.data.contentObj
- const index = contentObj.main.findIndex(res => res.code === "cpManager")
- contentObj.main[index].type = 'str'
- contentObj.main[index].urlKey = ''
- contentObj.main[index].required = true
- contentObj.main[index].readonly = true
- const buttonList = [{
- code: 'save',
- title: mixins.$t('save')
- }]
- this.setData({
- contentObj: contentObj,
- formData: JSON.stringify(formData),
- buttonFootList: buttonList
- })
- },
- /**
- * @desc : 加载数据
- * @date : 2024/2/1 15:49
- * @author : 姜永辉
- */
- close(e) {
- wx.navigateBack({
- data: 1
- })
- },
- /**
- * @desc : 给表单赋值
- * @date : 2024/2/1 15:49
- * @author : 姜永辉
- */
- setValuesByEdit(data) {
- let contentObj = this.data.contentObj
- this.setData({
- formData: JSON.stringify(data)
- })
- if (data.gradeCode == Constants.gradeCode.PRO) {
- contentObj.main.unshift({
- code: 'gradeName',
- type: 'str',
- readonly: 'true',
- title: mixins.$t('professionalVersion')
- })
- } else {
- contentObj.main.unshift({
- code: 'gradeName',
- type: 'str',
- readonly: 'true',
- title: mixins.$t('standardVersion')
- })
- }
- this.setData({
- contentObj: contentObj
- })
- },
- })
|