index.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  1. <style>
  2. .table-body {
  3. padding: 20px 20px;
  4. background-color: #fff;
  5. }
  6. .table-body .top-input {
  7. margin-top: 34px;
  8. }
  9. .input-item {
  10. width: 200px;
  11. margin-right: 20px;
  12. }
  13. .input-item .el-input__inner {
  14. border-right: 0;
  15. }
  16. .input-item .el-input__inner:hover {
  17. border: 1px solid #dcdfe6;
  18. border-right: 0;
  19. outline: 0;
  20. }
  21. .input-item .el-input__inner:focus {
  22. border: 1px solid #dcdfe6;
  23. border-right: 0;
  24. outline: 0;
  25. }
  26. .input-item .el-input-group__append {
  27. background-color: #fff;
  28. border-left: 0;
  29. width: 10%;
  30. padding: 0;
  31. }
  32. .input-item .el-input-group__append .el-button {
  33. padding: 0;
  34. }
  35. .input-item .el-input-group__append .el-button {
  36. margin: 0;
  37. }
  38. /* #app .table-body .el-table .el-button {
  39. border-radius: 16px;
  40. } */
  41. .create {
  42. height: 36px;
  43. line-height: 36px;
  44. float: right;
  45. color: #BCBCBC;
  46. margin-left: 20px;
  47. }
  48. .name {
  49. cursor: pointer;
  50. color: #49A9FF;
  51. }
  52. .el-input-group__append {
  53. /* background-color: #fff; */
  54. }
  55. /* 卡片 */
  56. .plugin-list {
  57. margin: 0 0 0 -20px;
  58. /* padding-right: 100px; */
  59. display: flex;
  60. flex-wrap: wrap;
  61. }
  62. .plugin-list .plugin-item {
  63. width: 20%;
  64. min-width: 400px;
  65. }
  66. .plugin-item {
  67. border: 1px solid #ebebeb;
  68. background: #FFFFFF;
  69. box-shadow: 3px 5px 15px rgba(80, 80, 80, 0.16);
  70. opacity: 1;
  71. border-radius: 5px;
  72. padding: 20px;
  73. margin: 0 0 20px 20px;
  74. transition: 250ms;
  75. position: relative;
  76. /* min-width: 300px; */
  77. }
  78. .plugin-item .item-status {
  79. position: absolute;
  80. top: 0;
  81. right: 0;
  82. width: 94px;
  83. height: 30px;
  84. background: #E8EAEC;
  85. opacity: 1;
  86. border-radius: 0px 5px 0px 5px;
  87. font-size: 14px;
  88. font-family: Microsoft YaHei;
  89. font-weight: 400;
  90. line-height: 30px;
  91. color: #9398A4;
  92. text-align: center;
  93. }
  94. .item-status-permanent {
  95. width: 94px;
  96. }
  97. .item-status-effective {
  98. width: 164px;
  99. }
  100. .plugin-item .item-info {
  101. display: flex;
  102. align-items: center;
  103. }
  104. /* .plugin-item .item-info .item-right{
  105. min-width: 500px;
  106. } */
  107. .plugin-item .item-btns {
  108. display: flex;
  109. align-items: center;
  110. justify-content: flex-end;
  111. margin-top: 12px;
  112. }
  113. .plugin-item .mall-logo {
  114. width: 70px;
  115. height: 70px;
  116. margin-right: 12px;
  117. }
  118. .plugin-item .mall-logo img {
  119. width: 100%;
  120. height: 100%;
  121. display: block;
  122. border-radius: 50%;
  123. }
  124. .plugin-item .display-name {
  125. font-size: 18pt;
  126. margin-top: 10px;
  127. margin-bottom: 4px;
  128. font-family: Microsoft YaHei;
  129. font-weight: bold;
  130. line-height: 30px;
  131. color: #3F495D;
  132. opacity: 1;
  133. width: 200px;
  134. white-space: nowrap;
  135. overflow: hidden;
  136. text-overflow: ellipsis;
  137. }
  138. .plugin-item .name {
  139. color: #909399;
  140. }
  141. .plugin-item:hover {
  142. cursor: pointer;
  143. border-color: #bfddff;
  144. }
  145. /* .plugin-item:hover .display-name {
  146. color: #409EFF;
  147. } */
  148. .plugin-item .plugin-option-btn {
  149. height: 25px;
  150. width: 25px;
  151. font-size: 12px;
  152. padding: 0;
  153. }
  154. .plugin-item .detail-option.detail-option {
  155. color: #909399;
  156. background: #F2F6FC;
  157. }
  158. .plugin-item .detail-option:hover {
  159. color: #fff;
  160. background: #909399;
  161. }
  162. </style>
  163. <div id="app" v-cloak>
  164. <el-card shadow="never" style="border:0;min-width: 1200px;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  165. <div slot="header">
  166. <div>
  167. <span>条件管理</span>
  168. <div style="float: right; margin: -5px 0">
  169. <el-button type="primary" size="small" @click="handleAdd">新增</el-button>
  170. </div>
  171. </div>
  172. </div>
  173. <div class="table-body">
  174. <template>
  175. <div>
  176. <el-table :data="tableData" style="width: 100%;margin-bottom: 20px;" row-key="id" stripe>
  177. <el-table-column prop="title" label="ID" width="50">
  178. <template slot-scope="scope">
  179. <span style="margin-left: 10px">{{ scope.row.id }}
  180. </span>
  181. </template>
  182. </el-table-column>
  183. <el-table-column prop="title" label="内容" width="800">
  184. <template slot-scope="scope">
  185. <span style="margin-left: 10px">{{ scope.row.content }}
  186. </span>
  187. </template>
  188. </el-table-column>
  189. <el-table-column prop="url" label="备注">
  190. <template slot-scope="scope">
  191. <span style="margin-left: 10px">{{ scope.row.remark }}</span>
  192. </template>
  193. </el-table-column>
  194. <el-table-column label="操作">
  195. <template slot-scope="scope">
  196. <el-button type="text" size="mini" circle style="margin-left: 10px;margin-top: 10px" @click="handleEdit(scope.$index, scope.row)">
  197. <el-tooltip class="item" effect="dark" content="编辑" placement="top">
  198. <img src="resources/img/mall/edit.png" alt="">
  199. </el-tooltip>
  200. </el-button>
  201. <el-button style="margin-left: 10px;margin-top: 10px" type="text" class="set-el-button" size="mini" circle @click="handleDelete(scope.$index, scope.row)">
  202. <el-tooltip class="item" effect="dark" content="删除" placement="top">
  203. <img src="resources/img/mall/del.png" alt="">
  204. </el-tooltip>
  205. </el-button>
  206. </template>
  207. </el-table-column>
  208. </el-table>
  209. </div>
  210. </template>
  211. </div>
  212. <el-dialog :close-on-click-modal="false" title="新增" :visible.sync="dialogFormVisible_add">
  213. <el-form :model="form" :rules="rules" ref="form" @close="handleClose('form')">
  214. <el-form-item label="内容" :label-width="formLabelWidth" prop="title">
  215. <el-input v-model="form.content" autocomplete="off"></el-input>
  216. </el-form-item>
  217. <el-form-item label="备注" :label-width="formLabelWidth" prop="url">
  218. <el-input v-model="form.remark" autocomplete="off"></el-input>
  219. </el-form-item>
  220. </el-form>
  221. <div slot="footer" class="dialog-footer">
  222. <el-button @click="dialogFormVisible_add = false">取 消</el-button>
  223. <el-button type="primary" @click="postAdd('form')">确 定</el-button>
  224. </div>
  225. </el-dialog>
  226. <el-dialog :close-on-click-modal="false" title="编辑" :visible.sync="dialogFormVisible_edit">
  227. <el-form :model="form" :rules="rules" ref="form" @close="handleClose('form')">
  228. <el-form-item label="内容" :label-width="formLabelWidth" prop="title">
  229. <el-input v-model="form.content" autocomplete="off"></el-input>
  230. </el-form-item>
  231. <el-form-item label="备注" :label-width="formLabelWidth" prop="url">
  232. <el-input v-model="form.remark" autocomplete="off"></el-input>
  233. </el-form-item>
  234. </el-form>
  235. <div slot="footer" class="dialog-footer">
  236. <el-button @click="dialogFormVisible_edit = false">取 消</el-button>
  237. <el-button type="primary" @click="postEdit('form')">确 定</el-button>
  238. </div>
  239. </el-dialog>
  240. </el-card>
  241. </div>
  242. <script>
  243. new Vue({
  244. el: '#app',
  245. data() {
  246. return {
  247. activeName: "1",
  248. tableData: [],
  249. dialogFormVisible_edit: false,
  250. dialogFormVisible_add: false,
  251. rules: {
  252. content: [{
  253. required: true,
  254. message: '请输入内容',
  255. trigger: 'blur'
  256. },
  257. {
  258. min: 1,
  259. max: 200,
  260. message: '长度在 1 到 200 个字符',
  261. trigger: 'blur'
  262. }
  263. ],
  264. remark: [ {
  265. min: 1,
  266. max: 200,
  267. message: '长度在 1 到 200 个字符',
  268. trigger: 'blur'
  269. }
  270. ],
  271. },
  272. form: {
  273. id: '',
  274. content: '',
  275. remark: '',
  276. status: 1,
  277. },
  278. ruleForm:{
  279. upgrade_type_condition:[]
  280. },
  281. formLabelWidth: '150px',
  282. }
  283. },
  284. created() {
  285. this.loadList({});
  286. },
  287. methods: {
  288. loadList(params) {
  289. params['r'] = 'mall/upgrade-condition/index';
  290. this.$request({
  291. params: params,
  292. }).then(e => {
  293. if (e.data.code == 0) {
  294. if(e.data.data.list){
  295. this.tableData = e.data.data.list;
  296. }
  297. }
  298. }).catch(e => {});
  299. },
  300. handleEdit(index, row) {
  301. this.form.id = row.id
  302. this.$request({
  303. params: {
  304. r: 'mall/upgrade-condition/edit',
  305. id: row.id,
  306. },
  307. }).then(e => {
  308. if(e.data.code==0){
  309. this.dialogFormVisible_edit = true;
  310. this.form = e.data.data;
  311. }else{
  312. this.$message.error(e.data.msg);
  313. }
  314. console.log(e.data.data);
  315. }).catch(e => {});
  316. },
  317. handleAdd() {
  318. this.dialogFormVisible_add = true;
  319. },
  320. postEdit(formName){
  321. this.$refs[formName].validate((valid) => {
  322. if(valid){
  323. this.$request({
  324. method:"post",
  325. params: {
  326. r:'mall/upgrade-condition/edit',
  327. },
  328. data:this.form
  329. }).then(e => {
  330. if(e.data.code==0){
  331. this.dialogFormVisible_edit = false;
  332. this.$message({
  333. message: e.data.msg,
  334. type: 'success'
  335. });
  336. }else{
  337. this.$message.error(e.data.msg);
  338. }
  339. }).catch(e => {
  340. });
  341. }
  342. });
  343. },
  344. postAdd(formName) {
  345. this.$refs[formName].validate((valid) => {
  346. if (valid) {
  347. this.$request({
  348. method: "post",
  349. params: {
  350. r: 'mall/upgrade-condition/add',
  351. },
  352. data: this.form
  353. }).then(e => {
  354. if (e.data.code == 0) {
  355. this.dialogFormVisible_add = false;
  356. this.$message({
  357. message: e.data.msg,
  358. type: 'success'
  359. });
  360. }else{
  361. this.$message.error(e.data.msg);
  362. }
  363. }).catch(e => {});
  364. }
  365. });
  366. },
  367. handleDelete(index, row) {
  368. console.log(row);
  369. this.form.id = row.id
  370. this.$request({
  371. params: {
  372. r: 'mall/upgrade-condition/del',
  373. id: row.id,
  374. status: -1,
  375. },
  376. }).then(e => {
  377. if (e.data.code == 0) {
  378. this.$message({
  379. message: e.data.msg,
  380. type: 'success'
  381. });
  382. location.reload();
  383. }
  384. }).catch(e => {});
  385. },
  386. handleUpdate(row) {
  387. console.log(row);
  388. this.form.id = row.id
  389. this.$request({
  390. params: {
  391. r:'mall/upgrade-condition/update-status',
  392. id:row.id,
  393. status:row.status,
  394. },
  395. }).then(e => {
  396. if (e.data.code == 0) {
  397. this.$message({
  398. message: e.data.msg,
  399. type: 'success'
  400. });
  401. }
  402. }).catch(e => {});
  403. },
  404. handleClose(formName){
  405. this.$refs[formName].resetFields();
  406. }
  407. },
  408. });
  409. </script>