setList.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. <template>
  2. <div>
  3. <el-container>
  4. <el-header style="height: 120px">
  5. <div id="header-one">
  6. <h3 class="el-icon-search" style="margin-left: 10px">筛选搜索</h3>
  7. <div id="header-one-btu">
  8. <el-button @click="empty">重置</el-button>
  9. <el-button type="primary" @click="check">搜索</el-button>
  10. </div>
  11. </div>
  12. <div id="header-two">
  13. <el-row>
  14. <el-col :span="5" id="header-two-left">
  15. <el-form ref="anFormRef" label-width="80px">
  16. <el-form-item label="藏品名称(套):" label-width="102px">
  17. <el-input
  18. v-model="input.value1"
  19. class="anInput"
  20. placeholder="筛选藏品标题"
  21. center
  22. ></el-input>
  23. </el-form-item>
  24. </el-form>
  25. </el-col>
  26. <el-col :span="12">
  27. <el-form label-width="80px">
  28. <el-form-item label="创建时间:">
  29. <el-date-picker
  30. v-model="input.value2"
  31. type="datetimerange"
  32. class="up-input-right"
  33. range-separator="至"
  34. start-placeholder="开始日期"
  35. end-placeholder="结束日期"
  36. align="right"
  37. >
  38. </el-date-picker>
  39. </el-form-item>
  40. </el-form>
  41. </el-col>
  42. </el-row>
  43. </div>
  44. </el-header>
  45. <el-main style="height: 110px">
  46. <h3 class="el-icon-tickets">套系列表 共有{{ total }}条数据</h3>
  47. <el-button id="main-btu" @click="addSet">添加</el-button>
  48. </el-main>
  49. <div class="footer">
  50. <el-row class="state">
  51. <el-button
  52. :class="flag == 0 ? 'active' : ''"
  53. size="small"
  54. @click="onSalel"
  55. >在售</el-button
  56. >
  57. <el-button
  58. :class="flag == 1 ? 'active' : ''"
  59. size="small"
  60. @click="preSale"
  61. >预售</el-button
  62. >
  63. <el-button
  64. :class="flag == 2 ? 'active' : ''"
  65. size="small"
  66. @click="expired"
  67. >已过期</el-button
  68. >
  69. </el-row>
  70. <el-table :data="tableData" border style="width: 100%">
  71. <el-table-column
  72. prop="tetherId"
  73. label="id"
  74. width="110"
  75. align="center"
  76. >
  77. </el-table-column>
  78. <el-table-column
  79. prop="tetherName"
  80. label="藏品名称(套)"
  81. width="220"
  82. align="center"
  83. >
  84. </el-table-column>
  85. <el-table-column
  86. prop="showTimeStart"
  87. label="创建时间"
  88. width="220"
  89. align="center"
  90. >
  91. </el-table-column>
  92. <el-table-column
  93. prop="showTimeEnd"
  94. label="结束时间"
  95. width="220"
  96. align="center"
  97. >
  98. </el-table-column>
  99. <el-table-column
  100. prop="total"
  101. label="藏品数量"
  102. width="195"
  103. align="center"
  104. >
  105. </el-table-column>
  106. <el-table-column
  107. prop="sellStatus"
  108. label="状态"
  109. width="200"
  110. align="center"
  111. >
  112. <template slot-scope="scope">
  113. <el-tag size="medium" :type=" scope.row.grounding == '0' ? 'success' : 'warning' ">
  114. {{ scope.row.grounding == "0" ? "已上架" : "未上架" }}
  115. </el-tag>
  116. </template>
  117. </el-table-column>
  118. <el-table-column prop="edit" label="操作" width="280" align="center">
  119. <template slot-scope="scope">
  120. <el-button type="text" @click="sList(scope.row)"
  121. >藏品列表</el-button
  122. >
  123. <el-row>
  124. <el-button type="text" @click="upJia(scope.row)"
  125. >上架</el-button
  126. >
  127. <el-button type="text" @click="CurendTime(scope.row)"
  128. >修改时间</el-button
  129. >
  130. </el-row>
  131. </template>
  132. </el-table-column>
  133. </el-table>
  134. <el-pagination
  135. @current-change="handleCurrentChange"
  136. background
  137. layout="total, prev, pager, next"
  138. :total="total"
  139. id="page"
  140. :page-size="10"
  141. >
  142. </el-pagination>
  143. </div>
  144. <el-dialog
  145. title="修改时间"
  146. :visible.sync="dialogFormVisible"
  147. :style="{ width: '100%' }"
  148. >
  149. <el-form>
  150. <el-form-item label="结束时间" label-width="80px">
  151. <el-date-picker
  152. v-model="showendtime"
  153. type="datetime"
  154. placeholder="选择结束时间"
  155. value-format="yyyy-MM-dd hh:mm:ss"
  156. >
  157. </el-date-picker>
  158. </el-form-item>
  159. <span id="tab"
  160. >当前结束时间为{{ showEnd }},结束日期需大于当前结束日期</span
  161. >
  162. </el-form>
  163. <div slot="footer" class="dialog-footer">
  164. <el-button @click="dialogFormVisible = false">取 消</el-button>
  165. <el-button type="primary" @click="submitTime">确 定</el-button>
  166. </div>
  167. </el-dialog>
  168. </el-container>
  169. </div>
  170. </template>
  171. <script>
  172. import {
  173. selectether,
  174. sellingList,
  175. advanceList,
  176. selledList,
  177. updataEndtime,
  178. Grounding,
  179. } from "@/api/sets/index";
  180. export default {
  181. data() {
  182. return {
  183. dialogFormVisible: false,
  184. pageInfo: {
  185. // 分页信息
  186. pageNum: 1,
  187. pageSize: 10,
  188. },
  189. input: {
  190. value1: "", // 搜索姓名
  191. value2: "", // 搜索时间
  192. },
  193. total: 1,
  194. flag: 0,
  195. tableData: [],
  196. startTime: [],
  197. endTime: [],
  198. showEnd: "",
  199. showendtime: "",
  200. tetherId: "",
  201. grounding: "",
  202. };
  203. },
  204. mounted() {
  205. this.flag = 0;
  206. this.sellingsList();
  207. },
  208. methods: {
  209. submitTime(data) {
  210. this.dialogFormVisible = false;
  211. if (!this.showendtime) return;
  212. console.log(this.showendtime);
  213. let time = {
  214. showTimeEnd: this.showendtime,
  215. tetherId: this.tetherId,
  216. };
  217. console.log(time);
  218. let { code } = updataEndtime(time).catch((err) => err);
  219. // console.log(code);
  220. this.$message("修改成功,请刷新界面");
  221. // this.sellingsList();
  222. // this.advancesList();
  223. // this.selledsList();
  224. },
  225. CurendTime(data) {
  226. console.log(data);
  227. this.dialogFormVisible = true;
  228. this.showEnd = data.showTimeEnd;
  229. this.tetherId = data.tetherId;
  230. },
  231. handleCurrentChange(newPage) {
  232. this.pageInfo.pageNum = newPage;
  233. this.setsList();
  234. },
  235. // 在售
  236. sellingsList() {
  237. sellingList(this.pageInfo).then((res) => {
  238. this.tableData = res.rows;
  239. this.total = res.total;
  240. });
  241. },
  242. // 预售
  243. advancesList() {
  244. advanceList(this.pageInfo).then((res) => {
  245. this.tableData = res.rows;
  246. this.total = res.total;
  247. });
  248. },
  249. // 已过期
  250. selledsList() {
  251. selledList(this.pageInfo).then((res) => {
  252. this.tableData = res.rows;
  253. this.total = res.total;
  254. });
  255. },
  256. // 点击标签切换修改后
  257. onSalel() {
  258. this.flag = 0;
  259. this.sellingsList();
  260. },
  261. preSale() {
  262. this.flag = 1;
  263. this.advancesList();
  264. },
  265. expired() {
  266. this.flag = 2;
  267. this.selledsList();
  268. },
  269. // 重置
  270. empty() {
  271. this.input.value1 = "";
  272. this.dataput = "";
  273. },
  274. // 搜索
  275. check() {
  276. if (this.input.value1 || this.input.value2) {
  277. let startTime = this.$formatDate(
  278. this.input.value2[0],
  279. "yyyy-MM-dd hh:mm:ss"
  280. );
  281. let endTime = this.$formatDate(
  282. this.input.value2[1],
  283. "yyyy-MM-dd hh:mm:ss"
  284. );
  285. let searchCon = {
  286. tetherName: this.input.value1,
  287. tetherTimeStart: startTime,
  288. tetherTimeEnd: endTime,
  289. };
  290. selectether(searchCon).then((res) => {
  291. this.tableData = res.rows;
  292. this.total = res.total;
  293. });
  294. } else {
  295. this.setsList();
  296. }
  297. },
  298. // 添加
  299. addSet() {
  300. this.$router.push("./addSet");
  301. },
  302. // 藏品列表
  303. sList(rows) {
  304. this.$router.push({ name: "collectionList", params: { rows } });
  305. },
  306. // 上架
  307. upJia(row) {
  308. this.$confirm("是否要上架商品?", "提示", {
  309. confirmButtonText: "确定",
  310. cancelButtonText: "取消",
  311. type: "warning",
  312. })
  313. .then(() => {
  314. row.grounding = 0;
  315. Grounding(row.grounding, row.tetherId).then(() => {
  316. this.$message({
  317. type: "success",
  318. message: "上架成功!",
  319. });
  320. });
  321. })
  322. .catch(() => {
  323. this.$message({
  324. type: "info",
  325. message: "已取消",
  326. });
  327. });
  328. },
  329. // 修改时间
  330. editTime() {
  331. console.log("修改时间");
  332. },
  333. },
  334. };
  335. </script>
  336. <style scoped>
  337. #tab {
  338. color: red;
  339. }
  340. .el-main {
  341. color: #333;
  342. border: 1px solid #d3d7d4;
  343. border-radius: 5px;
  344. margin-left: 30px;
  345. margin-right: 30px;
  346. }
  347. .el-header {
  348. color: #333;
  349. border: 1px solid #d3d7d4;
  350. border-radius: 5px;
  351. margin: 30px;
  352. }
  353. /* .el-footer {} */
  354. #footer-t {
  355. color: #333;
  356. border: 1px solid #d3d7d4;
  357. border-radius: 5px;
  358. margin-left: 10px;
  359. margin-top: 30px;
  360. }
  361. /* #header-one {} */
  362. #header-two {
  363. /* background-color: aqua; */
  364. margin-left: 90px;
  365. }
  366. #header-one-btu {
  367. margin: 20px 20px 0px 0px;
  368. float: right;
  369. }
  370. #header-two-left {
  371. margin-right: 150px;
  372. }
  373. #main-btu {
  374. float: right;
  375. margin-top: 10px;
  376. }
  377. #page {
  378. float: right;
  379. margin-top: 15px;
  380. }
  381. .footer {
  382. margin: 20px auto;
  383. width: 97%;
  384. }
  385. .state button {
  386. margin: 0;
  387. }
  388. .active {
  389. color: white;
  390. background-color: #409eff;
  391. }
  392. </style>