review-message.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  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;getFocus=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" confirm-type="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" :focus="getFocus" @confirm="getFocus=false">
  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://shop.9026.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() { this.$commonLoad.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: this.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. uni.showLoading({
  254. mask: true,
  255. title: '加载中...'
  256. });
  257. this.request({
  258. key: type,
  259. page: 1,
  260. keyword: '',
  261. }).then(response => {
  262. uni.hideLoading();
  263. if (response) {
  264. this.list = response.list;
  265. }
  266. });
  267. },
  268. getTabs() {
  269. let that = this;
  270. that.$request({
  271. url: that.$api.app_admin.tabs_v2,
  272. method: 'get'
  273. }).then(response=>{
  274. that.$hideLoading();
  275. uni.hideLoading();
  276. if(response.code == 0) {
  277. that.tab = response.data;
  278. if(that.tab.length == 1) {
  279. uni.setNavigationBarTitle({
  280. title: that.tab[0].plugin + '审核消息'
  281. })
  282. }else {
  283. that.titleShow = true;
  284. }
  285. that.titleWidth = 1/that.tab.length * 100 + '%';
  286. that.type = response.data[0].key;
  287. that.request({
  288. key: response.data[0].key,
  289. page: 1,
  290. keyword: '',
  291. }).then(response => {
  292. this.first = false;
  293. if (response) {
  294. that.list = response.list;
  295. }
  296. })
  297. }else {
  298. uni.showToast({
  299. title: response.msg,
  300. icon: 'none',
  301. duration: 1000
  302. });
  303. }
  304. })
  305. },
  306. blurFocus() {
  307. let that = this;
  308. setTimeout(v =>{
  309. that.getFocus=false;
  310. that.searchText();
  311. },300);
  312. },
  313. clearSearch() {
  314. this.keyword = '';
  315. this.searchBool = false;
  316. if(!this.searchBool) {
  317. this.searchText();
  318. }
  319. },
  320. changeType(data) {
  321. this.list = [];
  322. this.page = 1;
  323. this.type = data;
  324. this.over = false;
  325. this.keyword = '';
  326. this.searchBool = false;
  327. this.request({
  328. key: data,
  329. page: this.page,
  330. keyword: this.keyword,
  331. }).then(response => {
  332. if (response) {
  333. this.list = response.list;
  334. }
  335. });
  336. },
  337. async request({key, page, keyword}) {
  338. const response = await this.$request({
  339. url: this.$api.app_admin.review_v2,
  340. data: {
  341. key: key,
  342. page: page,
  343. keyword: keyword
  344. }
  345. });
  346. if (response.code === 0) {
  347. return response.data;
  348. } else {
  349. uni.showToast({
  350. title: response.msg,
  351. icon: 'none',
  352. duration: 1000
  353. });
  354. return false;
  355. }
  356. },
  357. checkQueue(queue_id) {
  358. this.$request({
  359. url: this.$api.app_admin.queue,
  360. data: {
  361. queue_id: queue_id,
  362. }
  363. }).then(response => {
  364. if (response.retry && response.retry == 1) {
  365. this.checkQueue(queue_id);
  366. }else {
  367. for (let i = 0; i < this.list.length; i++) {
  368. if (this.list[i].id === this.setItem.id) {
  369. this.$delete(this.list, i);
  370. this.model=false;
  371. this.setItem = {};
  372. }
  373. }
  374. }
  375. })
  376. },
  377. searchText() {
  378. if (this.keyword === '') {
  379. this.searchBool = false;
  380. }
  381. this.page = 1;
  382. this.over = false;
  383. uni.showLoading({
  384. mask: true,
  385. title: '搜索中...'
  386. });
  387. this.request({
  388. key: this.type,
  389. page: this.page,
  390. keyword: this.keyword,
  391. }).then(response => {
  392. uni.hideLoading();
  393. if (response) {
  394. this.list = response.list;
  395. }
  396. });
  397. },
  398. refuse(data) {
  399. this.setItem = data;
  400. this.modelType = 1;
  401. this.model = true;
  402. },
  403. by(data) {
  404. this.setItem = data;
  405. this.modelType = 2;
  406. this.model = true;
  407. },
  408. confirm() {
  409. if (this.modelType === 2) {
  410. this.$request({
  411. url: this.$api.app_admin.review_switch_v2,
  412. method: 'post',
  413. data: {
  414. key: this.type,
  415. status: 1,
  416. form: JSON.stringify(this.setItem),
  417. user_id: this.setItem.user_id
  418. }
  419. }).then(response => {
  420. if (response.code === 0) {
  421. if(this.type == 3) {
  422. this.checkQueue(response.data.queue_id);
  423. }else {
  424. for (let i = 0; i < this.list.length; i++) {
  425. if (this.list[i].id === this.setItem.id) {
  426. this.$delete(this.list, i);
  427. this.model=false;
  428. this.setItem = {};
  429. }
  430. }
  431. }
  432. }
  433. })
  434. } else if (this.modelType === 1) {
  435. this.setItem.review_remark = this.reasonRefusal;
  436. this.$request({
  437. url: this.$api.app_admin.review_switch_v2,
  438. method: 'post',
  439. data: {
  440. key: this.type,
  441. status: 2,
  442. form: JSON.stringify(this.setItem),
  443. reason: this.reasonRefusal,
  444. user_id: this.setItem.user_id
  445. }
  446. }).then(response => {
  447. if (response.code === 0) {
  448. this.reasonRefusal = '';
  449. for (let i = 0; i < this.list.length; i++) {
  450. if (this.list[i].id === this.setItem.id) {
  451. this.$delete(this.list, i);
  452. this.model=false;
  453. this.setItem = {};
  454. }
  455. }
  456. }else {
  457. uni.showToast({
  458. title: response.msg,
  459. icon: 'none',
  460. duration: 1000
  461. });
  462. }
  463. });
  464. }
  465. },
  466. cancel() {
  467. this.model=false;
  468. this.form = [];
  469. this.showForm = false;
  470. this.setItem = {};
  471. }
  472. }
  473. }
  474. </script>
  475. <style scoped lang="scss">
  476. @import "./review-message.scss";
  477. </style>