bannerList.vue 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042
  1. <template>
  2. <el-tabs v-model="activeName" @tab-click="handleClick">
  3. <el-tab-pane label="轮播图" name="first">
  4. <div style="float: right;margin-right:2%;">
  5. <el-button style='margin: 10px 0;' :disabled="!isAuth('bannerList:add')" size="mini" type="primary"
  6. icon="document" @click="addNotice">添加轮播图</el-button>
  7. </div>
  8. <el-table v-loading="tableDataLoading" :data="tableData">
  9. <el-table-column fixed prop="id" label="编号" width="50">
  10. </el-table-column>
  11. <el-table-column prop="imageUrl" label="头像">
  12. <template slot-scope="scope">
  13.   <img :src="scope.row.imageUrl" width="60" height="60" />
  14. </template>
  15. </el-table-column>
  16. <el-table-column prop="name" label="轮播图名称">
  17. </el-table-column>
  18. <el-table-column prop="state" label="状态">
  19. <template slot-scope="scope">
  20. <span v-if='scope.row.state == 1'>显示</span>
  21. <span v-if='scope.row.state == 2' style="color: #f56c6c;">隐藏</span>
  22. </template>
  23. </el-table-column>
  24. <el-table-column prop="state" label="是否启用">
  25. <template slot-scope="scope">
  26. <el-switch v-model="scope.row.state" @change="change(scope.row.state,scope.row)" :active-value="openValue"
  27. :inactive-value="closeValue" active-color="#13ce66" inactive-color="#ff4949" :disabled="!isAuth('bannerList:update')">
  28. </el-switch>
  29. </template>
  30. </el-table-column>
  31. <el-table-column prop="createTime" label="创建时间" width="160">
  32. </el-table-column>
  33. <el-table-column label="操作" width="180">
  34. <template slot-scope="scope">
  35. <el-button size="mini" type="primary" :disabled="!isAuth('bannerList:update')"
  36. @click="amendBanner(scope.$index, scope.row)">修改
  37. </el-button>
  38. <el-button size="mini" type="danger" :disabled="!isAuth('bannerList:delete')" @click="deletes(scope.row)">删除
  39. </el-button>
  40. </template>
  41. </el-table-column>
  42. </el-table>
  43. <div style="text-align: center;margin-top: 10px;float:right">
  44. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
  45. :page-sizes="[10, 20, 30,50,100]" :page-size="limit" :current-page="page" layout="total,sizes, prev, pager, next"
  46. :total="tableData.length">
  47. </el-pagination>
  48. </div>
  49. <!-- 添加弹框 -->
  50. <el-dialog title="添加" :visible.sync="dialogFormVisible" center>
  51. <div style="margin-bottom: 10px;display: flex;">
  52. <span style="width: 200px;display: inline-block;text-align: right;">图片:</span>
  53. <div
  54. style=" width:148px;height:148px;border: 1px dashed #c0ccda;border-radius: 6px;text-align: center;line-height: 148px;">
  55. <el-upload class="avatar-uploader" v-model="imageUrl"
  56. action="https://mxys.chuanghai-tech.com/sqx_fast/alioss/upload" :show-file-list="false"
  57. :on-success="handleAvatarSuccess">
  58. <img v-if="imageUrl" :src="imageUrl" class="avatar"
  59. style="border-radius: 6px;width: 148px;height: 148px;" />
  60. <i v-else class="el-icon-plus avatar-uploader-icon"></i>
  61. </el-upload>
  62. </div>
  63. </div>
  64. <div style="margin-bottom: 10px;">
  65. <span style="width: 200px;display: inline-block;text-align: right;">链接:</span>
  66. <el-input style="width:50%;" v-model="url" placeholder="请输入链接"></el-input>
  67. </div>
  68. <div style="margin-bottom: 10px;">
  69. <span style="width: 200px;display: inline-block;text-align: right;">名称:</span>
  70. <el-input style="width:50%;" v-model="name" placeholder="请输入名称"></el-input>
  71. </div>
  72. <div style="margin-bottom: 10px;">
  73. <span style="width: 200px;display: inline-block;text-align: right;">备注:</span>
  74. <el-input style="width:50%;" v-model="describes" placeholder="请输入描述"></el-input>
  75. </div>
  76. <div slot="footer" class="dialog-footer">
  77. <el-button @click="dialogFormVisible = false">取 消</el-button>
  78. <el-button type="primary" @click="addNoticeTo()">确 定</el-button>
  79. </div>
  80. </el-dialog>
  81. </el-tab-pane>
  82. <!-- <el-tab-pane label="首页分类" name="second">
  83. <div style="float: right;margin-right:2%;">
  84. <el-button style='margin: 10px 0;' :disabled="!isAuth('bannerList:add')" size="mini" type="primary"
  85. icon="document" @click="addNotice2">添加任务分类</el-button>
  86. </div>
  87. <el-table v-loading="tableDataLoading" :data="tableData">
  88. <el-table-column fixed prop="id" label="编号" width="80">
  89. </el-table-column>
  90. <el-table-column prop="imageUrl" label="头像">
  91. <template slot-scope="scope">
  92.   <img :src="scope.row.imageUrl" width="60" height="60" />
  93. </template>
  94. </el-table-column>
  95. <el-table-column prop="name" label="分类名称">
  96. </el-table-column>
  97. <el-table-column prop="url" label="链接" width="180">
  98. </el-table-column>
  99. <el-table-column prop="state" label="状态">
  100. <template slot-scope="scope">
  101. <span v-if='scope.row.state == 1'>显示</span>
  102. <span v-if='scope.row.state == 2' style="color: #f56c6c;">隐藏</span>
  103. </template>
  104. </el-table-column>
  105. <el-table-column prop="state" label="是否启用">
  106. <template slot-scope="scope">
  107. <el-switch v-model="scope.row.state" @change="change(scope.row.state,scope.row)" :active-value="openValue"
  108. :inactive-value="closeValue" active-color="#13ce66" inactive-color="#ff4949">
  109. </el-switch>
  110. </template>
  111. </el-table-column>
  112. <el-table-column prop="createTime" label="创建时间" width="160">
  113. </el-table-column>
  114. <el-table-column label="操作" width="180">
  115. <template slot-scope="scope">
  116. <el-button size="mini" type="primary" :disabled="!isAuth('bannerList:update')"
  117. @click="amendBanner(scope.$index, scope.row)">修改
  118. </el-button>
  119. <el-button size="mini" type="danger" :disabled="!isAuth('bannerList:delete')" @click="deletes(scope.row)">删除
  120. </el-button>
  121. </template>
  122. </el-table-column>
  123. </el-table>
  124. <div style="text-align: center;margin-top: 10px;float:right">
  125. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
  126. :page-sizes="[10, 20, 30,50,100]" :page-size="limit" :current-page="page" layout="total,sizes, prev, pager, next"
  127. :total="tableData.length">
  128. </el-pagination>
  129. </div> -->
  130. <!-- 添加弹框 -->
  131. <!-- <el-dialog title="添加" :visible.sync="dialogFormVisible2" center>
  132. <div style="margin-bottom: 10px;display: flex;">
  133. <span style="width: 200px;display: inline-block;text-align: right;">图片:</span>
  134. <div
  135. style=" width:148px;height:148px;border: 1px dashed #c0ccda;border-radius: 6px;text-align: center;line-height: 148px;">
  136. <el-upload class="avatar-uploader" v-model="imageUrl"
  137. action="https://mxys.chuanghai-tech.com/sqx_fast/alioss/upload" :show-file-list="false"
  138. :on-success="handleAvatarSuccess">
  139. <img v-if="imageUrl" :src="imageUrl" class="avatar"
  140. style="border-radius: 6px;width: 148px;height: 148px;" />
  141. <i v-else class="el-icon-plus avatar-uploader-icon"></i>
  142. </el-upload>
  143. </div>
  144. </div>
  145. <div style="margin-bottom: 10px;">
  146. <span style="width: 200px;display: inline-block;text-align: right;">链接:</span>
  147. <el-input style="width:50%;" v-model="url" placeholder="请输入链接"></el-input>
  148. </div>
  149. <div style="margin-bottom: 10px;">
  150. <span style="width: 200px;display: inline-block;text-align: right;">名称:</span>
  151. <el-input style="width:50%;" v-model="name" placeholder="请输入名称"></el-input>
  152. </div>
  153. <div style="margin-bottom: 10px;">
  154. <span style="width: 200px;display: inline-block;text-align: right;">备注:</span>
  155. <el-input style="width:50%;" v-model="describes" placeholder="请输入描述"></el-input>
  156. </div>
  157. <div slot="footer" class="dialog-footer">
  158. <el-button @click="dialogFormVisible2 = false">取 消</el-button>
  159. <el-button type="primary" @click="addNoticeTo2()">确 定</el-button>
  160. </div>
  161. </el-dialog>
  162. </el-tab-pane> -->
  163. <el-tab-pane label="首页分类" name="fifth">
  164. <div style="float: right;margin-right:2%;">
  165. <el-button style='margin: 10px 0;' :disabled="!isAuth('bannerList:add')" size="mini" type="primary"
  166. icon="document" @click="addNotice4">添加分类</el-button>
  167. </div>
  168. <el-table v-loading="tableDataLoading" :data="tableData" >
  169. <el-table-column fixed prop="id" label="编号" width="50">
  170. </el-table-column>
  171. <el-table-column prop="imageUrl" label="头像">
  172. <template slot-scope="scope">
  173.   <img :src="scope.row.imageUrl" width="60" height="60" />
  174. </template>
  175. </el-table-column>
  176. <el-table-column prop="name" label="分类名称">
  177. </el-table-column>
  178. <el-table-column prop="url" label="链接" width="180">
  179. </el-table-column>
  180. <el-table-column prop="state" label="状态">
  181. <template slot-scope="scope">
  182. <span v-if='scope.row.state == 1'>显示</span>
  183. <span v-if='scope.row.state == 2' style="color: #f56c6c;">隐藏</span>
  184. </template>
  185. </el-table-column>
  186. <el-table-column prop="state" label="是否启用">
  187. <template slot-scope="scope">
  188. <el-switch v-model="scope.row.state" @change="change(scope.row.state,scope.row)" :active-value="openValue"
  189. :inactive-value="closeValue" active-color="#13ce66" inactive-color="#ff4949" :disabled="!isAuth('bannerList:update')">
  190. </el-switch>
  191. </template>
  192. </el-table-column>
  193. <el-table-column prop="createTime" label="创建时间" width="160">
  194. </el-table-column>
  195. <el-table-column label="操作" width="180">
  196. <template slot-scope="scope">
  197. <el-button size="mini" type="primary" :disabled="!isAuth('bannerList:update')"
  198. @click="amendBanner(scope.$index, scope.row)">修改
  199. </el-button>
  200. <el-button size="mini" type="danger" :disabled="!isAuth('bannerList:delete')" @click="deletes(scope.row)">删除
  201. </el-button>
  202. </template>
  203. </el-table-column>
  204. </el-table>
  205. <div style="text-align: center;margin-top: 10px;float:right">
  206. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
  207. :page-sizes="[10, 20, 30,50,100]" :page-size="limit" :current-page="page" layout="total,sizes, prev, pager, next"
  208. :total="tableData.length">
  209. </el-pagination>
  210. </div>
  211. <!-- 添加弹框 -->
  212. <el-dialog title="添加" :visible.sync="dialogFormVisible4" center>
  213. <div style="margin-bottom: 10px;display: flex;">
  214. <span style="width: 200px;display: inline-block;text-align: right;">图片:</span>
  215. <div
  216. style=" width:148px;height:148px;border: 1px dashed #c0ccda;border-radius: 6px;text-align: center;line-height: 148px;">
  217. <el-upload class="avatar-uploader" v-model="imageUrl"
  218. action="https://mxys.chuanghai-tech.com/sqx_fast/alioss/upload" :show-file-list="false"
  219. :on-success="handleAvatarSuccess">
  220. <img v-if="imageUrl" :src="imageUrl" class="avatar"
  221. style="border-radius: 6px;width: 148px;height: 148px;" />
  222. <i v-else class="el-icon-plus avatar-uploader-icon"></i>
  223. </el-upload>
  224. </div>
  225. </div>
  226. <div style="margin-bottom: 10px;">
  227. <span style="width: 200px;display: inline-block;text-align: right;">链接:</span>
  228. <el-input style="width:50%;" v-model="url" placeholder="请输入链接"></el-input>
  229. </div>
  230. <div style="margin-bottom: 10px;">
  231. <span style="width: 200px;display: inline-block;text-align: right;">名称:</span>
  232. <el-input style="width:50%;" v-model="name" placeholder="请输入名称"></el-input>
  233. </div>
  234. <div style="margin-bottom: 10px;">
  235. <span style="width: 200px;display: inline-block;text-align: right;">备注:</span>
  236. <el-input style="width:50%;" v-model="describes" placeholder="请输入描述"></el-input>
  237. </div>
  238. <div slot="footer" class="dialog-footer">
  239. <el-button @click="dialogFormVisible4 = false">取 消</el-button>
  240. <el-button type="primary" @click="addNoticeTo4()">确 定</el-button>
  241. </div>
  242. </el-dialog>
  243. </el-tab-pane>
  244. <el-tab-pane label="背景图" name="fourthly">
  245. <div style="float: right;margin-right:2%;">
  246. <el-button style='margin: 10px 0;' :disabled="!isAuth('bannerList:add')" size="mini" type="primary"
  247. icon="document" @click="addNotice5">添加背景图</el-button>
  248. </div>
  249. <el-table v-loading="tableDataLoading" :data="tableData">
  250. <el-table-column fixed prop="id" label="编号" width="50">
  251. </el-table-column>
  252. <el-table-column prop="imageUrl" label="头像">
  253. <template slot-scope="scope">
  254.   <img :src="scope.row.imageUrl" width="60" height="60" />
  255. </template>
  256. </el-table-column>
  257. <el-table-column prop="name" label="背景图名称">
  258. </el-table-column>
  259. <el-table-column prop="describes" label="活动描述">
  260. </el-table-column>
  261. <el-table-column prop="url" label="链接" width="180">
  262. </el-table-column>
  263. <el-table-column prop="createTime" label="创建时间" width="160">
  264. </el-table-column>
  265. <el-table-column label="操作" width="180">
  266. <template slot-scope="scope">
  267. <el-button size="mini" type="primary" :disabled="!isAuth('bannerList:update')"
  268. @click="amendBanner(scope.$index, scope.row)">修改
  269. </el-button>
  270. <el-button size="mini" type="danger" :disabled="!isAuth('bannerList:delete')" @click="deletes(scope.row)">删除
  271. </el-button>
  272. </template>
  273. </el-table-column>
  274. </el-table>
  275. <div style="text-align: center;margin-top: 10px;float:right">
  276. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
  277. :page-sizes="[10, 20, 30,50,100]" :page-size="limit" :current-page="page" layout="total,sizes, prev, pager, next"
  278. :total="tableData.length">
  279. </el-pagination>
  280. </div>
  281. <!-- 添加弹框 -->
  282. <el-dialog title="添加" :visible.sync="dialogFormVisible5" center>
  283. <div style="margin-bottom: 10px;display: flex;">
  284. <span style="width: 200px;display: inline-block;text-align: right;">图片:</span>
  285. <div
  286. style=" width:148px;height:148px;border: 1px dashed #c0ccda;border-radius: 6px;text-align: center;line-height: 148px;">
  287. <el-upload class="avatar-uploader" v-model="imageUrl"
  288. action="https://mxys.chuanghai-tech.com/sqx_fast/alioss/upload" :show-file-list="false"
  289. :on-success="handleAvatarSuccess">
  290. <img v-if="imageUrl" :src="imageUrl" class="avatar"
  291. style="border-radius: 6px;width: 148px;height: 148px;" />
  292. <i v-else class="el-icon-plus avatar-uploader-icon"></i>
  293. </el-upload>
  294. </div>
  295. </div>
  296. <div style="margin-bottom: 10px;">
  297. <span style="width: 200px;display: inline-block;text-align: right;">链接:</span>
  298. <el-input style="width:50%;" v-model="url" placeholder="请输入链接"></el-input>
  299. </div>
  300. <div style="margin-bottom: 10px;">
  301. <span style="width: 200px;display: inline-block;text-align: right;">名称:</span>
  302. <el-input style="width:50%;" v-model="name" placeholder="请输入名称"></el-input>
  303. </div>
  304. <div style="margin-bottom: 10px;">
  305. <span style="width: 200px;display: inline-block;text-align: right;">备注:</span>
  306. <el-input style="width:50%;" v-model="describes" placeholder="请输入描述"></el-input>
  307. </div>
  308. <div slot="footer" class="dialog-footer">
  309. <el-button @click="dialogFormVisible5 = false">取 消</el-button>
  310. <el-button type="primary" @click="addNoticeTo5()">确 定</el-button>
  311. </div>
  312. </el-dialog>
  313. </el-tab-pane>
  314. <!-- 修改弹框 -->
  315. <el-dialog title="修改" :visible.sync="dialogFormVisible1" center>
  316. <el-form :model="form">
  317. <el-form-item label="图片:" :label-width="formLabelWidth">
  318. <div
  319. style=" width:148px;height:148px;border: 1px dashed #c0ccda;border-radius: 6px;text-align: center;line-height: 148px;">
  320. <el-upload class="avatar-uploader" v-model="imageUrl"
  321. action="https://mxys.chuanghai-tech.com/sqx_fast/alioss/upload" :show-file-list="false"
  322. :on-success="handleAvatarSuccess2">
  323. <img v-if="form.imageUrl" :src="form.imageUrl" class="avatar"
  324. style="border-radius: 6px;width: 148px;height: 148px;" />
  325. <i v-else class="el-icon-plus avatar-uploader-icon"></i>
  326. </el-upload>
  327. </div>
  328. </el-form-item>
  329. <el-form-item label="链接:" :label-width="formLabelWidth">
  330. <el-input v-model="form.url" style="width:65%;"></el-input>
  331. </el-form-item>
  332. <el-form-item label="名称:" :label-width="formLabelWidth">
  333. <el-input v-model="form.name" style="width:65%;"></el-input>
  334. </el-form-item>
  335. <el-form-item label="备注:" :label-width="formLabelWidth">
  336. <el-input v-model="form.describes" style="width:65%;"></el-input>
  337. </el-form-item>
  338. </el-form>
  339. <div slot="footer" class="dialog-footer">
  340. <el-button @click="dialogFormVisible1 = false">取 消</el-button>
  341. <el-button type="primary" @click="amendNoticeTo()">确 定</el-button>
  342. </div>
  343. </el-dialog>
  344. </el-tabs>
  345. </template>
  346. <script>
  347. export default {
  348. data() {
  349. return {
  350. page: 1,
  351. limit: 10,
  352. classify: 1,
  353. openValue: 1,
  354. closeValue: 2,
  355. name: '',
  356. imageUrl: '',
  357. url: '',
  358. state: -1,
  359. describes: '',
  360. hideUpload: false,
  361. activeName: 'first',
  362. dialogFormVisible: false,
  363. dialogFormVisible1: false,
  364. dialogFormVisible2: false,
  365. dialogFormVisible3: false,
  366. dialogFormVisible4: false,
  367. dialogFormVisible5: false,
  368. dialogFormVisible6: false,
  369. tableDataLoading: true,
  370. formLabelWidth: '200px',
  371. tableData: [],
  372. choicenData: [],
  373. choicenData2: [],
  374. checkBoxData: [], //多选框选择的值
  375. keyword: '',
  376. info: {
  377. stockDate: this.getNowTime(), //日期
  378. },
  379. states: [{
  380. label: '显示',
  381. value: 1
  382. },
  383. {
  384. label: '隐藏',
  385. value: 2
  386. }
  387. ],
  388. form: {
  389. id: '',
  390. name: '',
  391. imageUrl: '',
  392. url: '',
  393. classify: '',
  394. createTime: '',
  395. sort: '',
  396. state: '',
  397. describes: ''
  398. }
  399. }
  400. },
  401. methods: {
  402. // 多选
  403. changeFun(val) {
  404. this.checkBoxData = val;
  405. },
  406. //处理默认选中当前日期
  407. getNowTime() {
  408. var now = new Date();
  409. var year = now.getFullYear(); //得到年份
  410. var month = now.getMonth(); //得到月份
  411. var date = now.getDate(); //得到日期
  412. var hh = now.getHours() < 10 ? "0" + now.getHours() : now.getHours();
  413. var mm = now.getMinutes() < 10 ? "0" + now.getMinutes() : now.getMinutes();
  414. var ss = now.getSeconds() < 10 ? "0" + now.getSeconds() : now.getSeconds();
  415. month = month + 1;
  416. month = month.toString().padStart(2, "0");
  417. date = date.toString().padStart(2, "0");
  418. var defaultDate = `${year}-${month}-${date} ${hh}:${mm}:${ss}`;
  419. return defaultDate;
  420. this.$set(this.info, "stockDate", defaultDate);
  421. },
  422. // tabs切换
  423. handleClick(tab, event) {
  424. if (tab._props.label == '轮播图') {
  425. this.page = 1
  426. this.limit = 10
  427. this.classify = 1
  428. this.dataSelect()
  429. }
  430. // if (tab._props.label == '首页分类') {
  431. // this.page = 1
  432. // this.limit = 10
  433. // this.classify = 2
  434. // this.dataSelect()
  435. // }
  436. if (tab._props.label == '商家类型') {
  437. this.page = 1
  438. this.limit = 10
  439. this.classify = 3
  440. this.dataSelect()
  441. }
  442. if (tab._props.label == '首页分类') {
  443. this.page = 1
  444. this.limit = 10
  445. this.classify = 4
  446. this.dataSelect()
  447. }
  448. if (tab._props.label == '背景图') {
  449. this.page = 1
  450. this.limit = 10
  451. this.classify = 5
  452. this.dataSelect()
  453. }
  454. if (tab._props.label == '精选商品') {
  455. this.page = 1
  456. this.limit = 10
  457. this.choicenSelect()
  458. this.handpick()
  459. }
  460. },
  461. //上传成功
  462. handleAvatarSuccess(file) {
  463. this.imageUrl = file.data
  464. },
  465. handleAvatarSuccess2(file2) {
  466. this.form.imageUrl = file2.data
  467. },
  468. handleSizeChange(val) {
  469. this.limit = val;
  470. this.dataSelect();
  471. },
  472. handleCurrentChange(val) {
  473. this.page = val;
  474. this.dataSelect();
  475. },
  476. handleSizeChange3(val) {
  477. this.limit = val;
  478. this.choicenSelect()
  479. },
  480. handleCurrentChange3(val) {
  481. this.page = val;
  482. this.choicenSelect()
  483. },
  484. // 是否启用
  485. change(val, row) {
  486. this.$http({
  487. url: this.$http.adornUrl(`banner/updateBannerStateById?id=${row.id}`),
  488. method: 'post',
  489. data: this.$http.adornData({})
  490. }).then(({
  491. data
  492. }) => {
  493. this.$message({
  494. message: '操作成功',
  495. type: 'success',
  496. duration: 1500,
  497. onClose: () => {
  498. this.dataSelect()
  499. }
  500. })
  501. })
  502. },
  503. //添加banner图
  504. addNotice() {
  505. this.dialogFormVisible = true
  506. },
  507. // 添加banner图
  508. addNoticeTo() {
  509. if (this.imageUrl == '') {
  510. this.$notify({
  511. title: '提示',
  512. duration: 1800,
  513. message: '请上传图片',
  514. type: 'warning'
  515. });
  516. return
  517. }
  518. if (this.name == '') {
  519. this.$notify({
  520. title: '提示',
  521. duration: 1800,
  522. message: '请输入名称',
  523. type: 'warning'
  524. });
  525. return
  526. }
  527. this.classify = 1
  528. this.$http({
  529. url: this.$http.adornUrl('banner/insertBanner'),
  530. method: 'post',
  531. data: this.$http.adornData({
  532. 'classify': this.classify,
  533. 'imageUrl': this.imageUrl,
  534. 'state': this.state,
  535. 'url': this.url,
  536. 'name': this.name,
  537. 'describes': this.describes
  538. })
  539. }).then(({
  540. data
  541. }) => {
  542. this.dialogFormVisible = false
  543. this.$message({
  544. message: '操作成功',
  545. type: 'success',
  546. duration: 1500,
  547. onClose: () => {
  548. this.imageUrl = ''
  549. this.state = ''
  550. this.url = ''
  551. this.name = ''
  552. this.describes = ''
  553. this.dataSelect()
  554. }
  555. })
  556. })
  557. },
  558. // 修改
  559. amendBanner(index, rows) {
  560. this.dialogFormVisible1 = true
  561. this.form.id = rows.id
  562. this.form.imageUrl = rows.imageUrl
  563. this.form.url = rows.url
  564. this.form.sort = rows.sort
  565. this.form.state = rows.state
  566. this.form.name = rows.name
  567. this.form.describes = rows.describes
  568. },
  569. // 修改
  570. amendNoticeTo() {
  571. this.$http({
  572. url: this.$http.adornUrl(
  573. `banner/updateBannerById?id=${this.form.id}&createTime=${this.info.stockDate}&imageUrl=${this.form.imageUrl}&url=${this.form.url}&state=${this.form.state}&sort=${this.form.sort}&name=${this.form.name}&describes=${this.form.describes}`
  574. ),
  575. method: 'post',
  576. data: this.$http.adornData({})
  577. }).then(({
  578. data
  579. }) => {
  580. this.dialogFormVisible1 = false
  581. this.$message({
  582. message: '操作成功',
  583. type: 'success',
  584. duration: 1500,
  585. onClose: () => {
  586. this.dataSelect()
  587. }
  588. })
  589. })
  590. },
  591. //添加任务分类
  592. addNotice2() {
  593. this.dialogFormVisible2 = true
  594. },
  595. // 添加添加任务分类
  596. addNoticeTo2() {
  597. if (this.imageUrl == '') {
  598. this.$notify({
  599. title: '提示',
  600. duration: 1800,
  601. message: '请上传图片',
  602. type: 'warning'
  603. });
  604. return
  605. }
  606. if (this.name == '') {
  607. this.$notify({
  608. title: '提示',
  609. duration: 1800,
  610. message: '请输入名称',
  611. type: 'warning'
  612. });
  613. return
  614. }
  615. this.classify = 2
  616. this.$http({
  617. url: this.$http.adornUrl('banner/insertBanner'),
  618. method: 'post',
  619. data: this.$http.adornData({
  620. 'classify': this.classify,
  621. 'imageUrl': this.imageUrl,
  622. 'state': this.state,
  623. 'url': this.url,
  624. 'name': this.name,
  625. 'describes': this.describes
  626. })
  627. }).then(({
  628. data
  629. }) => {
  630. this.dialogFormVisible2 = false
  631. this.$message({
  632. message: '操作成功',
  633. type: 'success',
  634. duration: 1500,
  635. onClose: () => {
  636. this.imageUrl = ''
  637. this.state = ''
  638. this.url = ''
  639. this.name = ''
  640. this.describes = ''
  641. this.dataSelect()
  642. }
  643. })
  644. })
  645. },
  646. //添加活动
  647. addNotice3() {
  648. this.dialogFormVisible3 = true
  649. },
  650. // 添加添加活动
  651. addNoticeTo3() {
  652. if (this.imageUrl == '') {
  653. this.$notify({
  654. title: '提示',
  655. duration: 1800,
  656. message: '请上传图片',
  657. type: 'warning'
  658. });
  659. return
  660. }
  661. if (this.name == '') {
  662. this.$notify({
  663. title: '提示',
  664. duration: 1800,
  665. message: '请输入名称',
  666. type: 'warning'
  667. });
  668. return
  669. }
  670. this.classify = 3
  671. this.$http({
  672. url: this.$http.adornUrl('banner/insertBanner'),
  673. method: 'post',
  674. data: this.$http.adornData({
  675. 'classify': this.classify,
  676. 'imageUrl': this.imageUrl,
  677. 'state': this.state,
  678. 'url': this.url,
  679. 'name': this.name,
  680. 'describes': this.describes
  681. })
  682. }).then(({
  683. data
  684. }) => {
  685. this.dialogFormVisible3 = false
  686. this.$message({
  687. message: '操作成功',
  688. type: 'success',
  689. duration: 1500,
  690. onClose: () => {
  691. this.imageUrl = ''
  692. this.state = ''
  693. this.url = ''
  694. this.name = ''
  695. this.describes = ''
  696. this.dataSelect()
  697. }
  698. })
  699. })
  700. },
  701. //添加精品服务
  702. addNotice4() {
  703. this.dialogFormVisible4 = true
  704. },
  705. // 添加精品服务
  706. addNoticeTo4() {
  707. if (this.imageUrl == '') {
  708. this.$notify({
  709. title: '提示',
  710. duration: 1800,
  711. message: '请上传图片',
  712. type: 'warning'
  713. });
  714. return
  715. }
  716. if (this.name == '') {
  717. this.$notify({
  718. title: '提示',
  719. duration: 1800,
  720. message: '请输入名称',
  721. type: 'warning'
  722. });
  723. return
  724. }
  725. this.classify = 4
  726. this.$http({
  727. url: this.$http.adornUrl('banner/insertBanner'),
  728. method: 'post',
  729. data: this.$http.adornData({
  730. 'classify': this.classify,
  731. 'imageUrl': this.imageUrl,
  732. 'state': this.state,
  733. 'url': this.url,
  734. 'name': this.name,
  735. 'describes': this.describes
  736. })
  737. }).then(({
  738. data
  739. }) => {
  740. this.dialogFormVisible4 = false
  741. this.$message({
  742. message: '操作成功',
  743. type: 'success',
  744. duration: 1500,
  745. onClose: () => {
  746. this.imageUrl = ''
  747. this.state = ''
  748. this.url = ''
  749. this.name = ''
  750. this.describes = ''
  751. this.dataSelect()
  752. }
  753. })
  754. })
  755. },
  756. //添加活动背景图
  757. addNotice5() {
  758. if (this.tableData.length == 1) {
  759. this.$message({
  760. title: '提示',
  761. duration: 1800,
  762. message: '活动背景图只能添加一张',
  763. type: 'warning'
  764. });
  765. } else {
  766. this.dialogFormVisible5 = true
  767. }
  768. },
  769. // 添加背景图
  770. addNoticeTo5() {
  771. if (this.imageUrl == '') {
  772. this.$notify({
  773. title: '提示',
  774. duration: 1800,
  775. type: 'success',
  776. message: '请上传图片',
  777. type: 'warning'
  778. });
  779. return
  780. }
  781. if (this.name == '') {
  782. this.$notify({
  783. title: '提示',
  784. duration: 1800,
  785. message: '请输入名称',
  786. type: 'warning'
  787. });
  788. return
  789. }
  790. this.classify = 5
  791. this.$http({
  792. url: this.$http.adornUrl('banner/insertBanner'),
  793. method: 'post',
  794. data: this.$http.adornData({
  795. 'classify': this.classify,
  796. 'imageUrl': this.imageUrl,
  797. 'state': this.state,
  798. 'url': this.url,
  799. 'name': this.name,
  800. 'describes': this.describes
  801. })
  802. }).then(({
  803. data
  804. }) => {
  805. this.dialogFormVisible5 = false
  806. this.$message({
  807. message: '操作成功',
  808. type: 'success',
  809. duration: 1500,
  810. onClose: () => {
  811. this.imageUrl = ''
  812. this.state = ''
  813. this.url = ''
  814. this.name = ''
  815. this.describes = ''
  816. this.dataSelect()
  817. }
  818. })
  819. })
  820. },
  821. // 删除banner图
  822. deletes(row) {
  823. let delid = row.id
  824. this.$confirm(`确定删除此条信息?`, '提示', {
  825. confirmButtonText: '确定',
  826. cancelButtonText: '取消',
  827. type: 'warning'
  828. }).then(() => {
  829. this.$http({
  830. url: this.$http.adornUrl(`banner/deleteBannerById?ids=${delid}`),
  831. method: 'get',
  832. data: this.$http.adornData({})
  833. }).then(({
  834. data
  835. }) => {
  836. this.$message({
  837. message: '删除成功',
  838. type: 'success',
  839. duration: 1500,
  840. onClose: () => {
  841. this.dataSelect()
  842. }
  843. })
  844. })
  845. }).catch(() => {})
  846. },
  847. // 获取数据列表
  848. dataSelect() {
  849. this.tableDataLoading = true
  850. this.$http({
  851. url: this.$http.adornUrl('banner/selectBannerList'),
  852. method: 'get',
  853. params: this.$http.adornParams({
  854. 'state': this.state,
  855. 'classify': this.classify,
  856. })
  857. }).then(({
  858. data
  859. }) => {
  860. if (data && data.code === 0) {
  861. this.tableDataLoading = false
  862. let returnData = data.data;
  863. this.tableData = returnData;
  864. }
  865. })
  866. },
  867. //添加精选商品
  868. choiaddNotice() {
  869. this.dialogFormVisible6 = true
  870. },
  871. // 添加商品
  872. releasNoticeTo(row) {
  873. this.$http({
  874. url: this.$http.adornUrl('commodity/save'),
  875. method: 'post',
  876. data: this.$http.adornData({
  877. 'activityid': row.activityid,
  878. 'couponendtime': row.couponendtime,
  879. 'couponmoney': row.couponmoney,
  880. 'couponstarttime': row.couponstarttime,
  881. 'couponurl': row.couponurl,
  882. 'deposit': row.deposit,
  883. 'deposit_deduct': row.deposit_deduct,
  884. 'item_from': row.item_from,
  885. 'itemdesc': row.itemdesc,
  886. 'itemendprice': row.itemendprice,
  887. 'itemid': row.itemid,
  888. 'itempic': row.itempic,
  889. 'itemprice': row.itemprice,
  890. 'itemsale': row.itemsale,
  891. 'itemshorttitle': row.itemshorttitle,
  892. 'itemtitle': row.itemtitle,
  893. 'presale_end_time': row.presale_end_time,
  894. 'presale_start_time': row.presale_start_time,
  895. 'presale_tail_end_time': row.presale_tail_end_time,
  896. 'presale_tail_start_time': row.presale_tail_start_time,
  897. 'sellernick': row.sellernick,
  898. 'shopname': row.shopname,
  899. 'shoptype': row.shoptype,
  900. 'taobao_image': row.taobao_image,
  901. 'tkrates': row.tkrates,
  902. 'videoid': row.videoid,
  903. })
  904. }).then(({
  905. data
  906. }) => {
  907. if (data && data.code === 0) {
  908. this.$message({
  909. message: '操作成功',
  910. type: 'success',
  911. duration: 1500,
  912. onClose: () => {
  913. this.choicenSelect()
  914. this.keyword = ''
  915. }
  916. })
  917. } else {
  918. this.$message.error(data.msg)
  919. }
  920. })
  921. },
  922. // 精选淘宝商品
  923. handpick() {
  924. this.tableDataLoading = true
  925. this.keyword = '网红'
  926. this.$http({
  927. url: this.$http.adornUrl2(
  928. `/supersearch/apikey/maxd/back/20/sort/2/keyword/${this.keyword}/is_coupon/1/tb_p/1/min_id/1`),
  929. method: 'get',
  930. params: this.$http.adornParams({})
  931. }).then(({
  932. data
  933. }) => {
  934. if (data && data.code === 1) {
  935. this.tableDataLoading = false
  936. this.keyword = ''
  937. let returnData = data.data;
  938. this.choicenData2 = returnData
  939. }
  940. })
  941. },
  942. // 搜索
  943. shousuo() {
  944. this.tableDataLoading = true
  945. this.$http({
  946. url: this.$http.adornUrl2(
  947. `/supersearch/apikey/maxd/back/100/sort/2/keyword/${this.keyword}/is_coupon/1/tb_p/1/min_id/1`),
  948. method: 'get',
  949. params: this.$http.adornParams({})
  950. }).then(({
  951. data
  952. }) => {
  953. console.log(data)
  954. if (data && data.code === 1) {
  955. this.tableDataLoading = false
  956. let returnData = data.data;
  957. this.choicenData2 = returnData
  958. }
  959. })
  960. },
  961. // 精选商品列表
  962. choicenSelect() {
  963. this.tableDataLoading = true
  964. this.$http({
  965. url: this.$http.adornUrl('commodity/selectCommodityList'),
  966. method: 'get',
  967. params: this.$http.adornParams({
  968. 'page': this.page,
  969. 'limit': this.limit
  970. })
  971. }).then(({
  972. data
  973. }) => {
  974. this.tableDataLoading = false
  975. let returnData = data.data;
  976. this.choicenData = returnData
  977. })
  978. },
  979. // 批量删除任务
  980. choideletes(id) {
  981. var ids = id ? [id] : this.checkBoxData.map(item => {
  982. return item.id
  983. })
  984. this.$http({
  985. url: this.$http.adornUrl(`/commodity/deleteById?id=${ids}`),
  986. method: 'post',
  987. data: this.$http.adornData({})
  988. }).then(({
  989. data
  990. }) => {
  991. this.$message({
  992. message: '批量删除成功',
  993. type: 'success',
  994. duration: 1500,
  995. onClose: () => {
  996. this.choicenSelect()
  997. }
  998. })
  999. })
  1000. },
  1001. // 删除商品
  1002. choidelete(row) {
  1003. let delid = row.id
  1004. this.$confirm(`确定删除此条信息?`, '提示', {
  1005. confirmButtonText: '确定',
  1006. cancelButtonText: '取消',
  1007. type: 'warning'
  1008. }).then(() => {
  1009. this.$http({
  1010. url: this.$http.adornUrl(`/commodity/deleteById/?id=${delid}`),
  1011. method: 'post',
  1012. data: this.$http.adornData({})
  1013. }).then(({
  1014. data
  1015. }) => {
  1016. this.$message({
  1017. message: '删除成功',
  1018. type: 'success',
  1019. duration: 1500,
  1020. onClose: () => {
  1021. this.choicenSelect()
  1022. }
  1023. })
  1024. })
  1025. }).catch(() => {})
  1026. },
  1027. },
  1028. mounted() {
  1029. this.dataSelect()
  1030. }
  1031. }
  1032. </script>
  1033. <style>
  1034. .customWidth {
  1035. width: 80% !important;
  1036. }
  1037. </style>