pay-setting.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. <?php
  2. ?>
  3. <style>
  4. .list-title {
  5. font-weight: 400;
  6. font-size: 18px;
  7. }
  8. .plugin-list {
  9. margin: 0 0 0 -20px;
  10. }
  11. .plugin-item {
  12. position: relative;
  13. border: 1px solid #ebebeb;
  14. background: #fff;
  15. padding: 20px;
  16. margin: 0 0 20px 20px;
  17. transition: 250ms;
  18. height: 150px;
  19. }
  20. .plugin-item .display-name {
  21. margin-bottom: 10px;
  22. transition: 250ms;
  23. font-weight: bold;
  24. }
  25. .plugin-item .el-tooltip {
  26. color: #BFBFBF;
  27. }
  28. .plugin-item:hover {
  29. cursor: pointer;
  30. border-color: #bfddff;
  31. }
  32. .plugin-item:hover .display-name {
  33. color: #409EFF;
  34. font-weight: bold;
  35. }
  36. .plugin-item .plugin-option-btn {
  37. height: 25px;
  38. width: 25px;
  39. font-size: 12px;
  40. padding: 0;
  41. }
  42. .plugin-item .detail-option.detail-option {
  43. color: #909399;
  44. background: #F2F6FC;
  45. }
  46. .plugin-item .detail-option:hover {
  47. color: #fff;
  48. background: #909399;
  49. }
  50. .plugin-item .name{
  51. white-space:nowrap;
  52. overflow:hidden;
  53. text-overflow:ellipsis;
  54. font-size: 12px;
  55. }
  56. .plugin-item .item-status{
  57. position: absolute;
  58. z-index: 10;
  59. top: 0;
  60. right: 0;
  61. width: 64px;
  62. height: 20px;
  63. opacity: 1;
  64. border-radius: 0px 0px 0px 5px;
  65. font-size: 11px;
  66. line-height: 20px;
  67. font-family: Microsoft YaHei;
  68. font-weight: 400;
  69. text-align: center;
  70. }
  71. .plugin-item .status0{
  72. background-color: #E8EAEC;
  73. color: #9398A4;
  74. }
  75. .plugin-item .status2{
  76. background-color: #fef0f0;
  77. color: #f56c6c;
  78. }
  79. .question_icon{
  80. position: absolute;
  81. top: 6px;
  82. right: 6px;
  83. width: 20px;
  84. height: 20px;
  85. z-index: 10;
  86. }
  87. .question_icon i{
  88. font-size: 17px;
  89. color: #BFBFBF;
  90. }
  91. .use_number {
  92. margin-top: 10px;
  93. font-size: 12px !important;
  94. align-items: center;
  95. clear: both;
  96. }
  97. .price-top {
  98. border-radius: 5px;
  99. overflow: hidden;
  100. border: 1px solid #f1f1f1;
  101. }
  102. .price-bottom {
  103. padding-top: 10px;
  104. }
  105. .price-li {
  106. border-right: 1px solid #f1f1f1;
  107. padding: 5px;
  108. flex: 1;
  109. text-align: center
  110. }
  111. .price-li.active {
  112. background-color: #1A73E8;
  113. color: #fff;
  114. }
  115. .price-li.active-setting{
  116. background-color: #1A73E8;
  117. color: #fff;
  118. }
  119. .price-li:last-child {
  120. border-right: 0;
  121. }
  122. .template-setting {
  123. position: absolute;
  124. right: 35px;
  125. bottom: 0px;
  126. }
  127. </style>
  128. <div id="app" v-cloak>
  129. <el-card shadow="never" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  130. <div slot="header">
  131. <span>应用列表</span>
  132. &nbsp;
  133. &nbsp;
  134. &nbsp;
  135. &nbsp;
  136. <el-input @keyup.enter.native="getList" placeholder="请输入搜索应用名称" v-model="keyword"
  137. clearable @clear="toSearch" style="width: 300px">
  138. <el-button slot="append" icon="el-icon-search" @click="toSearch"></el-button>
  139. </el-input>
  140. &nbsp;
  141. &nbsp;
  142. <el-button type="danger" @click="clearSearch" v-if="keyword!=''">清除条件</el-button>
  143. </div>
  144. <div class="table-body">
  145. <el-row v-if="list" class="plugin-list" >
  146. <template v-for="(plugin,index) in list">
  147. <el-col :xs="30" :sm="12" :md="8" :lg="6" :xl="5" class="plugin-item">
  148. <div flex="dir:left box:first" @click="entryPlugin(plugin)">
  149. <div style="padding-right: 12px;">
  150. <!--<img style="width: 50px;height: 50px;display: block;" :src="plugin.cover">-->
  151. <el-image style="width: 50px;height: 50px;border-radius: 5px;" :src="plugin.cover">
  152. <div slot="error" class="image-slot">
  153. <com-image :src="plugin.default_cover"></com-image>
  154. </div>
  155. </el-image>
  156. </div>
  157. <div style="width: 53%">
  158. <div class="display-name">{{plugin.title}}</div>
  159. <div flex="box:last" >
  160. <com-ellipsis :line="1" :text="plugin.brief_introduction" style="width: 100%;"></com-ellipsis>
  161. </div>
  162. </div>
  163. </div>
  164. <div class="use_number" v-if="plugin.setting">
  165. <div class="price-top" flex>
  166. <div class="price-li"
  167. v-for="(val, index) in plugin.setting"
  168. :key="plugin.id+'_'+index"
  169. @click="tabClick(index,plugin,val)"
  170. :class="current[plugin.id] == index ? 'active' : ''"
  171. >{{ val.unit == 0 ? unit[val.unit] : val.unit == 1 ? val.duration+'个'+unit[val.unit]: val.duration+unit[val.unit]}}</div>
  172. </div>
  173. <div class="price-bottom" v-if = "setting_arr[plugin.id]">
  174. <span class="template-price">{{ setting_arr[plugin.id].money }}元</span> / {{ setting_arr[plugin.id].duration == -1 ? unit[setting_arr[plugin.id].unit] : setting_arr[plugin.id].duration+'个'+ unit[setting_arr[plugin.id].unit] }}
  175. </div>
  176. </div>
  177. <div class="use_number" v-else @click="handle('setting',plugin)">
  178. <div class="price-top">
  179. <div class="price-li active-setting">未设置付费</div>
  180. </div>
  181. </div>
  182. <el-button class="template-setting" type="text" @click="handle('setting',plugin)">设置</el-button>
  183. </el-col>
  184. </template>
  185. </el-row>
  186. <div style="text-align: right;margin: 20px 0;">
  187. <el-pagination @current-change="pagination" background layout="prev, pager, next" :page-count="pageCount"></el-pagination>
  188. </div>
  189. </div>
  190. </el-card>
  191. </div>
  192. <script>
  193. const app = new Vue({
  194. el: '#app',
  195. data() {
  196. return {
  197. unit:['永久','月','年'],
  198. current: {},
  199. setting_arr: {},
  200. list: [],
  201. addons_group:{},
  202. listLoading: false,
  203. operateLoading: false,
  204. page: 1,
  205. pageCount: 0,
  206. keyword: '',
  207. };
  208. },
  209. methods: {
  210. tabClick(i,item,val) {
  211. Object.assign(this.current, {[item.id]:i});
  212. Object.assign(this.setting_arr, {[item.id]:val});
  213. this.$forceUpdate();// 强制更新视图
  214. },
  215. addons_group_name(name){
  216. if(this.addons_group[name]){
  217. return this.addons_group[name].title
  218. }else{
  219. return '未分类';
  220. }
  221. },
  222. search() {
  223. this.page = 1;
  224. this.getList();
  225. },
  226. pagination(currentPage) {
  227. let self = this;
  228. self.page = currentPage;
  229. self.getList();
  230. },
  231. handleList(list){
  232. for(let item in list){
  233. list[item].default_cover = _diy_img_prefix+'/static/addons/icon/'+list[item].name+'.png'
  234. }
  235. },
  236. // 获取广告列表
  237. getList() {
  238. let self = this;
  239. if(self.listLoading == false){
  240. self.listLoading = true;
  241. request({
  242. params: {
  243. r: 'admin/addons/pay-setting',
  244. page: self.page,
  245. keyword : this.keyword,
  246. },
  247. method: 'get',
  248. }).then(e => {
  249. self.listLoading = false;
  250. this.handleList(e.data.data.list)
  251. self.list = e.data.data.list;
  252. if (!isEmpty(self.list)) {
  253. let setting = [];
  254. self.list.forEach(function (item, index) {
  255. if (!isEmpty(item.setting)) {
  256. Object.assign(self.current, {[item.id]:0});
  257. Object.assign(self.setting_arr, {[item.id]: item.setting[0]});
  258. }
  259. })
  260. }
  261. self.addons_group = e.data.data.addons_group;
  262. console.log(self.list)
  263. self.pageCount = e.data.data.page_count;
  264. }).catch(e => {
  265. console.log(e);
  266. });
  267. }
  268. },//handle
  269. handle(type,data){
  270. switch(type){
  271. case 'setting':
  272. this.$navigate({
  273. r: 'admin/addons/pay-setting-edit',
  274. name: data.name
  275. });
  276. break;
  277. default :
  278. }
  279. console.log(data.id);
  280. },
  281. send(name,type){
  282. let self = this;
  283. if(self.operateLoading == false){
  284. self.operateLoading = true;
  285. request({
  286. params: {r: 'admin/addons/index'},
  287. method: 'post',
  288. data: {name:name,type:type}
  289. }).then(e => {
  290. self.operateLoading = false
  291. if (e.data.code == 0) {
  292. this.$message({message: e.data.msg,type: 'success'});
  293. self.getList();
  294. } else {
  295. this.$message({message: e.data.msg,type: 'error'});
  296. }
  297. }).catch(e => {
  298. self.operateLoading = false
  299. console.log(e);
  300. });
  301. }
  302. },
  303. clearSearch(){
  304. this.keyword='';
  305. this.getList();
  306. },
  307. toSearch() {
  308. this.getList();
  309. },
  310. },
  311. mounted: function() {
  312. localStorage.setItem('admin_addons_menu_id', localStorage.getItem('open_menu_2_id'));
  313. this.getList();
  314. }
  315. });
  316. </script>