cash.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  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 === '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://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="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.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.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.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) {
  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. that.switchRequest({type: 1});
  246. },300)
  247. },
  248. clearSearch() {
  249. this.inputText = '';
  250. },
  251. bottomRequest() {
  252. this.$request({
  253. url: this.$api.app_admin.cash,
  254. data: {
  255. page: this.page,
  256. model_type: this.type,
  257. status: this.status,
  258. keyword: '',
  259. }
  260. }).then(response => {
  261. if (response.code === 0) {
  262. if (response.data.list.length === 0) {
  263. this.over = true;
  264. } else {
  265. this.list = [...this.list, ...response.data.list];
  266. }
  267. }else {
  268. uni.showToast({
  269. title: response.msg,
  270. icon: 'none',
  271. duration: 1000
  272. });
  273. }
  274. })
  275. },
  276. setStatus(data) {
  277. this.page = 1;
  278. this.status = data;
  279. this.over = false;
  280. this.inputText = '';
  281. this.searchBool = false;
  282. this.$request({
  283. url: this.$api.app_admin.cash,
  284. data: {
  285. page: 1,
  286. model_type: this.type,
  287. status: data,
  288. keyword: this.inputText,
  289. }
  290. }).then(response => {
  291. if (response.code === 0) {
  292. this.list = response.data.list;
  293. }else {
  294. uni.showToast({
  295. title: response.msg,
  296. icon: 'none',
  297. duration: 1000
  298. });
  299. }
  300. });
  301. },
  302. tabSwitch(data) {
  303. this.page = 1;
  304. this.status = 0;
  305. this.over = false;
  306. this.type = data;
  307. this.inputText = '';
  308. this.searchBool = false;
  309. this.list = [];
  310. this.$request({
  311. url: this.$api.app_admin.cash,
  312. data: {
  313. page: 1,
  314. model_type: data,
  315. status: 0,
  316. keyword: this.inputText,
  317. }
  318. }).then(response => {
  319. if (response.code === 0) {
  320. this.list = response.data.list;
  321. }else {
  322. uni.showToast({
  323. title: response.msg,
  324. icon: 'none',
  325. duration: 1000
  326. });
  327. }
  328. });
  329. },
  330. confirm() {
  331. // 拒绝
  332. if (this.modelType === 1) {
  333. if (this.textarea === '') {
  334. uni.showToast({
  335. title: '请填写拒绝理由',
  336. icon: 'none',
  337. duration: 1000
  338. });
  339. return false
  340. };
  341. this.$request({
  342. url: this.$api.app_admin.cash_save,
  343. method: 'post',
  344. data: {
  345. status: 3,
  346. id: this.setItem.id,
  347. content: this.textarea,
  348. model_type: this.type,
  349. }
  350. }).then(response => {
  351. if (response.code === 0) {
  352. for (let i = 0; i < this.list.length; i++) {
  353. if (this.list[i].id === this.setItem.id) {
  354. this.$delete(this.list, i);
  355. this.model = false;
  356. this.textarea = '';
  357. }
  358. }
  359. }else {
  360. uni.showToast({
  361. title: response.msg,
  362. icon: 'none',
  363. duration: 1000
  364. });
  365. }
  366. });
  367. } else if (this.modelType === 3) {
  368. this.$request({
  369. url: this.$api.app_admin.cash_save,
  370. method: 'post',
  371. data: {
  372. id: this.setItem.id,
  373. content: '小程序端操作',
  374. model_type: this.type,
  375. status: 2,
  376. }
  377. }).then(response => {
  378. if (response.code === 0) {
  379. for (let i = 0; i < this.list.length; i++) {
  380. if (this.list[i].id === this.setItem.id) {
  381. this.$delete(this.list, i);
  382. this.model = false;
  383. }
  384. }
  385. }else {
  386. uni.showToast({
  387. title: response.msg,
  388. icon: 'none',
  389. duration: 1000
  390. });
  391. }
  392. })
  393. } else if (this.modelType === 2) {
  394. this.$request({
  395. url: this.$api.app_admin.cash_save,
  396. method: 'post',
  397. data: {
  398. id: this.setItem.id,
  399. content: '小程序端操作',
  400. model_type: this.type,
  401. status: 1,
  402. }
  403. }).then(response => {
  404. if (response.code === 0) {
  405. for (let i = 0; i < this.list.length; i++) {
  406. if (this.list[i].id === this.setItem.id) {
  407. this.$delete(this.list, i);
  408. this.model = false;
  409. this.textarea = '';
  410. }
  411. }
  412. }else {
  413. uni.showToast({
  414. title: response.msg,
  415. icon: 'none',
  416. duration: 1000
  417. });
  418. }
  419. });
  420. }
  421. },
  422. refuse(data) {
  423. this.setItem = data;
  424. this.model = true;
  425. this.modelType = 1;
  426. },
  427. byGo(data) {
  428. this.setItem = data;
  429. this.model = true;
  430. this.modelType = 2;
  431. },
  432. pay(data) {
  433. this.setItem = data;
  434. this.model = true;
  435. this.modelType = 3;
  436. },
  437. async request(data) {
  438. const response = await this.$request({
  439. url: this.$api.app_admin.cash,
  440. data: {
  441. model_type: this.type,
  442. page: data.page,
  443. status: data.status,
  444. keyword: this.inputText,
  445. }
  446. });
  447. if (response.code === 0) {
  448. this.list = response.data.list;
  449. }else {
  450. uni.showToast({
  451. title: response.msg,
  452. icon: 'none',
  453. duration: 1000
  454. });
  455. }
  456. },
  457. switchRequest(data) {
  458. if (this.status === 0) {
  459. this.request({
  460. page: this.page,
  461. status: 0,
  462. });
  463. } else if (this.status === 1) {
  464. this.request({
  465. page: this.page,
  466. status: 1,
  467. });
  468. }
  469. }
  470. }
  471. }
  472. </script>
  473. <style scoped lang="scss">
  474. @import "./cash.scss";
  475. </style>