cash.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
  1. <template>
  2. <app-layout>
  3. <view class="cash">
  4. <view class="search">
  5. <view v-if="searchBool" style="position: relative">
  6. <input placeholder="请输入昵称搜索" confirm-type="search" type="text" class="input" focus v-model="inputText" :focus="getFocus" @focus="getFocus=true" @blur="searchText" @confirm="getFocus=false">
  7. <image v-if="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;getFocus=true">
  10. <image src="../image/icon-search.png"></image>
  11. <view>{{type === 'mch' ? '请输入订单号/店铺名/昵称搜索':'请输入昵称搜索'}}</view>
  12. </view>
  13. </view>
  14. <view v-if="titleShow" class="bar">
  15. <scroll-view class="scroll-view" scroll-x="true">
  16. <view class="bar-item" :style="{'width': `${titleWidth}`}" v-for="item in tab" :key="item.key" @click="tabSwitch(item.key)">
  17. <app-form-id>
  18. <view :class="['bar-item-text',`${type === item.key ? 'text-active' : ''}`]">{{item.name}}
  19. <view class="bar-item-tips">{{item.plugin}}</view>
  20. </view>
  21. </app-form-id>
  22. </view>
  23. </scroll-view>
  24. </view>
  25. <view class="reply main-center cross-center reply-margin-search" :class="{'reply-margin-bar': titleShow}">
  26. <view class="reply-item unreviewed " :class="{'reply-item-active': status === 0}">
  27. <app-form-id @click="setStatus(0)">
  28. 未审核
  29. </app-form-id>
  30. </view>
  31. <view class="reply-item unpaid" :class="{'reply-item-active': status === 1}">
  32. <app-form-id @click="setStatus(1)">
  33. 未打款
  34. </app-form-id>
  35. </view>
  36. </view>
  37. <view class="content content-margin-search" :class="{'content-margin-bar': titleShow}">
  38. <view class="content-item dir-left-nowrap" v-for="(item, index) in list" :key="index">
  39. <view class="image">
  40. <image :src="item.user.avatar"></image>
  41. </view>
  42. <view class="app-content dir-top-nowrap">
  43. <view class="name">{{item.user.nickname}}</view>
  44. <view class="amount">提现金额:¥{{item.cash.price}}</view>
  45. <view class="amount">手续费:¥{{item.cash.service_charge}}</view>
  46. <view class="pay dir-left-nowrap">
  47. <view class="pay-price-text">打款金额:</view>
  48. <view class="pay-price-number">¥{{item.cash.actual_price}}</view>
  49. </view>
  50. <view class="button-men dir-left-nowrap main-right cross-center">
  51. <view class="button ordinary">
  52. <app-form-id @click="toDetail(item)">
  53. 提现详情
  54. </app-form-id>
  55. </view>
  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://shop.9026.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="setItem.cash.actual_price > 0">¥{{setItem.cash.actual_price}}</view>
  96. <view class="price" v-else-if="setItem.money > 0">¥{{setItem.money}}</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. <u-mask :show="detailDialog" :maskClickAble="false" :zoom="false">
  113. <view class="dialog">
  114. <view class="dialog-title">提现详情</view>
  115. <view class="dialog-item dir-left-nowrap">
  116. <view class="dialog-label">提现方式</view>
  117. <view>{{detail.pay_type}}</view>
  118. </view>
  119. <view class="dialog-item dir-left-nowrap" v-if="detail.extra && detail.extra.name">
  120. <view class="dialog-label">{{detail.pay_type == '微信线下转账' ? '微信昵称': detail.pay_type == '银行线下转账' ? '开户人':'支付宝姓名'}}</view>
  121. <view>{{detail.extra.name}}</view>
  122. </view>
  123. <view class="dialog-item dir-left-nowrap" v-if="detail.extra && detail.extra.mobile">
  124. <view class="dialog-label">{{detail.pay_type == '微信线下转账' ? '微信号': detail.pay_type == '银行线下转账' ? '银行卡号':'支付宝帐号'}}</view>
  125. <view>{{detail.extra.mobile}}</view>
  126. </view>
  127. <view class="dialog-item dir-left-nowrap" v-if="detail.extra && detail.extra.bank_name">
  128. <view class="dialog-label">开户行</view>
  129. <view>{{detail.extra.bank_name}}</view>
  130. </view>
  131. <view @click="detailDialog=false" class="dialog-button">我知道了</view>
  132. </view>
  133. </u-mask>
  134. </view>
  135. </app-layout>
  136. </template>
  137. <script>
  138. import { mapState } from "vuex";
  139. import uMask from "../../../components/basic-component/u-mask/u-mask.vue";
  140. export default {
  141. name: "cash",
  142. data() {
  143. return {
  144. tabList: [
  145. {id:1, name: '出售中'},
  146. {id:0, name: '下架中'}
  147. ],
  148. activeTab: '1',
  149. detailDialog: false,
  150. searchBool: false,
  151. list: [],
  152. tab: [],
  153. detail: {},
  154. titleShow: false,
  155. type: 'share',
  156. titleWidth: null,
  157. getFocus: false,
  158. status: 0,
  159. over: false,
  160. model: false,
  161. modelType: -1,
  162. textarea: '',
  163. setItem: {},
  164. page: 1,
  165. inputText: '',
  166. }
  167. },
  168. components: {
  169. "u-mask": uMask
  170. },
  171. onLoad(options) { this.$commonLoad.onload(options);
  172. this.$showLoading({
  173. type: 'global',
  174. text: '加载中...'
  175. });
  176. this.getTabs();
  177. },
  178. onReachBottom() {
  179. if (!this.over) {
  180. this.page++;
  181. this.bottomRequest();
  182. }
  183. },
  184. methods: {
  185. toDetail(detail) {
  186. this.detail = detail;
  187. this.detailDialog = true;
  188. },
  189. getTabs() {
  190. let that = this;
  191. that.$request({
  192. url: that.$api.app_admin.cash_tabs,
  193. method: 'get'
  194. }).then(response=>{
  195. that.$hideLoading();
  196. uni.hideLoading();
  197. if(response.code == 0) {
  198. that.tab = response.data;
  199. if(that.tab.length == 1) {
  200. uni.setNavigationBarTitle({
  201. title: that.tab[0].plugin + '提现'
  202. })
  203. }else {
  204. that.titleShow = true;
  205. }
  206. that.titleWidth = 1/that.tab.length * 100 + '%';
  207. that.type = response.data[0].key;
  208. that.$request({
  209. url: that.$api.app_admin.cash,
  210. data: {
  211. page: 1,
  212. model_type: that.type,
  213. status: 0,
  214. keyword: '',
  215. }
  216. }).then(response => {
  217. if (response.code == 0) {
  218. that.list = response.data.list;
  219. }else {
  220. uni.showToast({
  221. title: response.msg,
  222. icon: 'none',
  223. duration: 1000
  224. });
  225. }
  226. })
  227. }else {
  228. uni.showToast({
  229. title: response.msg,
  230. icon: 'none',
  231. duration: 1000
  232. });
  233. }
  234. })
  235. },
  236. searchText() {
  237. let that = this;
  238. setTimeout(v=>{
  239. that.page = 1;
  240. that.over = false;
  241. that.getFocus=false;
  242. if(that.inputText == '') {
  243. that.searchBool = false;
  244. }
  245. uni.showLoading({
  246. mask: true,
  247. title: '搜索中...'
  248. });
  249. that.switchRequest({type: 1});
  250. },300)
  251. },
  252. clearSearch() {
  253. this.inputText = '';
  254. if(!this.searchBool) {
  255. this.searchText();
  256. }
  257. },
  258. bottomRequest() {
  259. this.$request({
  260. url: this.$api.app_admin.cash,
  261. data: {
  262. page: this.page,
  263. model_type: this.type,
  264. status: this.status,
  265. keyword: '',
  266. }
  267. }).then(response => {
  268. if (response.code === 0) {
  269. if (response.data.list.length === 0) {
  270. this.over = true;
  271. } else {
  272. this.list = [...this.list, ...response.data.list];
  273. }
  274. }else {
  275. uni.showToast({
  276. title: response.msg,
  277. icon: 'none',
  278. duration: 1000
  279. });
  280. }
  281. })
  282. },
  283. setStatus(data) {
  284. this.page = 1;
  285. this.status = data;
  286. this.over = false;
  287. this.inputText = '';
  288. this.searchBool = false;
  289. uni.showLoading({
  290. mask: true,
  291. title: '加载中...'
  292. });
  293. this.$request({
  294. url: this.$api.app_admin.cash,
  295. data: {
  296. page: 1,
  297. model_type: this.type,
  298. status: data,
  299. keyword: this.inputText,
  300. }
  301. }).then(response => {
  302. uni.hideLoading();
  303. if (response.code === 0) {
  304. this.list = response.data.list;
  305. }else {
  306. uni.showToast({
  307. title: response.msg,
  308. icon: 'none',
  309. duration: 1000
  310. });
  311. }
  312. });
  313. },
  314. tabSwitch(data) {
  315. this.page = 1;
  316. this.status = 0;
  317. this.over = false;
  318. this.type = data;
  319. this.inputText = '';
  320. this.searchBool = false;
  321. this.list = [];
  322. uni.showLoading({
  323. mask: true,
  324. title: '加载中...'
  325. });
  326. this.$request({
  327. url: this.$api.app_admin.cash,
  328. data: {
  329. page: 1,
  330. model_type: data,
  331. status: 0,
  332. keyword: this.inputText,
  333. }
  334. }).then(response => {
  335. uni.hideLoading();
  336. if (response.code === 0) {
  337. this.list = response.data.list;
  338. }else {
  339. uni.showToast({
  340. title: response.msg,
  341. icon: 'none',
  342. duration: 1000
  343. });
  344. }
  345. });
  346. },
  347. confirm() {
  348. // 拒绝
  349. if (this.modelType === 1) {
  350. if (this.textarea === '') {
  351. uni.showToast({
  352. title: '请填写拒绝理由',
  353. icon: 'none',
  354. duration: 1000
  355. });
  356. return false
  357. };
  358. this.$request({
  359. url: this.$api.app_admin.cash_save,
  360. method: 'post',
  361. data: {
  362. status: 3,
  363. id: this.setItem.id,
  364. content: this.textarea,
  365. model_type: this.type,
  366. }
  367. }).then(response => {
  368. if (response.code === 0) {
  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.textarea = '';
  374. }
  375. }
  376. }else {
  377. uni.showToast({
  378. title: response.msg,
  379. icon: 'none',
  380. duration: 1000
  381. });
  382. }
  383. });
  384. } else if (this.modelType === 3) {
  385. this.$request({
  386. url: this.$api.app_admin.cash_save,
  387. method: 'post',
  388. data: {
  389. id: this.setItem.id,
  390. content: '小程序端操作',
  391. model_type: this.type,
  392. status: 2,
  393. }
  394. }).then(response => {
  395. if (response.code === 0) {
  396. for (let i = 0; i < this.list.length; i++) {
  397. if (this.list[i].id === this.setItem.id) {
  398. this.$delete(this.list, i);
  399. this.model = false;
  400. }
  401. }
  402. }else {
  403. uni.showToast({
  404. title: response.msg,
  405. icon: 'none',
  406. duration: 1000
  407. });
  408. }
  409. })
  410. } else if (this.modelType === 2) {
  411. this.$request({
  412. url: this.$api.app_admin.cash_save,
  413. method: 'post',
  414. data: {
  415. id: this.setItem.id,
  416. content: '小程序端操作',
  417. model_type: this.type,
  418. status: 1,
  419. }
  420. }).then(response => {
  421. if (response.code === 0) {
  422. for (let i = 0; i < this.list.length; i++) {
  423. if (this.list[i].id === this.setItem.id) {
  424. this.$delete(this.list, i);
  425. this.model = false;
  426. this.textarea = '';
  427. }
  428. }
  429. }else {
  430. uni.showToast({
  431. title: response.msg,
  432. icon: 'none',
  433. duration: 1000
  434. });
  435. }
  436. });
  437. }
  438. },
  439. refuse(data) {
  440. this.setItem = data;
  441. this.model = true;
  442. this.modelType = 1;
  443. },
  444. byGo(data) {
  445. this.setItem = data;
  446. this.model = true;
  447. this.modelType = 2;
  448. },
  449. pay(data) {
  450. this.setItem = data;
  451. this.model = true;
  452. this.modelType = 3;
  453. },
  454. async request(data) {
  455. const response = await this.$request({
  456. url: this.$api.app_admin.cash,
  457. data: {
  458. model_type: this.type,
  459. page: data.page,
  460. status: data.status,
  461. keyword: this.inputText,
  462. }
  463. });
  464. uni.hideLoading();
  465. if (response.code === 0) {
  466. this.list = response.data.list;
  467. }else {
  468. uni.showToast({
  469. title: response.msg,
  470. icon: 'none',
  471. duration: 1000
  472. });
  473. }
  474. },
  475. switchRequest(data) {
  476. if (this.status === 0) {
  477. this.request({
  478. page: this.page,
  479. status: 0,
  480. });
  481. } else if (this.status === 1) {
  482. this.request({
  483. page: this.page,
  484. status: 1,
  485. });
  486. }
  487. }
  488. }
  489. }
  490. </script>
  491. <style scoped lang="scss">
  492. @import "./cash.scss";
  493. </style>