add-record.vue 9.7 KB

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