InformForm.vue 15 KB

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