add.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  1. <template>
  2. <view class="container qualifications" :style="{ paddingBottom: isIphoneX ? '68rpx' : '0' }">
  3. <view class="remarks-content-club" @click="handleClickClunInfo">
  4. <view class="content-club-le">
  5. <view class="club-le-text">
  6. <text class="label">机构名称:</text> <text class="text">{{ clubInfo.name }}</text>
  7. </view>
  8. <view class="club-le-text">
  9. <text class="label">联系人:</text> <text class="text">{{ clubInfo.linkMan }}</text>
  10. <text class="label phone">手机号:</text> <text class="text">{{ clubInfo.contractMobile }}</text>
  11. </view>
  12. <view class="club-le-text">
  13. <text class="label">地址:</text>
  14. <text class="text" v-if="clubInfo.provincialAddress">{{ clubInfo.provincialAddress }}{{ clubInfo.address }}</text>
  15. </view>
  16. </view>
  17. <view class="content-club-ri"> <text class="iconfont icon-xiayibu"></text> </view>
  18. </view>
  19. <view class="remarks-content">
  20. <view class="list-view-title">
  21. <view class="list-view-h1"><text>*</text>咨询人:</view>
  22. </view>
  23. <view class="remarks-input">
  24. <input
  25. class="input"
  26. type="text"
  27. v-model="remarksParams.questionMan"
  28. value=""
  29. placeholder="请输入和你聊天的客户姓名"
  30. maxlength="15"
  31. />
  32. </view>
  33. <view class="list-view-title">
  34. <view class="list-view-h1"><text>*</text>咨询类别:</view>
  35. </view>
  36. <view class="remarks-category">
  37. <view
  38. class="checkbox-list"
  39. :class="category.isChecked ? 'checked' : ''"
  40. v-for="(category, index) in categorys"
  41. :key="index"
  42. @click="choiceCategorys(category, index)"
  43. >
  44. <text class="iconfont" :class="category.isChecked ? 'icon-yixuanze' : 'icon-weixuanze'"></text>
  45. {{ category.className }}
  46. </view>
  47. </view>
  48. <view class="list-view-title">
  49. <view class="list-view-h1"><text>*</text>关键词记录:</view>
  50. </view>
  51. <view class="remarks-textarea">
  52. <textarea
  53. class="textarea"
  54. v-model="remarksParams.remarks"
  55. value=""
  56. placeholder="请总结你和客户的聊天内容,以关键词形式填入框内,关键词之间用中文逗号隔开"
  57. maxlength="500"
  58. @input="conInput"
  59. />
  60. <text class="limit-text">{{ min }}/{{ max }}</text>
  61. </view>
  62. <view class="list-view-title">
  63. <view class="list-view-h1">上传图片</view>
  64. <view class="list-view-p">(可上传与客户的聊天截图或其他重要图片资料,最多10张)</view>
  65. </view>
  66. <view class="list-view-upload clearfix">
  67. <view class="photo-item" v-for="(image, imageIndex) in remarksParams.imageList" :key="imageIndex">
  68. <image
  69. :src="image"
  70. mode="aspectFill"
  71. @click.stop="previewImg(remarksParams.imageList, imageIndex)"
  72. ></image>
  73. <text
  74. class="iconfont icon-iconfontguanbi"
  75. @click.stop="deletePhotoFn(remarksParams.imageList, imageIndex)"
  76. ></text>
  77. </view>
  78. <view
  79. class="photo-item add"
  80. @click.stop="uploadPhotoFn(remarksParams.imageList)"
  81. v-if="remarksParams.imageList.length < 10 || remarksParams.imageList.length == 0"
  82. >
  83. <text class="iconfont icon-jiahao"></text>
  84. </view>
  85. </view>
  86. <view class="list-view-title">
  87. <view class="list-view-h1">上传文件</view>
  88. <view class="list-view-p">(可上传与客户相关的文件资料,最多10份,支持word,excel,ppt和pdf格式文件)</view>
  89. </view>
  90. <view class="list-view" v-for="(file, fileIndex) in remarksParams.fileList" :key="fileIndex">
  91. <view class="list-view-text">
  92. <view class="input">{{ file.fileName }}</view>
  93. <view class="delbtn" @click.stop="deleteFileFn(remarksParams.fileList, fileIndex)">删除</view>
  94. </view>
  95. </view>
  96. <view class="list-view">
  97. <view class="list-view-file" @click="uploadFile(remarksParams.fileList)">选择文件</view>
  98. </view>
  99. </view>
  100. <view class="remarks-btn" :style="{ paddingBottom: isIphoneX ? '68rpx' : '34rpx' }">
  101. <view class="edit-button" @click="editButtonConfim">确定</view>
  102. </view>
  103. </view>
  104. </template>
  105. <script>
  106. import { mapState, mapMutations } from 'vuex'
  107. import authorize from '@/common/config/authorize.js'
  108. import { uploadFileImage, uploadFilePdfDocDocxXlsx } from '@/services/public.js'
  109. var isPreviewImg
  110. export default {
  111. data() {
  112. return {
  113. isIphoneX: this.$store.state.isIphoneX,
  114. shopOrderId: 0,
  115. logisticsBatchId: 0,
  116. productActions: [],
  117. remarksParams: {
  118. clubId: 0,
  119. questionMan: '',
  120. remarks: '',
  121. fileList: [],
  122. imageList: [],
  123. serviceProviderId: 0,
  124. consult:''
  125. },
  126. min: 0,
  127. max: 500,
  128. handleType: '',
  129. clubUserId: 0,
  130. clubInfo: {},
  131. userInfo: {},
  132. checkedCategorysList:[],
  133. categorys:[],
  134. isConfirmLoding:false
  135. }
  136. },
  137. onLoad(option) {
  138. console.log(option)
  139. if (option.type == 'edit') {
  140. this.getUserClubConsults()
  141. this.getUserClubRemarksDetail(option.remarksId)
  142. this.handleType = option.type
  143. uni.setNavigationBarTitle({ title: '修改记录' })
  144. } else {
  145. this.clubUserId = option.userId
  146. this.getCulbInfo()
  147. this.getUserClubConsults()
  148. }
  149. },
  150. methods: {
  151. ...mapMutations(['login']),
  152. getCulbInfo() {
  153. // 查询机构信息
  154. this.UserService.OrganizationUpdateModifyInfo({ userId: this.clubUserId })
  155. .then(response => {
  156. this.clubInfo = response.data.club
  157. this.userInfo = response.data.user
  158. this.remarksParams.clubId = this.clubInfo.clubId
  159. if(this.handleType != 'edit'){
  160. this.remarksParams.questionMan = this.clubInfo.linkMan
  161. }
  162. })
  163. .catch(error => {
  164. console.log('=============>', error.msg)
  165. })
  166. },
  167. getUserClubRemarksDetail(remarksId) {
  168. //修改回显资料备注信息
  169. this.UserService.getUserClubRemarksDetail({
  170. remarksId: remarksId
  171. })
  172. .then(response => {
  173. let data = response.data
  174. this.clubUserId = data.userId
  175. this.remarksParams.remarks = data.remarks.join(',')
  176. this.remarksParams.remarksId = data.remarksId
  177. this.remarksParams.fileList = data.fileList
  178. this.remarksParams.imageList = data.imageList
  179. if(this.handleType == 'edit'){
  180. this.remarksParams.questionMan = data.questionMan
  181. this.remarksParams.consult = data.consult
  182. this.checkedCategorysList = data.consult.split(',').map(i => parseInt(i, 0))
  183. this.categorys = this.categorys.map((el, index) => {
  184. if(data.consult.includes(el.id)){
  185. el.isChecked = true
  186. }else{
  187. el.isChecked = false
  188. }
  189. return el
  190. })
  191. }
  192. this.getCulbInfo()
  193. })
  194. .catch(error => {
  195. this.$util.msg(error.msg, 2000)
  196. })
  197. },
  198. getUserClubConsults() {
  199. //查询咨询类别
  200. this.UserService.getUserClubConsults()
  201. .then(response => {
  202. this.categorys = response.data.map((el, index) => {
  203. el.isChecked = false
  204. return el
  205. })
  206. })
  207. .catch(error => {
  208. console.log('=========>获取咨询类别列表失败')
  209. })
  210. },
  211. async editButtonConfim() {
  212. //保存资料备注
  213. if(this.isConfirmLoding){return}
  214. const userInfo = await this.$api.getStorage()
  215. if (this.remarksParams.questionMan == '') {
  216. this.$util.msg('请输入咨询人姓名', 2000)
  217. return
  218. }
  219. if (this.remarksParams.consult == '') {
  220. this.$util.msg('请选择咨询类别', 2000)
  221. return
  222. }
  223. if (this.remarksParams.remarks == '') {
  224. this.$util.msg('请输入关键词记录', 2000)
  225. return
  226. }
  227. this.remarksParams.serviceProviderId = userInfo.serviceProviderId ? userInfo.serviceProviderId : 0
  228. this.isConfirmLoding = true
  229. this.UserService.getUserClubRemarksSave({
  230. params: JSON.stringify(this.remarksParams)
  231. })
  232. .then(response => {
  233. this.$util.msg('保存成功', 3000, true, 'success')
  234. this.isConfirmLoding = false
  235. setTimeout(() => {
  236. uni.navigateBack({
  237. delta: 1
  238. })
  239. }, 1000)
  240. })
  241. .catch(error => {
  242. this.$util.msg(error.msg, 2000)
  243. this.isConfirmLoding = false
  244. })
  245. },
  246. choiceCategorys(category,index){
  247. // 选择类别
  248. category.isChecked = !category.isChecked
  249. if (category.isChecked) {
  250. if(!this.contains(this.checkedCategorysList,category.id)){
  251. this.checkedCategorysList.push(category.id)
  252. }
  253. } else {
  254. this.checkedCategorysList.splice(this.checkedCategorysList.indexOf(category.id),1)
  255. }
  256. this.remarksParams.consult = this.checkedCategorysList.join(',')
  257. },
  258. contains(arr, val) {// 校验
  259. return arr.some(item => item === val)
  260. },
  261. uploadFile(array) {
  262. //上传资质文件
  263. console.log(array)
  264. uploadFilePdfDocDocxXlsx()
  265. .then(res => {
  266. let data = JSON.parse(res.data).data
  267. let obj = {
  268. fileName: uni.getStorageSync('fileName'),
  269. ossName: data.ossName
  270. }
  271. array.push(obj)
  272. console.log('array', array)
  273. })
  274. .catch(err => {
  275. console.log(err)
  276. })
  277. },
  278. uploadPhotoFn(array) {
  279. //添加图片
  280. uploadFileImage().then(res => {
  281. array.push(JSON.parse(res.data).data)
  282. })
  283. },
  284. deleteFileFn(array, index) {
  285. console.log(array)
  286. //删除文件
  287. this.UploadService.PostFileDelete({
  288. ossName: array[index].ossName
  289. })
  290. .then(res => {
  291. array.splice(index, 1)
  292. })
  293. .catch(error => {
  294. console.log('删除文件异常提示===>', error.msg)
  295. })
  296. },
  297. deletePhotoFn(array, index) {
  298. //删除图片
  299. array.splice(index, 1)
  300. },
  301. previewImg(image, index) {
  302. //顶部商品图片预览
  303. isPreviewImg = true
  304. let previewUrls = image
  305. uni.previewImage({
  306. current: index, //图片索引
  307. urls: previewUrls, //必须是http图片,本地图片无效
  308. longPressActions: ''
  309. })
  310. },
  311. conInput(e) {
  312. //备注文字字数限制
  313. let value = e.detail.value
  314. let len = parseInt(value.length)
  315. if (len > this.max) return
  316. this.min = len
  317. if (this.min == 200) {
  318. this.$util.msg('您输入的字数已达上限', 2000)
  319. }
  320. },
  321. handleClickClunInfo() {
  322. //修改机构资料
  323. if (this.userInfo.userIdentity === 2) {
  324. this.$api.navigateTo(`/pages/seller/login/apply?userID=${this.userInfo.userId}`)
  325. } else if (this.userInfo.userIdentity === 4) {
  326. this.$api.navigateTo(`/pages/seller/login/information?userID=${this.userInfo.userId}`)
  327. }
  328. }
  329. },
  330. onShow() {}
  331. }
  332. </script>
  333. <style lang="scss">
  334. page {
  335. height: auto;
  336. background: #ffffff;
  337. }
  338. .remarks-content-club {
  339. width: 100%;
  340. height: 252rpx;
  341. padding: 24rpx;
  342. box-sizing: border-box;
  343. border-bottom: 20rpx solid #f7f7f7;
  344. .content-club-le {
  345. width: 660rpx;
  346. float: left;
  347. .club-le-text {
  348. width: 100%;
  349. height: 60rpx;
  350. line-height: 60rpx;
  351. font-size: $font-size-28;
  352. color: #333333;
  353. .label {
  354. color: #999999;
  355. &.phone {
  356. margin-left: 48rpx;
  357. }
  358. }
  359. }
  360. }
  361. .content-club-ri {
  362. width: 40rpx;
  363. height: 160rpx;
  364. float: right;
  365. line-height: 160rpx;
  366. text-align: center;
  367. color: #b2b2b2;
  368. }
  369. }
  370. .remarks-content {
  371. width: 100%;
  372. height: auto;
  373. box-sizing: border-box;
  374. padding: 0 24rpx;
  375. padding-bottom: 160rpx;
  376. .list-view-title {
  377. width: 100%;
  378. height: auto;
  379. margin-bottom: 16rpx;
  380. margin-top: 40rpx;
  381. .list-view-h1 {
  382. line-height: 40rpx;
  383. font-size: $font-size-28;
  384. color: #333333;
  385. text-align: left;
  386. text {
  387. color: #ff2a2a;
  388. }
  389. }
  390. .list-view-p {
  391. line-height: 30rpx;
  392. color: #fea785;
  393. font-size: $font-size-20;
  394. }
  395. }
  396. .remarks-category{
  397. width: 100%;
  398. float: left;
  399. .checkbox-list {
  400. height: 60rpx;
  401. font-size: $font-size-28;
  402. line-height: 60rpx;
  403. border-radius: 10rpx;
  404. margin-right: 20rpx;
  405. margin-bottom: 10rpx;
  406. box-sizing: border-box;
  407. float: left;
  408. .icon-yixuanze{
  409. margin-right: 10rpx;
  410. color: #E15616;
  411. }
  412. .icon-weixuanze{
  413. margin-right: 10rpx;
  414. color: #B2B2B2;
  415. }
  416. }
  417. .item-text {
  418. display: inline-block;
  419. font-size: 26rpx;
  420. color: #333333;
  421. border-radius: 28rpx;
  422. line-height: 50rpx;
  423. }
  424. }
  425. .remarks-input {
  426. width: 100%;
  427. height: 90rpx;
  428. padding: 0 16rpx;
  429. margin: 20rpx 0 0 0;
  430. border-radius: 6rpx;
  431. position: relative;
  432. border: 1px solid #b2b2b2;
  433. box-sizing: border-box;
  434. .input {
  435. width: 100%;
  436. height: 90rpx;
  437. line-height: 90rpx;
  438. font-size: $font-size-26;
  439. color: $text-color;
  440. z-index: 1;
  441. }
  442. }
  443. .remarks-textarea {
  444. width: 100%;
  445. height: 340rpx;
  446. padding: 16rpx;
  447. margin: 20rpx 0 0 0;
  448. border-radius: 6rpx;
  449. position: relative;
  450. border: 1px solid #b2b2b2;
  451. box-sizing: border-box;
  452. .textarea {
  453. width: 100%;
  454. height: 100%;
  455. line-height: 36rpx;
  456. font-size: $font-size-26;
  457. color: $text-color;
  458. z-index: 1;
  459. }
  460. .limit-text {
  461. position: absolute;
  462. right: 20rpx;
  463. bottom: 16rpx;
  464. line-height: 44rpx;
  465. font-size: $font-size-24;
  466. color: #b2b2b2;
  467. }
  468. }
  469. .list-view {
  470. width: 100%;
  471. height: 40rpx;
  472. margin-top: 20rpx;
  473. .list-view-file {
  474. width: 132rpx;
  475. height: 44rpx;
  476. line-height: 44rpx;
  477. font-size: $font-size-20;
  478. text-align: center;
  479. color: #ffffff;
  480. background-color: $color-system;
  481. border-radius: 8rpx;
  482. float: left;
  483. margin-top: 10rpx;
  484. }
  485. .list-view-text {
  486. width: 100%;
  487. float: left;
  488. .input {
  489. width: 560rpx;
  490. height: 44rpx;
  491. box-sizing: border-box;
  492. line-height: 44rpx;
  493. color: #333333;
  494. text-overflow: ellipsis;
  495. overflow: hidden;
  496. display: -webkit-box;
  497. -webkit-line-clamp: 1;
  498. line-clamp: 1;
  499. -webkit-box-orient: vertical;
  500. float: left;
  501. }
  502. .delbtn {
  503. width: 96rpx;
  504. height: 44rpx;
  505. border-radius: 8rpx;
  506. background-color: #fff2ec;
  507. font-size: $font-size-24;
  508. color: #e15616;
  509. line-height: 44rpx;
  510. text-align: center;
  511. float: left;
  512. }
  513. }
  514. }
  515. .list-view-upload {
  516. width: 100%;
  517. height: auto;
  518. .photo-item {
  519. display: inline-block;
  520. width: 112rpx;
  521. height: 112rpx;
  522. margin: 10rpx 0;
  523. margin-right: 25rpx;
  524. border-radius: 10rpx;
  525. border: 1px solid #f5f5f5;
  526. position: relative;
  527. float: left;
  528. &.add {
  529. width: 112rpx;
  530. height: 112rpx;
  531. border-color: #b2b2b2;
  532. text-align: center;
  533. line-height: 112rpx;
  534. margin-right: 0rpx;
  535. .icon-jiahao {
  536. font-size: $font-size-44;
  537. color: #b2b2b2;
  538. font-weight: bold;
  539. }
  540. }
  541. .icon-iconfontguanbi {
  542. width: 30rpx;
  543. height: 30rpx;
  544. border-radius: 50%;
  545. display: block;
  546. position: absolute;
  547. right: -10rpx;
  548. top: -10rpx;
  549. background: #f94b4b;
  550. text-align: center;
  551. line-height: 30rpx;
  552. color: #ffffff;
  553. font-size: $font-size-22;
  554. }
  555. image {
  556. width: 112rpx;
  557. height: 112rpx;
  558. border-radius: 10rpx;
  559. }
  560. }
  561. .photo-list {
  562. width: 100%;
  563. height: 116rpx;
  564. overflow: hidden;
  565. white-space: nowrap;
  566. display: flex;
  567. align-items: flex-start;
  568. }
  569. }
  570. }
  571. .remarks-btn {
  572. width: 100%;
  573. padding-top: 20rpx;
  574. position: fixed;
  575. bottom: 0;
  576. left: 0;
  577. background-color: #ffffff;
  578. .edit-button-canel {
  579. width: 100%;
  580. height: 88rpx;
  581. line-height: 88rpx;
  582. text-align: center;
  583. color: #e15616;
  584. font-size: $font-size-24;
  585. }
  586. .edit-button {
  587. width: 600rpx;
  588. height: 90rpx;
  589. background: $btn-confirm;
  590. line-height: 90rpx;
  591. text-align: center;
  592. color: #ffffff;
  593. font-size: $font-size-30;
  594. margin: 0 auto;
  595. border-radius: 45rpx;
  596. }
  597. }
  598. </style>