add-record.vue 12 KB

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