add.vue 12 KB

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