settlement.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
  1. <template>
  2. <base-page>
  3. <view class="page-height uni-flex uni-column">
  4. <view class="uni-flex uni-row" v-if="storeInfo">
  5. <view class="account-wrap">
  6. <view class="head-title">账户概览</view>
  7. <view class="account-item">
  8. <view class="account-title">待结算金额(元)</view>
  9. <view class="money">{{ storeInfo.account | moneyFormat }}</view>
  10. <view class="operation">
  11. <button type="default" class="primary-btn" v-if="
  12. storeInfo.is_settlement == 1 &&
  13. withdrawConfig.is_settlement == 1 &&
  14. withdrawConfig.period_type == 4 &&
  15. storeInfo.account > 0 &&
  16. parseFloat(storeInfo.account) >= parseFloat(withdrawConfig.withdraw_least)
  17. " @click="applyWithdraw">
  18. 申请结算
  19. </button>
  20. </view>
  21. </view>
  22. <view class="uni-flex uni-row sub-bottom">
  23. <view class="account-item" @click="$util.redirectTo('/pages/store/settlement_record')">
  24. <view class="account-title">打款中金额(元)</view>
  25. <view class="money">
  26. {{ storeInfo.account_apply | moneyFormat }}
  27. <text class="iconfont iconqianhou2"></text>
  28. </view>
  29. </view>
  30. <view class="account-item" @click="$util.redirectTo('/pages/store/settlement_record')">
  31. <view class="account-title">已打款金额(元)</view>
  32. <view class="money">
  33. {{ storeInfo.account_withdraw | moneyFormat }}
  34. <text class="iconfont iconqianhou2"></text>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="info-wrap">
  40. <view class="head-title">结算账户</view>
  41. <view class="info-content">
  42. <block v-if="storeInfo.is_settlement == 1 && withdrawConfig.is_settlement == 1">
  43. <view class="info-text">
  44. 结算方式:
  45. <text>总部收款,</text>
  46. <text v-if="withdrawConfig.period_type == 1">每日自动结算</text>
  47. <text v-if="withdrawConfig.period_type == 2">每周自动结算</text>
  48. <text v-if="withdrawConfig.period_type == 3">每月自动结算</text>
  49. <text v-if="withdrawConfig.period_type == 4">门店申请结算</text>
  50. </view>
  51. <view class="info-text">账户类型:{{ bankType[storeInfo.bank_type] }}</view>
  52. <block v-if="storeInfo.bank_type == 1">
  53. <view class="info-text">微信名:{{ storeInfo.bank_user_name }}</view>
  54. </block>
  55. <block v-if="storeInfo.bank_type == 2">
  56. <view class="info-text">真实姓名:{{ storeInfo.bank_user_name }}</view>
  57. <view class="info-text">支付宝账号:{{ storeInfo.bank_type_account }}</view>
  58. </block>
  59. <block v-if="storeInfo.bank_type == 3">
  60. <view class="info-text">开户行:{{ storeInfo.bank_type_name }}</view>
  61. <view class="info-text">户头:{{ storeInfo.bank_user_name }}</view>
  62. <view class="info-text">账户:{{ storeInfo.bank_type_account }}</view>
  63. </block>
  64. </block>
  65. <view class="empty" v-else>无需结算</view>
  66. </view>
  67. </view>
  68. </view>
  69. <view class="settlement-record uni-flex uni-column">
  70. <view class="head-title">结算记录</view>
  71. <view class="record-wrap common-scrollbar">
  72. <uni-data-table url="/store/storeapi/withdraw/page" :cols="cols" ref="table" :pagesize="8">
  73. <template v-slot:action="data">
  74. <view class="common-table-action"><text @click="detail(data)">查看详情</text></view>
  75. </template>
  76. </uni-data-table>
  77. </view>
  78. </view>
  79. </view>
  80. <uni-popup ref="applyWithdraw" type="center">
  81. <view class="apply-withdraw">
  82. <view class="title">
  83. 本次可结算金额为
  84. <text class="money" v-if="storeInfo">{{ storeInfo.account | moneyFormat }}</text>
  85. 元,是否申请结算?
  86. </view>
  87. <view class="btn">
  88. <button type="primary" class="primary-btn btn" @click="apply">确定</button>
  89. <button type="primary" class="default-btn btn save" @click="$refs.applyWithdraw.close()">取消</button>
  90. </view>
  91. </view>
  92. </uni-popup>
  93. <uni-popup ref="detailPopup">
  94. <view class="pop-box">
  95. <view class="pop-header">
  96. <view class="pop-header-text">结算详情</view>
  97. <view class="pop-header-close" @click="$refs.detailPopup.close()">
  98. <text class="iconguanbi1 iconfont"></text>
  99. </view>
  100. </view>
  101. <view class="pop-content common-scrollbar" v-if="withdrawDetail">
  102. <view class="pop-content-item">
  103. <view class="pop-content-text">结算信息</view>
  104. <view class="pop-contents-text">结算编号:{{ withdrawDetail.withdraw_no }}</view>
  105. <view class="pop-contents-text">结算状态:{{ withdrawDetail.status_name }}</view>
  106. <view class="pop-contents-text" v-if="withdrawDetail.status == -1">
  107. 拒绝理由:{{ withdrawDetail.refuse_reason }}</view>
  108. <view class="pop-contents-text">结算金额:{{ withdrawDetail.money | moneyFormat }}</view>
  109. <view class="pop-contents-text">结算方式:{{ withdrawDetail.transfer_type_name }}</view>
  110. <view class="pop-contents-text">结算类型:{{ withdrawDetail.settlement_type_name }}</view>
  111. <view class="pop-contents-text">结算申请时间:{{ withdrawDetail.apply_time | timeFormat }}</view>
  112. <view class="pop-contents-text" v-if="withdrawDetail.transfer_type == 'bank'">
  113. 银行名称:{{ withdrawDetail.bank_name }}</view>
  114. <view class="pop-contents-text">结算收款账号:{{ withdrawDetail.account_number }}</view>
  115. <view class="pop-contents-text">结算方式:{{ withdrawDetail.transfer_type_name }}</view>
  116. <view class="pop-contents-text">真实姓名:{{ withdrawDetail.realname }}</view>
  117. </view>
  118. <view class="pop-content-item" v-if="withdrawDetail.settlement_type != 'apply'">
  119. <view class="pop-content-text">周期结算</view>
  120. <view class="pop-contents-text">周期结算编号:{{ withdrawDetail.settlement_info.settlement_no }}</view>
  121. <view class="pop-contents-text">周期开始时间:{{ withdrawDetail.settlement_info.start_time }}</view>
  122. <view class="pop-contents-text">周期结束时间:{{ withdrawDetail.settlement_info.end_time }}</view>
  123. <view class="pop-contents-text">结算订单总额:{{ withdrawDetail.settlement_info.order_money }}</view>
  124. <view class="pop-contents-text">结算总分销佣金:{{ withdrawDetail.settlement_info.commission }}</view>
  125. </view>
  126. </view>
  127. </view>
  128. </uni-popup>
  129. </base-page>
  130. </template>
  131. <script>
  132. export default {
  133. data() {
  134. return {
  135. bankType: {
  136. 1: '微信',
  137. 2: '支付宝',
  138. 3: '银行卡'
  139. },
  140. withdrawConfig: {
  141. is_settlement: 0
  142. },
  143. cols: [{
  144. width: 12,
  145. title: '结算方式', // 标题
  146. field: 'transfer_type_name', // 字段名
  147. align: 'left'
  148. },
  149. {
  150. width: 12,
  151. title: '结算类型', // 标题
  152. field: 'settlement_type_name', // 字段名
  153. align: 'left'
  154. },
  155. {
  156. width: 12,
  157. title: '结算金额', // 标题
  158. align: 'left',
  159. return: data => {
  160. return this.$util.moneyFormat(data.money);
  161. }
  162. },
  163. {
  164. width: 12,
  165. title: '结算状态', // 标题
  166. field: 'status_name'
  167. },
  168. {
  169. width: 15,
  170. title: '申请时间',
  171. align: 'center',
  172. return: data => {
  173. return data.apply_time ? this.$util.timeFormat(data.apply_time) : '';
  174. }
  175. },
  176. {
  177. width: 15,
  178. title: '转账时间',
  179. align: 'center',
  180. return: data => {
  181. return data.transfer_time ? this.$util.timeFormat(data.transfer_time) : '';
  182. }
  183. },
  184. {
  185. width: 15,
  186. title: '操作',
  187. action: true, // 表格操作列
  188. align: 'right'
  189. }
  190. ],
  191. isRepeat: false,
  192. withdrawDetail: null
  193. };
  194. },
  195. onShow() {
  196. this.$store.dispatch('getStoreInfo');
  197. },
  198. onLoad() {
  199. this.getWithdrawConfig();
  200. },
  201. methods: {
  202. switchStoreAfter() {
  203. this.$refs.table.load();
  204. },
  205. getWithdrawConfig() {
  206. this.$api.sendRequest({
  207. url: '/store/storeapi/store/withdrawconfig',
  208. success: res => {
  209. if (res.code == 0) {
  210. this.withdrawConfig = res.data;
  211. }
  212. }
  213. });
  214. },
  215. applyWithdraw() {
  216. this.$refs.applyWithdraw.open();
  217. },
  218. apply() {
  219. if (this.isRepeat) return;
  220. this.isRepeat = true;
  221. this.$api.sendRequest({
  222. url: '/store/storeapi/withdraw/apply',
  223. data: {
  224. money: this.storeInfo.account
  225. },
  226. success: res => {
  227. if (res.code == 0) {
  228. this.$store.dispatch('getStoreInfo');
  229. this.$refs.applyWithdraw.close();
  230. this.$refs.table.load();
  231. setTimeout(() => {
  232. this.isRepeat = false;
  233. }, 500);
  234. } else {
  235. this.isRepeat = false;
  236. this.$util.showToast({
  237. title: res.message
  238. });
  239. }
  240. }
  241. });
  242. },
  243. detail(data) {
  244. this.$api.sendRequest({
  245. url: '/store/storeapi/withdraw/detail',
  246. data: {
  247. withdraw_id: data.value.withdraw_id
  248. },
  249. success: res => {
  250. if (res.code == 0) {
  251. this.withdrawDetail = res.data;
  252. this.$refs.detailPopup.open('center');
  253. }
  254. }
  255. });
  256. }
  257. }
  258. };
  259. </script>
  260. <style lang="scss">
  261. .page-height {
  262. height: 100%;
  263. }
  264. .account-wrap {
  265. flex: 1;
  266. width: 0;
  267. padding: 0.15rem;
  268. margin-right: 0.15rem;
  269. background: #fff;
  270. .head-title {
  271. font-size: 0.16rem;
  272. }
  273. .account-item {
  274. padding: 0.2rem 0;
  275. cursor: pointer;
  276. .account-title {
  277. font-size: 0.14rem;
  278. color: #aaa;
  279. }
  280. .money {
  281. font-size: 0.2rem;
  282. font-weight: bold;
  283. margin-top: 0.15rem;
  284. display: flex;
  285. align-items: center;
  286. .iconqianhou2 {
  287. line-height: 1;
  288. color: #bbb;
  289. margin-left: 0.05rem;
  290. }
  291. }
  292. .operation {
  293. margin-top: 0.3rem;
  294. button {
  295. display: inline-block;
  296. margin-right: 0.1rem;
  297. width: auto;
  298. min-width: 0.8rem;
  299. }
  300. }
  301. }
  302. .sub-bottom {
  303. border-top: 0.01rem solid #f5f5f5;
  304. .account-item {
  305. flex: 1;
  306. }
  307. }
  308. }
  309. .info-wrap {
  310. width: 30vw;
  311. padding: 0.15rem;
  312. background: #fff;
  313. .head-title {
  314. font-size: 0.16rem;
  315. }
  316. .info-content {
  317. margin-top: 0.2rem;
  318. .info-text {
  319. margin-bottom: 0.1rem;
  320. }
  321. }
  322. .empty {
  323. padding: 1rem;
  324. text-align: center;
  325. .operation {
  326. color: $primary-color;
  327. cursor: pointer;
  328. }
  329. }
  330. }
  331. .settlement-record {
  332. padding: 0.15rem;
  333. flex: 1;
  334. height: 0;
  335. margin: 0.15rem 0;
  336. background: #fff;
  337. .head-title {
  338. font-size: 0.16rem;
  339. }
  340. .record-wrap {
  341. padding-top: 0.15rem;
  342. flex: 1;
  343. height: 0;
  344. overflow-y: scroll;
  345. }
  346. }
  347. .pop-box {
  348. background: #ffffff;
  349. width: 5rem;
  350. height: 60vh;
  351. display: flex;
  352. flex-direction: column;
  353. .pop-header {
  354. width: 100%;
  355. padding: 0 0.15rem 0 0.2rem;
  356. height: 0.5rem;
  357. // width: 3.5rem;
  358. margin: 0 auto;
  359. line-height: 0.5rem;
  360. border-bottom: 0.01rem solid #f0f0f0;
  361. font-size: 0.14rem;
  362. color: #333;
  363. overflow: hidden;
  364. border-radius: 0.02rem 0.2rem 0 0;
  365. box-sizing: border-box;
  366. display: flex;
  367. justify-content: space-between;
  368. .pop-header-text {
  369. font-weight: 900;
  370. color: #567485;
  371. }
  372. .pop-header-close {
  373. cursor: pointer;
  374. i {
  375. font-size: 0.18rem;
  376. }
  377. }
  378. }
  379. .pop-content {
  380. flex: 1;
  381. height: 0;
  382. padding: 0.1rem 0.2rem;
  383. box-sizing: border-box;
  384. color: #567485;
  385. font-weight: 900;
  386. overflow-y: scroll;
  387. }
  388. .pop-contents {
  389. margin-top: 0.3rem;
  390. width: 3rem;
  391. height: 0.8rem;
  392. padding: 0.1rem 0.2rem;
  393. box-sizing: border-box;
  394. color: #567485;
  395. font-weight: 900;
  396. display: flex;
  397. flex-direction: column;
  398. flex-wrap: wrap;
  399. justify-content: space-between;
  400. }
  401. .pop-content-item {
  402. margin-left: 0.3rem;
  403. }
  404. .pop-content-items {
  405. margin-left: 0.3rem;
  406. }
  407. .pop-content-text {
  408. padding: 0.1rem;
  409. }
  410. .pop-contents-text {
  411. margin-left: 0.4rem;
  412. font-weight: normal;
  413. padding: 0.1rem;
  414. }
  415. .pop-contentss-text {
  416. margin-left: 0.8rem;
  417. font-weight: normal;
  418. color: rgb(197, 209, 216);
  419. }
  420. }
  421. .apply-withdraw {
  422. width: 3.8rem;
  423. border-radius: 0.06rem;
  424. background: #ffffff;
  425. padding: 0.6rem 0.15rem 0.2rem 0.15rem;
  426. box-sizing: border-box;
  427. .title {
  428. font-size: 0.16rem;
  429. text-align: center;
  430. }
  431. .money {
  432. font-weight: bold;
  433. font-size: 0.16rem;
  434. }
  435. .btn {
  436. width: 100%;
  437. display: flex;
  438. align-items: center;
  439. justify-content: center;
  440. margin-top: 0.3rem;
  441. .btn {
  442. width: auto;
  443. height: auto;
  444. padding: 0 0.3rem;
  445. margin: 0;
  446. height: 0.35rem;
  447. }
  448. .btn:last-child {
  449. margin-left: 0.2rem;
  450. }
  451. }
  452. }
  453. </style>