| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- /*******************************************************************************
- * Copyright(c) 2022 dongke All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 于继渤 2024-1-23 1.00 客户档案新增
- *******************************************************************************/
- const Constants = require('@/utils/Constants.js');
- const util = require('@/utils/util.js')
- const mixins = require('@/mixins/index.js')
- const app = getApp()
- Page({
- mixins: [mixins],
- /**
- * 页面的初始数据
- */
- data: {
- routeObjName: 'customer',
- cardList: ['main', 'center', 'remarks'],
- buttonSaveList: [{ code: 'add', title: mixins.$t('save'), width: '120rpx' }],
- contentObj: {
- main: [
- { code: 'cusName', type: 'str', required: true, title: mixins.$t('customerName') },
- { code: 'cusPhone', type: 'phone', title: mixins.$t('cusPhone'), required: true },
- { code: 'addressFull', type: 'address', title: mixins.$t('addressFull'), required: true },
- { code: 'addressNo', type: 'str', required: true, title: mixins.$t('addressNo') },
- { code: 'cusFrom', name: 'cusFromName', required: true, title: mixins.$t('customerSource'), type: 'choose', urlKey: 'choosecusFrom' },
- { code: 'contactName', type: 'str', required: false, title: mixins.$t('contactName') },
- { code: 'contactPhone', type: 'str', title: mixins.$t('cpPhone'), required: false },
- ],
- center: [
- { code: 'channelId', name: 'channelName', required: true, title: mixins.$t('saleChannel'), type: 'choose', urlKey: 'chooseChannel' },
-
- { code: 'staffId', name: 'staffName', type: 'choose', required: true, title: mixins.$t('saleStaff'), urlKey: 'chooseStaff' },
- { code: 'orgId', name: 'orgName', type: 'choose', required: true, title: mixins.$t('saleOrg'), urlKey: 'chooseOrg' },
- { code: 'initialDebt', type: 'number', required: false, title:'初始欠款' },
- ],
- remarks: [
- { code: 'remarks', type: 'textarea', title: mixins.$t('remarks') }
- ]
- },
- },
- /**
- * @desc : 选择数据源
- * @date : 2024/2/1 15:49
- * @author : 于继渤
- */
- chooseData(e) {
- let formData = JSON.parse(this.data.formData)
- let code = e.detail.code
- let data = e.detail.data.data
- if (code == "staffId") { //员工
- formData.staffId = data.id
- formData.staffName = data.name
- }
- if (code == "orgId") { //部门
- formData.orgId = data.id
- formData.orgName = data.name
- }
- //销售渠道
- if (code == 'channelId') {
- formData.channelId = data.id
- formData.channelCode = data.code
- formData.channelName = data.name
- }
- //客户来源
- if (code == 'cusFrom') {
- formData.cusFrom = data.id
- formData.cusFromCode = data.code
- formData.cusFromName = data.name
- }
- this.setData({
- formData: JSON.stringify(formData)
- })
- },
- /**
- * @desc : 保存数据服务
- * @date : 2024/2/1 15:49
- * @author : 于继渤
- */
- saveData() {
- if (this.data.formMode == Constants.formMode.edit) {
- return this.excute(this.data.service, this.data.service.update, this.data.params);
- } else {
- return this.excute(this.data.service, this.data.service.insert, this.data.params);
- }
- },
- /**
- * @desc : 给表单赋值
- * @date : 2024/2/1 15:49
- * @author : 于继渤
- */
- setValuesByEdit(data) {
- //处理地址
- data.address = {
- address: data.addressFull,
- addressFull: data.addressFull,
- addressArea: data.addressArea,
- addressGcj02: data.addressGcj02,
- addressName: data.addressName,
- }
- this.setData({
- formData: JSON.stringify(data)
- })
- },
- /**
- * 生命周期函数--监听页面加载
- */
- loadInit(options) {
- //TODO 销售渠道默认 零售 ,销售部门销售员工默认当前登录人的
- if (this.data.formMode == Constants.formMode.edit) {
- wx.setNavigationBarTitle({
- title: mixins.$t('editCus'),
- })
- }
- },
- })
|