index.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  1. <style>
  2. .header {
  3. padding: 18px 20px;
  4. background: #fff;
  5. margin-bottom: 10px;
  6. border-radius: 5px;
  7. border: 1px solid #EBEEF5;
  8. }
  9. .el-card {
  10. box-shadow: none !important;
  11. }
  12. .inquires_box {
  13. flex-wrap: wrap;
  14. }
  15. .condition {
  16. width: 450px;
  17. }
  18. .condition2 {
  19. margin-right: 30px;
  20. margin-bottom: 20px;
  21. }
  22. .operat_btn_list .el-button {
  23. padding: 8px 20px;
  24. }
  25. .table_box {
  26. margin-top: 10px;
  27. }
  28. .give_btn {
  29. border-radius: 5px;
  30. background: #fff;
  31. padding: 2px 0;
  32. border: 1px solid #DCDFE6;
  33. width: 80px;
  34. cursor: pointer;
  35. }
  36. .el-table .cell {
  37. /*display: flex;*/
  38. justify-content: center;
  39. }
  40. .operat1 {
  41. color: #3399FF;
  42. margin-right: 20px;
  43. cursor: pointer;
  44. }
  45. .operat2 {
  46. color: #FF336E;
  47. cursor: pointer;
  48. }
  49. .pagination_box {
  50. margin-top: 30px;
  51. justify-content: flex-end;
  52. }
  53. .types {
  54. cursor: pointer;
  55. }
  56. .coupon_type_list_box {
  57. flex-wrap: wrap;
  58. }
  59. .coupon_type_list {
  60. background: #F4F4F4;
  61. border-radius: 4px;
  62. padding: 8px 6px;
  63. width: 110px;
  64. margin-bottom: 15px;
  65. margin-right: 15px;
  66. position: relative;
  67. }
  68. /* .coupon_type_list:last-child */
  69. .coupon_type_list_box :nth-child(5n) {
  70. margin-right: 0px;
  71. }
  72. .coupon_type_title {
  73. font-size: 16px;
  74. margin-bottom: 10px;
  75. }
  76. .coupon_type_content {
  77. font-size: 12px;
  78. margin-bottom: 4px;
  79. }
  80. .coupon_type_list_expired {
  81. width: 100px;
  82. position: absolute;
  83. top: 50%;
  84. left: 50%;
  85. transform: translate(-50%, -50%);
  86. opacity: 0.2;
  87. zoom: 1.05;
  88. }
  89. .el-dialog__body {
  90. padding: 20px 20px 10px;
  91. }
  92. .switchStyle .el-switch__label {
  93. position: absolute;
  94. display: none;
  95. color: #fff;
  96. }
  97. .switchStyle .el-switch__label--left {
  98. z-index: 9;
  99. left: 6px;
  100. }
  101. .switchStyle .el-switch__label--right {
  102. z-index: 9;
  103. left: -14px;
  104. }
  105. .switchStyle .el-switch__label.is-active {
  106. display: block;
  107. }
  108. .switchStyle.el-switch .el-switch__core,
  109. .el-switch .el-switch__label {
  110. width: 56px !important;
  111. }
  112. /* 公共样式 */
  113. .flex {
  114. display: -webkit-box;
  115. display: -webkit-flex;
  116. /* #ifndef APP-NVUE */
  117. display: flex;
  118. /* #endif */
  119. }
  120. .title_bu:hover {
  121. cursor: pointer;
  122. }
  123. .flex-x-center {
  124. display: -webkit-box;
  125. display: -webkit-flex;
  126. /* #ifndef APP-NVUE */
  127. display: flex;
  128. /* #endif */
  129. -webkit-box-pack: center;
  130. -webkit-justify-content: center;
  131. -ms-flex-pack: center;
  132. justify-content: center;
  133. }
  134. .flex-x-between {
  135. display: -webkit-box;
  136. display: -webkit-flex;
  137. /* #ifndef APP-NVUE */
  138. display: flex;
  139. /* #endif */
  140. -webkit-box-pack: space-between;
  141. -webkit-justify-content: space-between;
  142. -ms-flex-pack: space-between;
  143. justify-content: space-between;
  144. }
  145. .flex-y-center {
  146. display: -webkit-box;
  147. display: -webkit-flex;
  148. /* #ifndef APP-NVUE */
  149. display: flex;
  150. /* #endif */
  151. -webkit-box-align: center;
  152. -webkit-align-items: center;
  153. -ms-flex-align: center;
  154. -ms-grid-row-align: center;
  155. align-items: center;
  156. }
  157. /* 溢出隐藏 */
  158. .over1 {
  159. text-overflow: -o-ellipsis-lastline;
  160. overflow: hidden;
  161. text-overflow: ellipsis;
  162. display: -webkit-box;
  163. -webkit-line-clamp: 1;
  164. -webkit-box-orient: vertical;
  165. }
  166. .over2 {
  167. text-overflow: -o-ellipsis-lastline;
  168. overflow: hidden;
  169. text-overflow: ellipsis;
  170. display: -webkit-box;
  171. -webkit-line-clamp: 2;
  172. -webkit-box-orient: vertical;
  173. }
  174. .el-table th > .cell {
  175. color: #333;
  176. font-weight: bold;
  177. font-size: 14px;
  178. }
  179. .el-table__footer-wrapper, .el-table__header-wrapper {
  180. border-bottom: 1.4px solid #D6D6D6;
  181. }
  182. .give-info {
  183. overflow: hidden;
  184. display: -webkit-box;
  185. -webkit-box-orient: vertical;
  186. -webkit-line-clamp: 1;
  187. }
  188. </style>
  189. <div id='app' v-cloak style="min-width: 1000px;">
  190. <!-- <div class="header">活动列表</div>-->
  191. <div class="header">
  192. <el-button style="height: 40px;" type="primary" @click="editRule(0)">添加活动</el-button>
  193. </div>
  194. <el-card v-loading='loading'>
  195. <!-- 条件查询 -->
  196. <div class="inquires_box flex">
  197. <div class="condition condition2 flex flex-y-center">
  198. <div style="width: 90px;">活动名称:</div>
  199. <el-input size="small" style="flex: 1;margin-left:10px" placeholder="请输入查询内容" v-model="name"></el-input>
  200. </div>
  201. <div class="flex flex-y-center condition2">
  202. <div style="width: 75px;">类型:</div>
  203. <el-select size="small" v-model="award_type" placeholder="请选择发放类型">
  204. <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
  205. </el-option>
  206. </el-select>
  207. </div>
  208. <div class="flex flex-y-center condition2">
  209. <div style="width: 75px;">状态:</div>
  210. <el-select size="small" v-model="active_status" placeholder="请选择发放类型">
  211. <el-option v-for="item in options2" :key="item.value" :label="item.label" :value="item.value">
  212. </el-option>
  213. </el-select>
  214. </div>
  215. <el-button type="primary" size="small" style="margin-bottom: 20px;" @click='query'>查询</el-button>
  216. </div>
  217. <div class="table_box">
  218. <el-table :data="tableData" stripe style="width: 100%;font-size:13px">
  219. <el-table-column prop="name" label="活动名称" width="180" align="center"></el-table-column>
  220. <el-table-column prop="start_at,end_at" label="活动时间" width="200" align="center">
  221. <template slot-scope="scope">
  222. <div>{{scope.row.start_at | dateTimeFormat("Y-m-d H:i")}}</div>
  223. <div>至</div>
  224. <div>{{scope.row.end_at | dateTimeFormat("Y-m-d H:i")}}</div>
  225. </template>
  226. </el-table-column>
  227. <el-table-column prop="give_cond" label="赠送类型" width="150" align="center">
  228. <template slot-scope="scope">
  229. <div v-if="scope.row.give_cond == 1"> 累计充值</div>
  230. <div v-else>单次充值</div>
  231. </template>
  232. </el-table-column>
  233. <el-table-column prop="give_info" label="赠送内容" align="center">
  234. <template slot-scope="scope">
  235. <el-tooltip placement="bottom">
  236. <div slot="content">
  237. <div style="margin-bottom: 6px;" v-for="(item,index) in scope.row.give_info"
  238. :key="index">
  239. 满{{item.num}}送
  240. <div v-for="(dataItem,dataIndex) in item.data" :key="dataItem.type">
  241. <div v-if="dataItem.type == 'coupon'">
  242. {{dataItem.name}}:
  243. <div v-for="(couponItem,coupoIndex) in dataItem.data" :key="couponItem.id">
  244. {{couponItem.discount_method}}*{{couponItem.num}}张
  245. </div>
  246. </div>
  247. <span v-else>
  248. {{dataItem.name}}:{{dataItem.data}}
  249. </span>
  250. </div>
  251. </div>
  252. </div>
  253. <div class="give-info">
  254. <span style="margin-bottom: 6px;" v-for="(item,index) in scope.row.give_info"
  255. :key="index">
  256. 满{{item.num}}送
  257. <span v-for="(dataItem,dataIndex) in item.data" :key="dataItem.type">
  258. <span v-if="dataItem.type == 'coupon'">
  259. {{dataItem.name}}:
  260. <span v-for="(couponItem,coupoIndex) in dataItem.data" :key="couponItem.id">
  261. {{couponItem.discount_method}}*{{couponItem.num}}张
  262. </span>
  263. </span>
  264. <span v-else>
  265. {{dataItem.name}}:{{dataItem.data}}
  266. </span>
  267. </span>
  268. </span>
  269. </div>
  270. </el-tooltip>
  271. </template>
  272. </el-table-column>
  273. <el-table-column label="已赠送" width="120px" align="center">
  274. <template slot-scope="scope">
  275. <div style="color: #0A54EA" class="title_bu" @click="typeGoTo(scope.row.id)">
  276. {{scope.row.already_give}}
  277. </div>
  278. </template>
  279. </el-table-column>
  280. <!-- 0/未开始 1/进行中 2/已过期 3/已停用-->
  281. <el-table-column prop="active_status" label="状态" width="150" align="center">
  282. <template slot-scope="scope">
  283. <div v-if="scope.row.active_status == 0"> 未开始</div>
  284. <div v-else-if="scope.row.active_status == 1">进行中</div>
  285. <div v-else-if="scope.row.active_status == 2">已过期</div>
  286. <div v-else-if="scope.row.active_status == 3">停用</div>
  287. </template>
  288. </el-table-column>
  289. <el-table-column prop="created_at" label="创建时间" width='200' align="center">
  290. <template slot-scope="scope">
  291. <div>{{scope.row.created_at | dateTimeFormat("Y-m-d H:i:s")}}</div>
  292. </template>
  293. </el-table-column>
  294. <el-table-column label="开关" width="120" align="center">
  295. <template slot-scope="scope">
  296. <el-switch :disabled="scope.row.active_status == 0||scope.row.active_status == 2"
  297. class="switchStyle" :value='scope.row.active_status' :active-value='1'
  298. inactive-value='3'
  299. @change='changeStatus(scope.row.id,scope.$index,scope.row.active_status)'
  300. active-text="启用" inactive-text="停用"></el-switch>
  301. </template>
  302. </el-table-column>
  303. <el-table-column label="操作" fixed="right" align="center" width='150'>
  304. <template slot-scope="scope">
  305. <div class="operat1" @click="editRule(scope.row.id)">编辑</div>
  306. <div class="operat1" @click="deleterRule(scope.row.id,scope.$index)">删除</div>
  307. </template>
  308. </el-table-column>
  309. </el-table>
  310. </div>
  311. <div flex="main:right cross:center" style="margin-top: 20px;">
  312. <el-pagination v-if="pagination" :page-size="pagination.defaultPageSize"
  313. style="display: inline-block;float: right;" background @current-change="pageChange"
  314. layout="prev, pager, next" :total="pagination.totalCount">
  315. </el-pagination>
  316. </div>
  317. </el-card>
  318. </div>
  319. <script>
  320. new Vue({
  321. el: '#app',
  322. data() {
  323. return {
  324. pagination: {
  325. total: 0
  326. },
  327. loading: false,
  328. options: [{
  329. value: '',
  330. label: '全部'
  331. }, {
  332. value: '0',
  333. label: '单次充值'
  334. }, {
  335. value: '1',
  336. label: '累计充值'
  337. }],
  338. options2: [{
  339. value: '',
  340. label: '全部'
  341. }, {
  342. value: '0',
  343. label: '未开始'
  344. }, {
  345. value: '1',
  346. label: '进行中'
  347. }, {
  348. value: '2',
  349. label: '已过期'
  350. }, {
  351. value: '3',
  352. label: '已停用'
  353. }],
  354. value: '',
  355. tableData: [],
  356. dialogVisible: false,
  357. pageCount: 0,
  358. name: '',
  359. status: '',
  360. active_status: '',
  361. award_type: '',
  362. page: 1,
  363. limit: 10,
  364. total_count: 0,
  365. dialog_sum: 0,
  366. dialog_types: '',
  367. current_arr: [],
  368. dialogVisible2: false,
  369. tips_msg: "",
  370. operate_id: '',
  371. operate_status: '',
  372. }
  373. },
  374. mounted() {
  375. this.getData();
  376. },
  377. computed: {
  378. serialNum() {
  379. return function (index) {
  380. return this.limit * (this.page - 1) + index + 1;
  381. }
  382. },
  383. typeName() {
  384. return function (val) {
  385. switch (val) {
  386. case '0':
  387. return '单次充值'
  388. case '1':
  389. return '累计充值'
  390. }
  391. }
  392. }
  393. },
  394. methods: {
  395. // 页面跳转
  396. toPageAdd() {
  397. navigateTo({
  398. r: 'plugin/recharge/mall/index/add',
  399. })
  400. },
  401. query() {
  402. this.page = 1;
  403. this.getData();
  404. },
  405. getData() {
  406. this.loading = true;
  407. request({
  408. params: {
  409. r: 'recharge/default/index',
  410. },
  411. data: {
  412. name: this.name,
  413. active_status: this.active_status,
  414. give_cond: this.award_type,
  415. page: this.page,
  416. limit: this.limit,
  417. },
  418. method: 'post',
  419. }).then(e => {
  420. this.loading = false;
  421. if (e.data.code == 0) {
  422. this.total_count = e.data.data.pagination.total_count;
  423. this.tableData = e.data.data.list;
  424. this.pageCount = e.data.data.pagination.page_count;
  425. this.pagination = e.data.data.pagination; //拿到关于页码页容量的数据
  426. } else {
  427. this.$message.error(e.data.msg);
  428. }
  429. });
  430. },
  431. pageChange(page) {
  432. this.page = page;
  433. this.getData();
  434. },
  435. changeStatus(id, index, status) {
  436. this.loading = true;
  437. request({
  438. params: {
  439. r: 'recharge/default/update',
  440. },
  441. data: {
  442. id: id,
  443. active_status: status
  444. },
  445. method: 'post',
  446. }).then(e => {
  447. this.loading = false;
  448. if (e.data.code == 0) {
  449. this.getData()
  450. // this.tableData[index].active_status = status == '1' ? '3' : '1';
  451. // this.$message.success(e.data.msg);
  452. // console.log(this.tableData[index])
  453. } else {
  454. this.$message.error(e.data.msg);
  455. }
  456. });
  457. },
  458. typeGoTo(id) {
  459. let url = "recharge/default/list";
  460. if (!url) {
  461. return;
  462. }
  463. navigateTo({
  464. r: url,
  465. recharge_active_id: id
  466. })
  467. },
  468. ruleSwitch() {
  469. },
  470. editRule(id) {
  471. navigateTo({
  472. r: 'recharge/default/edit',
  473. id
  474. })
  475. },
  476. deleterRule(id, index) {
  477. this.loading = true;
  478. request({
  479. params: {
  480. r: 'recharge/default/delete',
  481. },
  482. data: {
  483. id: id,
  484. status: -1
  485. },
  486. method: 'post',
  487. }).then(e => {
  488. this.loading = false;
  489. if (e.data.code == 0) {
  490. this.tableData.splice(index, 1);
  491. this.$message.success(e.data.msg);
  492. } else {
  493. this.$message.error(e.data.msg);
  494. }
  495. });
  496. },
  497. handleSizeChange(val) {
  498. this.limit = val;
  499. this.getData();
  500. },
  501. handleCurrentChange(val) {
  502. thia.page = val;
  503. this.getData();
  504. },
  505. showPop(key, val, obj) {
  506. this.dialogVisible = true;
  507. this.dialog_types = key;
  508. this.dialog_sum = val;
  509. this.current_arr = obj;
  510. },
  511. handleClose(done) {
  512. this.$confirm('确认关闭?')
  513. .then(_ => {
  514. done();
  515. })
  516. .catch(_ => {
  517. });
  518. }
  519. }
  520. })
  521. </script>