index.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  1. <?php
  2. /**
  3. * @link:http://www.goodmall.com/
  4. * @copyright: Copyright (c) 2020
  5. * 名片
  6. * Author: james
  7. * Date: 2020-07-10
  8. * Time: 15:48
  9. */
  10. ?>
  11. <div id="app" v-cloak>
  12. <el-card shadow="never" style="border:0;min-width: 1200px;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  13. <div slot="header">
  14. <span>类目管理</span>
  15. <div style="float: right; margin: -5px 0">
  16. <el-button type="primary" size="small" @click="onEdit(0)">添加类目</el-button>
  17. </div>
  18. </div>
  19. <div class="table-body">
  20. <el-form size="small" :inline="true" flex="dir:left cross:center">
  21. <div class="item-box">
  22. <el-select v-model="search.shop_id" placeholder="请选择所属店铺进行搜索" clearable size="small">
  23. <el-option v-for="(name, index) in shops" :key="index" :label="name" :value="index"></el-option>
  24. </el-select>
  25. </div>
  26. <div class="item-box">
  27. <el-select v-model="search.status" placeholder="请选择审核状态进行搜索" clearable size="small">
  28. <el-option v-for="(name, index) in status_map" :key="index" :label="name" :value="index"></el-option>
  29. </el-select>
  30. </div>
  31. <div class="item-box" flex="dir:left cross:center">
  32. <el-button size="small" type="primary" style="padding: 9px 15px !important;" @click="searchs">搜索</el-button>
  33. </div>
  34. </el-form>
  35. <el-tabs v-model="activeName" @tab-click="handleClick">
  36. <el-table :data="list" stripe v-loading="loading" size="small" style="margin-bottom: 15px;"
  37. @selection-change="handleSelectionChange">
  38. <el-table-column label="所属店铺" align="left">
  39. <template slot-scope="scope">
  40. {{scope.row.shop.name}}
  41. </template>
  42. </el-table-column>
  43. <el-table-column label="一级类目" align="left">
  44. <template slot-scope="scope">
  45. {{scope.row.catOne.name}}
  46. </template>
  47. </el-table-column>
  48. <el-table-column label="二级类目" align="left">
  49. <template slot-scope="scope">
  50. {{scope.row.catTwo.name}}
  51. </template>
  52. </el-table-column>
  53. <el-table-column label="三级类目" align="left">
  54. <template slot-scope="scope">
  55. {{scope.row.catThree.name}}
  56. </template>
  57. </el-table-column>
  58. <el-table-column label="审核状态" width="160" align="center">
  59. <template slot-scope="scope">
  60. {{status_map[scope.row.audit_status] ? status_map[scope.row.audit_status] : '审核中'}}
  61. </template>
  62. </el-table-column>
  63. <el-table-column label="审核失败原因" align="left">
  64. <template slot-scope="scope">
  65. {{scope.row.audit_status == 2 ? scope.row.audit_reason : '-'}}
  66. </template>
  67. </el-table-column>
  68. <el-table-column label="更新时间" width="160" align="center">
  69. <template slot-scope="scope">
  70. <div>{{scope.row.updated_at|dateTimeFormat('Y-m-d H:i:s')}}</div>
  71. </template>
  72. </el-table-column>
  73. </el-table>
  74. </el-tabs>
  75. <!-- 分页器 -->
  76. <div flex="box:last cross:center">
  77. <div></div>
  78. <div>
  79. <el-pagination v-if="pagination" :page-size="pagination.defaultPageSize"
  80. style="display: inline-block;float: right;" background @current-change="pageChange"
  81. layout="prev, pager, next" :total="pagination.totalCount">
  82. </el-pagination>
  83. </div>
  84. </div>
  85. </div>
  86. <!-- 这个是复制用的容器,已隐藏 -->
  87. <textarea id="inputs" style="opacity: 0;width: 0;height: 0;">这是幕后黑手</textarea>
  88. <el-dialog
  89. title="添加类目"
  90. :visible.sync="catDialogVisible"
  91. width="60%">
  92. <el-form size="small" ref="catForm" :model="catForm" label-position="top">
  93. <el-form-item label="请选择店铺" prop="shop_id" :rules="[{required: true, message: '请选择店铺'}]">
  94. <el-select v-model="catForm.shop_id" placeholder="请选择店铺" clearable size="small">
  95. <el-option v-for="(name, index) in shops" :key="index" :label="name" :value="index"></el-option>
  96. </el-select>
  97. </el-form-item>
  98. <el-form-item label="请选择类目" prop="cats" :rules="[{required: true, message: '请选择类目'}]">
  99. <el-cascader-panel v-model="catForm.cats" :options="wxList" :props="{
  100. value: 'id',
  101. label: 'name'
  102. }" @change="onChangeWxCat"></el-cascader-panel>
  103. </el-form-item>
  104. <div v-if="currentQua && currentQua.tips_list" style="padding-bottom: 10px">
  105. <div v-for="(item, index) in currentQua.tips_list" :key="index" style="margin-top: 10px; color: red">
  106. {{item}}
  107. </div>
  108. <h4>上传资质</h4>
  109. <el-form-item label="上传资质" prop="certificate">
  110. <div flex="dir:left">
  111. <div class="card-coverimg" v-for="(item, index) in catForm.certificate" :key="index">
  112. <el-image class="elImages" style="width: 80px; height: 80px;cursor: move;" :src="item"></el-image>
  113. <el-button @click="delCertificate(index)" class="icon-close" type="primary" size="mini" icon="el-icon-close" circle></el-button>
  114. </div>
  115. <com-attachment v-if="catForm.certificate.length < 11" :multiple="true" :max="9" type="images" @selected="certificatePic">
  116. <div class="card-upload">
  117. <i class="el-icon-plus"></i>
  118. </div>
  119. </com-attachment>
  120. </div>
  121. </el-form-item>
  122. </div>
  123. </el-form>
  124. <span slot="footer" class="dialog-footer">
  125. <el-button @click="catDialogVisible = false">取 消</el-button>
  126. <el-button type="primary" @click="onSubmitCat" :disabled="btnLoading" v-loading="btnLoading">确 定</el-button>
  127. </span>
  128. </el-dialog>
  129. </el-card>
  130. </div>
  131. <script>
  132. const app = new Vue({
  133. el: '#app',
  134. data: {
  135. page:1,
  136. search: {
  137. status: '',
  138. },
  139. loading: false,
  140. activeName: '-1',
  141. list: [], //列表数据
  142. pagination: null,
  143. status_map: {},
  144. wxList: [],
  145. catDialogVisible: false,
  146. selectedCats: [],
  147. currentQua: null,
  148. certificate: [],
  149. btnLoading: false,
  150. shops: {},
  151. catForm: {
  152. cats: [],
  153. shop_id: '',
  154. certificate: [],
  155. cat: ''
  156. }
  157. },
  158. mounted() {
  159. // 获取列表首页数据
  160. this.loadData(this.page,this.search); //获取列表数据
  161. this.getWxCat()
  162. },
  163. methods: {
  164. // 1.0 获取视频列表
  165. loadData(page,others) {
  166. this.loading = true;
  167. request({
  168. method: 'get',
  169. params: {
  170. r: 'wechat-video-shop/cate/index',
  171. page: page,
  172. limit: 10,
  173. ...others, //其他搜索字段
  174. },
  175. }).then(e => {
  176. this.loading = false;
  177. if (e.data.code === 0) {
  178. this.list = e.data.data.list;
  179. this.shops = e.data.data.shop;
  180. this.status_map = e.data.data.status_map;
  181. this.pagination = e.data.data.pagination;
  182. } else {
  183. this.$message.error(e.data.msg);
  184. }
  185. }).catch(e => {
  186. });
  187. },
  188. getWxCat() {
  189. // 获取所有类目
  190. request({
  191. method: 'get',
  192. params: {
  193. r: 'wechat-video-shop/cate/wx-list',
  194. },
  195. }).then(e => {
  196. this.loading = false;
  197. if (e.data.code === 0) {
  198. this.wxList = e.data.data
  199. } else {
  200. this.$message.error(e.data.msg);
  201. }
  202. }).catch(e => {
  203. });
  204. },
  205. handleClick(tab, event) {
  206. this.page = 1;
  207. this.search.status = this.activeName;
  208. this.loadData(this.page,this.search)
  209. },
  210. handleSelectionChange(val) {
  211. let self = this;
  212. self.choose_list = [];
  213. val.forEach(function (item) {
  214. self.choose_list.push(item.id);
  215. })
  216. },
  217. searchs() {
  218. this.page = 1;
  219. this.loadData(this.page,this.search);
  220. },
  221. onEdit(id) {
  222. this.currentQua = null
  223. this.catDialogVisible = true;
  224. },
  225. pageChange(page) {
  226. this.page = page;
  227. this.loadData(this.page,this.search);
  228. },
  229. pageChangeDataPop(page) {
  230. },
  231. onChangeWxCat(val) {
  232. if (val.length === 3) {
  233. for (let i in this.wxList) {
  234. if (this.wxList[i].id == val[0]) {
  235. for (let childrenKey in this.wxList[i].children) {
  236. if (this.wxList[i].children[childrenKey].id == val[1]) {
  237. for (let childrenKey1 in this.wxList[i].children[childrenKey].children) {
  238. if (this.wxList[i].children[childrenKey].children[childrenKey1].id == val[2]) {
  239. this.currentQua = JSON.parse(this.wxList[i].children[childrenKey].children[childrenKey1].qua)
  240. if (this.currentQua.tips) {
  241. this.currentQua.tips_list = this.currentQua.tips.split(';')
  242. }
  243. }
  244. }
  245. }
  246. }
  247. }
  248. }
  249. this.catForm.cat = val[2]
  250. this.catForm.cats = val
  251. }
  252. },
  253. onSubmitCat() {
  254. // if (this.selectedCats.length < 3) {
  255. // this.$message.error('类目不能为空');
  256. // return;
  257. // }
  258. // if (this.currentQua && this.currentQua.tips_list && this.certificate.length <= 0) {
  259. // this.$message.error('资质不能为空');
  260. // return;
  261. // }
  262. this.$refs['catForm'].validate((valid) => {
  263. if (valid) {
  264. this.btnLoading = true;
  265. request({
  266. method: 'post',
  267. params: {
  268. r: 'wechat-video-shop/cate/create',
  269. },
  270. data: this.catForm
  271. }).then(e => {
  272. this.btnLoading = false;
  273. if (e.data.code === 0) {
  274. this.$message.success(e.data.msg);
  275. this.loadData(1, {})
  276. this.catDialogVisible = false
  277. } else {
  278. this.$message.error(e.data.msg);
  279. }
  280. }).catch(e => {
  281. this.btnLoading = false;
  282. });
  283. }
  284. })
  285. },
  286. certificatePic(e) { // 选择轮播图
  287. if (e.length) {
  288. e.forEach((item, index) => {
  289. if (this.catForm.certificate.length >= 10) return;
  290. this.catForm.certificate.push(item.url);
  291. })
  292. }
  293. },
  294. delCertificate(type, index) { // 删除图片
  295. this.catForm.certificate.splice(index, 1)
  296. },
  297. }
  298. });
  299. </script>
  300. <style>
  301. .el-tabs__header {
  302. font-size: 16px;
  303. }
  304. .table-body {
  305. padding: 20px;
  306. background-color: #fff;
  307. }
  308. .table-body .el-button {
  309. padding: 0 !important;
  310. border: 0;
  311. margin: 0 5px;
  312. }
  313. .input-item {
  314. width: 250px;
  315. margin: 0 0 20px;
  316. display: inline-block;
  317. }
  318. .input-item .el-input__inner {
  319. border-right: 0;
  320. }
  321. .input-item .el-input__inner:hover {
  322. border: 1px solid #dcdfe6;
  323. border-right: 0;
  324. outline: 0;
  325. }
  326. .input-item .el-input__inner:focus {
  327. border: 1px solid #dcdfe6;
  328. border-right: 0;
  329. outline: 0;
  330. }
  331. .input-item .el-input-group__append {
  332. background-color: #fff;
  333. border-left: 0;
  334. width: 10%;
  335. padding: 0;
  336. }
  337. .input-item .el-input-group__append .el-button {
  338. padding: 0;
  339. }
  340. .input-item .el-input-group__append .el-button {
  341. margin: 0;
  342. }
  343. .batch {
  344. margin: 0 0 20px;
  345. display: inline-block;
  346. }
  347. .batch .el-button {
  348. padding: 9px 15px !important;
  349. }
  350. .item-box{
  351. margin-right: 20px;
  352. }
  353. .item-box .label{
  354. margin-right: 8px;
  355. }
  356. .item-box .symbol{
  357. margin: 0 6px;
  358. }
  359. .form-nickname{
  360. width: 180px;
  361. white-space:nowrap;
  362. overflow:hidden;
  363. text-overflow:ellipsis;
  364. }
  365. .index-video-url{
  366. width: 300px;
  367. }
  368. .index-video-url video{
  369. width: 100%;
  370. }
  371. .index-related-info{
  372. width: 500px;
  373. }
  374. .video-top{
  375. width: 100%;
  376. display: flex;
  377. align-items: flex-start;
  378. box-sizing: border-box;
  379. padding: 20px;
  380. /* opacity: .5; */
  381. background-color: #FFFFFF;
  382. }
  383. .video-top .top-right{
  384. line-height: 26px;
  385. }
  386. .video-top .top-right .top-title{
  387. font-size: 18px;
  388. white-space:nowrap;
  389. overflow:hidden;
  390. text-overflow:ellipsis;
  391. width: 360px;
  392. }
  393. .video-top .top-right .wrapper{
  394. display: flex;
  395. /* align-items: flex-start; */
  396. }
  397. .video-top .top-right .wrapper .to-copy{
  398. /* color: #03C5FF; */
  399. margin-left: 20px;
  400. }
  401. .video-top .top-right .detail-price{
  402. color: #BC0100;
  403. font-size: 18px;
  404. font-family: Microsoft YaHei;
  405. font-weight: bold;
  406. }
  407. /* .atooltip {
  408. background: #FFFFFF !important;
  409. border: none !important;
  410. } */
  411. .el-table th>.cell{
  412. color: #333;
  413. font-weight: bold;
  414. font-size: 14px;
  415. }
  416. .el-table__footer-wrapper, .el-table__header-wrapper{
  417. border-bottom: 1.4px solid #D6D6D6;
  418. }
  419. .price_col{
  420. color: #FF5D05;
  421. }
  422. </style>