add.vue 12 KB

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