index.vue 6.0 KB

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