index.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="票务名称">
  5. <el-input
  6. v-model="queryParams.goodsName"
  7. placeholder="请输入票务名称"
  8. clearable
  9. style="width: 240px;"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item>
  14. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  15. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  16. </el-form-item>
  17. </el-form>
  18. <el-row :gutter="10" class="mb8">
  19. <el-col :span="1.5">
  20. <el-button
  21. type="primary"
  22. plain
  23. icon="el-icon-plus"
  24. size="mini"
  25. @click="handleAdd"
  26. v-hasPermi="['ticketMr:ticketMr:add']"
  27. >新增</el-button>
  28. </el-col>
  29. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  30. </el-row>
  31. <el-table ref="tables" v-loading="loading" :data="dataList" border>
  32. <el-table-column label="序号" align="center" type="index" width="60"></el-table-column>
  33. <el-table-column label="票务名称" align="center" prop="goodsName" />
  34. <el-table-column label="销售价" align="center" prop="type">
  35. <template slot-scope="scope">
  36. <span>¥{{ scope.row.salePrice }}</span>
  37. </template>
  38. </el-table-column>
  39. <el-table-column label="是否限购" align="center" prop="type">
  40. <template slot-scope="scope">
  41. <el-tag type="success" v-if="scope.row.goodsPerform.buyAstrict > -1">是</el-tag>
  42. <el-tag type="danger" v-if="scope.row.goodsPerform.buyAstrict == -1">否</el-tag>
  43. </template>
  44. </el-table-column>
  45. <el-table-column label="销售渠道" align="center">
  46. <template slot-scope="scope">
  47. <span>{{ (scope.row.goodsPerform.channelWx == 0 ? '小程序' : '') + ' ' + (scope.row.goodsPerform.channelWindow == 0 ? '窗口' : '')}}</span>
  48. </template>
  49. </el-table-column>
  50. <el-table-column label="是否可退" align="center" prop="type">
  51. <template slot-scope="scope">
  52. <el-tag type="success" v-if="scope.row.goodsPerform.backStatus == 0">可退</el-tag>
  53. <el-tag type="danger" v-if="scope.row.goodsPerform.backStatus == 1">不可退</el-tag>
  54. </template>
  55. </el-table-column>
  56. <el-table-column label="状态" align="center" prop="type">
  57. <template slot-scope="scope">
  58. <el-switch
  59. @change="ionlineApi(scope.row)"
  60. v-model="scope.row.switchValue"
  61. :active-value="0"
  62. active-color="#13ce66"
  63. inactive-color="#ff4949">
  64. </el-switch>
  65. </template>
  66. </el-table-column>
  67. <el-table-column label="添加时间" align="center" prop="createTime" width="160" >
  68. <template slot-scope="scope">
  69. <span>{{ parseTime(scope.row.createTime) }}</span>
  70. </template>
  71. </el-table-column>
  72. <el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width">
  73. <template slot-scope="scope">
  74. <el-button
  75. size="mini"
  76. type="text"
  77. @click="openDetails(scope.row)"
  78. v-hasPermi="['ticketMr:ticketMr:details']"
  79. >详情</el-button>
  80. <el-button
  81. size="mini"
  82. type="text"
  83. @click="handleUpdate(scope.row)"
  84. v-hasPermi="['ticketMr:ticketMr:edit']"
  85. >修改</el-button>
  86. <el-button
  87. size="mini"
  88. type="text"
  89. @click="handleDelete(scope.row,scope.index)"
  90. v-hasPermi="['ticketMr:ticketMr:delete']"
  91. >删除</el-button>
  92. </template>
  93. </el-table-column>
  94. </el-table>
  95. <pagination
  96. v-show="total>0"
  97. :total="total"
  98. :page.sync="queryParams.pageNum"
  99. :limit.sync="queryParams.pageSize"
  100. @pagination="getList"
  101. />
  102. <!-- 新增/编辑弹框 -->
  103. <add-and-edit
  104. ref="addAndEdit"
  105. @getList="getList"
  106. />
  107. <!-- 详情 -->
  108. <details-dia ref="detailsDia"></details-dia>
  109. </div>
  110. </template>
  111. <script>
  112. import { pageList, deleteById, updateStatus } from '@/api/ticketMr/ticketMr'
  113. import addAndEdit from "./dialog/addAndEdit.vue";
  114. import detailsDia from "./dialog/details.vue";
  115. export default {
  116. name: "agreement",
  117. dicts: ['agreement_type'],
  118. components: { addAndEdit, detailsDia },
  119. data() {
  120. return {
  121. // 遮罩层
  122. loading: true,
  123. // 选中数组
  124. ids: [],
  125. // 非单个禁用
  126. single: true,
  127. // 非多个禁用
  128. multiple: true,
  129. // 显示搜索条件
  130. showSearch: true,
  131. // 总条数
  132. total: 0,
  133. // 用户表格数据
  134. dataList: null,
  135. // 弹出层标题
  136. title: "",
  137. // 是否显示弹出层
  138. open: false,
  139. // 日期范围
  140. dateRange: [],
  141. // 查询参数
  142. queryParams: {
  143. pageNum: 1,
  144. pageSize: 10,
  145. type: undefined,
  146. goodsType: 2,
  147. classifyId: 1
  148. },
  149. statusList: [
  150. {id: 1, name: '未发布', value: 0},
  151. {id: 2, name: '发布', value: 1},
  152. {id: 3, name: '下架', value: 2},
  153. ],
  154. visibleStatus: false,
  155. newObj: {},
  156. visibleType: ''
  157. };
  158. },
  159. created() {
  160. this.getList();
  161. },
  162. methods: {
  163. /** 查询列表 */
  164. getList() {
  165. this.loading = true;
  166. pageList(this.addDateRange(this.queryParams, this.dateRange))
  167. .then(response => {
  168. this.dataList = response.data.rows;
  169. this.dataList.forEach(item =>{
  170. item.switchValue = item.status;
  171. })
  172. this.total = response.data.total;
  173. this.loading = false;
  174. }
  175. );
  176. },
  177. // 取消按钮
  178. cancel() {
  179. this.open = false;
  180. },
  181. /** 搜索按钮操作 */
  182. handleQuery() {
  183. this.queryParams.pageNum = 1;
  184. this.getList();
  185. },
  186. /** 重置按钮操作 */
  187. resetQuery() {
  188. this.dateRange = [];
  189. this.$set(this.queryParams, 'goodsName', '');
  190. this.queryParams.pageNum = 1;
  191. this.handleQuery();
  192. },
  193. /** 新增按钮操作 */
  194. handleAdd() {
  195. this.$refs["addAndEdit"].openDialog("新增数据", null);
  196. },
  197. /** 修改按钮操作 */
  198. handleUpdate(row) {
  199. this.$refs["addAndEdit"].openDialog("修改数据", row);
  200. },
  201. /** 详情按钮操作 */
  202. openDetails(row) {
  203. this.$refs["detailsDia"].openDialog("详情", row);
  204. },
  205. /** 发布或者取消发布按钮操作 */
  206. ionlineApi(row) {
  207. try {
  208. updateStatus({ id: row.id, status: row.status == 0 ? 1 : 0 }).then((res) => {
  209. if (res.code == 200) {
  210. this.$message({
  211. type: 'success',
  212. message: '操作成功!'
  213. });
  214. this.getList();
  215. }
  216. });
  217. }catch (e) {
  218. this.getList();
  219. }
  220. },
  221. // 修改是否启用
  222. changeStatus(row) {
  223. console.log(row)
  224. },
  225. /** 删除按钮操作 */
  226. handleDelete(row) {
  227. this.$modal.confirm('是否确认删除数据票务名称为"' + row.goodsName + '"的数据项?').then(function() {
  228. return deleteById(row.id);
  229. }).then(() => {
  230. this.getList();
  231. this.$modal.msgSuccess("删除成功");
  232. }).catch(() => {});
  233. },
  234. /** 查看按钮操作 */
  235. seeCenter(obj, type) {
  236. this.visibleStatus = true
  237. this.visibleType = type;
  238. this.newObj = obj;
  239. }
  240. }
  241. };
  242. </script>