index.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="120px">
  4. <el-form-item label="票务名称" label-width="70px">
  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="['teamTicketMr:teamTicketMr: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="50"></el-table-column>
  33. <el-table-column label="剧目名称" align="center" prop="performName" />
  34. <el-table-column label="票务名称" align="center" prop="goodsName" />
  35. <el-table-column label="座位类型" align="center" prop="seatTypeName" />
  36. <el-table-column label="渠道票务别称" align="center" prop="otherName" />
  37. <el-table-column label="销售价" align="center" prop="brokerageTotal">
  38. <template slot-scope="scope">
  39. <span v-if="scope.row.originalSalePrice || scope.row.originalSalePrice==0">¥{{ scope.row.originalSalePrice }}</span>
  40. </template>
  41. </el-table-column>
  42. <el-table-column label="团购单价" align="center" prop="withdrawTotal">
  43. <template slot-scope="scope">
  44. <span v-if="scope.row.salePrice || scope.row.salePrice==0">¥{{ scope.row.salePrice }}</span>
  45. </template>
  46. </el-table-column>
  47. <el-table-column label="成团人数" align="center" prop="teamPersonNum" />
  48. <el-table-column label="备注" align="center" prop="remark" />
  49. <el-table-column label="状态" align="center">
  50. <template slot-scope="scope">
  51. <el-tag type="success" v-if="scope.row.status == 1">己上架</el-tag>
  52. <el-tag type="info" v-if="scope.row.status == 0">未上架</el-tag>
  53. </template>
  54. </el-table-column>
  55. <el-table-column label="创建人" align="center" prop="createBy" />
  56. <el-table-column label="添加时间" align="center" prop="createTime" width="160">
  57. <template slot-scope="scope">
  58. <span>{{ parseTime(scope.row.createTime) }}</span>
  59. </template>
  60. </el-table-column>
  61. <el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width">
  62. <template slot-scope="scope">
  63. <el-button
  64. size="mini"
  65. type="text"
  66. @click="handleUpdate(scope.row)"
  67. v-hasPermi="['teamTicketMr:teamTicketMr:edit']"
  68. >修改</el-button>
  69. <el-button
  70. size="mini"
  71. type="text"
  72. @click="handleTeam(scope.row)"
  73. v-hasPermi="['teamTicketMr:teamTicketMr:binding']"
  74. >团队绑定</el-button>
  75. <el-button
  76. size="mini"
  77. type="text"
  78. @click="ionlineApi(scope.row)"
  79. v-hasPermi="['teamTicketMr:teamTicketMr:online']"
  80. >{{ scope.row.status == 1 ? '下架' : '上架' }}</el-button>
  81. <el-button
  82. size="mini"
  83. type="text"
  84. @click="handleDelete(scope.row,scope.index)"
  85. v-hasPermi="['teamTicketMr:teamTicketMr:delete']"
  86. >删除</el-button>
  87. </template>
  88. </el-table-column>
  89. </el-table>
  90. <pagination
  91. v-show="total>0"
  92. :total="total"
  93. :page.sync="queryParams.pageNum"
  94. :limit.sync="queryParams.pageSize"
  95. @pagination="getList"
  96. />
  97. <!-- 新增/编辑弹框 -->
  98. <add-and-edit
  99. ref="addAndEdit"
  100. :dict="dict"
  101. @getList="getList"
  102. />
  103. <dumpling-edit :dict="dict" ref="dumplingEdit"></dumpling-edit>
  104. <el-dialog
  105. title="查看"
  106. :visible.sync="visibleStatus"
  107. width="600px"
  108. :destroy-on-close="true"
  109. :close-on-click-modal="false"
  110. >
  111. <div v-if="visibleType == 'img'">
  112. <el-image
  113. style="width: 400px; height: 100%"
  114. :src="newObj.mainImg"
  115. fit="cover"
  116. />
  117. </div>
  118. <div v-if="visibleType == 'html'">
  119. <div v-html="newObj.centent"></div>
  120. </div>
  121. <div slot="footer" class="dialog-footer">
  122. <el-button type="primary" @click="visibleStatus = false">确 定</el-button>
  123. </div>
  124. </el-dialog>
  125. </div>
  126. </template>
  127. <script>
  128. import { pageList, deleteById, updateStatus } from '@/api/team/ticketMr'
  129. import addAndEdit from "./dialog/addAndEdit.vue";
  130. import dumplingEdit from "./dialog/dumplingEdit";
  131. export default {
  132. name: "agreement",
  133. dicts: ['distribution_type', 'team_type'],
  134. components: { addAndEdit, dumplingEdit },
  135. data() {
  136. return {
  137. // 遮罩层
  138. loading: true,
  139. // 选中数组
  140. ids: [],
  141. // 非单个禁用
  142. single: true,
  143. // 非多个禁用
  144. multiple: true,
  145. // 显示搜索条件
  146. showSearch: true,
  147. // 总条数
  148. total: 0,
  149. // 用户表格数据
  150. dataList: null,
  151. // 弹出层标题
  152. title: "",
  153. // 是否显示弹出层
  154. open: false,
  155. // 日期范围
  156. dateRange: [],
  157. // 查询参数
  158. queryParams: {
  159. pageNum: 1,
  160. pageSize: 10,
  161. type: undefined
  162. },
  163. statusList: [
  164. {id: 1, name: '未发布', value: 0},
  165. {id: 2, name: '发布', value: 1},
  166. {id: 3, name: '下架', value: 2},
  167. ],
  168. visibleStatus: false,
  169. newObj: {},
  170. visibleType: '',
  171. setStatus: false,
  172. setForm: {},
  173. setRules: [],
  174. setLoading: false,
  175. };
  176. },
  177. created() {
  178. this.getList();
  179. },
  180. methods: {
  181. /** 查询列表 */
  182. getList() {
  183. this.loading = true;
  184. pageList(this.queryParams)
  185. .then(response => {
  186. this.dataList = response.data.rows;
  187. this.dataList.forEach(item =>{
  188. item.switchValue = item.status;
  189. })
  190. this.total = response.data.total;
  191. this.loading = false;
  192. }
  193. );
  194. },
  195. // 取消按钮
  196. cancel() {
  197. this.open = false;
  198. },
  199. /** 搜索按钮操作 */
  200. handleQuery() {
  201. this.queryParams.pageNum = 1;
  202. this.getList();
  203. },
  204. /** 重置按钮操作 */
  205. resetQuery() {
  206. this.dateRange = [];
  207. this.$set(this.queryParams, 'goodsName', '');
  208. this.queryParams.pageNum = 1;
  209. this.handleQuery();
  210. },
  211. /** 价格输入事件 */
  212. changePriceAmount(key) {
  213. if(this.setForm[key] * 1 < 0){
  214. this.$message.error("输入需大于或等于0!");
  215. this.$set(this.setForm, key, '');
  216. return false
  217. }
  218. },
  219. /** 新增按钮操作 */
  220. handleAdd() {
  221. this.$refs["addAndEdit"].openDialog("新增数据", null);
  222. },
  223. /** 修改按钮操作 */
  224. handleUpdate(row) {
  225. this.$refs["addAndEdit"].openDialog("修改数据", row);
  226. },
  227. /** 团队绑定按钮操作 */
  228. handleTeam(row) {
  229. this.$refs["dumplingEdit"].openDialog("团队绑定", row);
  230. },
  231. /** 禁用或者启用发布按钮操作 */
  232. ionlineApi(row) {
  233. this.$confirm("是否对剧目名称为" + row.performName + "的数据进行" + (row.status == 1 ? '下架?' : '上架?'), '提示', {
  234. confirmButtonText: '确定',
  235. cancelButtonText: '取消',
  236. type: 'warning'
  237. }).then(() => {
  238. updateStatus({ id: row.id, status: row.status == 1 ? 0 : 1 }).then((res) => {
  239. if (res.code == 200) {
  240. this.$message({
  241. type: 'success',
  242. message: '操作成功!'
  243. });
  244. this.getList();
  245. }
  246. });
  247. }).catch(() => {});
  248. },
  249. /** 删除按钮操作 */
  250. handleDelete(row) {
  251. this.$modal.confirm('是否确认删除数据剧目名称为"' + row.performName + '"的数据项?').then(function() {
  252. return deleteById(row.id);
  253. }).then(() => {
  254. this.getList();
  255. this.$modal.msgSuccess("删除成功");
  256. }).catch(() => {});
  257. },
  258. /** 查看按钮操作 */
  259. seeCenter(obj, type) {
  260. this.visibleStatus = true
  261. this.visibleType = type;
  262. this.newObj = obj;
  263. }
  264. }
  265. };
  266. </script>