index.vue 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033
  1. <template>
  2. <div class="goodsOnline pagePadding">
  3. <ex-table
  4. v-loading="loading"
  5. v-if="powers.some((i) => i == '001')"
  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">重置</el-button>
  83. </el-col>
  84. </el-row>
  85. <el-row>
  86. <el-col :span="6" style="width: 310px">
  87. <good-class
  88. :value="parmValue.cat_id"
  89. @handleChange="goods_class_change"
  90. :disabled="false"
  91. :size="searchSize"
  92. :isDetail="false"
  93. :placeholder="'分类'"
  94. />
  95. </el-col>
  96. <el-col :span="6" style="width: 240px; padding: 0 0 0 10px">
  97. <search-terrace
  98. :value="parmValue.platform_code"
  99. :disabled="false"
  100. :size="'mini'"
  101. :isDetail="false"
  102. :is_show="'0'"
  103. :controlDisabled="true"
  104. :placeholder="'所属平台'"
  105. @searchChange="platform_codeChange"
  106. />
  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">刷新</el-button>
  121. </el-col>
  122. </el-row>
  123. <el-row style="padding: 10px 0 0 0">
  124. <el-col :span="3" style="margin-right:10px">
  125. <el-select
  126. style="width:100%"
  127. v-model="parmValue.is_stock"
  128. size="mini"
  129. placeholder="商品类型"
  130. clearable
  131. @change="
  132. pageInfo.curr = 1;
  133. parmValue.page = 1;
  134. searchList();
  135. "
  136. >
  137. <el-option
  138. v-for="opt in isStockOptions"
  139. :key="opt.value"
  140. :value="opt.value"
  141. :label="opt.label"
  142. />
  143. </el-select>
  144. </el-col>
  145. <el-col :span="3" style="right:10px">
  146. <el-select
  147. style="width:100%"
  148. v-model="parmValue.is_compliance"
  149. size="mini"
  150. placeholder="是否合规"
  151. clearable
  152. @change="
  153. pageInfo.curr = 1;
  154. parmValue.page = 1;
  155. searchList();
  156. "
  157. >
  158. <el-option value="0" label="未设置" />
  159. <el-option value="1" label="合规" />
  160. <el-option value="2" label="不合规" />
  161. </el-select>
  162. </el-col>
  163. <el-col :span="3" style="margin-left:10px">
  164. <el-select placeholder="来源" clearable size="mini" style="width:100%" v-model="parmValue.create_source" @change=" pageInfo.curr = 1;
  165. parmValue.page = 1;
  166. searchList();">
  167. <el-option value="0" label="手动创建商品" />
  168. <el-option value="1" label="咨询成交商品" />
  169. </el-select>
  170. </el-col>
  171. <el-col :span="4" style="width: 350;margin-left:10px">
  172. <el-input
  173. :size="searchSize"
  174. v-model="sinput"
  175. :maxlength="40"
  176. @blur="
  177. pageInfo.curr = 1;
  178. parmValue.page = 1;
  179. searchList();
  180. "
  181. placeholder="关键字"
  182. >
  183. <el-select
  184. v-model="select"
  185. slot="prepend"
  186. :size="searchSize"
  187. style="width: 120px"
  188. @change="
  189. pageInfo.curr = 1;
  190. parmValue.page = 1;
  191. searchList();
  192. "
  193. placeholder="关键字类型"
  194. >
  195. <el-option label="商品名称" value="1" />
  196. <el-option label="供应商名称" value="3" />
  197. <el-option label="成本商品编号" value="2" />
  198. <el-option label="上线商品编号" value="8" />
  199. <el-option label="业务企业编号" value="5" />
  200. <el-option label="平台商品编号" value="6" />
  201. <el-option label="成本创建人" value="7" />
  202. <el-option label="上线创建人" value="10" />
  203. <el-option label="上线创建人部门" value="9" />
  204. </el-select>
  205. </el-input>
  206. </el-col>
  207. <el-col
  208. :span="3"
  209. class="fr"
  210. style="width: 66px; padding: 0 0 0 10px"
  211. v-if="powers.some((i) => i == '003') && !isSupertube"
  212. >
  213. <el-button
  214. :size="searchSize"
  215. type="success"
  216. style="float: right"
  217. @click="routeGoto('goodsOnlineAdd', {})"
  218. >添加</el-button>
  219. </el-col>
  220. <el-col
  221. :span="3"
  222. class="fr"
  223. style="width: 66px; padding: 0 0 0 10px"
  224. v-if="powers.some((i) => i == '087')"
  225. >
  226. <el-button
  227. :size="searchSize"
  228. type="primary"
  229. style="float: right"
  230. @click="centerDialogVisible = true"
  231. >导出上线商品</el-button>
  232. </el-col>
  233. </el-row>
  234. </div>
  235. </template>
  236. <template #create_source="{ scope }">
  237. <el-tag size="mini" :type="scope.row.create_source === '1' ? 'warning' : ''">
  238. {{ scope.row.create_source === "1" ? "咨询成交商品" : "手动创建商品" }}
  239. </el-tag>
  240. </template>
  241. <template #good_thumb_img="{ scope }">
  242. <div
  243. v-if="scope.row.good_thumb_img"
  244. style="width: 20px; height: 20px"
  245. class="hover"
  246. v-viewer
  247. >
  248. <img
  249. :src="scope.row.good_thumb_img"
  250. style="display: inline-block; width: 100%; height: 100%"
  251. alt
  252. />
  253. </div>
  254. </template>
  255. <template #is_stock="{ scope }">
  256. <el-tag
  257. size="mini"
  258. >{{ (isStockOptions.find(({value}) => value === String(scope.row.is_stock)) || {}).label}}</el-tag>
  259. </template>
  260. <template #status="{ scope }">
  261. <el-tag
  262. :size="tablebtnSize"
  263. :type="(options8.find((item) => item.id == scope.row.status) || {}).type || ''"
  264. v-text="
  265. (options8.find((item) => item.id == scope.row.status) || {}).name || '--'
  266. "
  267. ></el-tag>
  268. </template>
  269. <template #good_type="{ scope }">
  270. <el-tag
  271. :size="tablebtnSize"
  272. :type="scope.row.good_type == '0' ? 'warning' : ''"
  273. v-text="
  274. (options1.find((item) => item.id == scope.row.good_type) || {}).name || '否'
  275. "
  276. ></el-tag>
  277. </template>
  278. <template #is_compliance="{ scope }">
  279. <el-tag
  280. :size="tablebtnSize"
  281. :type="scope.row.is_compliance == '0' ? 'warning' : ''"
  282. v-text="
  283. (options01.find((item) => item.id == scope.row.is_compliance) || {}).name || '--'
  284. "
  285. ></el-tag>
  286. </template>
  287. <template #operation="{ scope }">
  288. <el-tooltip
  289. v-if="powers.some((i) => i == '007')"
  290. effect="dark"
  291. content="详情"
  292. placement="top"
  293. >
  294. <i
  295. class="el-icon-view tb-icon"
  296. @click="getRouter('goodsOnlineDetail', scope.row.skuCode)"
  297. ></i>
  298. </el-tooltip>
  299. <el-tooltip
  300. v-if="
  301. (powers.some((i) => i == '078') &&
  302. (scope.row.status + '' === '4' || scope.row.status + '' === '5')) && !isSupertube
  303. "
  304. effect="dark"
  305. content="重新发起上线流程"
  306. placement="top"
  307. >
  308. <i class="el-icon-upload tb-icon" @click="get_againonline(scope.row.skuCode)"></i>
  309. </el-tooltip>
  310. <el-tooltip
  311. v-if="(powers.some((i) => i == '079') && scope.row.status !== '5') && !isSupertube"
  312. effect="dark"
  313. content="下线商品"
  314. placement="top"
  315. >
  316. <i class="el-icon-download tb-icon" @click="showDonlineDlg(scope.row.skuCode)"></i>
  317. </el-tooltip>
  318. <el-tooltip
  319. effect="dark"
  320. content="设置是否合规"
  321. placement="top"
  322. v-if="!isSupertube && powers.includes('095')"
  323. >
  324. <i class="el-icon-setting tb-icon" @click="showCompianceModal(scope.row)"></i>
  325. </el-tooltip>
  326. </template>
  327. </ex-table>
  328. <no-auth v-else></no-auth>
  329. <el-dialog title="下线原因" :visible.sync="dialogFormVisible" width="500px">
  330. <el-form
  331. :model="donline_form"
  332. :rules="donline_rules"
  333. ref="donline_Form"
  334. class="demo-ruleForm"
  335. label-width="80px"
  336. >
  337. <el-form-item label="下线原因" prop="offline_reason">
  338. <el-select
  339. style="width: 100%"
  340. v-model="donline_form.offline_reason"
  341. placeholder="请选择下线原因"
  342. >
  343. <el-option
  344. :label="item.result"
  345. :value="item.result_code"
  346. v-for="item in donline_formStOps"
  347. :key="item.result_code"
  348. ></el-option>
  349. </el-select>
  350. </el-form-item>
  351. <el-form-item label="下线备注" prop="offline_remark">
  352. <el-input
  353. v-model="donline_form.offline_remark"
  354. type="textarea"
  355. placeholder="请输入下线备注"
  356. autocomplete="off"
  357. ></el-input>
  358. </el-form-item>
  359. </el-form>
  360. <div slot="footer" class="dialog-footer">
  361. <el-button @click="dialogFormVisible = false">取 消</el-button>
  362. <el-button type="primary" @click="donlineDlg">确 定</el-button>
  363. </div>
  364. </el-dialog>
  365. <el-dialog title="上线商品导出" :visible.sync="centerDialogVisible" width="500px" center>
  366. <el-form
  367. :model="ruleForm"
  368. :rules="rules"
  369. ref="ruleForm"
  370. class="demo-ruleForm"
  371. label-width="80px"
  372. >
  373. <el-form-item prop="start_date" label="日期: ">
  374. <!-- <el-date-picker
  375. value-format="yyyy-MM-dd"
  376. v-model="ruleForm.date"
  377. type="date"
  378. placeholder="请选择"
  379. >
  380. </el-date-picker>-->
  381. <periodDatePicker
  382. :start="ruleForm.start_date"
  383. :end="ruleForm.end_date"
  384. :width="'165px'"
  385. @timeReturned="time"
  386. />
  387. </el-form-item>
  388. <el-form-item label="状态: " prop="status">
  389. <el-select v-model="ruleForm.status" placeholder="请选择">
  390. <el-option label="待上线" value="5"></el-option>
  391. <el-option label="上线成功" value="6"></el-option>
  392. <el-option label="已下线" value="8"></el-option>
  393. </el-select>
  394. </el-form-item>
  395. <el-form-item label="平台id: " prop="platform_id">
  396. <!-- <el-input
  397. v-model="ruleForm.platform_id"
  398. style="width: 300px"
  399. placeholder="请输入"
  400. ></el-input>-->
  401. <search-terrace
  402. :value="ruleForm.platform_id"
  403. :disabled="false"
  404. :isDetail="false"
  405. :is_show="'0'"
  406. :placeholder="'所属平台'"
  407. @searchChange="platform_codesearchChange"
  408. />
  409. </el-form-item>
  410. </el-form>
  411. <span slot="footer" class="dialog-footer">
  412. <el-button @click="centerDialogVisible = false">取 消</el-button>
  413. <el-button type="primary" @click="goodsExport">导 出</el-button>
  414. </span>
  415. </el-dialog>
  416. <!-- 弹窗 新增/修改 -->
  417. <add-edit
  418. :id="modelId"
  419. :show-model="showModel"
  420. :sitem="sitem"
  421. @refresh="searchList"
  422. @cancel="showModel = false"
  423. />
  424. <compiance-modal
  425. :visible.sync="compianceModalVisible"
  426. :sitem="sitem"
  427. @refresh="() => searchList()"
  428. />
  429. </div>
  430. </template>
  431. <script>
  432. import asyncRequest from "@/apis/service/goodStore/goodsOnline";
  433. import mixinPage from "@/mixins/elPaginationHandle";
  434. import { mapGetters } from "vuex";
  435. import urlConfig from "@/apis/url-config";
  436. import resToken from "@/mixins/resToken";
  437. import { listCol, options1, options8, options01 } from "./columns";
  438. import companyHelper from "@/mixins/companyHelper";
  439. import { isStockOptions } from "@/assets/js/statusList";
  440. import CompianceModal from "./components/compiance-modal.vue";
  441. export default {
  442. name: "goodsOnline",
  443. components: { CompianceModal },
  444. mixins: [mixinPage, resToken, companyHelper],
  445. computed: {
  446. //组件SIZE设置
  447. ...mapGetters(["tablebtnSize", "searchSize", "size", "isSupertube"]),
  448. powers() {
  449. const tran =
  450. this.$store.getters.btnList.find(i => i.menu_route == "goodsOnline") ||
  451. {};
  452. const { action } = tran ?? {};
  453. return action ?? [];
  454. }
  455. },
  456. data() {
  457. var validate = (rule, value, callback) => {
  458. if (value == "") {
  459. return callback(new Error("必填项不能为空"));
  460. } else {
  461. callback();
  462. }
  463. };
  464. return {
  465. isStockOptions,
  466. options01,
  467. dialogFormVisible: false,
  468. donline_formStOps: [],
  469. donline_form: {
  470. offline_reason: "",
  471. offline_remark: "",
  472. skuCode: ""
  473. },
  474. donline_rules: {
  475. offline_reason: [
  476. { validator: validate, required: true, trigger: "blur" }
  477. ],
  478. offline_remark: [
  479. { validator: validate, required: true, trigger: "blur" }
  480. ]
  481. },
  482. fileUrl: urlConfig.baseURL,
  483. ruleForm: {
  484. // date: "",
  485. platform_id: "",
  486. status: "",
  487. start_date: "",
  488. end_date: ""
  489. },
  490. rules: {
  491. start_date: [
  492. {
  493. validator: validate,
  494. type: "date",
  495. required: true,
  496. trigger: "change"
  497. }
  498. ],
  499. status: [{ validator: validate, required: true, trigger: "change" }],
  500. platform_id: [
  501. { validator: validate, required: true, trigger: "change" }
  502. ]
  503. },
  504. compianceModalVisible: false,
  505. centerDialogVisible: false,
  506. options1: options1,
  507. options8: options8,
  508. loading: false,
  509. parmValue: {
  510. create_source:"",
  511. is_compliance: "",
  512. is_stock: "",
  513. good_name: "", //商品名称
  514. spucode: "", //商品编号
  515. skucode: "", //商品编号
  516. cat_id: "", //商品分类
  517. start: "", //开始日期
  518. end: "", //结束日期
  519. platform_code: "", //平台编码
  520. is_stock: "", //是否库存品
  521. page: 1, // 页码
  522. size: 15, // 每页显示条数
  523. supplierNo: "", //供应商编号
  524. good_type: "", //是否定制
  525. brand_id: "", //品牌
  526. companyNo: "", //业务企业编号
  527. exam_status: "", //审核状态
  528. plat_code: "", //平台商品编号
  529. creater: "", //
  530. company_name: "" //创建人部门
  531. },
  532. // 表格 - 数据
  533. tableData: [],
  534. // 表格 - 参数
  535. table: {
  536. stripe: true,
  537. border: true,
  538. _defaultHeader_: ["setcol"]
  539. },
  540. // 表格 - 分页
  541. pageInfo: {
  542. size: 15,
  543. curr: 1,
  544. total: 0
  545. },
  546. // 表格 - 列参数
  547. columns: listCol,
  548. cat_id: [],
  549. brandid: [],
  550. select: "1",
  551. sinput: ""
  552. };
  553. },
  554. mounted() {
  555. const { back } = this.$route.query;
  556. if (back) {
  557. this.parmValue = JSON.parse(back);
  558. console.log(this.parmValue);
  559. const { page, size } = this.parmValue;
  560. // this.parmValue.start = start || last_start;
  561. // this.parmValue.end = end || last_end;
  562. if (this.parmValue.brand_id.length > 0) {
  563. this.brandid = [this.parmValue.brand_id];
  564. }
  565. this.pageInfo = {
  566. size: size,
  567. curr: page,
  568. total: 0
  569. };
  570. //多选条件
  571. this.select = this.parmValue.select;
  572. // this.sselect = this.parmValue.sselect;
  573. this.sinput = this.parmValue.sinput;
  574. } else {
  575. this.select = "1";
  576. // this.sselect = "创建时间"
  577. }
  578. this.cat_id = [];
  579. // this.brandid = [];
  580. this.searchList();
  581. },
  582. methods: {
  583. // 获取异常原因下拉列表
  584. async getresultlist() {
  585. const res = await asyncRequest.resultlist({
  586. page: 1,
  587. size: 100,
  588. type: "8",
  589. status: "3"
  590. });
  591. if (res && res.code === 0 && res.data) {
  592. const { list } = res.data;
  593. this.donline_formStOps = list;
  594. } else if (res && res.code >= 100 && res.code <= 104) {
  595. await this.logout();
  596. } else {
  597. this.$message.warning(res.message);
  598. }
  599. },
  600. // 时间函数
  601. async time(e) {
  602. this.ruleForm.start_date = e.startTime || "";
  603. this.ruleForm.end_date = e.endTime || "";
  604. },
  605. platform_codesearchChange(e) {
  606. const { id } = e;
  607. this.ruleForm.platform_id = id || "";
  608. this.$refs.ruleForm.validateField("platform_id");
  609. },
  610. async platform_codeChange(e) {
  611. const { id } = e;
  612. this.parmValue.platform_code = id || "";
  613. this.pageInfo.curr = 1;
  614. this.parmValue.page = 1;
  615. await this.searchList();
  616. },
  617. //导出
  618. async goodsExport() {
  619. if (
  620. (this.ruleForm.start_date !== "" && this.ruleForm.end_date === "") ||
  621. (this.ruleForm.start_date === "" && this.ruleForm.end_date !== "")
  622. ) {
  623. this.$message.warning("时间区间不完整!");
  624. return;
  625. }
  626. // console.log(this.$refs.ruleForm)
  627. // return;
  628. await this.$refs.ruleForm.validate(async valid => {
  629. if (valid) {
  630. if (!this.loading) {
  631. this.loading = true;
  632. let httpType = `aplication/zip`;
  633. axios({
  634. method: "post",
  635. url: this.fileUrl + "admin/exportgood",
  636. responseType: "blob",
  637. data: this.ruleForm,
  638. headers: {
  639. Accept: httpType
  640. }
  641. })
  642. .then(res => {
  643. if (res && res.status == 200 && res.data) {
  644. let url = window.URL.createObjectURL(
  645. new Blob([res.data], {
  646. type: httpType
  647. })
  648. );
  649. let link = document.createElement("a");
  650. link.style.display = "none";
  651. link.href = url;
  652. let excelName = "商品.zip";
  653. link.setAttribute("download", excelName);
  654. document.body.appendChild(link);
  655. link.click();
  656. link.remove();
  657. window.URL.revokeObjectURL(url); //释放掉blob对象
  658. this.$message.success(`导出成功!`);
  659. setTimeout(() => {
  660. this.loading = false;
  661. }, 500);
  662. } else {
  663. this.$message.error(res.data.message);
  664. setTimeout(() => {
  665. this.loading = false;
  666. }, 500);
  667. }
  668. })
  669. .catch(error => {
  670. console.log(error);
  671. this.loading = false;
  672. });
  673. }
  674. // this.loading = true;
  675. // const res = await asyncRequest.exportgood(this.ruleForm);
  676. // if (res && res.code === 0) {
  677. // this.$message.warning(res.message);
  678. // console.log(res);
  679. // this.loading = false;
  680. // } else if (res && res.code >= 100 && res.code <= 104) {
  681. // await this.logout();
  682. // } else {
  683. // this.loading = false;
  684. // this.$message.warning(res.message);
  685. // }
  686. } else {
  687. console.log("error submit!!");
  688. return false;
  689. }
  690. });
  691. },
  692. //点击详情
  693. getRouter(toRouter, queryId) {
  694. if (toRouter && queryId) {
  695. let model = {
  696. id: queryId,
  697. type: "view"
  698. };
  699. //有多选框的条件
  700. this.parmValue.select = this.select;
  701. // this.parmValue.sselect = this.sselect ;
  702. this.parmValue.sinput = this.sinput;
  703. //
  704. console.log(this.parmValue);
  705. let routerModel = {
  706. options: JSON.parse(JSON.stringify(this.parmValue)),
  707. router: this.$route.path
  708. };
  709. model.preModel = JSON.stringify(routerModel);
  710. this.routeGoto(toRouter, model);
  711. } else {
  712. this.$message.warning("暂未找到相关流程!");
  713. }
  714. },
  715. restSearch() {
  716. this.select = "1";
  717. this.sinput = "";
  718. this.cat_id = [];
  719. this.brandid = [];
  720. // 表格 - 分页
  721. this.pageInfo = {
  722. size: 15,
  723. curr: 1,
  724. total: 0
  725. };
  726. this.parmValue = {
  727. create_source:"",
  728. is_compliance: "",
  729. good_name: "", //商品名称
  730. spucode: "", //商品编号
  731. skucode: "", //商品编号
  732. cat_id: "", //商品分类
  733. start: "", //开始日期
  734. end: "", //结束日期
  735. platform_code: "", //平台编码
  736. is_stock: "", //是否库存品
  737. page: 1, // 页码
  738. size: 15, // 每页显示条数
  739. supplierNo: "", //供应商编号
  740. good_type: "", //是否定制
  741. brand_id: "", //品牌
  742. companyNo: "", //业务企业编号
  743. exam_status: "", //审核状态
  744. plat_code: "", //平台商品编号
  745. creater: "", //
  746. company_name: "" //创建人部门
  747. };
  748. this.searchList();
  749. },
  750. //商品品牌选择
  751. async brandidsearchChange(e) {
  752. const { id, code, label } = e;
  753. if (id) {
  754. this.brandid = [id];
  755. this.parmValue.brand_id = id;
  756. this.parmValue.supplierName = label;
  757. } else {
  758. this.brandid = [];
  759. this.parmValue.brand_id = "";
  760. this.parmValue.supplierName = "";
  761. }
  762. this.parmValue.brand_id = this.brandid.toString();
  763. this.pageInfo.curr = 1;
  764. this.parmValue.page = 1;
  765. await this.searchList();
  766. },
  767. // 时间
  768. async handleTime(e) {
  769. this.parmValue.start = e.startTime || "";
  770. this.parmValue.end = e.endTime || "";
  771. if (
  772. (this.parmValue.start !== "" && this.parmValue.end !== "") ||
  773. (this.parmValue.start === "" && this.parmValue.end === "")
  774. ) {
  775. this.pageInfo.curr = 1;
  776. this.parmValue.page = 1;
  777. await this.searchList();
  778. }
  779. },
  780. /**
  781. * 商品重新上线
  782. * @param {String} id id
  783. * @param {String} status 0-禁用 1-启用
  784. */
  785. async get_againonline(skuCode) {
  786. await this.$confirm(`确定要重新发起上线流程?`, {
  787. confirmButtonText: "确定",
  788. cancelButtonText: "取消",
  789. type: "warning"
  790. })
  791. .then(async () => {
  792. this.loading = true;
  793. const model = {
  794. skuCode: skuCode
  795. };
  796. const res = await asyncRequest.againonline(model);
  797. if (res && res.code === 0) {
  798. this.loading = false;
  799. this.$notify.success({
  800. title: "重新发起上线流程成功!",
  801. message: ""
  802. });
  803. await this.searchList();
  804. } else if (res && res.code >= 100 && res.code <= 104) {
  805. await this.logout();
  806. } else {
  807. this.loading = false;
  808. this.$message.warning(res.message);
  809. }
  810. })
  811. .catch(() => {
  812. console.log("取消");
  813. });
  814. },
  815. //点击下线
  816. async showDonlineDlg(skuCode) {
  817. this.dialogFormVisible = true;
  818. this.donline_form = {
  819. offline_reason: "",
  820. offline_remark: "",
  821. skuCode: ""
  822. };
  823. this.donline_form.skuCode = skuCode;
  824. // this.donlineDlg(skuCode)
  825. },
  826. showCompianceModal(row) {
  827. this.compianceModalVisible = true;
  828. this.sitem = row;
  829. },
  830. //商品下线原因 确定
  831. async donlineDlg() {
  832. await this.$refs.donline_Form.validate(async valid => {
  833. if (valid) {
  834. this.dialogFormVisible = false;
  835. this.get_donline(this.donline_form.skuCode);
  836. } else {
  837. console.log("error submit!!");
  838. return false;
  839. }
  840. });
  841. },
  842. /**
  843. * 商品下线
  844. * @param {String} id id
  845. * @param {String} status 0-禁用 1-启用
  846. */
  847. async get_donline(skuCode) {
  848. await this.$confirm(`确定要下线商品?`, {
  849. confirmButtonText: "确定",
  850. cancelButtonText: "取消",
  851. type: "warning"
  852. })
  853. .then(async () => {
  854. this.loading = true;
  855. let obj = {
  856. skuCode: skuCode,
  857. exam_status: "5"
  858. };
  859. let model = { ...this.donline_form, ...obj };
  860. // console.log("aaaaa", model);
  861. const res = await asyncRequest.status(model);
  862. if (res && res.code === 0) {
  863. this.loading = false;
  864. this.$notify.success({
  865. title: res.message,
  866. message: ""
  867. });
  868. await this.searchList();
  869. } else if (res && res.code >= 100 && res.code <= 104) {
  870. await this.logout();
  871. } else {
  872. this.loading = false;
  873. this.$message.warning(res.message);
  874. }
  875. })
  876. .catch(() => {
  877. console.log("取消");
  878. });
  879. },
  880. /**
  881. * 启用/禁用
  882. * @param {String} id id
  883. * @param {String} status 0-禁用 1-启用
  884. */
  885. async changeStatus(id, status) {
  886. await this.$confirm(
  887. `确定要改为${status + "" === "1" ? "禁用" : "启用"}?`,
  888. {
  889. confirmButtonText: "确定",
  890. cancelButtonText: "取消",
  891. type: "warning"
  892. }
  893. )
  894. .then(async () => {
  895. this.loading = true;
  896. const model = {
  897. id: id,
  898. status: status + "" === "1" ? "0" : "1"
  899. };
  900. const res = await asyncRequest.status(model);
  901. if (res && res.code === 0) {
  902. this.loading = false;
  903. this.$notify.success({
  904. title: "状态修改成功!",
  905. message: ""
  906. });
  907. await this.searchList();
  908. } else if (res && res.code >= 100 && res.code <= 104) {
  909. await this.logout();
  910. } else {
  911. this.loading = false;
  912. this.$message.warning(res.message);
  913. }
  914. })
  915. .catch(() => {
  916. console.log("取消");
  917. });
  918. },
  919. async deleteItem(code) {
  920. await this.$confirm("确定要删除?", {
  921. confirmButtonText: "确定",
  922. cancelButtonText: "取消",
  923. type: "warning"
  924. })
  925. .then(async () => {
  926. const model = {
  927. codes: [code]
  928. };
  929. const res = await asyncRequest.delete(model);
  930. if (res && res.code === 0) {
  931. this.$notify.success({
  932. title: "删除成功",
  933. message: ""
  934. });
  935. this.searchList();
  936. } else if (res && res.code >= 100 && res.code <= 104) {
  937. await this.logout();
  938. } else {
  939. this.$message.warning(res.message);
  940. }
  941. })
  942. .catch(() => {
  943. console.log("取消");
  944. });
  945. },
  946. // 刷新表格
  947. async searchList() {
  948. if (
  949. (this.parmValue.start !== "" && this.parmValue.end === "") ||
  950. (this.parmValue.start === "" && this.parmValue.end !== "")
  951. ) {
  952. this.$message.warning("时间区间不完整!");
  953. return;
  954. }
  955. this.loading = true;
  956. let model = JSON.parse(JSON.stringify(this.parmValue));
  957. model.companyNo = this.currentCompany || "";
  958. model.good_name = this.select === "1" ? this.sinput : ""; //商品名称
  959. model.supplier_name = this.select === "3" ? this.sinput : "";
  960. model.spucode = this.select === "2" ? this.sinput : ""; //商品编号
  961. model.skucode = this.select === "8" ? this.sinput : ""; //商品编号
  962. // model.platform_code = this.select === "1" ? this.sinput : ""; //平台编码
  963. // model.supplierNo = this.select === "1" ? this.sinput : ""; //供应商编号
  964. // model.companyNo = this.select === "5" ? this.sinput : ""; //业务企业编号
  965. // model.exam_status = this.select === "1" ? this.sinput : ""; //审核状态
  966. model.plat_code = this.select === "6" ? this.sinput : ""; //平台商品编号
  967. model.creater = this.select === "7" ? this.sinput : ""; //
  968. model.company_name = this.select === "9" ? this.sinput : ""; // 部门
  969. model.online_creater = this.select === "10" ? this.sinput : ""; // 上线创建人
  970. const res = await asyncRequest.list(model);
  971. if (res && res.code === 0 && res.data) {
  972. this.tableData = res.data.list;
  973. this.tableData.forEach(a => {
  974. a.cat_name = "";
  975. let list = a.cat_info || [];
  976. list.forEach((b, i) => {
  977. a.cat_name += i == 0 ? b.name : "/" + b.name;
  978. });
  979. });
  980. this.pageInfo.total = Number(res.data.count);
  981. } else if (res && res.code >= 100 && res.code <= 104) {
  982. await this.logout();
  983. } else {
  984. this.tableData = [];
  985. this.pageInfo.total = 0;
  986. }
  987. this.getresultlist();
  988. this.loading = false;
  989. },
  990. //商品分类选择
  991. async goods_class_change(e) {
  992. this.cat_id = e;
  993. this.parmValue.cat_id =
  994. this.cat_id.length === 0 ? "" : this.cat_id[this.cat_id.length - 1];
  995. this.pageInfo.curr = 1;
  996. this.parmValue.page = 1;
  997. await this.searchList();
  998. }
  999. }
  1000. };
  1001. </script>
  1002. <style lang="scss" scoped></style>