index.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841
  1. <template>
  2. <div class="othgoodsOnline pagePadding">
  3. <div v-if=" powers.some((i) => i == '001')">
  4. <ex-table
  5. v-loading="loading"
  6. :table="table"
  7. :data="tableData"
  8. :columns="columns"
  9. :page="pageInfo"
  10. :size="size"
  11. @page-curr-change="handlePageChange"
  12. @page-size-change="handleSizeChange"
  13. @screen-reset="
  14. pageInfo.curr = 1;
  15. parmValue.page = 1;
  16. searchList();
  17. "
  18. @screen-submit="
  19. pageInfo.curr = 1;
  20. parmValue.page = 1;
  21. searchList();
  22. "
  23. >
  24. <template #table-header="{}">
  25. <div style="width: 100%">
  26. <el-row style="padding: 0 0 10px 80px">
  27. <el-col :span="4" style="width: 150px">
  28. <el-select
  29. v-model="parmValue.exam_status"
  30. filterable
  31. clearable
  32. :size="searchSize"
  33. placeholder="状态"
  34. style="width: 100%"
  35. @change="
  36. pageInfo.curr = 1;
  37. parmValue.page = 1;
  38. searchList();
  39. "
  40. >
  41. <el-option
  42. v-for="item in options8"
  43. :key="'status' + item.id"
  44. :label="item.name"
  45. :value="item.id"
  46. />
  47. </el-select>
  48. </el-col>
  49. <el-col :span="4" style="width: 130px; padding: 0 0 0 10px">
  50. <el-select
  51. v-model="parmValue.good_type"
  52. filterable
  53. clearable
  54. :size="searchSize"
  55. placeholder="是否定制"
  56. style="width: 100%"
  57. @change="
  58. pageInfo.curr = 1;
  59. parmValue.page = 1;
  60. searchList();
  61. "
  62. >
  63. <el-option
  64. v-for="item in options1"
  65. :key="'good_type' + item.id"
  66. :label="item.name"
  67. :value="item.id"
  68. />
  69. </el-select>
  70. </el-col>
  71. <el-col :span="6" style="width: 303px; padding: 0 0 0 10px">
  72. <period-date-picker
  73. :type="1"
  74. :width="'135px'"
  75. :size="searchSize"
  76. :start="parmValue.start"
  77. :end="parmValue.end"
  78. @timeReturned="handleTime"
  79. />
  80. </el-col>
  81. <el-col :span="3" class="fr" style="width: 66px; padding: 0 0 0 10px">
  82. <el-button type="warning" :size="searchSize" @click="restSearch">
  83. 重置
  84. </el-button>
  85. </el-col>
  86. </el-row>
  87. <el-row>
  88. <el-col :span="6" style="width: 310px">
  89. <good-class
  90. :value="parmValue.cat_id"
  91. @handleChange="goods_class_change"
  92. :disabled="false"
  93. :size="searchSize"
  94. :isDetail="false"
  95. :placeholder="'分类'"
  96. />
  97. </el-col>
  98. <el-col :span="6" style="width: 240px; padding: 0 0 0 10px">
  99. <search-terrace
  100. :value="parmValue.platform_code"
  101. :disabled="false"
  102. :size="'mini'"
  103. :isDetail="false"
  104. :is_show="'0'"
  105. :placeholder="'所属平台'"
  106. @searchChange="platform_codeChange"
  107. /></el-col>
  108. <el-col :span="4" style="width: 210px; padding: 0 0 0 10px">
  109. <search-brand
  110. :value="brandid"
  111. :disabled="false"
  112. :size="'mini'"
  113. :isDetail="true"
  114. :names="parmValue.supplierName"
  115. :placeholder="'商品品牌'"
  116. @searchChange="brandidsearchChange"
  117. />
  118. </el-col>
  119. <el-col :span="3" class="fr" style="width: 66px; padding: 0 0 0 10px">
  120. <el-button type="primary" :size="searchSize" @click="searchList">
  121. 刷新
  122. </el-button>
  123. </el-col>
  124. </el-row>
  125. <el-row style="padding: 10px 0 0 0">
  126. <el-col :span="4" style="width: 450px">
  127. <el-input
  128. :size="searchSize"
  129. v-model="sinput"
  130. :maxlength="40"
  131. @blur="
  132. pageInfo.curr = 1;
  133. parmValue.page = 1;
  134. searchList();
  135. "
  136. placeholder="关键字"
  137. ><el-select
  138. v-model="select"
  139. slot="prepend"
  140. :size="searchSize"
  141. style="width: 140px"
  142. @change="
  143. pageInfo.curr = 1;
  144. parmValue.page = 1;
  145. searchList();
  146. "
  147. placeholder="关键字类型"
  148. >
  149. <el-option label="商品名称" value="1" />
  150. <el-option label="成本商品编号" value="2" />
  151. <el-option label="上线商品编号" value="8" />
  152. <!-- <el-option label="平台编号" value="3" /> -->
  153. <!-- <el-option label="供应商编号" value="4" /> -->
  154. <el-option label="业务企业编号" value="5" />
  155. <el-option label="平台商品编号" value="6" />
  156. <el-option label="成本创建人" value="7" />
  157. <el-option label="上线创建人" value="10" />
  158. <el-option label="创建人部门" value="9" /> </el-select
  159. ></el-input>
  160. </el-col>
  161. <el-col
  162. :span="3"
  163. class="fr"
  164. style="width: 66px; padding: 0 0 0 10px"
  165. v-if="powers.some((i) => i == '087')"
  166. >
  167. <el-button
  168. :size="searchSize"
  169. type="primary"
  170. style="float: right"
  171. @click="centerDialogVisible = true"
  172. >
  173. 导出上线商品
  174. </el-button>
  175. </el-col>
  176. </el-row>
  177. </div></template
  178. >
  179. <template #good_thumb_img="{ scope }">
  180. <div
  181. v-if="scope.row.good_thumb_img"
  182. style="width: 20px; height: 20px"
  183. class="hover"
  184. v-viewer
  185. >
  186. <img
  187. :src="scope.row.good_thumb_img"
  188. style="display: inline-block; width: 100%; height: 100%"
  189. alt=""
  190. />
  191. </div>
  192. </template>
  193. <template #status="{ scope }">
  194. <el-tag
  195. :size="tablebtnSize"
  196. :type="
  197. scope.row.status == '6'
  198. ? ''
  199. : scope.row.status == '7'
  200. ? 'danger'
  201. : 'warning'
  202. "
  203. v-text="
  204. (options8.find((item) => item.id == scope.row.status) || {}).name || '--'
  205. "
  206. ></el-tag>
  207. </template>
  208. <template #good_type="{ scope }">
  209. <el-tag
  210. :size="tablebtnSize"
  211. :type="scope.row.good_type == '0' ? 'warning' : ''"
  212. v-text="
  213. (options1.find((item) => item.id == scope.row.good_type) || {}).name || '--'
  214. "
  215. ></el-tag>
  216. </template>
  217. <template #operation="{ scope }">
  218. <el-tooltip
  219. v-if="powers.some((i) => i == '007')"
  220. effect="dark"
  221. content="详情"
  222. placement="top"
  223. >
  224. <i
  225. class="el-icon-view tb-icon"
  226. @click="getRouter('othgoodsOnlineDetail', scope.row.platform_youzan_id)"
  227. ></i>
  228. </el-tooltip>
  229. <el-tooltip
  230. v-if="
  231. powers.some((i) => i == '078') &&
  232. (String(scope.row.status) === '7' || String(scope.row.status) === '8')
  233. "
  234. effect="dark"
  235. content="重新发起上线流程"
  236. placement="top"
  237. >
  238. <i
  239. class="el-icon-upload tb-icon"
  240. @click="get_againonline(scope.row.platform_youzan_id)"
  241. ></i>
  242. </el-tooltip>
  243. <el-tooltip
  244. v-if="powers.some((i) => i == '079') && scope.row.status + '' !== '8'"
  245. effect="dark"
  246. content="下线商品"
  247. placement="top"
  248. >
  249. <i
  250. class="el-icon-download tb-icon"
  251. @click="showDonlineDlg(scope.row.platform_youzan_id)"
  252. ></i>
  253. </el-tooltip>
  254. </template>
  255. </ex-table>
  256. <el-dialog title="下线原因" :visible.sync="dialogFormVisible" width="500px">
  257. <el-form
  258. :model="donline_form"
  259. :rules="donline_rules"
  260. ref="donline_Form"
  261. class="demo-ruleForm"
  262. label-width="80px"
  263. >
  264. <el-form-item label="下线原因" prop="offline_reason_id">
  265. <el-select
  266. style="width: 100%"
  267. v-model="donline_form.offline_reason_id"
  268. placeholder="请选择下线原因"
  269. >
  270. <el-option
  271. :label="item.result"
  272. :value="item.result_code"
  273. v-for="item in donline_formStOps"
  274. :key="item.result_code"
  275. ></el-option>
  276. </el-select>
  277. </el-form-item>
  278. <el-form-item label="下线备注" prop="offline_remark">
  279. <el-input
  280. v-model="donline_form.offline_remark"
  281. type="textarea"
  282. placeholder="请输入下线备注"
  283. autocomplete="off"
  284. ></el-input>
  285. </el-form-item>
  286. </el-form>
  287. <div slot="footer" class="dialog-footer">
  288. <el-button @click="dialogFormVisible = false">取 消</el-button>
  289. <el-button type="primary" @click="donlineDlg">确 定</el-button>
  290. </div>
  291. </el-dialog>
  292. <el-dialog
  293. title="上线商品导出"
  294. :visible.sync="centerDialogVisible"
  295. width="500px"
  296. center
  297. >
  298. <el-form
  299. :model="ruleForm"
  300. :rules="rules"
  301. ref="ruleForm"
  302. class="demo-ruleForm"
  303. label-width="80px"
  304. >
  305. <el-form-item prop="start_date" label="日期: ">
  306. <!-- <el-date-picker
  307. value-format="yyyy-MM-dd"
  308. v-model="ruleForm.date"
  309. type="date"
  310. placeholder="请选择"
  311. >
  312. </el-date-picker> -->
  313. <periodDatePicker
  314. :start="ruleForm.start_date"
  315. :end="ruleForm.end_date"
  316. :width="'165px'"
  317. @timeReturned="time"
  318. />
  319. </el-form-item>
  320. <el-form-item label="状态: " prop="status">
  321. <el-select v-model="ruleForm.status" placeholder="请选择">
  322. <el-option label="待上线" value="5"></el-option>
  323. <el-option label="上线成功" value="6"></el-option>
  324. <el-option label="已下线" value="8"></el-option>
  325. </el-select>
  326. </el-form-item>
  327. <el-form-item label="平台id: " prop="platform_id">
  328. <!-- <el-input
  329. v-model="ruleForm.platform_id"
  330. style="width: 300px"
  331. placeholder="请输入"
  332. ></el-input> -->
  333. <search-terrace
  334. :value="ruleForm.platform_id"
  335. :disabled="false"
  336. :isDetail="false"
  337. :is_show="'0'"
  338. :placeholder="'所属平台'"
  339. @searchChange="platform_codesearchChange"
  340. />
  341. </el-form-item>
  342. </el-form>
  343. <span slot="footer" class="dialog-footer">
  344. <el-button @click="centerDialogVisible = false">取 消</el-button>
  345. <el-button type="primary" @click="goodsExport">导 出</el-button>
  346. </span>
  347. </el-dialog>
  348. <!-- 弹窗 新增/修改 -->
  349. <add-edit
  350. :id="modelId"
  351. :show-model="showModel"
  352. :sitem="sitem"
  353. @refresh="searchList"
  354. @cancel="showModel = false"
  355. />
  356. </div>
  357. <div v-else>
  358. <no-auth></no-auth>
  359. </div>
  360. </div>
  361. </template>
  362. <script>
  363. import asyncRequest from "@/apis/service/youzan/othgoodsOnline";
  364. import mixinPage from "@/mixins/elPaginationHandle";
  365. import { mapGetters } from "vuex";
  366. import urlConfig from "@/apis/url-config";
  367. import resToken from "@/mixins/resToken";
  368. import { listCol, options1, options8 } from "./columns";
  369. export default {
  370. name: "othgoodsOnline",
  371. mixins: [mixinPage, resToken],
  372. computed: {
  373. //组件SIZE设置
  374. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  375. powers() {
  376. const tran =
  377. this.$store.getters.btnList.find((i) => i.menu_route == "othgoodsOnline") ||
  378. {};
  379. const { action } = tran ?? {};
  380. return action ?? [];
  381. },
  382. },
  383. data() {
  384. const validate = (rule, value, callback) => {
  385. if (value == "") {
  386. return callback(new Error("必填项不能为空"));
  387. } else {
  388. callback();
  389. }
  390. };
  391. return {
  392. dialogFormVisible: false,
  393. donline_formStOps: [],
  394. donline_form: {
  395. offline_reason_id: "",
  396. offline_remark: "",
  397. platform_youzan_id: "",
  398. },
  399. donline_rules: {
  400. offline_reason_id: [
  401. { message: "请选择下线原因", required: true, trigger: "change" },
  402. ],
  403. offline_remark: [{ message: "请输入下线备注", required: true, trigger: "blur" }],
  404. },
  405. fileUrl: urlConfig.baseURL,
  406. ruleForm: {
  407. // date: "",
  408. platform_id: "",
  409. status: "",
  410. start_date: "",
  411. end_date: "",
  412. },
  413. rules: {
  414. start_date: [
  415. {
  416. validator: validate,
  417. type: "date",
  418. required: true,
  419. trigger: "change",
  420. },
  421. ],
  422. status: [{ validator: validate, required: true, trigger: "change" }],
  423. platform_id: [{ validator: validate, required: true, trigger: "change" }],
  424. },
  425. centerDialogVisible: false,
  426. options1: options1,
  427. options8: options8,
  428. loading: false,
  429. parmValue: {
  430. good_name: "", //商品名称
  431. spucode: "", //商品编号
  432. skucode: "", //商品编号
  433. cat_id: "", //商品分类
  434. start: "", //开始日期
  435. end: "", //结束日期
  436. platform_code: "", //平台编码
  437. is_stock: "", //是否库存品
  438. page: 1, // 页码
  439. size: 15, // 每页显示条数
  440. supplierNo: "", //供应商编号
  441. good_type: "", //是否定制
  442. brand_id: "", //品牌
  443. companyNo: "", //业务企业编号
  444. exam_status: "", //审核状态
  445. plat_code: "", //平台商品编号
  446. creater: "", //
  447. company_name: "", //创建人部门
  448. },
  449. // 表格 - 数据
  450. tableData: [],
  451. // 表格 - 参数
  452. table: {
  453. stripe: true,
  454. border: true,
  455. _defaultHeader_: ["setcol"],
  456. },
  457. // 表格 - 分页
  458. pageInfo: {
  459. size: 15,
  460. curr: 1,
  461. total: 0,
  462. },
  463. // 表格 - 列参数
  464. columns: listCol,
  465. cat_id: [],
  466. brandid: [],
  467. select: "1",
  468. sinput: "",
  469. };
  470. },
  471. mounted() {
  472. const { back } = this.$route.query;
  473. if (back) {
  474. this.parmValue = JSON.parse(back);
  475. console.log(this.parmValue);
  476. const { page, size } = this.parmValue;
  477. // this.parmValue.start = start || last_start;
  478. // this.parmValue.end = end || last_end;
  479. if (this.parmValue.brand_id.length > 0) {
  480. this.brandid = [this.parmValue.brand_id];
  481. }
  482. this.pageInfo = {
  483. size: size,
  484. curr: page,
  485. total: 0,
  486. };
  487. //多选条件
  488. this.select = this.parmValue.select;
  489. // this.sselect = this.parmValue.sselect;
  490. this.sinput = this.parmValue.sinput;
  491. } else {
  492. this.select = "1";
  493. // this.sselect = "创建时间"
  494. }
  495. this.cat_id = [];
  496. // this.brandid = [];
  497. this.searchList();
  498. },
  499. methods: {
  500. // 获取异常原因下拉列表
  501. async getresultlist() {
  502. const { code, data, message } = await asyncRequest.resultlist({
  503. page: 1,
  504. size: 100,
  505. type: "8",
  506. status: "3",
  507. });
  508. if (code === 0) {
  509. const { list } = data ?? [];
  510. this.donline_formStOps = list;
  511. } else if (code >= 100 && code <= 104) {
  512. await this.logout();
  513. } else {
  514. this.$message.warning(message);
  515. }
  516. },
  517. // 时间函数
  518. async time(e) {
  519. this.ruleForm.start_date = e.startTime || "";
  520. this.ruleForm.end_date = e.endTime || "";
  521. },
  522. platform_codesearchChange(e) {
  523. const { id } = e;
  524. this.ruleForm.platform_id = id || "";
  525. this.$refs.ruleForm.validateField("platform_id");
  526. },
  527. async platform_codeChange(e) {
  528. const { id } = e;
  529. this.parmValue.platform_code = id || "";
  530. this.pageInfo.curr = 1;
  531. this.parmValue.page = 1;
  532. await this.searchList();
  533. },
  534. //点击下线
  535. async showDonlineDlg(platform_youzan_id) {
  536. this.donline_form = {
  537. offline_reason_id: "",
  538. offline_remark: "",
  539. platform_youzan_id: platform_youzan_id,
  540. };
  541. this.dialogFormVisible = true;
  542. },
  543. //商品下线原因 确定
  544. async donlineDlg() {
  545. await this.$refs.donline_Form.validate(async (valid) => {
  546. if (valid) {
  547. this.loading = true;
  548. const obj = JSON.parse(JSON.stringify(this.donline_form));
  549. const { code, data, message } = await asyncRequest.yz_goodoff(obj);
  550. this.dialogFormVisible = false;
  551. if (code === 0) {
  552. this.loading = false;
  553. this.$notify.success({
  554. title: message,
  555. message: "",
  556. });
  557. await this.searchList();
  558. } else if (code >= 100 && code <= 104) {
  559. await this.logout();
  560. } else {
  561. this.loading = false;
  562. this.$message.warning(message);
  563. }
  564. } else {
  565. console.log("error submit!!");
  566. return false;
  567. }
  568. });
  569. },
  570. //导出
  571. async goodsExport() {
  572. if (
  573. (this.ruleForm.start_date !== "" && this.ruleForm.end_date === "") ||
  574. (this.ruleForm.start_date === "" && this.ruleForm.end_date !== "")
  575. ) {
  576. this.$message.warning("时间区间不完整!");
  577. return;
  578. }
  579. // console.log(this.$refs.ruleForm)
  580. // return;
  581. await this.$refs.ruleForm.validate(async (valid) => {
  582. if (valid) {
  583. if (!this.loading) {
  584. this.loading = true;
  585. let httpType = `aplication/zip`;
  586. axios({
  587. method: "post",
  588. url: this.fileUrl + "admin/exportgood",
  589. responseType: "blob",
  590. data: this.ruleForm,
  591. headers: {
  592. Accept: httpType,
  593. },
  594. })
  595. .then((res) => {
  596. if (res && res.status == 200 && res.data) {
  597. let url = window.URL.createObjectURL(
  598. new Blob([res.data], {
  599. type: httpType,
  600. })
  601. );
  602. let link = document.createElement("a");
  603. link.style.display = "none";
  604. link.href = url;
  605. let excelName = "商品.zip";
  606. link.setAttribute("download", excelName);
  607. document.body.appendChild(link);
  608. link.click();
  609. link.remove();
  610. window.URL.revokeObjectURL(url); //释放掉blob对象
  611. this.$message.success(`导出成功!`);
  612. setTimeout(() => {
  613. this.loading = false;
  614. }, 500);
  615. } else {
  616. this.$message.error(res.data.message);
  617. setTimeout(() => {
  618. this.loading = false;
  619. }, 500);
  620. }
  621. })
  622. .catch((error) => {
  623. console.log(error);
  624. this.loading = false;
  625. });
  626. }
  627. // this.loading = true;
  628. // const res = await asyncRequest.exportgood(this.ruleForm);
  629. // if (res && res.code === 0) {
  630. // this.$message.warning(res.message);
  631. // console.log(res);
  632. // this.loading = false;
  633. // } else if (res && res.code >= 100 && res.code <= 104) {
  634. // await this.logout();
  635. // } else {
  636. // this.loading = false;
  637. // this.$message.warning(res.message);
  638. // }
  639. } else {
  640. console.log("error submit!!");
  641. return false;
  642. }
  643. });
  644. },
  645. //点击详情
  646. getRouter(toRouter, queryId) {
  647. if (toRouter && queryId) {
  648. let model = {
  649. id: queryId,
  650. type: "view",
  651. };
  652. //有多选框的条件
  653. this.parmValue.select = this.select;
  654. // this.parmValue.sselect = this.sselect ;
  655. this.parmValue.sinput = this.sinput;
  656. //
  657. console.log(this.parmValue);
  658. let routerModel = {
  659. options: JSON.parse(JSON.stringify(this.parmValue)),
  660. router: this.$route.path,
  661. };
  662. model.preModel = JSON.stringify(routerModel);
  663. this.routeGoto(toRouter, model);
  664. } else {
  665. this.$message.warning("暂未找到相关流程!");
  666. }
  667. },
  668. restSearch() {
  669. this.select = "1";
  670. this.sinput = "";
  671. this.cat_id = [];
  672. this.brandid = [];
  673. // 表格 - 分页
  674. this.pageInfo = {
  675. size: 15,
  676. curr: 1,
  677. total: 0,
  678. };
  679. this.parmValue = {
  680. good_name: "", //商品名称
  681. spucode: "", //商品编号
  682. skucode: "", //商品编号
  683. cat_id: "", //商品分类
  684. start: "", //开始日期
  685. end: "", //结束日期
  686. platform_code: "", //平台编码
  687. is_stock: "", //是否库存品
  688. page: 1, // 页码
  689. size: 15, // 每页显示条数
  690. supplierNo: "", //供应商编号
  691. good_type: "", //是否定制
  692. brand_id: "", //品牌
  693. companyNo: "", //业务企业编号
  694. exam_status: "", //审核状态
  695. plat_code: "", //平台商品编号
  696. creater: "", //
  697. company_name: "", //创建人部门
  698. };
  699. this.searchList();
  700. },
  701. //商品品牌选择
  702. async brandidsearchChange(e) {
  703. const { id, code, label } = e;
  704. if (id) {
  705. this.brandid = [id];
  706. this.parmValue.brand_id = id;
  707. this.parmValue.supplierName = label;
  708. } else {
  709. this.brandid = [];
  710. this.parmValue.brand_id = "";
  711. this.parmValue.supplierName = "";
  712. }
  713. this.parmValue.brand_id = this.brandid.toString();
  714. this.pageInfo.curr = 1;
  715. this.parmValue.page = 1;
  716. await this.searchList();
  717. },
  718. // 时间
  719. async handleTime(e) {
  720. this.parmValue.start = e.startTime || "";
  721. this.parmValue.end = e.endTime || "";
  722. if (
  723. (this.parmValue.start !== "" && this.parmValue.end !== "") ||
  724. (this.parmValue.start === "" && this.parmValue.end === "")
  725. ) {
  726. this.pageInfo.curr = 1;
  727. this.parmValue.page = 1;
  728. await this.searchList();
  729. }
  730. },
  731. /**
  732. * 商品重新上线
  733. * @param {String} id id
  734. * @param {String} status 0-禁用 1-启用
  735. */
  736. async get_againonline(platform_youzan_id) {
  737. await this.$confirm(`确定要重新发起上线流程?`, {
  738. confirmButtonText: "确定",
  739. cancelButtonText: "取消",
  740. type: "warning",
  741. })
  742. .then(async () => {
  743. this.loading = true;
  744. const model = {
  745. platform_youzan_id: platform_youzan_id,
  746. };
  747. const res = await asyncRequest.againonline(model);
  748. if (res && res.code === 0) {
  749. this.loading = false;
  750. this.$notify.success({
  751. title: "重新发起上线流程成功!",
  752. message: "",
  753. });
  754. await this.searchList();
  755. } else if (res && res.code >= 100 && res.code <= 104) {
  756. await this.logout();
  757. } else {
  758. this.loading = false;
  759. this.$message.warning(res.message);
  760. }
  761. })
  762. .catch(() => {
  763. console.log("取消");
  764. });
  765. },
  766. /**
  767. * 商品下线
  768. * @param {String} id id
  769. * @param {String} status 0-禁用 1-启用
  770. */
  771. // 刷新表格
  772. async searchList() {
  773. if (
  774. (this.parmValue.start !== "" && this.parmValue.end === "") ||
  775. (this.parmValue.start === "" && this.parmValue.end !== "")
  776. ) {
  777. this.$message.warning("时间区间不完整!");
  778. return;
  779. }
  780. this.loading = true;
  781. let model = JSON.parse(JSON.stringify(this.parmValue));
  782. model.good_name = this.select === "1" ? this.sinput : ""; //商品名称
  783. model.spucode = this.select === "2" ? this.sinput : ""; //商品编号
  784. model.skucode = this.select === "8" ? this.sinput : ""; //商品编号
  785. // model.platform_code = this.select === "1" ? this.sinput : ""; //平台编码
  786. // model.supplierNo = this.select === "1" ? this.sinput : ""; //供应商编号
  787. model.companyNo = this.select === "5" ? this.sinput : ""; //业务企业编号
  788. // model.exam_status = this.select === "1" ? this.sinput : ""; //审核状态
  789. model.plat_code = this.select === "6" ? this.sinput : ""; //平台商品编号
  790. model.creater = this.select === "7" ? this.sinput : ""; //
  791. model.company_name = this.select === "9" ? this.sinput : ""; // 部门
  792. model.online_creater = this.select === "10" ? this.sinput : ""; // 上线创建人
  793. const { code, data, message } = await asyncRequest.list(model);
  794. if (code === 0) {
  795. const { list, count } = data ?? {};
  796. this.tableData = list ?? [];
  797. this.tableData.forEach((a) => {
  798. a.cat_name = "";
  799. let list = a.cat_info || [];
  800. list.forEach((b, i) => {
  801. a.cat_name += i == 0 ? b.name : "/" + b.name;
  802. });
  803. });
  804. this.pageInfo.total = Number(count ?? "0");
  805. } else if (code >= 100 && code <= 104) {
  806. await this.logout();
  807. } else {
  808. this.tableData = [];
  809. this.pageInfo.total = 0;
  810. }
  811. this.getresultlist();
  812. this.loading = false;
  813. },
  814. //商品分类选择
  815. async goods_class_change(e) {
  816. this.cat_id = e;
  817. this.parmValue.cat_id =
  818. this.cat_id.length === 0 ? "" : this.cat_id[this.cat_id.length - 1];
  819. this.pageInfo.curr = 1;
  820. this.parmValue.page = 1;
  821. await this.searchList();
  822. },
  823. },
  824. };
  825. </script>
  826. <style lang="scss" scoped></style>