index.vue 7.3 KB

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