index.php 19 KB

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