index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <div class="app-container">
  3. <el-row :gutter="10" class="mb8">
  4. <right-toolbar :showSearch.sync="showSearch" :search="false" @queryTable="getList"></right-toolbar>
  5. </el-row>
  6. <el-table ref="tables" v-loading="loading" :data="dataList" max-height="580px" border>
  7. <el-table-column label="序号" align="center" type="index" width="50"></el-table-column>
  8. <!-- <el-table-column label="猫眼ID" align="center" prop="id" /> -->
  9. <el-table-column label="项目ID" align="center" prop="projectId" />
  10. <el-table-column label="演出厅" align="center" prop="performHallName" />
  11. <el-table-column label="剧目名称" align="center" prop="performName" />
  12. <el-table-column label="商品名称" align="center" prop="goodsName" />
  13. <el-table-column label="时刻信息" align="center" prop="goodsName1">
  14. <template slot-scope="scope">
  15. <span>{{ scope.row.times }}</span>
  16. </template>
  17. </el-table-column>
  18. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  19. <template slot-scope="scope">
  20. <span v-hasPermi="['otaMr:maoyan:push']" style="display: inline-block;">
  21. <el-button
  22. size="mini"
  23. type="text"
  24. style="margin-right: 10px;"
  25. @click="handlePush(scope.row,scope.index)"
  26. >{{ (scope.row.status == -1 || !scope.row.status) ? '上线' : '下线' }}</el-button>
  27. </span>
  28. <span v-hasPermi="['otaMr:maoyan:tuisong']" style="display: inline-block;">
  29. <el-button
  30. size="mini"
  31. type="text"
  32. style="margin-left: 10px;"
  33. @click="handleInventory(scope.row,scope.index)"
  34. v-if="scope.row.status == 1"
  35. >日历库存推送</el-button>
  36. </span>
  37. <span v-hasPermi="['otaMr:maoyan:time']" style="display: inline-block;margin-right: 10px;">
  38. <el-button
  39. size="mini"
  40. type="text"
  41. style="margin-left: 10px;"
  42. @click="handleUpdate(scope.row,'yesPush')"
  43. >价格日历</el-button>
  44. </span>
  45. <el-button
  46. size="mini"
  47. type="text"
  48. @click="handleUpdate(scope.row,scope.index,'noPush')"
  49. v-hasPermi="['otaMr:maoyan:scheduling']"
  50. >排期推送</el-button>
  51. </template>
  52. </el-table-column>
  53. </el-table>
  54. <pagination
  55. v-show="total>0"
  56. :total="total"
  57. :page.sync="queryParams.pageNum"
  58. :limit.sync="queryParams.pageSize"
  59. @pagination="getList"
  60. />
  61. <!-- 编辑商品弹框 -->
  62. <data-edit
  63. ref="dataEdit"
  64. @getList="getList"
  65. :dict="dict"></data-edit>
  66. </div>
  67. </template>
  68. <script>
  69. import { pageList, updateById,stockUpdateById, stockUpdateByIdApi } from '@/api/otaMr/maoyan'
  70. import dataEdit from "./dialog/dataEdit.vue";
  71. export default {
  72. name: "Meituan",
  73. dicts: ['tiktok_process','tiktok_online','tiktok_category'],
  74. components: { dataEdit },
  75. data() {
  76. return {
  77. // 遮罩层
  78. loading: true,
  79. otaLoading: false,
  80. // 选中数组
  81. ids: [],
  82. // 非单个禁用
  83. single: true,
  84. // 非多个禁用
  85. multiple: true,
  86. // 显示搜索条件
  87. showSearch: true,
  88. // 总条数
  89. total: 0,
  90. // 用户表格数据
  91. dataList: null,
  92. // 弹出层标题
  93. title: "",
  94. otaType: '1',
  95. // 是否显示弹出层
  96. open: false,
  97. // 日期范围
  98. dateRange: [],
  99. // 查询参数
  100. queryParams: {
  101. pageNum: 1,
  102. pageSize: 10,
  103. },
  104. visibleStatus: false,
  105. newObj: {},
  106. visibleType: '',
  107. otaForm: {},
  108. otaRules: {
  109. name: [{ required: true, message: "请输入供应商id", trigger: ["change","blur"] }],
  110. otaKey: [{ required: true, message: "请输入client id", trigger: ["change","blur"] }],
  111. otaValue: [{ required: true, message: "请输入client secret", trigger: ["change","blur"] }]
  112. },
  113. };
  114. },
  115. created() {
  116. this.getList();
  117. },
  118. methods: {
  119. /** 查询列表 */
  120. getList() {
  121. this.loading = true;
  122. pageList(this.addDateRange(this.queryParams, this.dateRange))
  123. .then(response => {
  124. this.dataList = response.data.rows;
  125. this.total = response.data.total?Number(response.data.total):0;
  126. this.loading = false;
  127. }
  128. ).catch(()=>{
  129. this.dataList = []
  130. this.total = 0;
  131. this.loading = false;
  132. })
  133. },
  134. // 取消按钮
  135. cancel() {
  136. this.open = false;
  137. },
  138. /** 搜索按钮操作 */
  139. handleQuery() {
  140. this.queryParams.pageNum = 1;
  141. this.getList();
  142. },
  143. /** 重置按钮操作 */
  144. resetQuery() {
  145. this.dateRange = [];
  146. this.dataList = [];
  147. this.queryParams.pageNum = 1;
  148. this.handleQuery();
  149. },
  150. /** 修改按钮操作 */
  151. handleUpdate(row,type) {
  152. this.$refs["dataEdit"].openDialog("修改数据", row,type);
  153. },
  154. /** 删除按钮操作 */
  155. handleDelete(row) {
  156. this.$modal.confirm('是否确认删除商品名称为"' + row.goodsName + '"的数据项?').then(function() {
  157. return deleteById(row.id);
  158. }).then(() => {
  159. this.getList();
  160. this.$modal.msgSuccess("删除成功");
  161. }).catch(() => {});
  162. },
  163. /** 推送 */
  164. handlePush(row) {
  165. this.$modal.confirm(`是否确认${ (row.status == -1 || !row.status) ? '上线': row.status == 1 ?'下线':''}此商品吗?`).then(function() {
  166. return updateById({
  167. id: row.id,
  168. status: row.status == -1 ? 1 : 0
  169. });
  170. }).then(() => {
  171. this.$modal.msgSuccess(`${ (row.status == -1 || !row.status) ? '上线': row.status == 1 ?'下线':''}成功`);
  172. this.getList();
  173. }).catch(() => {
  174. });
  175. },
  176. handleInventory(row) {
  177. this.$modal.confirm(`是否确认推送此商品的日历库存?`).then(function() {
  178. return stockUpdateByIdApi({
  179. id: row.id,
  180. });
  181. }).then(() => {
  182. this.$modal.msgSuccess(`推送成功`);
  183. this.getList();
  184. }).catch(() => {
  185. });
  186. },
  187. }
  188. };
  189. </script>