index.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507
  1. <style>
  2. .table-body {
  3. padding: 20px;
  4. background-color: #fff;
  5. }
  6. .input-item {
  7. display: inline-block;
  8. width: 250px;
  9. margin: 0 0 20px;
  10. }
  11. .input-item .el-input__inner {
  12. border-right: 0;
  13. }
  14. .input-item .el-input__inner:hover {
  15. border: 1px solid #dcdfe6;
  16. border-right: 0;
  17. outline: 0;
  18. }
  19. .input-item .el-input__inner:focus {
  20. border: 1px solid #dcdfe6;
  21. border-right: 0;
  22. outline: 0;
  23. }
  24. .input-item .el-input-group__append {
  25. background-color: #fff;
  26. border-left: 0;
  27. width: 10%;
  28. padding: 0;
  29. }
  30. .input-item .el-input-group__append .el-button {
  31. padding: 0;
  32. }
  33. .input-item .el-input-group__append .el-button {
  34. margin: 0;
  35. }
  36. .table-body .el-button {
  37. padding: 0 !important;
  38. border: 0;
  39. margin: 0 5px;
  40. }
  41. .el-table th > .cell {
  42. color: #333;
  43. font-weight: bold;
  44. font-size: 14px;
  45. }
  46. .el-table__footer-wrapper, .el-table__header-wrapper {
  47. border-bottom: 1.4px solid #D6D6D6;
  48. }
  49. .label {
  50. margin-right: 10px;
  51. }
  52. .default-goods{
  53. max-width: 50px;
  54. max-height: 50px;
  55. }
  56. .flex-x-between {
  57. display: -webkit-box;
  58. display: -webkit-flex;
  59. display: flex;
  60. -webkit-box-pack: space-between;
  61. -webkit-justify-content: space-between;
  62. -ms-flex-pack: space-between;
  63. justify-content: space-between;
  64. }
  65. .cont-title {
  66. font-size: 15px;
  67. padding-top: 20px;
  68. padding-bottom: 10px;
  69. font-weight: 700;
  70. }
  71. .cont-num {
  72. font-size: 14px;
  73. font-weight: 700;
  74. padding-bottom: 10px;
  75. }
  76. .center {
  77. text-align: center;
  78. }
  79. .el-dialog__header .el-dialog__title{
  80. font-size: 18px;
  81. }
  82. .el-dialog__wrapper .el-dialog__body{
  83. padding: 3px 20px;
  84. }
  85. /*头像样式 start*/
  86. .default-avatar{
  87. width: 50px;
  88. height: 50px;
  89. border-radius: 50%;
  90. }
  91. .user_img{
  92. position: relative;
  93. margin-right: 8px;
  94. height: 50px;
  95. width: 50px;
  96. }
  97. .el-table_1_column_2 .cell { /*-2 表示在第二行*/
  98. display: flex;
  99. }
  100. /*头像样式 end*/
  101. </style>
  102. <div id="app" v-cloak>
  103. <el-card shadow="never" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  104. <div slot="header">
  105. <div>
  106. <span>种草管理</span>
  107. </div>
  108. </template>
  109. </div>
  110. <div class="table-body el-input--small">
  111. <el-form size="small" :inline="true" flex="dir:left cross:center" style="margin-bottom: 12px;">
  112. <div class="item-box" flex="dir:left cross:center">
  113. <div class="label">创建时间</div>
  114. <el-date-picker
  115. v-model="time"
  116. type="datetimerange"
  117. value-format="yyyy-MM-dd HH:mm:ss"
  118. range-separator="至"
  119. start-placeholder="开始日期"
  120. end-placeholder="结束日期">
  121. </el-date-picker>
  122. </div>
  123. <div class="item-box" flex="dir:left cross:center" style="margin-right: 20px; margin-left: 20px;">
  124. <div class="label">会员ID</div>
  125. <el-input style="width: 80px" v-model="search.user_id" placeholder="会员ID"></el-input>
  126. </div>
  127. <div class="item-box" flex="dir:left cross:center" style="margin-right: 20px">
  128. <div class="label">会员昵称</div>
  129. <el-input style="width: 150px" v-model="search.user_name" placeholder="会员昵称"></el-input>
  130. </div>
  131. <div class="item-box" flex="dir:left cross:center" style="margin-right: 20px">
  132. <div class="label">标题</div>
  133. <el-input style="width: 150px" v-model="search.title" placeholder="标题"></el-input>
  134. </div>
  135. <div class="item-box" flex="dir:left cross:center">
  136. <el-button type="primary" style="padding: 12px 34px !important;" @click="searchs">搜索
  137. </el-button>
  138. </div>
  139. </el-form>
  140. <el-table v-loading="listLoading" :data="list" stripe style="width: 100%">
  141. <el-table-column label="会员ID" min-width="80" align="center">
  142. <template slot-scope="scope">
  143. <div style="font-size: 13px;" v-if="scope.row.user_id>0">{{scope.row.user_id}}</div>
  144. <div style="font-size: 13px;color: red;" v-else>0</div>
  145. </template>
  146. </el-table-column>
  147. <el-table-column label="会员" width="180" >
  148. <template slot-scope="scope">
  149. <div class="user_img" v-if="scope.row.user_id>0">
  150. <el-image class="default-avatar" :src="scope.row.user.avatar_url">
  151. <div slot="error" class="image-slot">
  152. <com-image src="/resources/img/common/default-avatar.png"></com-image>
  153. </div>
  154. </el-image>
  155. </div>
  156. <div class="user_img" v-else>
  157. <el-image class="default-avatar" :src="scope.row.user_avatar_url">
  158. <div slot="error" class="image-slot">
  159. <com-image src="/resources/img/common/default-avatar.png"></com-image>
  160. </div>
  161. </el-image>
  162. </div>
  163. <div>
  164. <div style="color:#000;" v-if="scope.row.user_id>0">{{scope.row.user.nickname}}</div>
  165. <div style="color:#000;" v-else>{{scope.row.user_name}}</div>
  166. <div style="font-size: 13px;" v-if="scope.row.user_id>0">{{scope.row.user.mobile}}</div>
  167. </div>
  168. </template>
  169. </el-table-column>
  170. <el-table-column label="标题" min-width="80" align="center">
  171. <template slot-scope="scope">
  172. <p>{{scope.row.title}}</p>
  173. </template>
  174. </el-table-column>
  175. <el-table-column label="分类" min-width="80" align="center">
  176. <template slot-scope="scope">
  177. <p>{{scope.row.cate.name}}</p>
  178. </template>
  179. </el-table-column>
  180. <el-table-column label="关联商品" width="250" >
  181. <template slot-scope="scope">
  182. <div v-if="scope.row.goods != ''&& scope.row.goods != null">
  183. <div style="float: left; width:60px">
  184. <img width='60px' height='60px'
  185. style="float: left;"
  186. v-if="scope.row.goods.cover_pic"
  187. :src="scope.row.goods.cover_pic"
  188. />
  189. </div>
  190. <div style="float: left; width: 50%;margin-left: 10px; text-align: left;">
  191. <com-ellipsis :line="1" :title="scope.row.goods.goods_name">{{scope.row.goods.goods_name}}</com-ellipsis>
  192. <p style="color: red;">¥{{scope.row.goods.price}}</p>
  193. </div>
  194. </div>
  195. <samp v-else>--</samp>
  196. </template>
  197. </el-table-column>
  198. <el-table-column label="浏览数" min-width="80" align="center">
  199. <template slot-scope="scope">
  200. <p>{{scope.row.views_count}}</p>
  201. </template>
  202. </el-table-column>
  203. <el-table-column label="点赞数" min-width="80" align="center">
  204. <template slot-scope="scope">
  205. <p>{{scope.row.stars_count}}</p>
  206. </template>
  207. </el-table-column>
  208. <el-table-column label="启用状态" min-width="80" align="center">
  209. <template slot-scope="scope">
  210. <el-switch active-value="1" inactive-value="0" @change="handle('enable',scope.row)"
  211. v-model="scope.row.status + ''">
  212. </el-switch>
  213. </template>
  214. </el-table-column>
  215. <el-table-column prop="scope" width="160" label="创建时间">
  216. <template slot-scope="scope">
  217. {{scope.row.created_at|dateTimeFormat('Y-m-d H:i:s')}}
  218. </template>
  219. </el-table-column>
  220. <el-table-column
  221. label="操作"
  222. min-width="180"
  223. align="center">
  224. <template slot-scope="scope">
  225. <el-button circle size="mini" type="text" @click="detail(scope.row)">
  226. 查看
  227. </el-button>
  228. <el-button circle size="mini" type="text" @click="handle('delete',scope.row)">
  229. 删除
  230. </el-button>
  231. </template>
  232. </el-table-column>
  233. </el-table>
  234. <div style="text-align: right;margin: 20px 0;">
  235. <el-pagination v-if="pagination" :page-size="pagination.pageSize"
  236. style="display: inline-block;float: right;" background @current-change="pageChange"
  237. layout="prev, pager, next" :total="pagination.total_count">
  238. </el-pagination>
  239. </div>
  240. </div>
  241. </el-card>
  242. <!-- “数据”弹窗 -->
  243. <!-- <el-dialog title="数据(数据更新于2021-02-12 12:11)" :visible.sync="dialogFormVisible"> -->
  244. <el-dialog title="数据详情" :visible.sync="dialogFormVisible" >
  245. <div class="flex-x-between">
  246. <div>种草:{{data_list.title}}</div>
  247. <div style="color: #999;" v-if="data_list.created_at">
  248. 发布时间:{{data_list.created_at | dateTimeFormat("Y-m-d H:i:s")}}
  249. </div>
  250. </div>
  251. <div class="dialog-cont">
  252. <div class="cont-title">基本信息</div>
  253. <el-row :gutter="20" style="padding: 0px 10px;">
  254. <dl>正文:<span style="margin-left: 20px;">{{data_list.main_text}}</span></dl>
  255. </el-row>
  256. <el-row :gutter="20" style="padding: 0px 10px;">
  257. <div style="float: left" v-if="data_list && data_list.source.type == 1">图片:</div>
  258. <div style="float: left" v-else>视频:</div>
  259. <div style="float: left;margin-left: 20px;">
  260. <div v-if="data_list && data_list.source.type == 1" class="demo-image__preview">
  261. <el-image v-for="item in data_list.source.source" style="width: 80px; height: 80px;margin-left: 10px;" :src="item" :preview-src-list="data_list.source.source"> </el-image>
  262. </div>
  263. <div v-else>
  264. <video ref="videoPlayer" controls :src="data_list.source.source" :poster="data_list.source.source" controlslist="nodownload" style="width: 50%; height: 50%; object-fit: fill">
  265. </video>
  266. </div>
  267. </div>
  268. </el-row>
  269. </div>
  270. <div class="dialog-cont" :data="data_list">
  271. <div class="cont-title">互动数据</div>
  272. <el-row :gutter="20" style="padding: 10px 0">
  273. <el-col :span="6">
  274. <div class="cont-num center">{{data_list.shares_count}}</div>
  275. <div class="center">分享次数</div>
  276. </el-col>
  277. <el-col :span="6">
  278. <div class="cont-num center">{{data_list.views_count}}</div>
  279. <div class="center">浏览数</div>
  280. </el-col>
  281. <el-col :span="6">
  282. <div class="cont-num center">{{data_list.discuss_count}}</div>
  283. <div class="center">评论人数</div>
  284. </el-col>
  285. <el-col :span="6">
  286. <div class="cont-num center">{{data_list.stars_count}}</div>
  287. <div class="center">点赞数</div>
  288. </el-col>
  289. </el-row>
  290. </div>
  291. <div class="dialog-cont">
  292. <div class="cont-title">商品数据</div>
  293. <el-table :data = "goods_data" height="250" style="width: 100%" :header-cell-style="{'text-align':'center'}" :cell-style="{'text-align':'center'}">
  294. <el-table-column label="商品名称" align="center">
  295. <template slot-scope="scope">
  296. <div v-if="scope.row.goods != ''&& scope.row.goods != null">
  297. <div style="float: left; width:60px">
  298. <img width='60px' height='60px'
  299. style="float: left;"
  300. v-if="scope.row.goods.cover_pic"
  301. :src="scope.row.goods.cover_pic"
  302. />
  303. </div>
  304. <div style="float: left; width: 50%;margin-left: 10px; text-align: left;">
  305. <com-ellipsis :line="1" :title="scope.row.goods.goods_name">{{scope.row.goods.goods_name}}</com-ellipsis>
  306. <p style="color: red;">¥{{scope.row.goods.price}}</p>
  307. </div>
  308. </div>
  309. <samp v-else>--</samp>
  310. </template>
  311. </el-table-column>
  312. <el-table-column prop="view_number" label="商品访问人数" width="180">
  313. <template slot-scope="scope">
  314. <span :title="scope.row.view_number" class="">{{scope.row.goods_views_count}}</span>
  315. </template>
  316. </el-table-column>
  317. <el-table-column prop="bought_number" label="成交人数">
  318. <template slot-scope="scope">
  319. <span :title="scope.row.bought_number" class="">{{scope.row.order_count}}</span>
  320. </template>
  321. </el-table-column>
  322. <el-table-column prop="amount" label="成交金额">
  323. <template slot-scope="scope">
  324. <span :title="scope.row.amount" class="">{{scope.row.goods_amount}}</span>
  325. </template>
  326. </el-table-column>
  327. </el-table>
  328. </div>
  329. </el-dialog>
  330. </div>
  331. <script>
  332. const app = new Vue({
  333. el: '#app',
  334. data() {
  335. return {
  336. listLoading: false,
  337. page: 1,
  338. pageCount: 0,
  339. //基础数据
  340. editBasisData: {
  341. materialTypeList: [],
  342. },
  343. //本地存时间,请求时不发送
  344. time: [],
  345. search: {
  346. keyword: '',
  347. user_id: '',
  348. title: '',
  349. user_name: '',
  350. check_status: '1',
  351. date_start: null,
  352. date_end: null,
  353. },
  354. list: [],
  355. //弹框配置
  356. addForm: {
  357. id: '',
  358. name: '',
  359. },
  360. title: "",
  361. dialogFormVisible: false, //数据弹窗
  362. data_list: {
  363. source:{"type":1,"source": ['1','2']},
  364. },//数据
  365. goods_data:[],//详细数据
  366. dialogAddgsVisible: false,
  367. // 对话框显示与否
  368. dialogVisible: false,
  369. dataloading: false,
  370. pagination:null,
  371. };
  372. },
  373. methods: {
  374. searchs() {
  375. this.page = 1;
  376. this.getList();
  377. },
  378. pageChange(currentPage) {
  379. let self = this;
  380. self.page = currentPage;
  381. self.getList();
  382. },
  383. getList() {
  384. let self = this;
  385. self.listLoading = true;
  386. // 检查是否选择了搜索时间
  387. if (!self.time) {
  388. self.search.date_start = '';
  389. self.search.date_end = '';
  390. } else {
  391. self.search.date_start = self.time[0];
  392. self.search.date_end = self.time[1];
  393. }
  394. request({
  395. method: 'post',
  396. params: {
  397. r: 'xhs/default/index',
  398. },
  399. data: {
  400. page: self.page,
  401. keyword: self.search.keyword,
  402. user_id: self.search.user_id,
  403. mobile: self.search.mobile,
  404. user_name: self.search.user_name,
  405. check_status: self.search.check_status,
  406. date_start: self.search.date_start,
  407. date_end: self.search.date_end,
  408. title: self.search.title,
  409. },
  410. }).then(e => {
  411. self.listLoading = false;
  412. self.list = e.data.data.list;
  413. this.pagination = e.data.data.pagination;
  414. this.pagination.pageSize = e.data.data.page_size;
  415. this.pagination.total_count = e.data.data.count;
  416. }).catch(e => {
  417. console.log(e);
  418. });
  419. },
  420. detail(data) {
  421. console.log(data);
  422. this.data_list = [];
  423. this.goods_data = [];
  424. this.dialogFormVisible = true;
  425. this.data_list = data;
  426. this.goods_data.push(data);
  427. },
  428. handle(type,data = null){
  429. switch (type) {
  430. case 'delete':// 删除
  431. this.$confirm('删除该条数据后不可以恢复, 是否继续?', '警告', {type: 'warning'}).then(() => {this.send({id: data.id,status:-1,type:'1'});})
  432. break;
  433. case 'enable':
  434. var status = 0;
  435. if(data.status=='0') status = 1;
  436. this.send({id: data.id,status: status,type:'1'});
  437. break;
  438. }
  439. },
  440. send(data){
  441. let self = this;
  442. self.listLoading = true;
  443. request({
  444. params: {
  445. r: 'xhs/default/edit',
  446. },
  447. method: 'post',
  448. data:data,
  449. }).then(e => {
  450. self.listLoading = false;
  451. if (e.data.code === 0) {
  452. self.$message.success(e.data.msg);
  453. } else {
  454. self.$message.error(e.data.msg);
  455. }
  456. self.getList();
  457. }).catch(e => {
  458. console.log(e);
  459. });
  460. },
  461. /**
  462. *关闭或取消模态框,清空值
  463. * @param
  464. */
  465. closeDialogAddgsVisible() {
  466. this.$refs.addForm.resetFields();//element封装的方法,清空模态框的值
  467. this.title = "" //初始化title的值
  468. this.addForm = {//初始化addForm中的值
  469. title: "",
  470. }
  471. },
  472. },
  473. mounted: function () {
  474. this.getList();
  475. }
  476. });
  477. </script>