review-message.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  1. <template>
  2. <app-layout>
  3. <view class="review-message">
  4. <view v-if="titleShow" class="header main-center">
  5. <view class="header-item box-grow-1" @click="changeType(1)" v-if="mch=== '1'">
  6. <app-form-id>
  7. <text :class="{'active-header': type === 1}">商户</text>
  8. </app-form-id>
  9. </view>
  10. <view class="header-item box-grow-1" @click="changeType(2)" v-if="share=== '1'">
  11. <app-form-id>
  12. <text :class="{'active-header': type === 2}">分销商</text>
  13. </app-form-id>
  14. </view>
  15. <view class="header-item box-grow-1" @click="changeType(3)" v-if="bonus=== '1'">
  16. <app-form-id>
  17. <text :class="{'active-header': type === 3}">队长</text>
  18. </app-form-id>
  19. </view>
  20. <view class="header-item box-grow-1" @click="changeType(4)" v-if="stock=== '1'">
  21. <app-form-id>
  22. <text :class="{'active-header': type === 4}">股东</text>
  23. </app-form-id>
  24. </view>
  25. </view>
  26. <view class="search" :class="{'search-top': titleShow}">
  27. <view class="search-view dir-left-nowrap main-center cross-center" v-if="!searchBool" @click="searchBool = true">
  28. <image class="image" src="../image/icon-search.png"></image>
  29. <view class="text">{{type === 1 ? '请输入店铺名称搜索':type ==3 || type == 4 ? '请输入昵称搜索' : '请输入昵称或姓名搜索' }}</view>
  30. </view>
  31. <view style="position: relative">
  32. <input id="search" :placeholder="type === 1 ? '请输入店铺名称搜索':type ==3 || type == 4 ? '请输入昵称搜索' : '请输入昵称或姓名搜索'" v-model="keyword" type="text" focus v-if="searchBool" @focus="getFocus=true" @blur="blurFocus" class="search-view">
  33. <image v-if="getFocus && keyword.length > 0" @click="clearSearch" class="search-clear" src="../image/clear.png"></image>
  34. </view>
  35. </view>
  36. <view class="content" :class="{'content-top': titleShow}">
  37. <template v-if="type != 1">
  38. <view class="content-item dir-top-nowrap" :key="index" v-for="(item, index) in list">
  39. <view class="content-content dir-left-nowrap">
  40. <image class="content-image" :src="item.avatar"></image>
  41. <view class="content-name dir-top-nowrap">
  42. <view class="name" v-if="type === 3">{{item.user.nickname}}</view>
  43. <view class="name" v-else>{{item.nickname}}</view>
  44. <view v-if="type === 2" class="referrer">推荐人:{{item.parent_name}}</view>
  45. </view>
  46. </view>
  47. <view class="content-buttons dir-left-nowrap main-right">
  48. <view class="refuse" @click="refuse(item)">
  49. <app-form-id>
  50. 拒绝
  51. </app-form-id>
  52. </view>
  53. <view class="by" @click="by(item)">
  54. <app-form-id>
  55. 通过
  56. </app-form-id>
  57. </view>
  58. </view>
  59. </view>
  60. </template>
  61. <template v-if="type === 1">
  62. <view class="check-content" v-for="(item, index) in list" :key="index">
  63. <app-jump-button form :url="`/pages/app_admin/mch-detail/mch-detail?id=${item.id}`">
  64. <view class="check-nei dir-left-nowrap cross-center">
  65. <image class="check-avatar" :src="item.user.userInfo.avatar"></image>
  66. <view class="check-content-content">
  67. <view class="name">{{item.user.nickname}}</view>
  68. <view class="shop">{{item.store.name}}</view>
  69. </view>
  70. <image class="icon" src="../image/arrow-right.png"></image>
  71. </view>
  72. </app-jump-button>
  73. </view>
  74. </template>
  75. </view>
  76. <view class="no-tip" v-if="list.length === 0">
  77. <image src="https://v4test.zjhejiang.com/web/statics/img/app/app_admin/no-message.png"></image>
  78. <view>没有任何消息哦~</view>
  79. </view>
  80. <view @touchmove.stop.prevent="" class="model" v-if="model">
  81. <template v-if="modelType === 1">
  82. <view class="refuse">
  83. <view class="top">{{type > 2 ? '拒绝申请' : '不通过申请'}}</view>
  84. <view class="content">
  85. <textarea v-model="reasonRefusal" class="textarea" placeholder="请填写拒绝理由"></textarea>
  86. </view>
  87. <view class="buttons dir-left-nowrap cross-center">
  88. <view class="but cancel" @click="cancel">
  89. <app-form-id>
  90. 取消
  91. </app-form-id>
  92. </view>
  93. <view class="line"></view>
  94. <view class="but confirm" @click="confirm">
  95. <app-form-id>确认</app-form-id>
  96. </view>
  97. </view>
  98. </view>
  99. </template>
  100. <template v-if="modelType === 2">
  101. <view class="by">
  102. <view class="top">通过申请</view>
  103. <view class="content">
  104. 是否确认通过申请
  105. </view>
  106. <view class="buttons dir-left-nowrap cross-center">
  107. <view class="but cancel" @click="cancel">
  108. <app-form-id>
  109. 取消
  110. </app-form-id>
  111. </view>
  112. <view class="line"></view>
  113. <view class="but confirm" @click="confirm">
  114. <app-form-id>确认</app-form-id>
  115. </view>
  116. </view>
  117. </view>
  118. </template>
  119. </view>
  120. </view>
  121. </app-layout>
  122. </template>
  123. <script>
  124. export default {
  125. name: "review-message",
  126. data() {
  127. return {
  128. type: 1,
  129. mch: '0',
  130. share: '0',
  131. bonus: '0',
  132. stock: '0',
  133. over: false,
  134. titleShow: false,
  135. list: [],
  136. getFocus: false,
  137. keyword: '',
  138. searchBool: false,
  139. modelType: 1,
  140. reasonRefusal: '',
  141. setItem: {},
  142. model: false,
  143. page: 1,
  144. }
  145. },
  146. onLoad(options) {
  147. this.mch = options.mch;
  148. this.share = options.share;
  149. this.bonus = options.bonus;
  150. this.stock = options.stock;
  151. if (this.mch === '1') {
  152. if(this.share === '1' || this.bonus === '1' || this.stock === '1') {
  153. this.titleShow = true;
  154. }else {
  155. uni.setNavigationBarTitle({
  156. title: '多商户审核消息'
  157. })
  158. }
  159. }
  160. if (this.share === '1') {
  161. if(this.mch === '1' || this.bonus === '1' || this.stock === '1') {
  162. this.titleShow = true;
  163. if(this.mch === '0') {
  164. this.type = 2;
  165. }
  166. }else {
  167. this.type = 2;
  168. uni.setNavigationBarTitle({
  169. title: '分销商审核消息'
  170. })
  171. }
  172. }
  173. if (this.bonus === '1') {
  174. if(this.mch === '1' || this.share === '1' || this.stock === '1') {
  175. this.titleShow = true;
  176. if(this.share === '0' && this.mch === '0') {
  177. this.type = 3;
  178. }
  179. }else {
  180. this.type = 3;
  181. uni.setNavigationBarTitle({
  182. title: '团队分红审核消息'
  183. })
  184. }
  185. }
  186. if (this.stock === '1') {
  187. if(this.mch === '1' || this.bonus === '1' || this.share === '1') {
  188. this.titleShow = true;
  189. }else {
  190. this.type = 4;
  191. uni.setNavigationBarTitle({
  192. title: '股东分红审核消息'
  193. })
  194. }
  195. }
  196. this.request({
  197. type: this.type,
  198. page: 1,
  199. keyword: '',
  200. }).then(response => {
  201. if (response) {
  202. this.list = response.list;
  203. }
  204. })
  205. },
  206. onReachBottom() {
  207. if (!this.over) {
  208. this.page++;
  209. this.request({
  210. type: this.type,
  211. page: this.page,
  212. keyword: this.keyword,
  213. }).then(response => {
  214. console.log(response);
  215. if (response && response.list.length > 0) {
  216. this.list = [...this.list, ...response.list];
  217. } else if (response && response.list.length === 0) {
  218. this.over = true;
  219. }
  220. });
  221. }
  222. },
  223. onShow() {
  224. // let type = 1;
  225. // if (this.mch === '0') {
  226. // this.type = 2;
  227. // }
  228. this.request({
  229. type: this.type,
  230. page: 1,
  231. keyword: '',
  232. }).then(response => {
  233. if (response) {
  234. this.list = response.list;
  235. }
  236. });
  237. },
  238. methods: {
  239. blurFocus() {
  240. let that = this;
  241. setTimeout(v =>{
  242. that.getFocus=false;
  243. that.searchText();
  244. },300)
  245. },
  246. clearSearch() {
  247. let that = this;
  248. that.keyword = '';
  249. },
  250. changeType(data) {
  251. this.list = [];
  252. this.page = 1;
  253. this.type = data;
  254. this.over = false;
  255. this.keyword = '';
  256. this.searchBool = false;
  257. this.request({
  258. type: data,
  259. page: this.page,
  260. keyword: this.keyword,
  261. }).then(response => {
  262. if (response) {
  263. this.list = response.list;
  264. }
  265. });
  266. },
  267. async request({type, page, keyword}) {
  268. const response = await this.$request({
  269. url: this.$api.app_admin.review,
  270. data: {
  271. type: type,
  272. page: page,
  273. keyword: keyword,
  274. }
  275. });
  276. if (response.code === 0) {
  277. return response.data;
  278. } else {
  279. return false;
  280. }
  281. },
  282. checkQueue(queue_id) {
  283. this.$request({
  284. url: this.$api.app_admin.queue,
  285. data: {
  286. queue_id: queue_id,
  287. }
  288. }).then(response => {
  289. if (response.retry && response.retry == 1) {
  290. this.checkQueue(queue_id);
  291. }else {
  292. for (let i = 0; i < this.list.length; i++) {
  293. if (this.list[i].id === this.setItem.id) {
  294. this.$delete(this.list, i);
  295. this.model=false;
  296. this.setItem = {};
  297. }
  298. }
  299. }
  300. })
  301. },
  302. searchText() {
  303. if (this.keyword === '') {
  304. this.searchBool = false;
  305. }
  306. this.page = 1;
  307. this.over = false;
  308. this.request({
  309. type: this.type,
  310. page: this.page,
  311. keyword: this.keyword,
  312. }).then(response => {
  313. if (response) {
  314. this.list = response.list;
  315. }
  316. });
  317. },
  318. refuse(data) {
  319. this.setItem = data;
  320. this.modelType = 1;
  321. this.model = true;
  322. },
  323. by(data) {
  324. this.setItem = data;
  325. this.modelType = 2;
  326. this.model = true;
  327. },
  328. confirm() {
  329. if (this.modelType === 2) {
  330. this.$request({
  331. url: this.$api.app_admin.review_switch,
  332. method: 'post',
  333. data: {
  334. type: this.type,
  335. status: 1,
  336. form: JSON.stringify(this.setItem),
  337. user_id: this.setItem.user_id,
  338. }
  339. }).then(response => {
  340. if (response.code === 0) {
  341. if(this.type == 3) {
  342. this.checkQueue(response.data.queue_id);
  343. }else {
  344. for (let i = 0; i < this.list.length; i++) {
  345. if (this.list[i].id === this.setItem.id) {
  346. this.$delete(this.list, i);
  347. this.model=false;
  348. this.setItem = {};
  349. }
  350. }
  351. }
  352. }
  353. })
  354. } else if (this.modelType === 1) {
  355. this.setItem.review_remark = this.reasonRefusal;
  356. this.$request({
  357. url: this.$api.app_admin.review_switch,
  358. method: 'post',
  359. data: {
  360. type: this.type,
  361. status: 2,
  362. form: JSON.stringify(this.setItem),
  363. reason: this.reasonRefusal,
  364. user_id: this.setItem.user_id,
  365. }
  366. }).then(response => {
  367. if (response.code === 0) {
  368. this.reasonRefusal = '';
  369. for (let i = 0; i < this.list.length; i++) {
  370. if (this.list[i].id === this.setItem.id) {
  371. this.$delete(this.list, i);
  372. this.model=false;
  373. this.setItem = {};
  374. }
  375. }
  376. }else {
  377. uni.showToast({
  378. title: response.msg,
  379. icon: 'none',
  380. duration: 1000
  381. });
  382. }
  383. });
  384. }
  385. },
  386. cancel() {
  387. this.model=false;
  388. this.setItem = {};
  389. }
  390. }
  391. }
  392. </script>
  393. <style scoped lang="scss">
  394. @import "./review-message.scss";
  395. </style>