ComplaintForm.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473
  1. <template><page-meta :root-font-size="fontSize+'px'"></page-meta>
  2. <seller-base :show="false">
  3. <view class="div container">
  4. <!-- header -->
  5. <view class="div common-header-wrap">
  6. <view :style="'height:'+navHeight+'px'"></view>
  7. <view class="common-header-holder"></view>
  8. <view class="common-header-fixed">
  9. <title-header />
  10. <uni-nav-bar title="投诉详情" class="common-header" left-icon="back" @clickLeft="goBack()">
  11. </uni-nav-bar>
  12. </view>
  13. </view>
  14. <!--投诉信息-->
  15. <view class="div">
  16. <view class="div menu-item"><text class="span line-name">投诉信息</text></view>
  17. <view class="div menu-content">
  18. <flex-line :show-border="true"><text class="span line-name">投诉状态</text><text class="span" slot="right">{{complaint.complain_state_text}}</text></flex-line>
  19. <flex-line :show-border="true"><text class="span line-name">投诉人</text><text class="span" slot="right">{{complaint.accused_name}}</text></flex-line>
  20. <flex-line :show-border="true"><text class="span line-name">投诉主题</text><text class="span" slot="right">{{complaint.complain_subject_content}}</text></flex-line>
  21. <flex-line :show-border="true"><text class="span line-name">投诉时间</text><text class="span" slot="right">{{$moment.unix(complaint.complain_datetime).format('YYYY.MM.DD')}}</text></flex-line>
  22. <flex-line :show-border="true"><text class="span line-name">投诉内容</text><text class="span" slot="right">{{complaint.complain_content}}</text></flex-line>
  23. <view class="div" @click="showPopup('isshow')" v-if="complain_pic.length"><flex-line :show-border="true"><text class="span line-name">投诉凭证</text><text class="span" slot="right">查看</text></flex-line></view>
  24. </view>
  25. <uni-popup background-color="#fff" ref="isshow" v-if="complain_pic.length>0">
  26. <view class="div preview-picture">
  27. <title-header />
  28. <view
  29. class="div picture-header"
  30. v-on:click="hidePopup('isshow')"
  31. >
  32. <text class="span">关闭</text
  33. ><text class="span" v-if="complain_pic"
  34. >{{ defaultindex + 1 }} / {{ complain_pic.length }}</text
  35. >
  36. </view>
  37. <view class="div picture-body">
  38. <swiper
  39. :autoplay="false"
  40. :indicator-dots="true"
  41. :current="defaultindex"
  42. class="ui-common-swiper"
  43. :prevent="false"
  44. :stop-propagation="true"
  45. @change="handleChange"
  46. >
  47. <swiper-item
  48. class="ui-common-swiper-item"
  49. v-for="(item, index) in complain_pic"
  50. v-bind:key="index"
  51. >
  52. <image mode="aspectFit" class="img" v-bind:src="item" style="max-width: 100%;max-height: 100%" />
  53. </swiper-item>
  54. </swiper>
  55. </view>
  56. </view>
  57. </uni-popup>
  58. </view>
  59. <!--申诉信息-->
  60. <view class="div" v-if="complaint.complain_state>20">
  61. <view class="div menu-item"><text class="span line-name">申诉信息</text></view>
  62. <view class="div menu-content">
  63. <flex-line :show-border="true"><text class="span line-name">申诉时间</text><text class="span" slot="right">{{$moment.unix(complaint.appeal_datetime).format('YYYY.MM.DD')}}</text></flex-line>
  64. <flex-line :show-border="true"><text class="span line-name">申诉内容</text><text class="span" slot="right">{{complaint.appeal_message}}</text></flex-line>
  65. <view class="div" @click="showPopup('isshow2')" v-if="appeal_pic.length"><flex-line :show-border="true"><text class="span line-name">申诉凭证</text><text class="span" slot="right">查看</text></flex-line></view>
  66. </view>
  67. <uni-popup background-color="#fff" ref="isshow2" v-if="appeal_pic.length>0">
  68. <view class="div preview-picture">
  69. <title-header />
  70. <view
  71. class="div picture-header"
  72. v-on:click="hidePopup('isshow2')"
  73. >
  74. <text class="span">关闭</text
  75. ><text class="span" v-if="appeal_pic"
  76. >{{ defaultindex2 + 1 }} / {{ appeal_pic.length }}</text
  77. >
  78. </view>
  79. <view class="div picture-body">
  80. <swiper
  81. :autoplay="false"
  82. :indicator-dots="true"
  83. :current="defaultindex2"
  84. class="ui-common-swiper"
  85. :prevent="false"
  86. :stop-propagation="true"
  87. @change="handleChange2"
  88. >
  89. <swiper-item
  90. class="ui-common-swiper-item"
  91. v-for="(item, index) in appeal_pic"
  92. v-bind:key="index"
  93. >
  94. <image mode="aspectFit" class="img" v-bind:src="item" style="max-width: 100%;max-height: 100%" />
  95. </swiper-item>
  96. </swiper>
  97. </view>
  98. </view>
  99. </uni-popup>
  100. </view>
  101. <view class="div" v-if="complaint.complain_state==20">
  102. <!-- body -->
  103. <view class="div body">
  104. <flex-line class="div"><text class="span line-name">申诉凭证</text></flex-line>
  105. <view class="div image-wrapper">
  106. <view class="div user-avatar">
  107. <uni-file-picker v-model="image" fileMediatype="image" mode="grid" :limit="3" :auto-upload="false"
  108. @select="uploadComplaintPic" @delete="deleteComplaintPic"></uni-file-picker>
  109. </view>
  110. </view>
  111. <view class="div order-comment-body">
  112. <view class="div enter">
  113. <textarea
  114. placeholder="申诉内容"
  115. v-model="content"
  116. ></textarea>
  117. </view>
  118. </view>
  119. </view>
  120. <view class="div pt-10 pb-10"><view class="div common-btn ds-button-large" @click="addComplaint">提交</view></view>
  121. </view>
  122. <view class="div" v-else>
  123. <!--对话-->
  124. <view class="div body">
  125. <view class="div menu-item"><text class="span line-name">对话记录</text></view>
  126. <view class="div menu-content"><flex-line v-for="(item,index) in talk_list" :key="index" :show-border="true"><text class="span line-name">{{item.talk}}</text></flex-line></view>
  127. </view>
  128. <view class="div" v-if="complaint.complain_state>20 && complaint.complain_state<99">
  129. <view class="div body">
  130. <view class="div order-comment-body">
  131. <view class="div enter">
  132. <textarea
  133. placeholder="对话内容"
  134. v-model="content"
  135. ></textarea>
  136. </view>
  137. </view>
  138. </view>
  139. <view class="div pt-10 pb-10"><view class="div common-btn ds-button-large" @click="addComplaintTalk">提交</view></view>
  140. </view>
  141. </view>
  142. <tui-picture-cropper v-if="cropperOption.imgUrl" :width="cropperOption.autoCropWidth" :height="cropperOption.autoCropHeight" :imageUrl="cropperOption.img" @ready="cropReady" @cropper="useCrop" @back="cropBack"></tui-picture-cropper>
  143. </view>
  144. </seller-base>
  145. </template>
  146. <script>
  147. import {getFontSize} from '@/util/common'
  148. import TitleHeader from '../../TitleHeader'
  149. import SellerBase from '../SellerBase'
  150. import tuiPictureCropper from "@/components/thorui/tui-picture-cropper/tui-picture-cropper"
  151. import { getComplaintInfo, addComplaint, uploadComplaintPic, addComplaintTalk, getComplaintTalk } from '../../../api/sellerCompliant'
  152. import flexLine from '../../flexLine'
  153. export default {
  154. computed:{
  155. fontSize(){
  156. return getFontSize()
  157. },
  158. },
  159. data(){
  160. return {
  161. navHeight: 0,
  162. screenWidth:0,
  163. cropperOption: {
  164. img: '',
  165. canMove: false,
  166. autoCrop: true,
  167. autoCropWidth: 100,
  168. autoCropHeight: 100,
  169. maxImgSize: 500,
  170. outputType: 'png'
  171. },
  172. cropType: '',
  173. content: '',
  174. complain_id: 0,
  175. subjectVisible: false,
  176. subject_options: [],
  177. subject_name: '',
  178. subject: '',
  179. image: [],
  180. file_value: {},
  181. complaint: {},
  182. complain_pic: [],
  183. appeal_pic: [],
  184. defaultindex: 0,
  185. defaultindex2: 0,
  186. talk_list: []
  187. }
  188. },
  189. onLoad: function (option) {
  190. this.complain_id = option.complain_id
  191. getComplaintInfo(this.complain_id).then(res => {
  192. this.complaint = res.result.complain_info
  193. this.complain_pic = res.result.complain_pic
  194. this.appeal_pic = res.result.appeal_pic
  195. }).catch(function (error) {
  196. uni.showToast({icon:'none',title: error.message})
  197. })
  198. this.getComplaintTalk()
  199. },
  200. components:{
  201. TitleHeader,
  202. SellerBase,
  203. flexLine,
  204. tuiPictureCropper
  205. },
  206. watch: {
  207. subject: function (subject) {
  208. let temp = subject.split(',')
  209. this.subject_name = temp[1]
  210. this.subjectVisible = false
  211. }
  212. },
  213. mounted(){
  214. // #ifdef MP-WEIXIN
  215. this.navHeight = uni.getMenuButtonBoundingClientRect().height
  216. // #endif
  217. this.screenWidth=uni.getSystemInfoSync().screenWidth
  218. },
  219. methods:{
  220. getComplaintTalk(){
  221. getComplaintTalk(this.complain_id).then(res => {
  222. this.talk_list = res.result.talk_list
  223. }).catch(function (error) {
  224. uni.showToast({icon:'none',title: error.message})
  225. })
  226. },
  227. showPopup(id){
  228. this.$refs[id].open()
  229. },
  230. hidePopup(id){
  231. this.$refs[id].close()
  232. },
  233. goBack(){uni.navigateBack({delta:1})},
  234. handleChange (e) {
  235. this.defaultindex = e.detail.current
  236. },
  237. handleChange2 (e) {
  238. this.defaultindex2 = e.detail.current
  239. },
  240. addComplaintTalk () {
  241. addComplaintTalk(this.complain_id, this.content).then(res => {
  242. this.getComplaintTalk()
  243. }).catch(function (error) {
  244. uni.showToast({icon:'none',title: error.message})
  245. })
  246. },
  247. addComplaint () {
  248. var file_value = []
  249. for (var i in this.file_value) {
  250. file_value.push(this.file_value[i])
  251. }
  252. addComplaint(this.complain_id, this.content, file_value).then(res => {
  253. uni.navigateTo({url:'/pages/seller/complaint/ComplaintList'})
  254. }).catch(function (error) {
  255. uni.showToast({icon:'none',title: error.message})
  256. })
  257. },
  258. useCrop(res) {
  259. let index = this.cropType
  260. var formdata = {
  261. filePath: res.url,
  262. name: 'complain_pic'
  263. }
  264. uploadComplaintPic(formdata).then(res => {
  265. this.file_value[index] = res.result.file_name
  266. this.image[index] = [{
  267. name: index,
  268. extname: 'jpg',
  269. url: res.result.pic
  270. }]
  271. this.cropperOption.imgUrl = ''
  272. this.$forceUpdate()
  273. uni.hideLoading()
  274. }).catch(function(error) {
  275. uni.showToast({
  276. icon: 'none',
  277. title: error.message
  278. })
  279. uni.hideLoading()
  280. this.cropperOption.imgUrl = ''
  281. this.$forceUpdate()
  282. })
  283. },
  284. deleteComplaintPic(event) {
  285. let file = event.tempFile
  286. var index = file.name
  287. delete this.file_value[index]
  288. },
  289. cropReady() {
  290. this.cropperOption.img = this.cropperOption.imgUrl
  291. },
  292. cropBack(){
  293. this.cropperOption.imgUrl=''
  294. this.$forceUpdate()
  295. },
  296. uploadComplaintPic(event) {
  297. let that = this
  298. let file = event.tempFiles[0]
  299. this.cropType = file.uuid
  300. that.cropperOption.imgUrl = file.path
  301. that.cropperOption.autoCropWidth = uni.getSystemInfoSync().windowWidth
  302. that.cropperOption.autoCropHeight = uni.getSystemInfoSync().windowWidth
  303. that.cropperOption.maxImgSize = uni.getSystemInfoSync().windowHeight - 40
  304. that.$forceUpdate()
  305. }
  306. }
  307. }
  308. </script>
  309. <style lang="scss" scoped>
  310. .common-header{
  311. .btn{background: #000;color: #fff;box-shadow: 0px 2px 4px #d2d2d2;}
  312. }
  313. .common-header-wrap .common-header{box-shadow: unset}
  314. .ui-common-swiper {
  315. width: 100%;
  316. }
  317. .ui-common-swiper-item{display: flex;align-content: center}
  318. .common-score-wrapper .back{display: block}
  319. .container {
  320. display: flex;
  321. flex-direction: column;
  322. justify-content: flex-start;
  323. align-items: stretch;
  324. .body {
  325. top: 2.2rem;
  326. width: 100%;
  327. padding: 0 $pageSpace;
  328. background-color: #fff;
  329. box-sizing: border-box;
  330. .order-comment-body {
  331. background: rgba(255, 255, 255, 1);
  332. padding: 0.75rem 0;
  333. .body-list {
  334. display: flex;
  335. justify-content: left;
  336. align-content: center;
  337. align-items: center;
  338. padding-bottom: 0.75rem;
  339. border-bottom: 1px solid #e8eaed;
  340. }
  341. .image {
  342. width: 3.75rem;
  343. height: 3.75rem;
  344. flex-shrink: 0;
  345. .img {
  346. width: 100%;
  347. height: 100%;
  348. }
  349. }
  350. .comment {
  351. flex-basis: 100%;
  352. padding-left: 0.75rem;
  353. .span {
  354. font-size:$h2;
  355. color: #7c7f88;
  356. text-align: left;
  357. display: block;
  358. }
  359. .ul {
  360. display: flex;
  361. justify-content: space-between;
  362. align-content: center;
  363. align-items: center;
  364. margin-top: 1.2rem;
  365. .li {
  366. .img {
  367. width: 0.95rem;
  368. height: 0.95rem;
  369. flex-shrink: 0;
  370. }
  371. label {
  372. font-size:$subFontSize;
  373. color: rgba(78, 84, 93, 1);
  374. font-weight: normal;
  375. }
  376. }
  377. }
  378. }
  379. .enter {
  380. padding-top: 0.75rem;
  381. textarea {
  382. width: 100%;
  383. height: 11rem;
  384. background: rgba(247, 249, 250, 1);
  385. border: 1px solid #f7f9fa;
  386. box-sizing: border-box;
  387. padding: 0.5rem 0 0 0.5rem;
  388. font-size:$subFontSize;
  389. -webkit-appearance: none;
  390. outline: none;
  391. }
  392. }
  393. }
  394. }
  395. }
  396. .image-wrapper{background-color: #fff;}
  397. .swipe-wrapper {
  398. width: 100%;
  399. }
  400. .mint-popup {
  401. width: 100%;
  402. height: 100%;
  403. background-color: #000;
  404. }
  405. .mint-swipe,
  406. .mint-swipe-items-wrap {
  407. position: static;
  408. }
  409. .preview-picture {
  410. width: 100%;
  411. height: 100%;
  412. position: fixed;
  413. z-index: 10;
  414. top:0;
  415. bottom:0;
  416. left:0;
  417. right:0;
  418. background-color: #000;
  419. .picture-header {
  420. height: 2.2rem;
  421. color: #000;
  422. background-color: #fff;
  423. display: flex;
  424. justify-content: center;
  425. align-content: center;
  426. align-items: center;
  427. width: 100%;
  428. top:0;
  429. padding-top:var(--status-bar-height);
  430. .span {
  431. font-size:$subFontSize;
  432. font-weight: normal;
  433. &:first-child {
  434. cursor: pointer;
  435. position: absolute;
  436. left: 0.75rem;
  437. background-size: 1.2rem;
  438. display: inline-block;
  439. height: 2.2rem;
  440. line-height: 2.2rem;
  441. }
  442. }
  443. }
  444. .picture-body {
  445. position: absolute;
  446. top: 2.2rem;
  447. bottom:0;
  448. width: 100%;
  449. display: flex;
  450. justify-content: center;
  451. align-content: center;
  452. align-items: center;
  453. }
  454. }
  455. .menu-item{padding:0 $pageSpace;line-height:2rem;font-size:$h2;}
  456. .menu-content{background:#fff;padding:0 $pageSpace;}
  457. </style>