add.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  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
  158. this.remarksParams.remarksId = data.remarksId
  159. console.log('00000000000')
  160. this.remarksParams.fileList = data.fileList
  161. console.log('11111111111111')
  162. this.remarksParams.imageList = data.imageList
  163. console.log('2222222222222')
  164. this.initGetStotage()
  165. })
  166. .catch(error => {
  167. this.$util.msg(error.msg, 2000)
  168. })
  169. },
  170. editButtonConfim() {
  171. //保存资料备注
  172. if (this.remarksParams.remarks == '') {
  173. this.$util.msg('请输入文字备注', 2000)
  174. return
  175. }
  176. this.UserService.getUserClubRemarksSave({
  177. params: JSON.stringify(this.remarksParams)
  178. })
  179. .then(response => {
  180. this.$util.msg('添加成功', 3000, true, 'success')
  181. setTimeout(() => {
  182. uni.navigateBack({ delta: 1 })
  183. }, 1000)
  184. })
  185. .catch(error => {
  186. this.$util.msg(error.msg, 2000)
  187. })
  188. },
  189. uploadFile(array) {
  190. //上传资质文件
  191. console.log(array)
  192. uploadFilePdfDocDocxXlsx()
  193. .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. })
  202. .catch(err => {
  203. console.log(err)
  204. })
  205. },
  206. uploadPhotoFn(array) {
  207. //添加图片
  208. uploadFileImage().then(res => {
  209. array.push(JSON.parse(res.data).data)
  210. })
  211. },
  212. deleteFileFn(array, index) {
  213. console.log(array)
  214. //删除文件
  215. this.UploadService.PostFileDelete({
  216. ossName: array[index].ossName
  217. })
  218. .then(res => {
  219. array.splice(index, 1)
  220. })
  221. .catch(error => {
  222. console.log('删除文件异常提示===>', error.msg)
  223. })
  224. },
  225. deletePhotoFn(array, index) {
  226. //删除图片
  227. array.splice(index, 1)
  228. },
  229. previewImg(image, index) {
  230. //顶部商品图片预览
  231. isPreviewImg = true
  232. let previewUrls = image
  233. uni.previewImage({
  234. current: index, //图片索引
  235. urls: previewUrls, //必须是http图片,本地图片无效
  236. longPressActions: ''
  237. })
  238. },
  239. conInput(e) {
  240. //备注文字字数限制
  241. let value = e.detail.value
  242. let len = parseInt(value.length)
  243. if (len > this.max) return
  244. this.min = len
  245. if (this.min == 200) {
  246. this.$util.msg('您输入的字数已达上限', 2000)
  247. }
  248. },
  249. handleClickClunInfo() {
  250. //修改机构资料
  251. if (this.userInfo.userIdentity === 2) {
  252. this.$api.navigateTo(`/pages/seller/login/apply?userID=${this.userInfo.userId}`)
  253. } else if (this.userInfo.userIdentity === 4) {
  254. this.$api.navigateTo(`/pages/seller/login/information?userID=${this.userInfo.userId}`)
  255. }
  256. }
  257. },
  258. onShow() {}
  259. }
  260. </script>
  261. <style lang="scss">
  262. page {
  263. height: auto;
  264. background: #ffffff;
  265. }
  266. .remarks-content-club {
  267. width: 100%;
  268. height: 252rpx;
  269. padding: 24rpx;
  270. box-sizing: border-box;
  271. border-bottom: 20rpx solid #f7f7f7;
  272. .content-club-le {
  273. width: 660rpx;
  274. float: left;
  275. .club-le-text {
  276. width: 100%;
  277. height: 60rpx;
  278. line-height: 60rpx;
  279. font-size: $font-size-28;
  280. color: #333333;
  281. .label {
  282. color: #999999;
  283. &.phone {
  284. margin-left: 48rpx;
  285. }
  286. }
  287. }
  288. }
  289. .content-club-ri {
  290. width: 40rpx;
  291. height: 160rpx;
  292. float: right;
  293. line-height: 160rpx;
  294. text-align: center;
  295. color: #b2b2b2;
  296. }
  297. }
  298. .remarks-content {
  299. width: 100%;
  300. height: auto;
  301. box-sizing: border-box;
  302. padding: 0 24rpx;
  303. padding-bottom: 160rpx;
  304. .list-view-title {
  305. width: 100%;
  306. height: auto;
  307. margin-bottom: 16rpx;
  308. margin-top: 40rpx;
  309. .list-view-h1 {
  310. line-height: 40rpx;
  311. font-size: $font-size-28;
  312. color: #333333;
  313. text-align: left;
  314. text {
  315. color: #ff2a2a;
  316. }
  317. }
  318. .list-view-p {
  319. line-height: 30rpx;
  320. color: #fea785;
  321. font-size: $font-size-20;
  322. }
  323. }
  324. .remarks-input {
  325. width: 100%;
  326. height: 90rpx;
  327. padding: 0 16rpx;
  328. margin: 20rpx 0 0 0;
  329. border-radius: 6rpx;
  330. position: relative;
  331. border: 1px solid #b2b2b2;
  332. box-sizing: border-box;
  333. .input {
  334. width: 100%;
  335. height: 90rpx;
  336. line-height: 90rpx;
  337. font-size: $font-size-26;
  338. color: $text-color;
  339. z-index: 1;
  340. }
  341. }
  342. .remarks-textarea {
  343. width: 100%;
  344. height: 340rpx;
  345. padding: 16rpx;
  346. margin: 20rpx 0 0 0;
  347. border-radius: 6rpx;
  348. position: relative;
  349. border: 1px solid #b2b2b2;
  350. box-sizing: border-box;
  351. .textarea {
  352. width: 100%;
  353. height: 100%;
  354. line-height: 36rpx;
  355. font-size: $font-size-26;
  356. color: $text-color;
  357. z-index: 1;
  358. }
  359. .limit-text {
  360. position: absolute;
  361. right: 20rpx;
  362. bottom: 16rpx;
  363. line-height: 44rpx;
  364. font-size: $font-size-24;
  365. color: #b2b2b2;
  366. }
  367. }
  368. .list-view {
  369. width: 100%;
  370. height: 40rpx;
  371. margin-top: 20rpx;
  372. .list-view-file {
  373. width: 132rpx;
  374. height: 44rpx;
  375. line-height: 44rpx;
  376. font-size: $font-size-20;
  377. text-align: center;
  378. color: #ffffff;
  379. background-color: $color-system;
  380. border-radius: 8rpx;
  381. float: left;
  382. margin-top: 10rpx;
  383. }
  384. .list-view-text {
  385. width: 100%;
  386. float: left;
  387. .input {
  388. width: 560rpx;
  389. height: 44rpx;
  390. box-sizing: border-box;
  391. line-height: 44rpx;
  392. color: #333333;
  393. text-overflow: ellipsis;
  394. overflow: hidden;
  395. display: -webkit-box;
  396. -webkit-line-clamp: 1;
  397. line-clamp: 1;
  398. -webkit-box-orient: vertical;
  399. float: left;
  400. }
  401. .delbtn {
  402. width: 96rpx;
  403. height: 44rpx;
  404. border-radius: 8rpx;
  405. background-color: #fff2ec;
  406. font-size: $font-size-24;
  407. color: #e15616;
  408. line-height: 44rpx;
  409. text-align: center;
  410. float: left;
  411. }
  412. }
  413. }
  414. .list-view-upload {
  415. width: 100%;
  416. height: auto;
  417. .photo-item {
  418. display: inline-block;
  419. width: 112rpx;
  420. height: 112rpx;
  421. margin: 10rpx 0;
  422. margin-right: 25rpx;
  423. border-radius: 10rpx;
  424. border: 1px solid #f5f5f5;
  425. position: relative;
  426. float: left;
  427. &.add {
  428. width: 112rpx;
  429. height: 112rpx;
  430. border-color: #b2b2b2;
  431. text-align: center;
  432. line-height: 112rpx;
  433. margin-right: 0rpx;
  434. .icon-jiahao {
  435. font-size: $font-size-44;
  436. color: #b2b2b2;
  437. font-weight: bold;
  438. }
  439. }
  440. .icon-iconfontguanbi {
  441. width: 30rpx;
  442. height: 30rpx;
  443. border-radius: 50%;
  444. display: block;
  445. position: absolute;
  446. right: -10rpx;
  447. top: -10rpx;
  448. background: #f94b4b;
  449. text-align: center;
  450. line-height: 30rpx;
  451. color: #ffffff;
  452. font-size: $font-size-22;
  453. }
  454. image {
  455. width: 112rpx;
  456. height: 112rpx;
  457. border-radius: 10rpx;
  458. }
  459. }
  460. .photo-list {
  461. width: 100%;
  462. height: 116rpx;
  463. overflow: hidden;
  464. white-space: nowrap;
  465. display: flex;
  466. align-items: flex-start;
  467. }
  468. }
  469. }
  470. .remarks-btn {
  471. width: 100%;
  472. padding-top: 20rpx;
  473. position: fixed;
  474. bottom: 0;
  475. left: 0;
  476. background-color: #ffffff;
  477. .edit-button-canel {
  478. width: 100%;
  479. height: 88rpx;
  480. line-height: 88rpx;
  481. text-align: center;
  482. color: #e15616;
  483. font-size: $font-size-24;
  484. }
  485. .edit-button {
  486. width: 600rpx;
  487. height: 90rpx;
  488. background: $btn-confirm;
  489. line-height: 90rpx;
  490. text-align: center;
  491. color: #ffffff;
  492. font-size: $font-size-30;
  493. margin: 0 auto;
  494. border-radius: 45rpx;
  495. }
  496. }
  497. </style>