add-record.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  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="500"
  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: 500,
  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.questionManId = data.questionManId
  120. this.remarksParams.remarks = data.remarks.join(',')
  121. this.remarksParams.remarksId = data.remarksId
  122. this.remarksParams.fileList = data.fileList
  123. this.remarksParams.imageList = data.imageList
  124. this.initGetStotage()
  125. })
  126. .catch(error => {
  127. this.$util.msg(error.msg, 2000)
  128. })
  129. },
  130. editButtonConfim() {
  131. //保存资料备注
  132. if (this.remarksParams.remarks == '') {
  133. this.$util.msg('请输入关键词记录', 2000)
  134. return
  135. }
  136. this.UserService.getUserClubVisitorSaveAdd({
  137. params: JSON.stringify(this.remarksParams)
  138. })
  139. .then(response => {
  140. this.$util.msg('添加成功', 2000, true, 'success')
  141. let VisitorInfo = {
  142. questionManId: this.remarksParams.questionManId,
  143. questionMan: this.questionMan
  144. }
  145. this.$api.setStorage('VisitorInfo', VisitorInfo)
  146. setTimeout(() => {
  147. this.$api.redirectTo('/pages/seller/remarks/record-list')
  148. }, 2000)
  149. })
  150. .catch(error => {
  151. this.$util.msg(error.msg, 2000)
  152. })
  153. },
  154. uploadFile(array) {
  155. //上传资质文件
  156. console.log(array)
  157. uploadFilePdfDocDocxXlsx().then(res => {
  158. let data = JSON.parse(res.data).data
  159. let obj = {
  160. fileName: uni.getStorageSync('fileName'),
  161. ossName: data.ossName
  162. }
  163. array.push(obj)
  164. console.log('array', array)
  165. }).catch(err=>{
  166. console.log(err)
  167. })
  168. },
  169. uploadPhotoFn(array) {
  170. //添加图片
  171. uploadFileImage().then(res => {
  172. array.push(JSON.parse(res.data).data)
  173. })
  174. },
  175. deleteFileFn(array, index) {
  176. console.log(array)
  177. //删除文件
  178. this.UploadService.PostFileDelete({
  179. ossName: array[index].ossName
  180. })
  181. .then(res => {
  182. array.splice(index, 1)
  183. })
  184. .catch(error => {
  185. console.log('删除文件异常提示===>', error.msg)
  186. })
  187. },
  188. deletePhotoFn(array, index) {
  189. //删除图片
  190. array.splice(index, 1)
  191. },
  192. previewImg(image, index) {
  193. //顶部商品图片预览
  194. isPreviewImg = true
  195. let previewUrls = image
  196. uni.previewImage({
  197. current: index, //图片索引
  198. urls: previewUrls, //必须是http图片,本地图片无效
  199. longPressActions: ''
  200. })
  201. },
  202. conInput(e) {
  203. //备注文字字数限制
  204. let value = e.detail.value
  205. let len = parseInt(value.length)
  206. if (len > this.max) return
  207. this.min = len
  208. if (this.min == 200) {
  209. this.$util.msg('您输入的字数已达上限', 2000)
  210. }
  211. },
  212. },
  213. onShow() {}
  214. }
  215. </script>
  216. <style lang="scss">
  217. page {
  218. height: auto;
  219. background: #ffffff;
  220. }
  221. .remarks-content {
  222. width: 100%;
  223. height: auto;
  224. box-sizing: border-box;
  225. padding: 0 24rpx;
  226. padding-bottom: 160rpx;
  227. .list-view-title {
  228. width: 100%;
  229. height: auto;
  230. margin-bottom: 16rpx;
  231. margin-top: 20rpx;
  232. .list-view-h1 {
  233. line-height: 40rpx;
  234. font-size: $font-size-28;
  235. color: #333333;
  236. text-align: left;
  237. text {
  238. color: #ff2a2a;
  239. }
  240. }
  241. .list-view-p {
  242. line-height: 30rpx;
  243. color: #fea785;
  244. font-size: $font-size-20;
  245. }
  246. }
  247. .remarks-input{
  248. width: 100%;
  249. height: 48rpx;
  250. padding:0 16rpx;
  251. margin: 20rpx 0 0 0;
  252. position: relative;
  253. box-sizing: border-box;
  254. line-height: 48rpx;
  255. font-size: $font-size-26;
  256. color: $text-color;
  257. }
  258. .remarks-textarea {
  259. width: 100%;
  260. height: 340rpx;
  261. padding: 16rpx;
  262. margin: 20rpx 0 0 0;
  263. border-radius: 6rpx;
  264. position: relative;
  265. border: 1px solid #b2b2b2;
  266. box-sizing: border-box;
  267. .textarea {
  268. width: 100%;
  269. height: 100%;
  270. line-height: 36rpx;
  271. font-size: $font-size-26;
  272. color: $text-color;
  273. z-index: 1;
  274. }
  275. .limit-text {
  276. position: absolute;
  277. right: 20rpx;
  278. bottom: 16rpx;
  279. line-height: 44rpx;
  280. font-size: $font-size-24;
  281. color: #b2b2b2;
  282. }
  283. }
  284. .list-view {
  285. width: 100%;
  286. height: 40rpx;
  287. margin-top: 20rpx;
  288. .list-view-file {
  289. width: 132rpx;
  290. height: 44rpx;
  291. line-height: 44rpx;
  292. font-size: $font-size-20;
  293. text-align: center;
  294. color: #ffffff;
  295. background-color: $color-system;
  296. border-radius: 8rpx;
  297. float: left;
  298. margin-top: 10rpx;
  299. }
  300. .list-view-text {
  301. width: 100%;
  302. float: left;
  303. .input {
  304. width: 560rpx;
  305. height: 44rpx;
  306. box-sizing: border-box;
  307. line-height: 44rpx;
  308. color: #333333;
  309. text-overflow: ellipsis;
  310. overflow: hidden;
  311. display: -webkit-box;
  312. -webkit-line-clamp: 1;
  313. line-clamp: 1;
  314. -webkit-box-orient: vertical;
  315. float: left;
  316. }
  317. .delbtn {
  318. width: 96rpx;
  319. height: 44rpx;
  320. border-radius: 8rpx;
  321. background-color: #fff2ec;
  322. font-size: $font-size-24;
  323. color: #e15616;
  324. line-height: 44rpx;
  325. text-align: center;
  326. float: left;
  327. }
  328. }
  329. }
  330. .list-view-upload {
  331. width: 100%;
  332. height: auto;
  333. .photo-item {
  334. display: inline-block;
  335. width: 112rpx;
  336. height: 112rpx;
  337. margin: 10rpx 0;
  338. margin-right: 25rpx;
  339. border-radius: 10rpx;
  340. border: 1px solid #f5f5f5;
  341. position: relative;
  342. float: left;
  343. &.add {
  344. width: 112rpx;
  345. height: 112rpx;
  346. border-color: #b2b2b2;
  347. text-align: center;
  348. line-height: 112rpx;
  349. margin-right: 0rpx;
  350. .icon-jiahao {
  351. font-size: $font-size-44;
  352. color: #b2b2b2;
  353. font-weight: bold;
  354. }
  355. }
  356. .icon-iconfontguanbi {
  357. width: 30rpx;
  358. height: 30rpx;
  359. border-radius: 50%;
  360. display: block;
  361. position: absolute;
  362. right: -10rpx;
  363. top: -10rpx;
  364. background: #f94b4b;
  365. text-align: center;
  366. line-height: 30rpx;
  367. color: #ffffff;
  368. font-size: $font-size-22;
  369. }
  370. image {
  371. width: 112rpx;
  372. height: 112rpx;
  373. border-radius: 10rpx;
  374. }
  375. }
  376. .photo-list {
  377. width: 100%;
  378. height: 116rpx;
  379. overflow: hidden;
  380. white-space: nowrap;
  381. display: flex;
  382. align-items: flex-start;
  383. }
  384. }
  385. }
  386. .remarks-btn {
  387. width: 100%;
  388. padding-top: 20rpx;
  389. position: fixed;
  390. bottom: 0;
  391. left: 0;
  392. background-color: #ffffff;
  393. .edit-button-canel {
  394. width: 100%;
  395. height: 88rpx;
  396. line-height: 88rpx;
  397. text-align: center;
  398. color: #e15616;
  399. font-size: $font-size-24;
  400. }
  401. .edit-button {
  402. width: 600rpx;
  403. height: 90rpx;
  404. background: $btn-confirm;
  405. line-height: 90rpx;
  406. text-align: center;
  407. color: #ffffff;
  408. font-size: $font-size-30;
  409. margin: 0 auto;
  410. border-radius: 45rpx;
  411. }
  412. }
  413. </style>