index.vue 7.1 KB

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