index.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614
  1. <?php
  2. ?>
  3. <style>
  4. @media screen and (max-width: 1370px) {
  5. #stat_pay {
  6. min-width: 1131px;
  7. }
  8. }
  9. .order_stat {
  10. background: #FFF;
  11. padding: 10px 10px 0;
  12. margin-bottom: 10px;
  13. }
  14. .title {
  15. font-size: 18px;
  16. font-weight: bold;
  17. display: flex;
  18. align-items: center;
  19. height: 40px;
  20. }
  21. .order_stat>.title>.time {
  22. font-size: 13px;
  23. font-weight: 400;
  24. color: #BFBFBF;
  25. margin-left: 20px;
  26. flex: 1;
  27. }
  28. .order_stat .stat_details {
  29. padding: 10px 0;
  30. display: flex;
  31. }
  32. .stat_details .order_module {
  33. flex: 1;
  34. background: #F2F2F2;
  35. margin: 0 5px;
  36. padding: 20px 25px;
  37. }
  38. .order_module {
  39. display: flex;
  40. flex-direction: column;
  41. }
  42. .order_module:last-child {
  43. margin-right: 0;
  44. }
  45. .order_module:first-child {
  46. margin-left: 0;
  47. }
  48. .price {
  49. font-size: 22px;
  50. font-weight: bold;
  51. flex: 1;
  52. word-break: break-all;
  53. }
  54. .oirder_modul_title {
  55. font-size: 12px;
  56. margin: 10px 0;
  57. /* display: flex;
  58. align-items: center; */
  59. }
  60. .oirder_modul_title .text {
  61. margin-right: 10px;
  62. }
  63. .stat_icon {
  64. font-size: 19px;
  65. color: #BFBFBF;
  66. }
  67. .total {
  68. display: flex;
  69. margin-bottom: 10px;
  70. }
  71. .pay_total {
  72. flex: 1;
  73. flex-basis: 764px;
  74. background: #FFF;
  75. padding: 10px 10px 15px;
  76. }
  77. .pay_total:last-child {
  78. margin-left: 12px;
  79. }
  80. .el-date-editor .el-range-separator {
  81. padding: 0;
  82. }
  83. .pay_modules {
  84. margin-top: 20px;
  85. display: flex;
  86. flex-wrap: wrap;
  87. }
  88. .module {
  89. /* width: 350px; */
  90. width: 46%;
  91. background: #F7F7F7;
  92. padding: 20px 25px;
  93. margin-bottom: 15px;
  94. display: flex;
  95. }
  96. .module_two {
  97. width: 33%;
  98. background: #F7F7F7;
  99. padding: 20px 25px;
  100. margin-bottom: 15px;
  101. display: flex;
  102. }
  103. .module:nth-child(2n) {
  104. margin-left: 30px
  105. }
  106. .no_open {
  107. flex: 1;
  108. color: #2E8FF4;
  109. display: flex;
  110. align-items: center;
  111. justify-content: flex-end;
  112. }
  113. .pay_button {
  114. display: flex;
  115. border: 1px solid #2E8FF4;
  116. border-radius: 4px;
  117. color: #464646;
  118. }
  119. .pay_button div {
  120. background: #FFF;
  121. padding: 10px;
  122. font-size: 14px;
  123. font-weight: 500;
  124. width: 80px;
  125. height: 36px;
  126. border-radius: 4px;
  127. text-align: center;
  128. }
  129. .assets {
  130. color: #848484;
  131. }
  132. .data_chart {
  133. background: #FFF;
  134. padding: 10px 10px 15px;
  135. width: 100%;
  136. position: relative;
  137. /* display: flex; */
  138. }
  139. .data_chart_time {
  140. position: absolute;
  141. top: 10px;
  142. right: 50px;
  143. display: flex;
  144. font-size: 16px;
  145. }
  146. .sel_time {
  147. margin-right: 20px;
  148. padding-bottom: 5px;
  149. }
  150. .sel_time:hover {
  151. cursor: pointer
  152. }
  153. .sel_color {
  154. border-bottom: 2px solid #5ED9A9;
  155. }
  156. .top_title {
  157. display: flex;
  158. padding: 18px 0;
  159. background-color: white;
  160. margin: 10px 0;
  161. align-items: center;
  162. }
  163. .top_title div:nth-of-type(1) {
  164. padding: 0 30px 0 20px;
  165. font-weight: bold;
  166. font-size: 16px;
  167. }
  168. .div_text_center {
  169. text-align: center;
  170. }
  171. .table-body {
  172. padding: 20px;
  173. background-color: #fff;
  174. }
  175. .input-item {
  176. display: inline-block;
  177. width: 250px;
  178. margin: 0 0 20px 20px;
  179. }
  180. .input-item .el-input__inner {
  181. height: 32px;
  182. line-height: 32px;
  183. font-size: 12px;
  184. }
  185. .input-item .el-input__inner:hover {
  186. border: 1px solid #dcdfe6;
  187. /* outline: 0; */
  188. }
  189. .input-item .el-input__inner:focus {
  190. border: 1px solid #dcdfe6;
  191. /* outline: 0; */
  192. }
  193. .input-item .el-input-group__append {
  194. background-color: #fff;
  195. width: 10%;
  196. padding: 0;
  197. }
  198. .input-item .el-input-group__append .el-button {
  199. padding: 0;
  200. }
  201. .input-item .el-input-group__append .el-button {
  202. margin: 0;
  203. }
  204. .table-info-img {
  205. max-width: 50px !important;
  206. }
  207. .table-body .el-input__icon{
  208. line-height: 32px;
  209. }
  210. </style>
  211. <div id="stat_pay" v-cloak>
  212. <div class="top_title">
  213. <div>嗨贝明细</div>
  214. </div>
  215. <div class="order_stat">
  216. <div class="stat_details">
  217. <div class="order_module" v-for="(item,index) in dataOverview" :key="item.type">
  218. <div class="price div_text_center">
  219. {{item.value}}
  220. </div>
  221. <div class="oirder_modul_title">
  222. <div class="div_text_center">{{item.name}}</div>
  223. </div>
  224. </div>
  225. </div>
  226. </div>
  227. <div class="table-body">
  228. <div class="input-item" v-if="!user_id">
  229. <el-input @keyup.enter.native="search" size="small" placeholder="请输入会员ID" v-model="searchData.user_id" clearable @clear="search">
  230. </el-input>
  231. </div>
  232. <div class="input-item">
  233. <el-input @keyup.enter.native="search" size="small" placeholder="请输入昵称/手机号" v-model="searchData.keyword" clearable @clear="search">
  234. </el-input>
  235. </div>
  236. <div class="input-item">
  237. <el-input @keyup.enter.native="search" size="small" placeholder="备注" v-model="searchData.remark" clearable>
  238. </el-input>
  239. </div>
  240. <div class="input-item">
  241. <template>
  242. <el-select v-model="searchData.change_type" placeholder="请选择类型" clearable @change="search" @clear="search">
  243. <el-option v-for="item in options" :key="item.name" :label="item.label" :value="item.name">
  244. </el-option>
  245. </el-select>
  246. </template>
  247. </div>
  248. <div class="input-item">
  249. <template>
  250. <el-select v-model="searchData.from_type" placeholder="请选择业务类型" clearable @change="search" @clear="search">
  251. <el-option v-for="(item, index) in from_type_config" :key="index" :label="item" :value="index">
  252. </el-option>
  253. </el-select>
  254. </template>
  255. </div>
  256. <div class="input-item">
  257. <el-button type="primary" size="small" icon="el-icon-search" @click="search" class="search_button">搜索</el-button>
  258. </div>
  259. <el-table :data="form" stripe style="width: 100%" v-loading="listLoading">
  260. <el-table-column prop="user_id" label="会员ID" min-width="100" align="center"></el-table-column>
  261. <el-table-column label="用户信息" min-width="180">
  262. <template slot-scope="scope">
  263. <div style="display:flex;align-items:center;">
  264. <el-image class="table-info-img circle" :src="scope.row.user.avatar_url">
  265. <div slot="error" class="image-slot">
  266. <com-image src="/resources/img/common/default-avatar.png"></com-image>
  267. </div>
  268. </el-image>
  269. <div style="padding-left:8px;">
  270. <div class="over2" v-if="scope.row.user.nickname">{{scope.row.user.nickname}}</div>
  271. <div>{{scope.row.user.mobile}}</div>
  272. </div>
  273. </div>
  274. </template>
  275. </el-table-column>
  276. <el-table-column prop="from_type" label="业务类型">
  277. </el-table-column>
  278. <el-table-column prop="scope" label="收入/支出">
  279. <template slot-scope="scope">
  280. <div v-if="scope.row.change_type == 'add'">
  281. <span style="color:#5ED9A9">{{'+'+scope.row.change_num}}</span>
  282. </div>
  283. <div v-else>
  284. <span style="color:red">{{'-'+scope.row.change_num}}</span>
  285. </div>
  286. </template>
  287. </el-table-column>
  288. <el-table-column prop="before_num" label="变动前嗨贝">
  289. </el-table-column>
  290. <el-table-column prop="after_num" label="变动后嗨贝">
  291. </el-table-column>
  292. <el-table-column prop="desc" label="备注">
  293. </el-table-column>
  294. <el-table-column label="创建时间" align="center">
  295. <template slot-scope="scope">
  296. {{scope.row.created_at|dateTimeFormat('Y-m-d H:i:s')}}
  297. </template>
  298. </el-table-column>
  299. <el-table-column label="操作" width="250" align="center">
  300. <template slot-scope="scope">
  301. <el-button circle size="small" type="text" @click="recharge(scope.row.user_id)">充值</el-button>
  302. </template>
  303. </el-table-column>
  304. </el-table>
  305. <!--工具条 批量操作和分页-->
  306. <el-col :span="24" class="toolbar">
  307. <div style="height:20px;"></div>
  308. <el-pagination background layout="prev, pager, next" @current-change="pageChange" :page-count="pageCount" style="float:right;margin:15px">
  309. </el-col>
  310. </div>
  311. <el-dialog :title="'充值嗨贝'" :visible.sync="dialogBalance" width="30%" @close="closePop" center>
  312. <el-form :model="balanceForm" label-width="100px" ref="integralForm">
  313. <el-form-item prop="price" size="small">
  314. <el-col :span="4">
  315. <label>嗨呗数额</label>
  316. </el-col>
  317. <el-col :span="12">
  318. <el-input type="number" v-model="balanceForm.price" placeholder="请输入要加/减的嗨呗(-1代表减1嗨呗)"></el-input>
  319. </el-col>
  320. </el-form-item>
  321. <el-form-item prop="remark" size="small">
  322. <el-col :span="4">
  323. <label>备注</label>
  324. </el-col>
  325. <el-col :span="12">
  326. <el-input type="textarea" v-model="balanceForm.remark"></el-input>
  327. </el-col>
  328. </el-form-item>
  329. </el-form>
  330. <div slot="footer" class="dialog-footer">
  331. <el-button @click="dialogBalance = false" style="padding:8px 18px;font-size:13px;">取消</el-button>
  332. <el-button :loading="btnLoading" type="primary" style="padding:8px 16px;font-size:13px;" @click="balanceSubmit">确定</el-button>
  333. </div>
  334. </el-dialog>
  335. </div>
  336. <script>
  337. new Vue({
  338. el: '#stat_pay',
  339. data() {
  340. return {
  341. options: [{
  342. label: '增加',
  343. name: 'add'
  344. },
  345. {
  346. label: '减少',
  347. name: 'sub'
  348. },
  349. ],
  350. from_type_config:[],
  351. dialogBalance: false,
  352. btnLoading: false,
  353. balanceForm: {
  354. price: 0,
  355. remark: '',
  356. user_id: 0,
  357. wallet_type: 'hi_bei'
  358. },
  359. searchData: {
  360. keyword: '',
  361. user_id: null,
  362. remark: '',
  363. // date: '',
  364. start_date: '',
  365. end_at: '',
  366. change_type: '',
  367. from_type:'',
  368. },
  369. listLoading: false,
  370. user_id: null, // 外部链接传递进来的 user_id
  371. pageCount: 0,
  372. form: [],
  373. update_order_time: '',
  374. order_time: [],
  375. buttonType: 1,
  376. user_total: null,
  377. order_total: null,
  378. dataOverview: {
  379. "total_send_hi_bei": {
  380. type: 'total_send_hi_bei',
  381. name: '总发放嗨贝',
  382. value: '0.00',
  383. },
  384. "total_profit": {
  385. type: 'total_profit',
  386. name: '让利总额',
  387. value: '0.00',
  388. },
  389. "total_deduct_hi_bei": {
  390. type: 'total_deduct_hi_bei',
  391. name: '扣除嗨贝总额',
  392. value: '0.00',
  393. },
  394. },
  395. // 会员资产
  396. memberAssets: {},
  397. chartTimeType: 0,
  398. currencyInfo: [],
  399. chartTimeArr: [],
  400. paid_amount_arr: [],
  401. settle_income_arr: [],
  402. }
  403. },
  404. mounted: function() {
  405. this.getData();
  406. this.getList();
  407. },
  408. methods: {
  409. recharge(user_id) {
  410. this.dialogBalance = true;
  411. this.balanceForm.user_id = user_id;
  412. },
  413. closePop() {
  414. this.dialogBalance = false;
  415. this.balanceForm.price = 0;
  416. this.balanceForm.remark = '';
  417. this.balanceForm.user_id = 0;
  418. this.btnLoading = false;
  419. },
  420. balanceSubmit() {
  421. this.btnLoading = true;
  422. if (this.balanceForm.price == 0) {
  423. this.$message.error('充值金额不能为0');
  424. return;
  425. }
  426. request({
  427. params: {
  428. r: 'hi-go/hi-bei/recharge',
  429. },
  430. method: 'post',
  431. data: this.balanceForm
  432. }).then(e => {
  433. if (e.data.code == 0) {
  434. this.$message.success(e.data.msg);
  435. } else {
  436. this.$message.error(e.data.msg);
  437. }
  438. this.closePop()
  439. }).catch(e => {
  440. this.$message.error(e);
  441. this.closePop()
  442. })
  443. },
  444. pageChange(currentPage) {
  445. this.page = currentPage;
  446. this.getList();
  447. },
  448. search() {
  449. this.page = 1;
  450. this.getList();
  451. },
  452. getList() {
  453. let user_id = this.user_id ? this.user_id : this.searchData.user_id;
  454. let params = {
  455. r: 'hi-go/hi-bei/index',
  456. page: this.page,
  457. date: this.date,
  458. user_id: user_id,
  459. keyword: this.searchData.keyword,
  460. type: this.searchData.change_type,
  461. from_type:this.searchData.from_type,
  462. };
  463. if (this.searchData.date) {
  464. Object.assign(params, {
  465. start_time: this.searchData.date[0],
  466. end_time: this.searchData.date[1],
  467. });
  468. }
  469. request({
  470. params,
  471. }).then(e => {
  472. if (e.data.code === 0) {
  473. this.form = e.data.data.list;
  474. this.pagination = e.data.data.pagination;
  475. this.pageSize = e.data.data.page_size;
  476. this.pageCount = e.data.data.page_count
  477. this.from_type_config = e.data.data.from_type_config;
  478. //订单概况
  479. for (let field in this.dataOverview) {
  480. if (e.data.data.orderStatistics[field]) {
  481. this.dataOverview[field]['value'] = e.data.data.orderStatistics[field];
  482. } else {
  483. this.dataOverview[field]['value'] = '0.00';
  484. }
  485. }
  486. console.log(this.pageCount);
  487. } else {
  488. this.$message.error(e.data.msg);
  489. }
  490. this.listLoading = false;
  491. }).catch(e => {
  492. this.listLoading = false;
  493. });
  494. this.listLoading = true;
  495. },
  496. getData() {
  497. let that = this;
  498. that.currencyInfo = [];
  499. //that.memberAssets = [];
  500. let date = {
  501. r: '/mall/finance/stat'
  502. }
  503. if (this.order_time) {
  504. // date.start_date = this.order_time[0];
  505. // date.end_date = this.order_time[1];
  506. date.order_time = this.order_time;
  507. }
  508. request({
  509. params: date,
  510. method: 'get',
  511. }).then(res => {
  512. if (res.data.code == 0) {
  513. that.update_order_time = res.data.data.update_time;
  514. that.order_time = res.data.data.date;
  515. //订单概况
  516. for (let field in this.orderTotalArr) {
  517. if (res.data.data.orderStatistics[field]) {
  518. this.orderTotalArr[field]['value'] = res.data.data.orderStatistics[field];
  519. } else {
  520. this.orderTotalArr[field]['value'] = '0.00';
  521. }
  522. }
  523. //支付统计
  524. that.rechargeArr = res.data.data.payment_data;
  525. }
  526. }).catch(e => {
  527. });
  528. },
  529. upButton(type) {
  530. if (this.butbuttonType == type) {
  531. return;
  532. }
  533. this.buttonType = type;
  534. this.memberAssets = [];
  535. if (type == 2) {
  536. this.memberAssets.push(...this.currencyInfo);
  537. } else {
  538. }
  539. },
  540. updateOrderTime(v) {
  541. this.order_time = v;
  542. this.getData();
  543. },
  544. }
  545. })
  546. </script>