add.vue 14 KB

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