cash.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536
  1. <template>
  2. <app-layout>
  3. <view class="cash">
  4. <view class="search">
  5. <view v-if="searchBool" style="position: relative">
  6. <input placeholder="请输入昵称搜索" type="text" class="input" focus v-model="inputText" @focus="getFocus=true" @blur="searchText">
  7. <image v-if="getFocus && inputText.length > 0" @click="clearSearch" class="search-clear" src="../image/clear.png"></image>
  8. </view>
  9. <view class="view dir-left-nowrap main-center cross-center" v-else @click="searchBool = true">
  10. <image src="../image/icon-search.png"></image>
  11. <view>{{type === 1 ? '请输入订单号/店铺名/昵称搜索':'请输入昵称搜索'}}</view>
  12. </view>
  13. </view>
  14. <view class="bar dir-left-nowrap" v-if="mch === '1' && share === '1'">
  15. <view class="bar-item">
  16. <app-form-id @click="mchShare(1)">
  17. <text :class="{'text-active': type === 1}">多商户</text>
  18. </app-form-id>
  19. </view>
  20. <view class="bar-item">
  21. <app-form-id @click="mchShare(2)">
  22. <text :class="{'text-active': type === 2}">分销商</text>
  23. </app-form-id>
  24. </view>
  25. </view>
  26. <view class="reply main-center cross-center reply-margin-search" :class="{'reply-margin-bar': mch === '1' && share === '1'}">
  27. <view class="reply-item unreviewed " :class="{'reply-item-active': status === 0}">
  28. <app-form-id @click="setStatus(0)">
  29. 未审核
  30. </app-form-id>
  31. </view>
  32. <view class="reply-item unpaid" :class="{'reply-item-active': status === 1}">
  33. <app-form-id @click="setStatus(1)">
  34. 未打款
  35. </app-form-id>
  36. </view>
  37. </view>
  38. <view class="content content-margin-search" :class="{'content-margin-bar': mch === '1' && share === '1'}">
  39. <view class="content-item dir-left-nowrap" v-for="(item, index) in list" :key="index">
  40. <view class="image">
  41. <image v-if="type === 2" :src="item.user.avatar"></image>
  42. <image v-if="type === 1" :src="item.mch.user.userInfo.avatar"></image>
  43. </view>
  44. <view class="app-content dir-top-nowrap">
  45. <view class="name" v-if="type === 1">{{item.mch.user.nickname }}</view>
  46. <view class="name" v-if="type === 2">{{item.user.nickname}}</view>
  47. <view class="amount" v-if="type === 2">提现金额:¥{{item.cash.price}}</view>
  48. <view class="amount" v-if="type === 1">提现金额:¥{{item.money}}</view>
  49. <view class="amount" v-if="type === 2">手续费:¥{{item.cash.service_charge}}</view>
  50. <view class="pay dir-left-nowrap">
  51. <view class="pay-price-text">打款金额:</view>
  52. <view class="pay-price-number" v-if="type === 2">¥{{item.cash.actual_price}}</view>
  53. <view class="pay-price-number" v-if="type === 1">¥{{item.money}}</view>
  54. </view>
  55. <view class="button-men dir-left-nowrap main-right cross-center">
  56. <view class="button ordinary">
  57. <app-form-id @click="refuse(item)">
  58. 拒绝
  59. </app-form-id>
  60. </view>
  61. <view class="button can" v-if="item.status == '0'">
  62. <app-form-id @click="byGo(item)">
  63. 通过
  64. </app-form-id>
  65. </view>
  66. <view class="button can" v-if="item.status == '1'">
  67. <app-form-id @click="pay(item)">
  68. 打款
  69. </app-form-id>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. <view class="no-tip" v-if="list.length === 0">
  76. <image src="https://v4test.zjhejiang.com/web/statics/img/app/app_admin/no-apply.png"></image>
  77. <view>没有任何申请哦~</view>
  78. </view>
  79. <view @touchmove.stop.prevent="" class="model" v-if="model">
  80. <view class="model-content">
  81. <view class="header">{{modelType === 2 ? '通过申请' : modelType === 3 ? '打款' : modelType === 1 ? '拒绝申请' :''}}</view>
  82. <view class="center">
  83. <template v-if="modelType === 1">
  84. <view class="free">
  85. <textarea class="textarea" placeholder="请填写拒绝理由" v-model="textarea"></textarea>
  86. </view>
  87. </template>
  88. <template v-if="modelType === 2">
  89. <view class="i-modal-body">
  90. <view>是否确认通过提现申请</view>
  91. </view>
  92. </template>
  93. <template v-if="modelType === 3">
  94. <view class="i-modal-body-free">
  95. <view class="price" v-if="type === 1">¥{{setItem.money}}</view>
  96. <view class="price" v-if="type === 2">¥{{setItem.cash.actual_price}}</view>
  97. <view class="text">是否确认打款</view>
  98. </view>
  99. </template>
  100. </view>
  101. <view class="bottom dir-left-nowrap cross-center">
  102. <view class="but cancel">
  103. <app-form-id @click="model=false; modelType=-1">取消</app-form-id>
  104. </view>
  105. <view class="line"></view>
  106. <view class="but confirm">
  107. <app-form-id @click="confirm">确认</app-form-id>
  108. </view>
  109. </view>
  110. </view>
  111. </view>
  112. </view>
  113. </app-layout>
  114. </template>
  115. <script>
  116. export default {
  117. name: "cash",
  118. data() {
  119. return {
  120. searchBool: false,
  121. list: [],
  122. mch: '0',
  123. share: '0',
  124. type: 1,
  125. getFocus: false,
  126. status: 0,
  127. over: false,
  128. model: false,
  129. modelType: -1,
  130. textarea: '',
  131. setItem: {},
  132. page: 1,
  133. inputText: '',
  134. }
  135. },
  136. onLoad(options) {
  137. this.mch = options.mch;
  138. this.share = options.share;
  139. if (this.mch === '0') {
  140. this.type = 2;
  141. }
  142. this.$request({
  143. url: this.$api.app_admin.cash,
  144. data: {
  145. page: 1,
  146. type: this.type,
  147. status: 0,
  148. keyword: '',
  149. }
  150. }).then(response => {
  151. if (response.code === 0) {
  152. this.list = response.data.list;
  153. }
  154. })
  155. },
  156. onReachBottom() {
  157. if (!this.over) {
  158. this.page++;
  159. this.bottomRequest();
  160. }
  161. },
  162. methods: {
  163. searchText() {
  164. let that = this;
  165. setTimeout(v=>{
  166. that.page = 1;
  167. that.over = false;
  168. that.getFocus=false;
  169. if(that.inputText == '') {
  170. that.searchBool = false;
  171. }
  172. switch (that.type) {
  173. case 1:
  174. that.switchRequest({type: 1});
  175. break;
  176. case 2:
  177. that.switchRequest({type: 2});
  178. break;
  179. }
  180. },300)
  181. },
  182. clearSearch() {
  183. this.inputText = '';
  184. },
  185. bottomRequest() {
  186. if (this.type === 1 && this.status === 0) {
  187. this.$request({
  188. url: this.$api.app_admin.cash,
  189. data: {
  190. type: 1,
  191. page: this.page,
  192. status: 0,
  193. keyword: '',
  194. }
  195. }).then(response => {
  196. if (response.code === 0) {
  197. if (response.data.list.length === 0) {
  198. this.over = true;
  199. } else {
  200. this.list = [...this.list, ...response.data.list];
  201. }
  202. }
  203. })
  204. } else if (this.type === 1 && this.status === 1) {
  205. this.$request({
  206. url: this.$api.app_admin.cash,
  207. data: {
  208. type: 1,
  209. page: this.page,
  210. status: 1,
  211. keyword: '',
  212. }
  213. }).then(response => {
  214. if (response.code === 0) {
  215. if (response.data.list.length === 0) {
  216. this.over = true;
  217. } else {
  218. this.list = [...this.list, ...response.data.list];
  219. }
  220. }
  221. })
  222. } else if (this.type === 2 && this.status === 0) {
  223. this.$request({
  224. url: this.$api.app_admin.cash,
  225. data: {
  226. type: 2,
  227. page: this.page,
  228. status: 0,
  229. keyword: '',
  230. }
  231. }).then(response => {
  232. if (response.code === 0) {
  233. if (response.data.list.length === 0) {
  234. this.over = true;
  235. } else {
  236. this.list = [...this.list, ...response.data.list];
  237. }
  238. }
  239. })
  240. } else if (this.type === 2 && this.status === 1) {
  241. this.$request({
  242. url: this.$api.app_admin.cash,
  243. data: {
  244. type: 2,
  245. page: this.page,
  246. status: 1,
  247. keyword: '',
  248. }
  249. }).then(response => {
  250. if (response.code === 0) {
  251. if (response.data.list.length === 0) {
  252. this.over = true;
  253. } else {
  254. this.list = [...this.list, ...response.data.list];
  255. }
  256. }
  257. })
  258. }
  259. },
  260. setStatus(data) {
  261. this.page = 1;
  262. this.status = data;
  263. this.over = false;
  264. this.inputText = '';
  265. this.searchBool = false;
  266. this.$request({
  267. url: this.$api.app_admin.cash,
  268. data: {
  269. page: 1,
  270. type: this.type,
  271. status: data,
  272. keyword: this.inputText,
  273. }
  274. }).then(response => {
  275. if (response.code === 0) {
  276. this.list = response.data.list;
  277. }
  278. });
  279. },
  280. mchShare(data) {
  281. this.page = 1;
  282. this.status = 0;
  283. this.over = false;
  284. this.type = data;
  285. this.inputText = '';
  286. this.searchBool = false;
  287. this.list = [];
  288. this.$request({
  289. url: this.$api.app_admin.cash,
  290. data: {
  291. page: 1,
  292. type: data,
  293. status: 0,
  294. keyword: this.inputText,
  295. }
  296. }).then(response => {
  297. if (response.code === 0) {
  298. this.list = response.data.list;
  299. }
  300. });
  301. },
  302. confirm() {
  303. // 拒绝
  304. if (this.modelType === 1) {
  305. if (this.textarea === '') return;
  306. if (this.type === 1 && this.status === 0) {
  307. this.$request({
  308. url: this.$api.app_admin.verify,
  309. method: 'post',
  310. data: {
  311. status: 0,
  312. id: this.setItem.id,
  313. content: this.textarea,
  314. type: 1,
  315. }
  316. }).then(response => {
  317. if (response.code === 0) {
  318. for (let i = 0; i < this.list.length; i++) {
  319. if (this.list[i].id === this.setItem.id) {
  320. this.$delete(this.list, i);
  321. this.model = false;
  322. this.textarea = '';
  323. }
  324. }
  325. }
  326. });
  327. } else if (this.type === 1 && this.status === 1) {
  328. this.$request({
  329. url: this.$api.app_admin.user_cash,
  330. method: 'post',
  331. data: {
  332. id: this.setItem.id,
  333. content: this.textarea,
  334. type: this.type,
  335. transfer_type: 3,
  336. }
  337. }).then(response => {
  338. if (response.code === 0) {
  339. for (let i = 0; i < this.list.length; i++) {
  340. if (this.list[i].id === this.setItem.id) {
  341. this.$delete(this.list, i);
  342. this.model = false;
  343. this.textarea = '';
  344. }
  345. }
  346. }
  347. })
  348. } else if (this.type === 2 && this.status === 0) {
  349. this.$request({
  350. url: this.$api.app_admin.verify,
  351. method: 'post',
  352. data: {
  353. status: 3,
  354. id: this.setItem.id,
  355. content: this.textarea,
  356. type: 2,
  357. }
  358. }).then(response => {
  359. if (response.code === 0) {
  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.textarea = '';
  365. }
  366. }
  367. }
  368. });
  369. } else if (this.type === 2 && this.status === 1) {
  370. this.$request({
  371. url: this.$api.app_admin.user_cash,
  372. method: 'post',
  373. data: {
  374. id: this.setItem.id,
  375. content: this.textarea,
  376. type: 2,
  377. status: 3,
  378. }
  379. }).then(response => {
  380. if (response.code === 0) {
  381. for (let i = 0; i < this.list.length; i++) {
  382. if (this.list[i].id === this.setItem.id) {
  383. this.$delete(this.list, i);
  384. this.model = false;
  385. this.textarea = '';
  386. }
  387. }
  388. }
  389. })
  390. }
  391. } else if (this.modelType === 3) {
  392. if (this.type === 1) {
  393. this.$request({
  394. url: this.$api.app_admin.user_cash,
  395. method: 'post',
  396. data: {
  397. id: this.setItem.id,
  398. content: '小程序端操作',
  399. type: 1,
  400. transfer_type: 1,
  401. }
  402. }).then(response => {
  403. if (response.code === 0) {
  404. for (let i = 0; i < this.list.length; i++) {
  405. if (this.list[i].id === this.setItem.id) {
  406. this.$delete(this.list, i);
  407. this.model = false;
  408. }
  409. }
  410. }
  411. })
  412. } else if (this.type === 2) {
  413. this.$request({
  414. url: this.$api.app_admin.user_cash,
  415. method: 'post',
  416. data: {
  417. id: this.setItem.id,
  418. content: '小程序端操作',
  419. type: 2,
  420. status: 2,
  421. }
  422. }).then(response => {
  423. if (response.code === 0) {
  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. }
  429. }
  430. } else if (response.code === 1) {
  431. uni.showModal({
  432. title: '提示',
  433. content: response.msg,
  434. });
  435. this.model = false;
  436. }
  437. })
  438. }
  439. } else if (this.modelType === 2) {
  440. if (this.type === 1) {
  441. this.$request({
  442. url: this.$api.app_admin.verify,
  443. method: 'post',
  444. data: {
  445. status: 1,
  446. id: this.setItem.id,
  447. content: '小程序端操作',
  448. type: 1,
  449. }
  450. }).then(response => {
  451. if (response.code === 0) {
  452. for (let i = 0; i < this.list.length; i++) {
  453. if (this.list[i].id === this.setItem.id) {
  454. this.$delete(this.list, i);
  455. this.model = false;
  456. this.textarea = '';
  457. }
  458. }
  459. }
  460. });
  461. } else if (this.type === 2) {
  462. this.$request({
  463. url: this.$api.app_admin.verify,
  464. method: 'post',
  465. data: {
  466. status: 1,
  467. id: this.setItem.id,
  468. content: '小程序端操作',
  469. type: 2,
  470. }
  471. }).then(response => {
  472. if (response.code === 0) {
  473. for (let i = 0; i < this.list.length; i++) {
  474. if (this.list[i].id === this.setItem.id) {
  475. this.$delete(this.list, i);
  476. this.model = false;
  477. this.textarea = '';
  478. }
  479. }
  480. }
  481. });
  482. }
  483. }
  484. },
  485. refuse(data) {
  486. this.setItem = data;
  487. this.model = true;
  488. this.modelType = 1;
  489. },
  490. byGo(data) {
  491. this.setItem = data;
  492. this.model = true;
  493. this.modelType = 2;
  494. },
  495. pay(data) {
  496. this.setItem = data;
  497. this.model = true;
  498. this.modelType = 3;
  499. },
  500. async request(data) {
  501. const response = await this.$request({
  502. url: this.$api.app_admin.cash,
  503. data: {
  504. type: data.type,
  505. page: data.page,
  506. status: data.status,
  507. keyword: this.inputText,
  508. }
  509. });
  510. if (response.code === 0) {
  511. this.list = response.data.list;
  512. }
  513. },
  514. switchRequest(data) {
  515. if (this.status === 0) {
  516. this.request({
  517. type: data.type,
  518. page: this.page,
  519. status: 0,
  520. });
  521. } else if (this.status === 1) {
  522. this.request({
  523. type: data.type,
  524. page: this.page,
  525. status: 1,
  526. });
  527. }
  528. }
  529. }
  530. }
  531. </script>
  532. <style scoped lang="scss">
  533. @import "./cash.scss";
  534. </style>