settlement.vue 12 KB

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