add.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  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. }
  135. },
  136. onLoad(option) {
  137. console.log(option)
  138. if (option.type == 'edit') {
  139. this.getUserClubConsults()
  140. this.getUserClubRemarksDetail(option.remarksId)
  141. this.handleType = option.type
  142. uni.setNavigationBarTitle({ title: '修改记录' })
  143. } else {
  144. this.clubUserId = option.userId
  145. this.getCulbInfo()
  146. this.getUserClubConsults()
  147. }
  148. },
  149. methods: {
  150. ...mapMutations(['login']),
  151. getCulbInfo() {
  152. // 查询机构信息
  153. this.UserService.OrganizationUpdateModifyInfo({ userId: this.clubUserId })
  154. .then(response => {
  155. this.clubInfo = response.data.club
  156. this.userInfo = response.data.user
  157. this.remarksParams.clubId = this.clubInfo.clubId
  158. if(this.handleType != 'edit'){
  159. this.remarksParams.questionMan = this.clubInfo.linkMan
  160. }
  161. })
  162. .catch(error => {
  163. console.log('=============>', error.msg)
  164. })
  165. },
  166. getUserClubRemarksDetail(remarksId) {
  167. //修改回显资料备注信息
  168. this.UserService.getUserClubRemarksDetail({
  169. remarksId: remarksId
  170. })
  171. .then(response => {
  172. let data = response.data
  173. this.clubUserId = data.userId
  174. this.remarksParams.remarks = data.remarks.join(',')
  175. this.remarksParams.remarksId = data.remarksId
  176. this.remarksParams.fileList = data.fileList
  177. this.remarksParams.imageList = data.imageList
  178. if(this.handleType == 'edit'){
  179. this.remarksParams.questionMan = data.questionMan
  180. this.checkedCategorysList = data.consult.split(',')
  181. this.categorys = this.categorys.map((el, index) => {
  182. if(data.consult.includes(el.id)){
  183. el.isChecked = true
  184. }else{
  185. el.isChecked = false
  186. }
  187. return el
  188. })
  189. }
  190. this.getCulbInfo()
  191. })
  192. .catch(error => {
  193. this.$util.msg(error.msg, 2000)
  194. })
  195. },
  196. getUserClubConsults() {
  197. //查询咨询类别
  198. this.UserService.getUserClubConsults()
  199. .then(response => {
  200. this.categorys = response.data.map((el, index) => {
  201. el.isChecked = false
  202. return el
  203. })
  204. })
  205. .catch(error => {
  206. console.log('=========>获取咨询类别列表失败')
  207. })
  208. },
  209. async editButtonConfim() {
  210. //保存资料备注
  211. const userInfo = await this.$api.getStorage()
  212. if (this.remarksParams.questionMan == '') {
  213. this.$util.msg('请输入咨询人姓名', 2000)
  214. return
  215. }
  216. if (this.remarksParams.remarks == '') {
  217. this.$util.msg('请输入关键词记录', 2000)
  218. return
  219. }
  220. this.remarksParams.serviceProviderId = userInfo.serviceProviderId ? userInfo.serviceProviderId : 0
  221. this.UserService.getUserClubRemarksSave({
  222. params: JSON.stringify(this.remarksParams)
  223. })
  224. .then(response => {
  225. this.$util.msg('添加成功', 3000, true, 'success')
  226. setTimeout(() => {
  227. uni.navigateBack({ delta: 1 })
  228. }, 1000)
  229. })
  230. .catch(error => {
  231. this.$util.msg(error.msg, 2000)
  232. })
  233. },
  234. choiceCategorys(category,index){
  235. // 选择类别
  236. category.isChecked = !category.isChecked
  237. if (category.isChecked) {
  238. this.checkedCategorysList.push(category.id)
  239. } else {
  240. this.checkedCategorysList.splice(index, 1)
  241. }
  242. this.remarksParams.consult = this.checkedCategorysList.join(',')
  243. console.log('this.remarksParams.consult', this.remarksParams.consult)
  244. },
  245. uploadFile(array) {
  246. //上传资质文件
  247. console.log(array)
  248. uploadFilePdfDocDocxXlsx()
  249. .then(res => {
  250. let data = JSON.parse(res.data).data
  251. let obj = {
  252. fileName: uni.getStorageSync('fileName'),
  253. ossName: data.ossName
  254. }
  255. array.push(obj)
  256. console.log('array', array)
  257. })
  258. .catch(err => {
  259. console.log(err)
  260. })
  261. },
  262. uploadPhotoFn(array) {
  263. //添加图片
  264. uploadFileImage().then(res => {
  265. array.push(JSON.parse(res.data).data)
  266. })
  267. },
  268. deleteFileFn(array, index) {
  269. console.log(array)
  270. //删除文件
  271. this.UploadService.PostFileDelete({
  272. ossName: array[index].ossName
  273. })
  274. .then(res => {
  275. array.splice(index, 1)
  276. })
  277. .catch(error => {
  278. console.log('删除文件异常提示===>', error.msg)
  279. })
  280. },
  281. deletePhotoFn(array, index) {
  282. //删除图片
  283. array.splice(index, 1)
  284. },
  285. previewImg(image, index) {
  286. //顶部商品图片预览
  287. isPreviewImg = true
  288. let previewUrls = image
  289. uni.previewImage({
  290. current: index, //图片索引
  291. urls: previewUrls, //必须是http图片,本地图片无效
  292. longPressActions: ''
  293. })
  294. },
  295. conInput(e) {
  296. //备注文字字数限制
  297. let value = e.detail.value
  298. let len = parseInt(value.length)
  299. if (len > this.max) return
  300. this.min = len
  301. if (this.min == 200) {
  302. this.$util.msg('您输入的字数已达上限', 2000)
  303. }
  304. },
  305. handleClickClunInfo() {
  306. //修改机构资料
  307. if (this.userInfo.userIdentity === 2) {
  308. this.$api.navigateTo(`/pages/seller/login/apply?userID=${this.userInfo.userId}`)
  309. } else if (this.userInfo.userIdentity === 4) {
  310. this.$api.navigateTo(`/pages/seller/login/information?userID=${this.userInfo.userId}`)
  311. }
  312. }
  313. },
  314. onShow() {}
  315. }
  316. </script>
  317. <style lang="scss">
  318. page {
  319. height: auto;
  320. background: #ffffff;
  321. }
  322. .remarks-content-club {
  323. width: 100%;
  324. height: 252rpx;
  325. padding: 24rpx;
  326. box-sizing: border-box;
  327. border-bottom: 20rpx solid #f7f7f7;
  328. .content-club-le {
  329. width: 660rpx;
  330. float: left;
  331. .club-le-text {
  332. width: 100%;
  333. height: 60rpx;
  334. line-height: 60rpx;
  335. font-size: $font-size-28;
  336. color: #333333;
  337. .label {
  338. color: #999999;
  339. &.phone {
  340. margin-left: 48rpx;
  341. }
  342. }
  343. }
  344. }
  345. .content-club-ri {
  346. width: 40rpx;
  347. height: 160rpx;
  348. float: right;
  349. line-height: 160rpx;
  350. text-align: center;
  351. color: #b2b2b2;
  352. }
  353. }
  354. .remarks-content {
  355. width: 100%;
  356. height: auto;
  357. box-sizing: border-box;
  358. padding: 0 24rpx;
  359. padding-bottom: 160rpx;
  360. .list-view-title {
  361. width: 100%;
  362. height: auto;
  363. margin-bottom: 16rpx;
  364. margin-top: 40rpx;
  365. .list-view-h1 {
  366. line-height: 40rpx;
  367. font-size: $font-size-28;
  368. color: #333333;
  369. text-align: left;
  370. text {
  371. color: #ff2a2a;
  372. }
  373. }
  374. .list-view-p {
  375. line-height: 30rpx;
  376. color: #fea785;
  377. font-size: $font-size-20;
  378. }
  379. }
  380. .remarks-category{
  381. width: 100%;
  382. float: left;
  383. .checkbox-list {
  384. height: 60rpx;
  385. font-size: $font-size-28;
  386. line-height: 60rpx;
  387. border-radius: 10rpx;
  388. margin-right: 20rpx;
  389. margin-bottom: 10rpx;
  390. box-sizing: border-box;
  391. float: left;
  392. .icon-yixuanze{
  393. margin-right: 10rpx;
  394. color: #E15616;
  395. }
  396. .icon-weixuanze{
  397. margin-right: 10rpx;
  398. color: #B2B2B2;
  399. }
  400. }
  401. .item-text {
  402. display: inline-block;
  403. font-size: 26rpx;
  404. color: #333333;
  405. border-radius: 28rpx;
  406. line-height: 50rpx;
  407. }
  408. }
  409. .remarks-input {
  410. width: 100%;
  411. height: 90rpx;
  412. padding: 0 16rpx;
  413. margin: 20rpx 0 0 0;
  414. border-radius: 6rpx;
  415. position: relative;
  416. border: 1px solid #b2b2b2;
  417. box-sizing: border-box;
  418. .input {
  419. width: 100%;
  420. height: 90rpx;
  421. line-height: 90rpx;
  422. font-size: $font-size-26;
  423. color: $text-color;
  424. z-index: 1;
  425. }
  426. }
  427. .remarks-textarea {
  428. width: 100%;
  429. height: 340rpx;
  430. padding: 16rpx;
  431. margin: 20rpx 0 0 0;
  432. border-radius: 6rpx;
  433. position: relative;
  434. border: 1px solid #b2b2b2;
  435. box-sizing: border-box;
  436. .textarea {
  437. width: 100%;
  438. height: 100%;
  439. line-height: 36rpx;
  440. font-size: $font-size-26;
  441. color: $text-color;
  442. z-index: 1;
  443. }
  444. .limit-text {
  445. position: absolute;
  446. right: 20rpx;
  447. bottom: 16rpx;
  448. line-height: 44rpx;
  449. font-size: $font-size-24;
  450. color: #b2b2b2;
  451. }
  452. }
  453. .list-view {
  454. width: 100%;
  455. height: 40rpx;
  456. margin-top: 20rpx;
  457. .list-view-file {
  458. width: 132rpx;
  459. height: 44rpx;
  460. line-height: 44rpx;
  461. font-size: $font-size-20;
  462. text-align: center;
  463. color: #ffffff;
  464. background-color: $color-system;
  465. border-radius: 8rpx;
  466. float: left;
  467. margin-top: 10rpx;
  468. }
  469. .list-view-text {
  470. width: 100%;
  471. float: left;
  472. .input {
  473. width: 560rpx;
  474. height: 44rpx;
  475. box-sizing: border-box;
  476. line-height: 44rpx;
  477. color: #333333;
  478. text-overflow: ellipsis;
  479. overflow: hidden;
  480. display: -webkit-box;
  481. -webkit-line-clamp: 1;
  482. line-clamp: 1;
  483. -webkit-box-orient: vertical;
  484. float: left;
  485. }
  486. .delbtn {
  487. width: 96rpx;
  488. height: 44rpx;
  489. border-radius: 8rpx;
  490. background-color: #fff2ec;
  491. font-size: $font-size-24;
  492. color: #e15616;
  493. line-height: 44rpx;
  494. text-align: center;
  495. float: left;
  496. }
  497. }
  498. }
  499. .list-view-upload {
  500. width: 100%;
  501. height: auto;
  502. .photo-item {
  503. display: inline-block;
  504. width: 112rpx;
  505. height: 112rpx;
  506. margin: 10rpx 0;
  507. margin-right: 25rpx;
  508. border-radius: 10rpx;
  509. border: 1px solid #f5f5f5;
  510. position: relative;
  511. float: left;
  512. &.add {
  513. width: 112rpx;
  514. height: 112rpx;
  515. border-color: #b2b2b2;
  516. text-align: center;
  517. line-height: 112rpx;
  518. margin-right: 0rpx;
  519. .icon-jiahao {
  520. font-size: $font-size-44;
  521. color: #b2b2b2;
  522. font-weight: bold;
  523. }
  524. }
  525. .icon-iconfontguanbi {
  526. width: 30rpx;
  527. height: 30rpx;
  528. border-radius: 50%;
  529. display: block;
  530. position: absolute;
  531. right: -10rpx;
  532. top: -10rpx;
  533. background: #f94b4b;
  534. text-align: center;
  535. line-height: 30rpx;
  536. color: #ffffff;
  537. font-size: $font-size-22;
  538. }
  539. image {
  540. width: 112rpx;
  541. height: 112rpx;
  542. border-radius: 10rpx;
  543. }
  544. }
  545. .photo-list {
  546. width: 100%;
  547. height: 116rpx;
  548. overflow: hidden;
  549. white-space: nowrap;
  550. display: flex;
  551. align-items: flex-start;
  552. }
  553. }
  554. }
  555. .remarks-btn {
  556. width: 100%;
  557. padding-top: 20rpx;
  558. position: fixed;
  559. bottom: 0;
  560. left: 0;
  561. background-color: #ffffff;
  562. .edit-button-canel {
  563. width: 100%;
  564. height: 88rpx;
  565. line-height: 88rpx;
  566. text-align: center;
  567. color: #e15616;
  568. font-size: $font-size-24;
  569. }
  570. .edit-button {
  571. width: 600rpx;
  572. height: 90rpx;
  573. background: $btn-confirm;
  574. line-height: 90rpx;
  575. text-align: center;
  576. color: #ffffff;
  577. font-size: $font-size-30;
  578. margin: 0 auto;
  579. border-radius: 45rpx;
  580. }
  581. }
  582. </style>