review-message.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  1. <template>
  2. <app-layout>
  3. <scroll-view @scrolltolower="getMore" scroll-y :style="{'height':`${windowHeight}px`}">
  4. <view class="review-message">
  5. <view v-if="titleShow" class="bar">
  6. <scroll-view class="scroll-view" scroll-x="true">
  7. <view class="bar-item" :style="{'width': `${titleWidth}`}" v-for="item in tab" :key="item.key" @click="tabSwitch(item.key)">
  8. <app-form-id>
  9. <view :class="['bar-item-text',`${type === item.key ? 'text-active' : ''}`]">{{item.name}}
  10. <view class="bar-item-tips">{{item.plugin}}</view>
  11. </view>
  12. </app-form-id>
  13. </view>
  14. </scroll-view>
  15. </view>
  16. <view class="search" :class="{'search-top': titleShow}">
  17. <view class="search-view dir-left-nowrap main-center cross-center" v-if="!searchBool" @click="searchBool = true">
  18. <image class="image" src="../image/icon-search.png"></image>
  19. <view class="text">{{type === 'mch' ? '请输入店铺名称搜索': type =='share' ? '请输入昵称或姓名搜索' : type =='community' ? '请输入姓名搜索' : '请输入昵称搜索' }}</view>
  20. </view>
  21. <view v-else style="position: relative">
  22. <input id="search" :placeholder="type === 'mch' ? '请输入店铺名称搜索': type =='share' ? '请输入昵称或姓名搜索' : type =='community' ? '请输入姓名搜索' : '请输入昵称搜索'" v-model="keyword" type="text" focus v-if="searchBool" @focus="getFocus=true" @blur="blurFocus" class="search-view">
  23. <image v-if="keyword.length > 0" @click="clearSearch" class="search-clear" src="../image/clear.png"></image>
  24. </view>
  25. </view>
  26. <view class="content" :class="{'content-top': titleShow}">
  27. <view @click="toUrl(item)" class="dir-top-nowrap" :key="index" v-for="(item, index) in list" :class="type == 'share' || type == 'stock' || type == 'bonus' ? 'content-item' :'check-content'">
  28. <view class="dir-left-nowrap" :class="type == 'share' || type == 'stock' || type == 'bonus' ? 'content-content' :'check-nei cross-center'">
  29. <image :src="item.avatar" :class="type == 'share' || type == 'stock' || type == 'bonus' ? 'content-image' :'check-avatar'"></image>
  30. <view class="dir-top-nowrap" :class="type == 'share' || type == 'stock' || type == 'bonus' ? 'content-name' :'check-content-content'">
  31. <view class="name">{{item.nickname}}</view>
  32. <view v-if="type === 'share'" class="referrer">姓名:{{item.name}}</view>
  33. <view v-if="type === 'share'" class="referrer">手机号:{{item.mobile}}</view>
  34. <view v-if="type === 'mch' || type === 'share'" :class="type == 'share'? 'referrer' :'shop'">{{item.tip}}</view>
  35. <view v-if="type === 'region'" class="shop">代理级别:{{item.tip}}</view>
  36. </view>
  37. <image v-if="type != 'share' && type != 'stock' && type != 'bonus'" class="icon" src="../image/arrow-right.png"></image>
  38. </view>
  39. <view v-if="type == 'share' || type == 'stock' || type == 'bonus'" class="content-buttons dir-left-nowrap main-right">
  40. <view v-if="type == 'share' && item.form" class="refuse" @click="toggle(item)">
  41. <app-form-id>
  42. 表单信息
  43. </app-form-id>
  44. </view>
  45. <view class="refuse" @click="refuse(item)">
  46. <app-form-id>
  47. 拒绝
  48. </app-form-id>
  49. </view>
  50. <view class="by" @click="by(item)">
  51. <app-form-id>
  52. 通过
  53. </app-form-id>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. <view class="no-tip" v-if="list.length === 0">
  59. <image src="https://v4test.zjhejiang.com/web/statics/img/app/app_admin/no-message.png"></image>
  60. <view>没有任何消息哦~</view>
  61. </view>
  62. <view @touchmove.stop.prevent="" class="model" v-if="model">
  63. <template v-if="modelType === 1">
  64. <view class="refuse">
  65. <view class="top">{{type != 'share' && type != 'mch' ? '拒绝申请' : '不通过申请'}}</view>
  66. <view class="content">
  67. <textarea v-model="reasonRefusal" class="textarea" placeholder="请填写拒绝理由"></textarea>
  68. </view>
  69. <view class="buttons dir-left-nowrap cross-center">
  70. <view class="but cancel" @click="cancel">
  71. <app-form-id>
  72. 取消
  73. </app-form-id>
  74. </view>
  75. <view class="line"></view>
  76. <view class="but confirm" @click="confirm">
  77. <app-form-id>确认</app-form-id>
  78. </view>
  79. </view>
  80. </view>
  81. </template>
  82. <template v-if="modelType === 2">
  83. <view class="by">
  84. <view class="top">通过申请</view>
  85. <view class="content">
  86. 是否确认通过申请
  87. </view>
  88. <view class="buttons dir-left-nowrap cross-center">
  89. <view class="but cancel" @click="cancel">
  90. <app-form-id>
  91. 取消
  92. </app-form-id>
  93. </view>
  94. <view class="line"></view>
  95. <view class="but confirm" @click="confirm">
  96. <app-form-id>确认</app-form-id>
  97. </view>
  98. </view>
  99. </view>
  100. </template>
  101. </view>
  102. <view class="model" v-if="showForm">
  103. <view class="form">
  104. <view class="top">表单信息</view>
  105. <view class="form-content">
  106. <view v-for="(item,index) in form" v-if="item.value" :key="index" class="price-item">
  107. <view class="price-label">{{item.label}}</view>
  108. <view v-if="item.key == 'img_upload'">
  109. <view v-if="Array.isArray(item.value)">
  110. <block v-for="(img,key) in item.value" :key="key">
  111. <image v-if="img" v-show="!item.loadOver" @load="imageLoad(index)" @click='look(img)' class="form-img" :src='img'></image>
  112. </block>
  113. </view>
  114. <view v-else>
  115. <image v-if="item.value" v-show="!item.loadOver" @load="imageLoad(index)" @click='look(item.value)' class="form-img" :src='item.value'></image>
  116. </view>
  117. </view>
  118. <view style="word-break: break-all" v-else>{{item.value}}</view>
  119. </view>
  120. </view>
  121. <view class="buttons dir-left-nowrap cross-center">
  122. <view class="but cancel" @click="cancel">
  123. <app-form-id>
  124. 取消
  125. </app-form-id>
  126. </view>
  127. <view class="line"></view>
  128. <view class="but confirm" @click="cancel">
  129. <app-form-id>确认</app-form-id>
  130. </view>
  131. </view>
  132. </view>
  133. </view>
  134. </view>
  135. </scroll-view>
  136. </app-layout>
  137. </template>
  138. <script>
  139. import { mapState } from "vuex";
  140. export default {
  141. name: "review-message",
  142. data() {
  143. return {
  144. type: 'share',
  145. first: true,
  146. over: false,
  147. titleShow: false,
  148. showForm: false,
  149. form: [],
  150. list: [],
  151. tab: [],
  152. getFocus: false,
  153. keyword: '',
  154. searchBool: false,
  155. modelType: 1,
  156. reasonRefusal: '',
  157. setItem: {},
  158. titleWidth: '100%',
  159. model: false,
  160. page: 1
  161. }
  162. },
  163. computed: {
  164. ...mapState({
  165. windowHeight : state=>state.gConfig.systemInfo.windowHeight
  166. })
  167. },
  168. onLoad() {
  169. this.$showLoading({
  170. type: 'global',
  171. text: '加载中...'
  172. });
  173. this.getTabs();
  174. },
  175. onShow() {
  176. if(this.first) {
  177. return false
  178. }
  179. this.request({
  180. key: this.type,
  181. page: 1,
  182. keyword: '',
  183. }).then(response => {
  184. if (response) {
  185. this.list = response.list;
  186. }
  187. });
  188. },
  189. methods: {
  190. getMore() {
  191. if (!this.over) {
  192. this.page++;
  193. this.request({
  194. key: this.type,
  195. page: this.page,
  196. keyword: this.keyword,
  197. }).then(response => {
  198. if (response && response.list.length > 0) {
  199. this.list = [...this.list, ...response.list];
  200. } else if (response && response.list.length === 0) {
  201. this.over = true;
  202. }
  203. });
  204. }
  205. },
  206. imageLoad(index) {
  207. this.form[index].loadOver = false;
  208. },
  209. // 查看图片
  210. look(e) {
  211. uni.previewImage({
  212. current: e, // 当前显示图片的http链接
  213. urls: [e] // 需要预览的图片http链接列表
  214. })
  215. },
  216. toggle(item) {
  217. this.form = item.form;
  218. for(let i in this.form) {
  219. if(this.form[i].key == 'img_upload' && Array.isArray(this.form[i].value)) {
  220. let show = false;
  221. for(let img of this.form[i].value) {
  222. if(img != '') {
  223. show = true;
  224. }
  225. }
  226. if(!show) {
  227. this.form.splice(i,1)
  228. }
  229. }
  230. }
  231. this.showForm = true;
  232. },
  233. toUrl(item) {
  234. if(this.type == 'region' || this.type == 'community' || this.type == 'mch') {
  235. let url = '/pages/app_admin/'+this.type+'-detail/'+this.type+'-detail?id=';
  236. if(this.type == 'region') {
  237. url += item.id + '&name=' + item.nickname
  238. }
  239. if(this.type == 'mch') {
  240. url += item.id
  241. }
  242. if(this.type == 'community') {
  243. url += item.user_id
  244. }
  245. uni.navigateTo({
  246. url: url
  247. });
  248. }
  249. },
  250. tabSwitch(type) {
  251. this.list = [];
  252. this.type = type
  253. this.request({
  254. key: type,
  255. page: 1,
  256. keyword: '',
  257. }).then(response => {
  258. if (response) {
  259. this.list = response.list;
  260. }
  261. });
  262. },
  263. getTabs() {
  264. let that = this;
  265. that.$request({
  266. url: that.$api.app_admin.tabs_v2,
  267. method: 'get'
  268. }).then(response=>{
  269. that.$hideLoading();
  270. uni.hideLoading();
  271. if(response.code == 0) {
  272. that.tab = response.data;
  273. if(that.tab.length == 1) {
  274. uni.setNavigationBarTitle({
  275. title: that.tab[0].plugin + '审核消息'
  276. })
  277. }else {
  278. that.titleShow = true;
  279. }
  280. that.titleWidth = 1/that.tab.length * 100 + '%';
  281. that.type = response.data[0].key;
  282. that.request({
  283. key: response.data[0].key,
  284. page: 1,
  285. keyword: '',
  286. }).then(response => {
  287. this.first = false;
  288. if (response) {
  289. that.list = response.list;
  290. }
  291. })
  292. }else {
  293. uni.showToast({
  294. title: response.msg,
  295. icon: 'none',
  296. duration: 1000
  297. });
  298. }
  299. })
  300. },
  301. blurFocus() {
  302. let that = this;
  303. setTimeout(v =>{
  304. that.getFocus=false;
  305. that.searchText();
  306. },300);
  307. },
  308. clearSearch() {
  309. let that = this;
  310. that.keyword = '';
  311. that.searchBool = false;
  312. },
  313. changeType(data) {
  314. this.list = [];
  315. this.page = 1;
  316. this.type = data;
  317. this.over = false;
  318. this.keyword = '';
  319. this.searchBool = false;
  320. this.request({
  321. key: data,
  322. page: this.page,
  323. keyword: this.keyword,
  324. }).then(response => {
  325. if (response) {
  326. this.list = response.list;
  327. }
  328. });
  329. },
  330. async request({key, page, keyword}) {
  331. const response = await this.$request({
  332. url: this.$api.app_admin.review_v2,
  333. data: {
  334. key: key,
  335. page: page,
  336. keyword: keyword
  337. }
  338. });
  339. if (response.code === 0) {
  340. return response.data;
  341. } else {
  342. uni.showToast({
  343. title: response.msg,
  344. icon: 'none',
  345. duration: 1000
  346. });
  347. return false;
  348. }
  349. },
  350. checkQueue(queue_id) {
  351. this.$request({
  352. url: this.$api.app_admin.queue,
  353. data: {
  354. queue_id: queue_id,
  355. }
  356. }).then(response => {
  357. if (response.retry && response.retry == 1) {
  358. this.checkQueue(queue_id);
  359. }else {
  360. for (let i = 0; i < this.list.length; i++) {
  361. if (this.list[i].id === this.setItem.id) {
  362. this.$delete(this.list, i);
  363. this.model=false;
  364. this.setItem = {};
  365. }
  366. }
  367. }
  368. })
  369. },
  370. searchText() {
  371. if (this.keyword === '') {
  372. this.searchBool = false;
  373. }
  374. this.page = 1;
  375. this.over = false;
  376. this.request({
  377. key: this.type,
  378. page: this.page,
  379. keyword: this.keyword,
  380. }).then(response => {
  381. if (response) {
  382. this.list = response.list;
  383. }
  384. });
  385. },
  386. refuse(data) {
  387. this.setItem = data;
  388. this.modelType = 1;
  389. this.model = true;
  390. },
  391. by(data) {
  392. this.setItem = data;
  393. this.modelType = 2;
  394. this.model = true;
  395. },
  396. confirm() {
  397. if (this.modelType === 2) {
  398. this.$request({
  399. url: this.$api.app_admin.review_switch_v2,
  400. method: 'post',
  401. data: {
  402. key: this.type,
  403. status: 1,
  404. form: JSON.stringify(this.setItem),
  405. user_id: this.setItem.user_id
  406. }
  407. }).then(response => {
  408. if (response.code === 0) {
  409. if(this.type == 3) {
  410. this.checkQueue(response.data.queue_id);
  411. }else {
  412. for (let i = 0; i < this.list.length; i++) {
  413. if (this.list[i].id === this.setItem.id) {
  414. this.$delete(this.list, i);
  415. this.model=false;
  416. this.setItem = {};
  417. }
  418. }
  419. }
  420. }
  421. })
  422. } else if (this.modelType === 1) {
  423. this.setItem.review_remark = this.reasonRefusal;
  424. this.$request({
  425. url: this.$api.app_admin.review_switch_v2,
  426. method: 'post',
  427. data: {
  428. key: this.type,
  429. status: 2,
  430. form: JSON.stringify(this.setItem),
  431. reason: this.reasonRefusal,
  432. user_id: this.setItem.user_id
  433. }
  434. }).then(response => {
  435. if (response.code === 0) {
  436. this.reasonRefusal = '';
  437. for (let i = 0; i < this.list.length; i++) {
  438. if (this.list[i].id === this.setItem.id) {
  439. this.$delete(this.list, i);
  440. this.model=false;
  441. this.setItem = {};
  442. }
  443. }
  444. }else {
  445. uni.showToast({
  446. title: response.msg,
  447. icon: 'none',
  448. duration: 1000
  449. });
  450. }
  451. });
  452. }
  453. },
  454. cancel() {
  455. this.model=false;
  456. this.form = [];
  457. this.showForm = false;
  458. this.setItem = {};
  459. }
  460. }
  461. }
  462. </script>
  463. <style scoped lang="scss">
  464. @import "./review-message.scss";
  465. </style>