index.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  1. <?php
  2. use common\helpers\ComponentHelper;
  3. ComponentHelper::loadComponentView('com-image');
  4. ComponentHelper::loadComponentView('com-export-dialog', '@backend/views/components/common');
  5. ?>
  6. <div id="app" v-cloak>
  7. <div class="order_stat">
  8. <div class="title">
  9. <span>数字币明细</span>
  10. <!-- <com-export-dialog :field_list='exportList' :action_url="export_url" :params="searchData" @selected="exportConfirm"></com-export-dialog>-->
  11. </div>
  12. <div class="stat_details">
  13. <div class="order_module" v-for="(item,index) in orderTotalArr" :key="item.type">
  14. <div class="oirder_modul_title">
  15. <div class="text">{{item.name}}</div>
  16. <el-tooltip class="item" effect="dark" v-if="item.prompt" :content="item.prompt" placement="bottom">
  17. <i class="el-icon-question stat_icon"></i>
  18. </el-tooltip>
  19. </div>
  20. <div class="price">
  21. {{item.value}}
  22. </div>
  23. </div>
  24. </div>
  25. </div>
  26. <el-card shadow="never" style="border:0;min-width: 800px;">
  27. <template>
  28. <el-tabs v-model="actionName" type="card" @tab-click="change_tab">
  29. <el-tab-pane label="已结算" name="settlement">
  30. </el-tab-pane>
  31. <el-tab-pane label="未结算" name="noSettlement">
  32. </el-tab-pane>
  33. </el-tabs>
  34. </template>
  35. <div class="input-item">
  36. <el-input @keyup.enter.native="search" size="small" placeholder="请输入会员id" v-model="searchData.user_id" clearable>
  37. </el-input>
  38. </div>
  39. <div class="input-item">
  40. <el-input @keyup.enter.native="search" size="small" placeholder="会员昵称/手机号" v-model="searchData.keyword" clearable>
  41. </el-input>
  42. </div>
  43. <div class="input-item">
  44. <el-input @keyup.enter.native="search" size="small" placeholder="请输入订单号" v-model="searchData.order_no" clearable>
  45. </el-input>
  46. </div>
  47. <el-date-picker size="small" style="margin-top: 1px; float: left" @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']"></el-date-picker>
  48. <div class="input-item">
  49. <el-input @keyup.enter.native="search" size="small" placeholder="备注" v-model="searchData.remark" clearable>
  50. </el-input>
  51. </div>
  52. <el-select size="small" v-model="searchData.capital_type" @change='search' class="select">
  53. <el-option key="all" label="业务类型" value=""></el-option>
  54. <el-option :key="index" :label="item" :value="index" v-for="(item, index) in incomeCapitalTypeList"></el-option>
  55. </el-select>
  56. <div class="input-item">
  57. <el-button type="primary" size="small" icon="el-icon-search" @click="search" class="search_button">搜索</el-button>
  58. </div>
  59. <el-table :data="form" stripe style="width: 100%" v-loading="listLoading">
  60. <el-table-column prop="user.id" label="会员ID" min-width="100" align="center"></el-table-column>
  61. <el-table-column label="会员" width="200">
  62. <template slot-scope="scope">
  63. <div class="table-info-img-text">
  64. <el-image v-if="scope.row.user" class="table-info-img circle" :src="scope.row.user.avatar_url">
  65. <div slot="error" class="image-slot">
  66. <com-image src="/resources/img/common/default-avatar.png"></com-image>
  67. </div>
  68. </el-image>
  69. <div class="table-info-text">
  70. <div v-if="scope.row.user">{{scope.row.user.nickname}}</div>
  71. <div v-if="scope.row.user">{{scope.row.user.mobile}}</div>
  72. </div>
  73. </div>
  74. </template>
  75. </el-table-column>
  76. <el-table-column label="业务类型" min-width="200" align="center">
  77. <template slot-scope="scope">
  78. <div v-if="scope.row.source_text">{{scope.row.source_text}}</div>
  79. </template>
  80. </el-table-column>
  81. <el-table-column label="收入/支出" min-width="150" align="center">
  82. <template slot-scope="scope">
  83. <div style="font-size: 18px;color: #68CF3D" v-if="scope.row.change_type == 'add'">+{{scope.row.change_num}}</div>
  84. <div style="font-size: 18px;color: #F6AA5A" v-if="scope.row.change_type == 'sub'">{{ -Math.abs(scope.row.change_num)}}</div>
  85. </template>
  86. </el-table-column>
  87. <el-table-column prop="current_num" label="变动前数字币" min-width="150" align="center">
  88. <template slot-scope="scope">
  89. {{parseFloat(scope.row.current_num)}}
  90. </template>
  91. </el-table-column>
  92. <el-table-column prop="current_num" label="变动后数字币" min-width="150" align="center">
  93. <template slot-scope="scope">
  94. <div v-if="scope.row.change_type == 'add'">{{Number((scope.row.current_num + scope.row.change_num)).toFixed(2)}}</div>
  95. <div v-if="scope.row.change_type == 'sub'">{{Number((scope.row.current_num - scope.row.change_num)).toFixed(2)}}</div>
  96. </template>
  97. </el-table-column>
  98. <el-table-column prop="desc" label="备注" min-width="200"></el-table-column>
  99. <el-table-column prop="scope" min-width="180" label="创建时间" align="center">
  100. <template slot-scope="scope">
  101. {{scope.row.created_at|dateTimeFormat('Y-m-d H:i:s')}}
  102. </template>
  103. </el-table-column>
  104. </el-table>
  105. <!--工具条 批量操作和分页-->
  106. <el-col :span="24" class="toolbar">
  107. <el-input v-model="page" placeholder="" size="small" @keyup.enter.native="pageSearch" style="width:50px; margin-top: 100px; float: right; text-align: center; margin-top: 15px; padding: 0;"></el-input>
  108. <el-pagination v-if="pagination" style="display: inline-block;" background @current-change="pageChange" layout="prev, pager, next" :page-count="pageCount">
  109. </el-pagination>
  110. </el-col>
  111. </el-card>
  112. </div>
  113. <script>
  114. const app = new Vue({
  115. el: '#app',
  116. data() {
  117. return {
  118. searchData: {
  119. keyword: '',
  120. date: '',
  121. start_date: '',
  122. end_at: '',
  123. user_id: '',
  124. order_no: '',
  125. remark: '',
  126. capital_type: '',
  127. },
  128. exportList: {},
  129. export_url: 'mall/finance/score-log',
  130. status: 1,
  131. actionName: 'settlement',
  132. incomeCapitalTypeList: [],
  133. date: '',
  134. keyword: '',
  135. user_id: '',
  136. remark: '',
  137. capital_type: '',
  138. form: [],
  139. page: 1,
  140. pageCount: 0,
  141. pagination: null,
  142. listLoading: false,
  143. scoreFromTypeList: [],
  144. orderTotalArr: [{
  145. type: 'score',
  146. name: '总发放金豆',
  147. value: '0.00',
  148. prompt: '平台全部发放的金豆',
  149. }, {
  150. type: 'score_no_used',
  151. name: '待结算金豆',
  152. value: '0.00',
  153. prompt: '待结算的金豆',
  154. }, {
  155. type: 'score_used',
  156. name: '已使用',
  157. value: '0.00',
  158. prompt: '所有会员总共使用的金豆',
  159. }, ]
  160. };
  161. },
  162. methods: {
  163. exportConfirm() {
  164. this.search.status = this.status
  165. },
  166. pageChange(currentPage) {
  167. this.page = currentPage;
  168. this.getList();
  169. },
  170. pageSearch() {
  171. this.page_count = 1;
  172. this.getList();
  173. },
  174. search() {
  175. this.page = 1;
  176. if (this.date == null) {
  177. this.date = ''
  178. }
  179. this.getList();
  180. },
  181. selectDateTime(e) {
  182. this.searchData.date = e;
  183. this.page = 1;
  184. this.search();
  185. },
  186. getList() {
  187. let params = {
  188. r: 'mall/digital/index',
  189. page: this.page,
  190. date: this.searchData.date,
  191. user_id: this.searchData.user_id,
  192. order_no: this.searchData.order_no,
  193. keyword: this.searchData.keyword,
  194. desc: this.searchData.remark,
  195. capital_type: this.searchData.capital_type,
  196. status: this.status
  197. };
  198. request({
  199. params,
  200. }).then(e => {
  201. if (e.data.code === 0) {
  202. this.form = e.data.data.list;
  203. this.searchData.date = e.data.data.date;
  204. this.pagination = e.data.data.pagination;
  205. if (this.page_count != 1) this.pageCount = e.data.data.page_count;
  206. this.currentPage = parseInt(this.page);
  207. this.incomeCapitalTypeList = e.data.data.incomeCapitalTypeList;
  208. this.pageCount = e.data.data.page_count;
  209. this.exportList = e.data.data.export_list;
  210. for (const key in e.data.data.total) {
  211. let info = this.orderTotalArr.filter(v => v.type == key); //订单概况
  212. if (info.length) {
  213. let index = this.orderTotalArr.findIndex(v => v.type == info[0].type);
  214. this.orderTotalArr[index].value = Number(e.data.data.total[key]).toFixed(2);
  215. }
  216. }
  217. } else {
  218. if (e.data.msg == 'User Id必须是整数。') {
  219. e.data.msg = '会员id必须是整数';
  220. }
  221. this.$message.error(e.data.msg);
  222. }
  223. this.listLoading = false;
  224. }).catch(e => {
  225. this.listLoading = false;
  226. });
  227. this.listLoading = true;
  228. },
  229. change_tab(tab, event) {
  230. for (let i in this.searchData) {
  231. this.searchData[i] = '';
  232. }
  233. if (tab.name == 'settlement') {
  234. this.searchData['status'] = 1;
  235. this.status = 1;
  236. } else {
  237. this.searchData['status'] = 9;
  238. this.status = 9;
  239. }
  240. this.search();
  241. },
  242. exportData() {
  243. let self = this;
  244. self.listLoading = true;
  245. request({
  246. params: {
  247. r: 'mall/finance/score-log',
  248. date: this.searchData.date,
  249. user_id: this.searchData.user_id,
  250. order_no: this.searchData.order_no,
  251. keyword: this.searchData.keyword,
  252. desc: this.searchData.remark,
  253. capital_type: this.searchData.capital_type,
  254. status: this.status,
  255. flag: 'EXPORT'
  256. },
  257. }).then(e => {
  258. if (e.data.code == 0) {
  259. this.$message.success(e.data.msg);
  260. } else {
  261. this.$message.error(e.data.msg);
  262. }
  263. self.listLoading = false;
  264. }).catch(e => {
  265. self.listLoading = false;
  266. });
  267. }
  268. },
  269. mounted: function() {
  270. this.searchData.user_id = getQuery('user_id');
  271. this.getList();
  272. }
  273. });
  274. </script>
  275. <style>
  276. .table-body {
  277. padding: 20px;
  278. background-color: #fff;
  279. }
  280. .input-item {
  281. display: inline-block;
  282. width: 250px;
  283. margin: 0 0 20px 20px;
  284. }
  285. .input-item .el-input__inner:hover {
  286. border: 1px solid #dcdfe6;
  287. border-right: 0;
  288. outline: 0;
  289. }
  290. .input-item .el-input__inner:focus {
  291. border: 1px solid #dcdfe6;
  292. border-right: 0;
  293. outline: 0;
  294. }
  295. .input-item .el-input-group__append {
  296. background-color: #fff;
  297. border-left: 0;
  298. width: 10%;
  299. padding: 0;
  300. }
  301. .el-table th>.cell {
  302. color: #333;
  303. font-weight: bold;
  304. font-size: 14px;
  305. }
  306. .el-table__footer-wrapper,
  307. .el-table__header-wrapper {
  308. border-bottom: 1.4px solid #D6D6D6;
  309. }
  310. .stat_details {
  311. padding-bottom: 30px;
  312. display: flex;
  313. }
  314. .order_module {
  315. flex: 1;
  316. background: #F2F2F2;
  317. margin: 0 5px;
  318. padding: 20px 25px;
  319. }
  320. .order_module:last-child {
  321. margin-right: 0;
  322. }
  323. .order_module:first-child {
  324. margin-left: 0;
  325. }
  326. .price {
  327. font-size: 22px;
  328. font-weight: bold;
  329. }
  330. .oirder_modul_title {
  331. font-size: 12px;
  332. margin-bottom: 10px;
  333. display: flex;
  334. align-items: center;
  335. }
  336. .oirder_modul_title .text {
  337. margin-right: 10px;
  338. }
  339. .stat_icon {
  340. font-size: 19px;
  341. color: #BFBFBF;
  342. }
  343. .order_stat {
  344. background: #FFF;
  345. padding: 10px 10px 0;
  346. margin-bottom: 10px;
  347. }
  348. .title {
  349. font-size: 18px;
  350. font-weight: bold;
  351. display: flex;
  352. align-items: center;
  353. height: 40px;
  354. display: flex;
  355. justify-content: space-between;
  356. }
  357. .order_stat>.title>.time {
  358. font-size: 13px;
  359. font-weight: 400;
  360. color: #BFBFBF;
  361. margin-left: 20px;
  362. flex: 1;
  363. }
  364. .order_stat .stat_details {
  365. padding: 30px 0;
  366. display: flex;
  367. }
  368. .default-avatar {
  369. width: 50px;
  370. height: 50px;
  371. border-radius: 50%;
  372. margin-right: 8px;
  373. }
  374. .uer-nickname {
  375. flex: 1;
  376. }
  377. .user_img {
  378. position: relative;
  379. margin-right: 8px;
  380. }
  381. </style>