add.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906
  1. const app = getApp();
  2. const util = require('../../../../utils/util.js')
  3. const api = require('../../../../utils/api.js');
  4. const Constants = require('../../../../utils/Constants.js');
  5. const common = require('../../../../utils/common');
  6. const config = require('../../../../config/config.js')
  7. Page({
  8. /**
  9. * 页面的初始数据
  10. */
  11. data: {
  12. saveFlag: true,
  13. checked_1: false,
  14. checked_2: false,
  15. checked_3: false,
  16. checked_4: false,
  17. checked_5: false,
  18. checked_6: false,
  19. checked_7: false,
  20. checked_8: false,
  21. //数量
  22. quantity_1: '0',
  23. quantity_2: '0',
  24. quantity_3: '0',
  25. quantity_4: '0',
  26. quantity_5: '0',
  27. quantity_6: '0',
  28. quantity_7: '0',
  29. quantity_8: '0',
  30. show: false,
  31. activeboxNames: ['1'],
  32. form: {
  33. customerName: '',
  34. customerPhone: '',
  35. AddressName: '',
  36. addressNo: '',
  37. FollowType: '',
  38. NextFollowTime: '', //提醒时间
  39. FollowUpContent: '', //跟进内容
  40. NextFollowUpPlan: '', //下次跟进计划
  41. CustomerIntentionsName: '', //客户意向
  42. LeaveTime: '', //留店时长
  43. CompetitionBrand: '', //竞品品牌
  44. OtherName: '其他',
  45. customerFrom: null,//客户来源
  46.      customerFromName: '',
  47. },
  48. minDate: new Date().getTime(),
  49. radio_follow_up: '2',
  50. selectflag: false,
  51. followTypeFlag: false,
  52. otherFlag: false,
  53. customerIntentionsFlag: false,
  54. competitionBrandFlag: false,
  55. mustFillFlag: true, //必填项目
  56. columns: [],
  57. nextFollowTimeSearch: new Date().getTime() + 100,
  58. formatter(type, value) {
  59. if (type === 'year') {
  60. return `${value}年`;
  61. }
  62. if (type === 'month') {
  63. return `${value}月`;
  64. }
  65. if (type === 'day') {
  66. return `${value}日`;
  67. }
  68. if (type === 'hour') {
  69. return `${value}时`;
  70. }
  71. if (type === 'minute') {
  72. return `${value}分`;
  73. }
  74. return value;
  75. },
  76. fileList: [], //图片
  77. },
  78. /**
  79. * 删除图片
  80. */
  81. deleteImg(e) {
  82. let index = e.detail.index;
  83. let arr = this.data.fileList;
  84. arr.splice(index, 1);
  85. this.setData({
  86. fileList: arr
  87. })
  88. },
  89. /**
  90. * @desc : 上传方法
  91. * @author : 于继渤
  92. * @date : 2022/6/02 16:16
  93. */
  94. afterRead(event) {
  95. const _this = this;
  96. const {
  97. file
  98. } = event.detail;
  99. file.forEach(res => {
  100. // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
  101. wx.uploadFile({
  102. url: `${config.server_add}:${config.server_port}` + '/basic-server/file/upload',
  103. filePath: res.path,
  104. name: 'file',
  105. formData: {
  106. 'folder': 't_csm_follow/follow'
  107. },
  108. header: {
  109. 'Authorization': 'Bearer ' + app.globalData.token
  110. },
  111. success(res) {
  112. res.data = JSON.parse(res.data)
  113. if (res.data.code === 200) {
  114. let arr = _this.data.fileList;
  115. arr.push({
  116. url: res.data.data.absolutelyPath,
  117. FilePath: res.data.data.relativePath,
  118. deletable: true
  119. })
  120. _this.setData({
  121. fileList: arr
  122. })
  123. }
  124. },
  125. })
  126. })
  127. },
  128. /**
  129. * 小程序地图调用
  130. */
  131. onClickWxchartAddress() {
  132. // 跳转新建地图实例
  133. common.onClickWxchartAddress();
  134. },
  135. /**
  136. * 获取意向品类数据源
  137. */
  138. getGoodsSpecs() {
  139. let param = {
  140. dataSourceCode: "商品规格分类"
  141. }
  142. param.cpId = app.globalData.user.cpId
  143. return new Promise((resolve, reject) => {
  144. api.request(Constants.BASIC_COMMON_API + 'get_wx_init_data', 'POST', param).then(res => {
  145. if (res.data.code === 200) {
  146. let specsList = []
  147. specsList = res.data.data
  148. this.setData({
  149. specsList
  150. })
  151. resolve(res)
  152. } else {
  153. reject(res)
  154. }
  155. })
  156. })
  157. },
  158. /**
  159. *手风琴 复选框 数据源监听事件
  160. */
  161. onDataChange(e) {
  162. this.setData({
  163. specsList: e.detail.dataList
  164. })
  165. },
  166. /**
  167. * 获取接待时常数据
  168. */
  169. followTime_init_base() {
  170. let param = {
  171. dataSourceCode: 'followTime'
  172. }
  173. api.request(Constants.BASIC_COMMON_API + 'get_wx_init_data', 'POST', param).then(res => {
  174. if (res.data.code === 200) {
  175. let followTime = []
  176. let columns = []
  177. followTime = res.data.data
  178. followTime.forEach(element => {
  179. columns.push(element.name)
  180. });
  181. this.setData({
  182. columns
  183. })
  184. }
  185. })
  186. },
  187. /**
  188. * 新客接待单选
  189. * @param {} event
  190. */
  191. onRadio_Follow_Up(event) {
  192. // if (this.data.form.customerName == '无联系人' || this.data.type == 'add') {
  193. // this.setData({
  194. // radio_follow_up: event.detail,
  195. // });
  196. // }
  197. this.setData({
  198. radio_follow_up: event.detail,
  199. });
  200. },
  201. /**
  202. * 提醒时间
  203. */
  204. onChangePickDate() {
  205. this.setData({
  206. show: true
  207. })
  208. },
  209. /**
  210. * @desc : 标识日期变化事件
  211. * @author : 秦祺
  212. * @date : 2022/5/26 17:16
  213. */
  214. changeDate(e) {
  215. let key = e.currentTarget.dataset.key
  216. //提醒时间
  217. if (key === 'nextFollowTime') {
  218. this.setData({
  219. nextFollowTimeSearch: e.detail
  220. })
  221. }
  222. },
  223. /**
  224. * 关闭提醒时间
  225. */
  226. onCloseChooseDate() {
  227. this.setData({
  228. show: false
  229. })
  230. },
  231. /**
  232. * 确定提醒时间
  233. * @param {*} e
  234. */
  235. onConfirmChooseDate(e) {
  236. let form = this.data.form
  237. form.NextFollowTime = util.formatDataTime(new Date(this.data.nextFollowTimeSearch))
  238. this.setData({
  239. form: form,
  240. show: false
  241. })
  242. },
  243. /**
  244. * 取消提醒时间
  245. */
  246. onCloseChooseDate() {
  247. this.setData({
  248. show: false
  249. })
  250. },
  251. /**
  252. * 客户查重
  253. * @param {} event
  254. */
  255. blurCustomerPhone(event) {
  256. //根据联系电话判断客户是否存在 ,存在则跳转跟进
  257. let customerPhone = this.data.form.customerPhone
  258. if (customerPhone != '') {
  259. let param = {
  260. pageSize: '',
  261. currentPage: '',
  262. customerPhone: customerPhone,
  263. saleStatus: '查重',
  264. }
  265. param.cpId = app.globalData.user.cpId
  266. api.request(Constants.SALE_CUSTOMER_API + 'select_customer_list', 'POST', param).then(res => {
  267. this.setData({
  268. loading: false
  269. })
  270. if (res.data.code === 200) {
  271. let list = res.data.data.list; //后台返回数据
  272. if (list.length > 0) { //有数据 就赋值
  273. let form = this.data.form
  274. form.customerName = list[0].customerName
  275. form.customerId = list[0].customerId
  276. form.addressNo = list[0].addressNo
  277. form.addressArea = list[0].addressArea
  278. form.saleStatus = list[0].saleStatus
  279. form.addressName = list[0].addressName
  280. this.setData({
  281. form
  282. })
  283. } else {
  284. // 如果根据联系电话没有查到数据,需要清空客户id,客户编码(企业微信没有联系电话的除外)
  285. let form = this.data.form
  286. if (!form.noTelephone) {
  287. form.customerId = null;
  288. form.customerCode = null;
  289. }
  290. this.setData({
  291. form: form
  292. })
  293. }
  294. }
  295. })
  296. }
  297. },
  298. /**
  299. * 留店时长
  300. */
  301. showPopup() {
  302. this.setData({
  303. selectflag: true
  304. });
  305. },
  306. /**
  307. * 跟进方式
  308. */
  309. showFollowTypePopup() {
  310. this.setData({
  311. followTypeFlag: true
  312. });
  313. },
  314. /*
  315. * 客户意向
  316. */
  317. showCustomerIntentionsPopup(e) {
  318. let type = e.currentTarget.dataset.type
  319. if (type === 'CustomerIntentions') {
  320. this.setData({
  321. customerIntentionsFlag: true
  322. });
  323. }
  324. if (type === 'customerFrom') {
  325. this.setData({
  326. customerSourceFlag: true
  327. })
  328. }
  329. },
  330. //组件单选确定
  331. mutiSearch(e) {
  332. console.log(e)
  333. console.log('选择啦')
  334. let id = e.target.id
  335. let form = this.data.form
  336. if (id === 'customerFrom') {
  337. form.customerFromName = e.detail.name
  338. form.customerFrom = e.detail.id
  339. console.log(form)
  340. }
  341. if (id === 'customerIntentions') {
  342. form.CustomerIntentionsName = e.detail.name
  343. }
  344. if (id === 'other') {
  345. form.OtherName = e.detail.name
  346. }
  347. this.setData({
  348. form: form
  349. })
  350. if (form.CustomerIntentionsName == '已流失') {
  351. this.setData({
  352. competitionBrandFlag: true,
  353. })
  354. } else {
  355. this.setData({
  356. competitionBrandFlag: false,
  357. })
  358. }
  359. if (form.CustomerIntentionsName == '放入公海') {
  360. this.setData({
  361. mustFillFlag: false
  362. })
  363. } else {
  364. this.setData({
  365. mustFillFlag: true
  366. })
  367. }
  368. },
  369. /**
  370. * 留店时长
  371. * @param {*} e
  372. */
  373. onChange(e) {
  374. let form = this.data.form
  375. form.LeaveTime = e.detail.value
  376. this.setData({
  377. form: form,
  378. selectflag: false
  379. })
  380. },
  381. /**
  382. * 取消留店时长
  383. * @param {*} e
  384. */
  385. onCancel() {
  386. this.setData({
  387. selectflag: false
  388. })
  389. },
  390. /**
  391. * 跟进内容
  392. * @param {} event
  393. */
  394. onFollowUpContentChange(event) {
  395. let form = this.data.form
  396. form.FollowUpContent = event.detail
  397. this.setData({
  398. form: form
  399. })
  400. },
  401. /**
  402. * 下次跟进计划
  403. * @param {} event
  404. */
  405. onNextFollowUpPlanChange(event) {
  406. let form = this.data.form
  407. form.NextFollowUpPlan = event.detail
  408. this.setData({
  409. form: form
  410. })
  411. },
  412. /**
  413. * 客户名称
  414. * @param {*} event
  415. */
  416. onCustomerNameChange(event) {
  417. let form = this.data.form
  418. form.customerName = event.detail
  419. this.setData({
  420. form: form
  421. })
  422. },
  423. /**
  424. * @desc : 联系电话输入事件
  425. * @author : 于继渤
  426. * @date : 2022/5/24 12:16
  427. */
  428. changeCustomerFormFieldPhone(e) {
  429. let key = e.detail.currentTarget.dataset.key
  430. let form = this.data.form
  431. form.customerPhone = e.detail.detail
  432. this.setData({
  433. form: form
  434. })
  435. },
  436. /**
  437. * @desc : 修改联系电话
  438. * @author : 周兴
  439. * @date : 2022/10/27 18:16
  440. */
  441. editPhone(e) {
  442. this.setData({
  443. telephoneFlag: true,
  444. telephone: this.data.form.customerPhone
  445. })
  446. },
  447. /**
  448. * @desc : 编辑联系电话事件
  449. * @author : 周兴
  450. * @date : 2022/10/27 12:16
  451. */
  452. closeCustomerPhonePop(e) {
  453. this.setData({
  454. telephoneFlag: false
  455. })
  456. },
  457. /**
  458. * @desc : 修改联系电话事件
  459. * @author : 周兴
  460. * @date : 2022/10/27 12:16
  461. */
  462. changeCustomerPhonePop(e) {
  463. this.setData({
  464. telephone: e.detail.detail
  465. })
  466. },
  467. /**
  468. * @desc : 更新联系电话
  469. * @author : 周兴
  470. * @date : 2022/10/27 12:16
  471. */
  472. updateCustomerPhone(e) {
  473. let form = this.data.form
  474. form.customerPhone = this.data.telephone
  475. this.setData({
  476. form: form,
  477. telephoneFlag: false
  478. })
  479. },
  480. /**
  481. * 联系电话
  482. * @param {*} event
  483. */
  484. onCustomerPhoneChange(event) {
  485. let form = this.data.form
  486. form.customerPhone = event.detail
  487. this.setData({
  488. form: form
  489. })
  490. },
  491. /**
  492. * 客户地址
  493. * @param {*} event
  494. */
  495. onAddressNameChange(event) {
  496. let form = this.data.form
  497. form.AddressName = event.detail
  498. this.setData({
  499. form: form
  500. })
  501. },
  502. /**
  503. * 门牌号
  504. * @param {*} event
  505. */
  506. onAddressNoChange(event) {
  507. let form = this.data.form
  508. form.addressNo = event.detail
  509. this.setData({
  510. form: form
  511. })
  512. },
  513. /**
  514. * 选择跟进方式
  515. * @param {*} e
  516. */
  517. onFollowTypeChange(e) {
  518. let form = this.data.form
  519. form.FollowType = e.detail.value
  520. this.setData({
  521. form: form
  522. })
  523. },
  524. /**
  525. * 选择客户意向
  526. * @param {*} e
  527. */
  528. onCustomerIntentionsChange(e) {
  529. let form = this.data.form
  530. form.CustomerIntentions = e.detail.value
  531. this.setData({
  532. form: form
  533. })
  534. },
  535. /**
  536. * 关闭
  537. *
  538. */
  539. onClose() {
  540. this.setData({
  541. selectflag: false,
  542. followTypeFlag: false,
  543. customerIntentionsFlag: false,
  544. })
  545. },
  546. /**
  547. * @desc : 跳转选商品 orderType 1预算报价
  548. * @author : 于继渤
  549. * @date : 2022/6/14 12:16
  550. */
  551. toPay(e) {
  552. this.setData({
  553. toPayFlag: true
  554. })
  555. //this.submit();
  556. let form = this.data.form
  557. form.ascpId = app.globalData.user.ascpId
  558. form.sale1Id = app.globalData.user.sale1Id
  559. form.sale2Id = app.globalData.user.sale2Id
  560. if (!form.noTelephone) {
  561. if (!form.customerPhone) {
  562. wx.showToast({
  563. title: '请输入联系电话',
  564. icon: 'none'
  565. })
  566. return false
  567. }
  568. if (!util.isPoneAvailable(form.customerPhone)) {
  569. wx.showToast({
  570. title: '联系电话格式不正确',
  571. icon: 'none'
  572. })
  573. return false
  574. }
  575. }
  576. let that = this
  577. setTimeout(function () {
  578. wx.navigateTo({
  579. url: '/package4/pages/order-billing/choose-goods/choose-goods?orderType=1&page=receiveCustomers&customerItem=' + JSON.stringify(that.data.form)
  580. })
  581. }, 200)
  582. },
  583. /**
  584. * 提交保存
  585. */
  586. submit() {
  587. if (!this.data.saveFlag) {
  588. return
  589. }
  590. //业务员
  591. let followUsers = app.globalData.user.userId
  592. let result = this.checkForm();
  593. if (result.flag) {
  594. this.setData({
  595. loading: true,
  596. loadingButtonFlag: true
  597. })
  598. let specsList = this.data.specsList
  599. let specsList_ = []
  600. specsList.forEach(function (item) {
  601. if (item.checked) {
  602. specsList_.push({
  603. "specsId": item.id,
  604. "specsName": item.name,
  605. "count": item.quantity,
  606. "value": item.checked,
  607. "other": item.other ? item.other : false
  608. })
  609. }
  610. });
  611. let param = {}
  612. param.ascpId = app.globalData.user.ascpId
  613. param.sale1Id = app.globalData.user.sale1Id
  614. param.sale2Id = app.globalData.user.sale2Id
  615. // 客户来源
  616. param.customerFrom = this.data.form.customerFrom
  617. //当前跟进人(业务员)
  618. param.followUsers = [],
  619. param.followUsers.push(followUsers) //业务员
  620. param.customerName = this.data.radio_follow_up == 1 ? "无联系人" : this.data.form.customerName //客户名称
  621. param.customerId = this.data.form.customerId ? this.data.form.customerId : null //客户ID
  622. param.salesChannel = app.globalData.user.channelId
  623. if (this.data.form.customerId != null) {
  624. if (this.data.form.saleStatus != '客成状态-成交') {
  625. param.saleStatus = '客成状态-潜客'
  626. } else {
  627. param.saleStatus = this.data.form.saleStatus
  628. }
  629. }
  630. param.customerPhone = this.data.form.customerPhone //联系电话
  631. param.addressName = this.data.form.addressName //客户地址
  632. if (this.data.form.addressArea) {
  633. param.addressFull = (this.data.form.addressArea.province ? this.data.form.addressArea.province : '') + (this.data.form.addressArea.city ? this.data.form.addressArea.city : '') + (this.data.form.addressArea.district ? this.data.form.addressArea.district : '') + (this.data.form.addressName ? this.data.form.addressName : '') + (this.data.form.addressNo ? this.data.form.addressNo : '')
  634. }
  635. param.addressGcj02 = this.data.form.addressGcj02,
  636. param.addressNo = this.data.form.addressNo //门牌号
  637. param.addressArea = this.data.form.addressArea
  638. //不同接待跟进状态不同
  639. if (this.data.radio_follow_up == 1) {
  640. param.followStatus = '跟进状态-接待' //跟进状态
  641. } else if (this.data.radio_follow_up == 2) {
  642. param.followStatus = '跟进状态-报备' //跟进状态
  643. }
  644. param.followType = '跟进方式-进店' //跟进方式
  645. param.followData = this.data.form.FollowUpContent //跟进内容
  646. param.nextFollowPlan = this.data.form.NextFollowUpPlan //下次跟进计划
  647. param.nextFollowTime = this.data.form.NextFollowTime //下次跟进计划
  648. param.stayTimeLen = '留店时长-' + this.data.form.LeaveTime //留店时长
  649. if (this.data.radio_follow_up == 2) {
  650. param.intention = '客户意向-' + this.data.form.CustomerIntentionsName //客户意向
  651. }
  652. param.competitiveBrands = this.data.form.CompetitionBrand //竞品品牌
  653. param.followOrg = app.globalData.user.orgId
  654. param.intentionInfo = specsList_ //意向品类
  655. let fileList_ = this.data.fileList
  656. let fileList = []
  657. fileList_.forEach(item => {
  658. fileList.push(item.FilePath)
  659. })
  660. // 跟进附件 20220613
  661. param.annexPaths = {
  662. annexPaths: fileList
  663. }
  664. if (this.data.radio_follow_up == '1') {
  665. //陌生接待清空其他数据
  666. param.customerPhone = ""
  667. param.addressGcj02 = null
  668. param.addressNo = ""
  669. param.addressArea = null
  670. param.addressName = null
  671. param.nextFollowPlan = "" //下次跟进计划
  672. param.nextFollowTime = "" //下次跟进计划
  673. }
  674. let API = ''
  675. if(this.data.pageFlag && this.data.pageFlag == 'edit'){
  676. //编辑客户接待
  677. API = 'update'
  678. param.followId = this.data.form.followId ? this.data.form.followId : null
  679. }else{
  680. API = 'insert'
  681. }
  682. api.request(Constants.SALE_CUSTOMERFOLLOW_API + API, 'POST', param).then(res => {
  683. this.setData({
  684. loading: false,
  685. })
  686. if (res.data.code === 200) {
  687. wx.showToast({
  688. title: '保存成功',
  689. image: '/static/image/success.png',
  690. duration: 1000
  691. })
  692. let deltaNum = 1
  693. let pagesNum = 2
  694. if(this.data.pageFlag && this.data.pageFlag == 'edit'){
  695. deltaNum = 2
  696. pagesNum = 3
  697. }
  698. var pages = getCurrentPages();
  699. var prevPage = pages[pages.length - pagesNum];
  700. prevPage.setData({
  701. selectflag: true
  702. })
  703. this.setData({
  704. toPayFlag: false,
  705. saveFlag: false
  706. })
  707. setTimeout(function () {
  708. wx.navigateBack({
  709. delta: deltaNum
  710. })
  711. }, 1000)
  712. } else {
  713. this.setData({
  714. loadingButtonFlag: false
  715. })
  716. }
  717. })
  718. } else {
  719. this.setData({
  720. loading: false,
  721. loadingButtonFlag: false
  722. })
  723. setTimeout(function () {
  724. wx.showToast({
  725. title: result.msg,
  726. image: '/static/image/warning.png',
  727. duration: 1000
  728. })
  729. }, 1000)
  730. }
  731. },
  732. /* 表单校验 */
  733. checkForm() {
  734. //客户接待
  735. if (this.data.radio_follow_up == 2) {
  736. if (!this.data.form.customerName) {
  737. return {
  738. flag: false,
  739. msg: '客户名称为空'
  740. };
  741. }
  742. if (!this.data.form.customerPhone && !this.data.form.noTelephone) {
  743. return {
  744. flag: false,
  745. msg: '客户电话为空'
  746. };
  747. }
  748. if (!util.isPoneAvailable(this.data.form.customerPhone) && !this.data.form.noTelephone) {
  749. return {
  750. flag: false,
  751. msg: '客户电话不正确'
  752. };
  753. }
  754. if (!this.data.form.CustomerIntentionsName) {
  755. return {
  756. flag: false,
  757. msg: '客户意向为空'
  758. };
  759. }
  760. // if (!this.data.form.NextFollowTime && this.setData.mustFillFlag) {
  761. // return {
  762. // flag: false,
  763. // msg: '提醒时间为空'
  764. // };
  765. // }
  766. }
  767. if (!this.data.form.FollowUpContent) {
  768. return {
  769. flag: false,
  770. msg: '跟进内容为空'
  771. };
  772. }
  773. if (!this.data.form.LeaveTime) {
  774. return {
  775. flag: false,
  776. msg: '留店时长为空'
  777. };
  778. }
  779. return {
  780. flag: true,
  781. msg: '表单校验通过'
  782. }
  783. },
  784. /**
  785. * 生命周期函数--监听页面加载
  786. */
  787. onLoad: function (options) {
  788. },
  789. /**
  790. * 页面取消
  791. */
  792. cancle() {
  793. wx.navigateBack({
  794. delta: -1
  795. });
  796. },
  797. /**
  798. * 生命周期函数--监听页面初次渲染完成
  799. */
  800. onReady: function () {
  801. },
  802. /**
  803. * 生命周期函数--监听页面显示
  804. */
  805. onShow: function () {
  806. },
  807. /**
  808. * 生命周期函数--监听页面卸载
  809. */
  810. onUnload: function () {
  811. // 页面卸载时设置插件选点数据为null,防止再次进入页面,geLocation返回的是上次选点结果
  812. chooseLocation.setLocation(null);
  813. },
  814. /**
  815. * @desc : 跳转选择客户
  816. * @author : 于继渤
  817. * @date : 2022/09/27 09:56
  818. */
  819. onChooseCustomer() {
  820. wx.navigateTo({
  821. url: '/package4/pages/order-billing/choose-customer/choose-customer?page=receiveAdd',
  822. })
  823. },
  824. /**
  825. * @desc : 加微信
  826. * @date :
  827. * @author :
  828. */
  829. onnavigateToAddCustomer: function (e) {
  830. if (!app.globalData.SystemInfo.environment) {
  831. wx.showToast({
  832. title: '请在企业微信模式下运行',
  833. icon: 'none'
  834. })
  835. return
  836. }
  837. wx.qy.navigateToAddCustomer({
  838. success: (res) => {
  839. },
  840. fail: (res) => {
  841. },
  842. complete: (res) => {
  843. }
  844. })
  845. },
  846. })