add-record.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  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.checked ? 'checked' : ''"
  15. v-for="(category, index) in categorys"
  16. :key="index"
  17. @click="choiceCategorys(category, index)"
  18. >
  19. <text class="iconfont" :class="category.checked ? 'icon-yixuanze' : 'icon-weixuanze'"></text>
  20. {{ category.name }}
  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. {value: '1',value: '1',name:'产品',checked:false},
  109. {value: '2',name:'仪器',checked:false},
  110. {value: '3',name:'耗材',checked:false},
  111. {value: '4',name:'超级会员',checked:false},
  112. {value: '5',name:'机构会员',checked:false},
  113. {value: '6',name:'其他',checked:false},
  114. ]
  115. }
  116. },
  117. onLoad(option) {
  118. console.log(option)
  119. if (option.type == 'edit') {
  120. this.questionMan = option.questionMan
  121. this.handleType = option.type
  122. this.getUserRemarksVisitDetail(option.remarksId)
  123. uni.setNavigationBarTitle({title:'修改记录'})
  124. } else {
  125. this.questionMan = option.questionMan
  126. this.remarksParams.questionManId = option.questionManId
  127. this.initGetStotage(option)
  128. }
  129. },
  130. methods: {
  131. ...mapMutations(['login']),
  132. async initGetStotage(option) {
  133. const userInfo = await this.$api.getStorage()
  134. this.remarksParams.serviceProviderId = userInfo.serviceProviderId ? userInfo.serviceProviderId : 0
  135. },
  136. getUserRemarksVisitDetail(remarksId) {
  137. //修改回显资料备注信息
  138. this.UserService.getUserRemarksVisitDetail({
  139. remarksId : remarksId
  140. })
  141. .then(response => {
  142. let data = response.data
  143. this.remarksParams.questionManId = data.questionManId
  144. this.remarksParams.remarks = data.remarks.join(',')
  145. this.remarksParams.remarksId = data.remarksId
  146. this.remarksParams.fileList = data.fileList
  147. this.remarksParams.imageList = data.imageList
  148. this.initGetStotage()
  149. })
  150. .catch(error => {
  151. this.$util.msg(error.msg, 2000)
  152. })
  153. },
  154. editButtonConfim() {
  155. //保存资料备注
  156. if (this.remarksParams.remarks == '') {
  157. this.$util.msg('请输入关键词记录', 2000)
  158. return
  159. }
  160. this.UserService.getUserClubVisitorSaveAdd({
  161. params: JSON.stringify(this.remarksParams)
  162. })
  163. .then(response => {
  164. this.$util.msg('添加成功', 2000, true, 'success')
  165. let VisitorInfo = {
  166. questionManId: this.remarksParams.questionManId,
  167. questionMan: this.questionMan
  168. }
  169. this.$api.setStorage('VisitorInfo', VisitorInfo)
  170. setTimeout(() => {
  171. this.$api.redirectTo('/pages/seller/remarks/record-list')
  172. }, 2000)
  173. })
  174. .catch(error => {
  175. this.$util.msg(error.msg, 2000)
  176. })
  177. },
  178. choiceCategorys(category,index){
  179. // 选择类别
  180. category.checked = !category.checked
  181. if (category.checked) {
  182. this.checkedCategorysList.push(category.value)
  183. } else {
  184. this.checkedCategorysList.splice(index, 1)
  185. }
  186. console.log('checkedBrandList', this.checkedCategorysList)
  187. // this.listQuery.brandIds = this.checkedBrandList.join(',')
  188. // console.log('this.listQuery.brandIds', this.listQuery.brandIds)
  189. },
  190. uploadFile(array) {
  191. //上传资质文件
  192. console.log(array)
  193. uploadFilePdfDocDocxXlsx().then(res => {
  194. let data = JSON.parse(res.data).data
  195. let obj = {
  196. fileName: uni.getStorageSync('fileName'),
  197. ossName: data.ossName
  198. }
  199. array.push(obj)
  200. console.log('array', array)
  201. }).catch(err=>{
  202. console.log(err)
  203. })
  204. },
  205. uploadPhotoFn(array) {
  206. //添加图片
  207. uploadFileImage().then(res => {
  208. array.push(JSON.parse(res.data).data)
  209. })
  210. },
  211. deleteFileFn(array, index) {
  212. console.log(array)
  213. //删除文件
  214. this.UploadService.PostFileDelete({
  215. ossName: array[index].ossName
  216. })
  217. .then(res => {
  218. array.splice(index, 1)
  219. })
  220. .catch(error => {
  221. console.log('删除文件异常提示===>', error.msg)
  222. })
  223. },
  224. deletePhotoFn(array, index) {
  225. //删除图片
  226. array.splice(index, 1)
  227. },
  228. previewImg(image, index) {
  229. //顶部商品图片预览
  230. isPreviewImg = true
  231. let previewUrls = image
  232. uni.previewImage({
  233. current: index, //图片索引
  234. urls: previewUrls, //必须是http图片,本地图片无效
  235. longPressActions: ''
  236. })
  237. },
  238. conInput(e) {
  239. //备注文字字数限制
  240. let value = e.detail.value
  241. let len = parseInt(value.length)
  242. if (len > this.max) return
  243. this.min = len
  244. if (this.min == 200) {
  245. this.$util.msg('您输入的字数已达上限', 2000)
  246. }
  247. },
  248. },
  249. onShow() {}
  250. }
  251. </script>
  252. <style lang="scss">
  253. page {
  254. height: auto;
  255. background: #ffffff;
  256. }
  257. .remarks-content {
  258. width: 100%;
  259. height: auto;
  260. box-sizing: border-box;
  261. padding: 0 24rpx;
  262. padding-bottom: 160rpx;
  263. .list-view-title {
  264. width: 100%;
  265. height: auto;
  266. margin-bottom: 16rpx;
  267. margin-top: 20rpx;
  268. .list-view-h1 {
  269. line-height: 40rpx;
  270. font-size: $font-size-28;
  271. color: #333333;
  272. text-align: left;
  273. text {
  274. color: #ff2a2a;
  275. }
  276. }
  277. .list-view-p {
  278. line-height: 30rpx;
  279. color: #fea785;
  280. font-size: $font-size-20;
  281. }
  282. }
  283. .remarks-category{
  284. width: 100%;
  285. display: flex;
  286. flex-flow: row wrap;
  287. justify-content: space-between;
  288. align-items: center;
  289. .checkbox-list {
  290. height: 60rpx;
  291. font-size: $font-size-28;
  292. line-height: 60rpx;
  293. border-radius: 10rpx;
  294. margin-right: 20rpx;
  295. margin-bottom: 10rpx;
  296. box-sizing: border-box;
  297. float: left;
  298. .icon-yixuanze{
  299. margin-right: 10rpx;
  300. color: #E15616;
  301. }
  302. .icon-weixuanze{
  303. margin-right: 10rpx;
  304. color: #B2B2B2;
  305. }
  306. }
  307. .item-text {
  308. display: inline-block;
  309. font-size: 26rpx;
  310. color: #333333;
  311. border-radius: 28rpx;
  312. line-height: 50rpx;
  313. }
  314. }
  315. .remarks-input{
  316. width: 100%;
  317. height: 48rpx;
  318. padding:0 16rpx;
  319. margin: 20rpx 0 0 0;
  320. position: relative;
  321. box-sizing: border-box;
  322. line-height: 48rpx;
  323. font-size: $font-size-26;
  324. color: $text-color;
  325. }
  326. .remarks-textarea {
  327. width: 100%;
  328. height: 340rpx;
  329. padding: 16rpx;
  330. margin: 20rpx 0 0 0;
  331. border-radius: 6rpx;
  332. position: relative;
  333. border: 1px solid #b2b2b2;
  334. box-sizing: border-box;
  335. .textarea {
  336. width: 100%;
  337. height: 100%;
  338. line-height: 36rpx;
  339. font-size: $font-size-26;
  340. color: $text-color;
  341. z-index: 1;
  342. }
  343. .limit-text {
  344. position: absolute;
  345. right: 20rpx;
  346. bottom: 16rpx;
  347. line-height: 44rpx;
  348. font-size: $font-size-24;
  349. color: #b2b2b2;
  350. }
  351. }
  352. .list-view {
  353. width: 100%;
  354. height: 40rpx;
  355. margin-top: 20rpx;
  356. .list-view-file {
  357. width: 132rpx;
  358. height: 44rpx;
  359. line-height: 44rpx;
  360. font-size: $font-size-20;
  361. text-align: center;
  362. color: #ffffff;
  363. background-color: $color-system;
  364. border-radius: 8rpx;
  365. float: left;
  366. margin-top: 10rpx;
  367. }
  368. .list-view-text {
  369. width: 100%;
  370. float: left;
  371. .input {
  372. width: 560rpx;
  373. height: 44rpx;
  374. box-sizing: border-box;
  375. line-height: 44rpx;
  376. color: #333333;
  377. text-overflow: ellipsis;
  378. overflow: hidden;
  379. display: -webkit-box;
  380. -webkit-line-clamp: 1;
  381. line-clamp: 1;
  382. -webkit-box-orient: vertical;
  383. float: left;
  384. }
  385. .delbtn {
  386. width: 96rpx;
  387. height: 44rpx;
  388. border-radius: 8rpx;
  389. background-color: #fff2ec;
  390. font-size: $font-size-24;
  391. color: #e15616;
  392. line-height: 44rpx;
  393. text-align: center;
  394. float: left;
  395. }
  396. }
  397. }
  398. .list-view-upload {
  399. width: 100%;
  400. height: auto;
  401. .photo-item {
  402. display: inline-block;
  403. width: 112rpx;
  404. height: 112rpx;
  405. margin: 10rpx 0;
  406. margin-right: 25rpx;
  407. border-radius: 10rpx;
  408. border: 1px solid #f5f5f5;
  409. position: relative;
  410. float: left;
  411. &.add {
  412. width: 112rpx;
  413. height: 112rpx;
  414. border-color: #b2b2b2;
  415. text-align: center;
  416. line-height: 112rpx;
  417. margin-right: 0rpx;
  418. .icon-jiahao {
  419. font-size: $font-size-44;
  420. color: #b2b2b2;
  421. font-weight: bold;
  422. }
  423. }
  424. .icon-iconfontguanbi {
  425. width: 30rpx;
  426. height: 30rpx;
  427. border-radius: 50%;
  428. display: block;
  429. position: absolute;
  430. right: -10rpx;
  431. top: -10rpx;
  432. background: #f94b4b;
  433. text-align: center;
  434. line-height: 30rpx;
  435. color: #ffffff;
  436. font-size: $font-size-22;
  437. }
  438. image {
  439. width: 112rpx;
  440. height: 112rpx;
  441. border-radius: 10rpx;
  442. }
  443. }
  444. .photo-list {
  445. width: 100%;
  446. height: 116rpx;
  447. overflow: hidden;
  448. white-space: nowrap;
  449. display: flex;
  450. align-items: flex-start;
  451. }
  452. }
  453. }
  454. .remarks-btn {
  455. width: 100%;
  456. padding-top: 20rpx;
  457. position: fixed;
  458. bottom: 0;
  459. left: 0;
  460. background-color: #ffffff;
  461. .edit-button-canel {
  462. width: 100%;
  463. height: 88rpx;
  464. line-height: 88rpx;
  465. text-align: center;
  466. color: #e15616;
  467. font-size: $font-size-24;
  468. }
  469. .edit-button {
  470. width: 600rpx;
  471. height: 90rpx;
  472. background: $btn-confirm;
  473. line-height: 90rpx;
  474. text-align: center;
  475. color: #ffffff;
  476. font-size: $font-size-30;
  477. margin: 0 auto;
  478. border-radius: 45rpx;
  479. }
  480. }
  481. </style>