main.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599
  1. <template>
  2. <div class="showGoodsDataTable" v-loading="loading">
  3. <show-data-table
  4. v-if="
  5. (type === '1' || type === '2' || type === '5' || type === '6') &&
  6. this.sitem &&
  7. this.sitem.addtime &&
  8. !iscgd
  9. "
  10. :sitem="sitem"
  11. :columns="onlineColumns"
  12. :border="border"
  13. >
  14. <template slot="good_name">
  15. <img
  16. v-viewer
  17. style="width: 23px; height: 23px; margin: 0 5px 0 0"
  18. class="fl"
  19. v-if="sitem.good_thumb_img"
  20. :src="sitem.good_thumb_img"
  21. alt=""
  22. />
  23. <span>{{ sitem.good_name }}</span>
  24. <span v-for="(si, i) in sitem.speclist" :key="si.spec_id + i">
  25. <span v-if="i !== 0">-</span>
  26. <span v-else>_</span>
  27. <span>{{ si.spec_name }}[{{ si.spec_value }}]</span>
  28. </span>
  29. <el-popover placement="top" width="300" trigger="hover">
  30. <ul>
  31. <li>
  32. <span>上线商品编号:</span><span>{{ sitem.skuCode }}</span>
  33. </li>
  34. <li
  35. v-if="
  36. newTime !== '' &&
  37. private_field &&
  38. private_field.length > 0 &&
  39. private_field.some((item) => item == '1')
  40. "
  41. >
  42. <span>商品成本编号:</span><span>{{ sitem.spuCode }}</span>
  43. </li>
  44. <li>
  45. <span>平台商品编码:</span
  46. ><span>{{ sitem.platform_code_en }}</span>
  47. </li>
  48. </ul>
  49. <i class="el-icon-warning-outline fr" slot="reference"></i>
  50. </el-popover>
  51. </template>
  52. <template slot="good_img">
  53. <img
  54. class="fl"
  55. style="width: 23px; height: 23px; margin: 0 5px 0 0"
  56. v-viewer
  57. v-for="(si, i) in sitem.good_img"
  58. :src="si"
  59. :key="si + i"
  60. />
  61. </template>
  62. <template slot="good_info_img">
  63. <img
  64. class="fl"
  65. style="width: 23px; height: 23px; margin: 0 5px 0 0"
  66. v-viewer
  67. v-for="(si, i) in sitem.good_info_img"
  68. :src="si"
  69. :key="si + i"
  70. />
  71. </template>
  72. <template slot="company">
  73. <span>{{ sitem.company }}</span>
  74. <el-popover placement="top" width="300" trigger="hover">
  75. <ul>
  76. <li>
  77. <span>业务企业编号:</span><span>{{ sitem.companyNo }}</span>
  78. </li>
  79. </ul>
  80. <i class="el-icon-warning-outline fr" slot="reference"></i>
  81. </el-popover>
  82. </template>
  83. <template slot="exclusive">
  84. <span v-for="(si, sii) in sitem.exclusive" :key="si.id">
  85. <span v-if="sii !== 0">/</span> <span>{{ si.name }}</span>
  86. </span>
  87. </template>
  88. <template slot="supply_area">
  89. <el-tag
  90. :size="'mini'"
  91. v-text="
  92. (options6.find((item) => item.id == sitem.supply_area) || {})
  93. .name || '--'
  94. "
  95. />
  96. </template>
  97. <template slot="is_stock">
  98. <el-tag
  99. :size="'mini'"
  100. v-text="
  101. (options4.find((item) => item.id == sitem.is_stock) || {}).name ||
  102. '--'
  103. "
  104. />
  105. </template>
  106. <template slot="good_type">
  107. <el-tag
  108. :size="'mini'"
  109. v-text="
  110. (options1.find((item) => item.id == sitem.good_type) || {}).name ||
  111. '--'
  112. "
  113. />
  114. <span v-if="sitem.good_type === '1'" style="padding: 0 0 0 5px"
  115. >{{ sitem.moq }}起订/工期{{ sitem.customized }}天</span
  116. >
  117. </template>
  118. <template slot="noble">
  119. <span v-if="sitem.noble_metal"
  120. >{{ sitem.noble_weight ? sitem.noble_weight : "0" }}g-{{
  121. sitem.noble_name
  122. }}-{{ sitem.gold_price ? sitem.gold_price : "0" }}元/g-{{
  123. sitem.is_gold_price === "0" ? "不" : ""
  124. }}启用实时金价-{{ sitem.is_diff === "1" ? "有" : "无" }}工差-{{
  125. sitem.config
  126. }}-{{ sitem.other_config }}</span
  127. >
  128. </template>
  129. </show-data-table>
  130. <show-data-table
  131. v-else-if="
  132. (type === '1' || type === '2' || type === '5' || type === '6') &&
  133. this.sitem &&
  134. this.sitem.addtime &&
  135. iscgd
  136. "
  137. :sitem="sitem"
  138. :columns="costColumns"
  139. :border="border"
  140. >
  141. <template slot="good_name">
  142. <img
  143. v-viewer
  144. style="width: 23px; height: 23px; margin: 0 5px 0 0"
  145. class="fl"
  146. v-if="sitem.good_thumb_img"
  147. :src="sitem.good_thumb_img"
  148. alt=""
  149. />
  150. <span>{{ sitem.good_name }}</span>
  151. <span v-for="(si, i) in sitem.speclist" :key="si.spec_id + i">
  152. <span v-if="i !== 0">-</span>
  153. <span v-else>_</span>
  154. <span>{{ si.spec_name }}[{{ si.spec_value }}]</span>
  155. </span>
  156. <el-popover placement="top" width="300" trigger="hover">
  157. <ul>
  158. <li>
  159. <span>商品成本编号:</span><span>{{ sitem.spuCode }}</span>
  160. </li>
  161. </ul>
  162. <i class="el-icon-warning-outline fr" slot="reference"></i>
  163. </el-popover>
  164. </template>
  165. <template slot="good_img">
  166. <img
  167. class="fl"
  168. style="width: 23px; height: 23px; margin: 0 5px 0 0"
  169. v-viewer
  170. v-for="(si, i) in sitem.good_img"
  171. :src="si"
  172. :key="si + i"
  173. />
  174. </template>
  175. <template slot="good_info_img">
  176. <img
  177. class="fl"
  178. style="width: 23px; height: 23px; margin: 0 5px 0 0"
  179. v-viewer
  180. v-for="(si, i) in sitem.good_info_img"
  181. :src="si"
  182. :key="si + i"
  183. />
  184. </template>
  185. <template slot="company">
  186. <span>{{ sitem.company }}</span>
  187. <el-popover placement="top" width="300" trigger="hover">
  188. <ul>
  189. <li>
  190. <span>业务企业编号:</span><span>{{ sitem.companyNo }}</span>
  191. </li>
  192. </ul>
  193. <i class="el-icon-warning-outline fr" slot="reference"></i>
  194. </el-popover>
  195. </template>
  196. <template slot="supplierName">
  197. <span>{{ sitem.supplierName }}</span>
  198. <el-popover placement="top" width="300" trigger="hover">
  199. <ul>
  200. <li>
  201. <span>供应商编号:</span><span>{{ sitem.supplierNo }}</span>
  202. </li>
  203. </ul>
  204. <i class="el-icon-warning-outline fr" slot="reference"></i>
  205. </el-popover>
  206. </template>
  207. <template slot="exclusive">
  208. <span v-for="(si, sii) in sitem.exclusive" :key="si.id">
  209. <span v-if="sii !== 0">/</span> <span>{{ si.name }}</span>
  210. </span>
  211. </template>
  212. <template slot="supply_area">
  213. <el-tag
  214. :size="'mini'"
  215. v-text="
  216. (options6.find((item) => item.id == sitem.supply_area) || {})
  217. .name || '--'
  218. "
  219. />
  220. </template>
  221. <template slot="is_stock">
  222. <el-tag
  223. :size="'mini'"
  224. v-text="
  225. (options4.find((item) => item.id == sitem.is_stock) || {}).name ||
  226. '--'
  227. "
  228. />
  229. </template>
  230. <template slot="is_auth">
  231. <el-tag
  232. :size="'mini'"
  233. v-text="
  234. (options3.find((item) => item.id == sitem.is_auth) || {}).name ||
  235. '--'
  236. "
  237. />
  238. </template>
  239. <template slot="good_type">
  240. <el-tag
  241. :size="'mini'"
  242. v-text="
  243. (options1.find((item) => item.id == sitem.good_type) || {}).name ||
  244. '--'
  245. "
  246. />
  247. <span v-if="sitem.good_type === '1'" style="padding: 0 0 0 5px"
  248. >{{ sitem.moq }}起订/工期{{ sitem.customized }}天</span
  249. >
  250. </template>
  251. <template slot="noble">
  252. <span v-if="sitem.noble_metal"
  253. >{{ sitem.noble_weight ? sitem.noble_weight : "0" }}g-{{
  254. sitem.noble_name
  255. }}-{{ sitem.gold_price ? sitem.gold_price : "0" }}元/g-{{
  256. sitem.is_gold_price === "0" ? "不" : ""
  257. }}启用实时金价-{{ sitem.is_diff === "1" ? "有" : "无" }}工差-{{
  258. sitem.config
  259. }}-{{ sitem.other_config }}</span
  260. >
  261. </template>
  262. </show-data-table>
  263. <show-data-table
  264. v-else-if="
  265. (type === '3' || type === '4') &&
  266. this.sitem &&
  267. this.sitem.addtime &&
  268. !iscgd
  269. "
  270. :sitem="sitem"
  271. :columns="reColumns"
  272. :border="border"
  273. >
  274. <template slot="good_name">
  275. <!-- <img
  276. v-viewer
  277. style="width: 23px; height: 23px; margin: 0 5px 0 0"
  278. class="fl"
  279. v-if="sitem.good_img"
  280. :src="sitem.good_img"
  281. alt=""
  282. /> -->
  283. <span>{{ sitem.good_name }}</span>
  284. <span v-for="(si, i) in sitem.specinfo" :key="si.spec_id + i">
  285. <span v-if="i !== 0">-</span>
  286. <span v-else>_</span>
  287. <span>{{ si.spec_name }}[{{ si.spec_value_name }}]</span>
  288. </span>
  289. <el-popover placement="top" width="300" trigger="hover">
  290. <ul>
  291. <li>
  292. <span>商品编号:</span><span>{{ sitem.spuCode }}</span>
  293. </li>
  294. </ul>
  295. <i class="el-icon-warning-outline fr" slot="reference"></i>
  296. </el-popover>
  297. </template>
  298. <template slot="send_way">
  299. <span>{{ sitem.send_way === "1" ? "供应商包邮" : "公司自提" }}</span>
  300. </template>
  301. <template slot="good_type">
  302. <el-tag
  303. :size="'mini'"
  304. v-text="
  305. (options1.find((item) => item.id == sitem.good_type) || {}).name ||
  306. '--'
  307. "
  308. />
  309. <span v-if="sitem.good_type === '1'" style="padding: 0 0 0 5px"
  310. >{{ sitem.moq }}起订/工期{{ sitem.customized }}天</span
  311. >
  312. </template>
  313. <template slot="supply_area">
  314. <el-tag
  315. :size="'mini'"
  316. v-text="
  317. (options6.find((item) => item.id === sitem.supply_area) || {})
  318. .name || '--'
  319. "
  320. ></el-tag>
  321. </template>
  322. <template slot="pay_way">
  323. <el-tag
  324. :size="'mini'"
  325. v-text="
  326. (options9.find((item) => item.id == sitem.pay_way) || {}).name ||
  327. '--'
  328. "
  329. />
  330. </template>
  331. <template slot="noble">
  332. <span v-if="sitem.noble_name"
  333. >{{ sitem.noble_weight ? sitem.noble_weight : "0" }}g-{{
  334. sitem.noble_name
  335. }}-{{ sitem.gold_price ? sitem.gold_price : "0" }}元/g-{{
  336. sitem.is_gold_price === "0" ? "不" : ""
  337. }}启用实时金价-{{ sitem.is_diff === "1" ? "有" : "无" }}工差-{{
  338. sitem.config
  339. }}-{{ sitem.other_config }}</span
  340. >
  341. <span v-else>--</span>
  342. </template>
  343. <template slot="good_img">
  344. <img
  345. v-viewer
  346. style="width: 23px; height: 23px; margin: 0 5px 0 0"
  347. class="fl"
  348. v-for="(si, sii) in sitem.good_img"
  349. :key="si + sii"
  350. :src="si"
  351. alt=""
  352. />
  353. </template>
  354. </show-data-table>
  355. <show-data-table
  356. v-else-if="
  357. (type === '3' || type === '4') &&
  358. this.sitem &&
  359. this.sitem.addtime &&
  360. iscgd
  361. "
  362. :sitem="sitem"
  363. :columns="coveColumns"
  364. :border="border"
  365. >
  366. <template slot="good_name">
  367. <span>{{ sitem.good_name }}</span>
  368. <span v-for="(si, i) in sitem.specinfo" :key="si.spec_id + i">
  369. <span v-if="i !== 0">-</span>
  370. <span v-else>_</span>
  371. <span>{{ si.spec_name }}[{{ si.spec_value_name }}]</span>
  372. </span>
  373. <el-popover placement="top" width="300" trigger="hover">
  374. <ul>
  375. <li>
  376. <span>商品编号:</span><span>{{ sitem.spuCode }}</span>
  377. </li>
  378. </ul>
  379. <i class="el-icon-warning-outline fr" slot="reference"></i>
  380. </el-popover>
  381. </template>
  382. <template slot="send_way">
  383. <span>{{ sitem.send_way === "1" ? "供应商包邮" : "公司自提" }}</span>
  384. </template>
  385. <template slot="good_type">
  386. <el-tag
  387. :size="'mini'"
  388. v-text="
  389. (options1.find((item) => item.id == sitem.good_type) || {}).name ||
  390. '--'
  391. "
  392. />
  393. <span v-if="sitem.good_type === '1'" style="padding: 0 0 0 5px"
  394. >{{ sitem.moq }}起订/工期{{ sitem.customized }}天</span
  395. >
  396. </template>
  397. <template slot="supply_area">
  398. <el-tag
  399. :size="'mini'"
  400. v-text="
  401. (options6.find((item) => item.id === sitem.supply_area) || {})
  402. .name || '--'
  403. "
  404. ></el-tag>
  405. </template>
  406. <template slot="pay_way">
  407. <el-tag
  408. :size="'mini'"
  409. v-text="
  410. (options9.find((item) => item.id == sitem.pay_way) || {}).name ||
  411. '--'
  412. "
  413. />
  414. </template>
  415. <template slot="noble">
  416. <span v-if="sitem.noble_name"
  417. >{{ sitem.noble_weight ? sitem.noble_weight : "0" }}g-{{
  418. sitem.noble_name
  419. }}-{{ sitem.gold_price ? sitem.gold_price : "0" }}元/g-{{
  420. sitem.is_gold_price === "0" ? "不" : ""
  421. }}启用实时金价-{{ sitem.is_diff === "1" ? "有" : "无" }}工差-{{
  422. sitem.config
  423. }}-{{ sitem.other_config }}</span
  424. >
  425. <span v-else>--</span>
  426. </template>
  427. <template slot="good_img">
  428. <img
  429. v-viewer
  430. style="width: 23px; height: 23px; margin: 0 5px 0 0"
  431. class="fl"
  432. v-for="(si, sii) in sitem.good_img"
  433. :key="si + sii"
  434. :src="si"
  435. alt=""
  436. />
  437. </template>
  438. </show-data-table>
  439. <div v-else>商品编号有误</div>
  440. </div>
  441. </template>
  442. <script>
  443. import asyncRequest from "@/apis/components/show-goods-data-table";
  444. import {
  445. onlineColumns,
  446. reColumns,
  447. costColumns,
  448. coveColumns,
  449. options1,
  450. options2,
  451. options3,
  452. options4,
  453. options5,
  454. options6,
  455. options7,
  456. options8,
  457. options9,
  458. options10,
  459. options11,
  460. options12,
  461. } from "./ShowDataTableColumns";
  462. export default {
  463. name: "showGoodsDataTable",
  464. props: {
  465. newTime: {
  466. type: String,
  467. default: "",
  468. },
  469. type: {
  470. type: String,
  471. default: "",
  472. },
  473. skucode: {
  474. type: String,
  475. default: "",
  476. },
  477. iscgd: {
  478. type: Boolean,
  479. default: false,
  480. },
  481. spucode: {
  482. type: String,
  483. default: "",
  484. },
  485. border: {
  486. type: Boolean,
  487. default: false,
  488. },
  489. },
  490. computed: {},
  491. data() {
  492. return {
  493. loading: true,
  494. sitem: {},
  495. options1,
  496. options2,
  497. options3,
  498. options4,
  499. options5,
  500. options6,
  501. options7,
  502. options8,
  503. options9,
  504. options10,
  505. options11,
  506. options12,
  507. onlineColumns,
  508. reColumns,
  509. costColumns,
  510. coveColumns,
  511. };
  512. },
  513. watch: {
  514. newTime: function (val) {
  515. if (val) {
  516. this.initForm();
  517. }
  518. },
  519. },
  520. mounted() {
  521. this.initForm();
  522. },
  523. methods: {
  524. async initForm() {
  525. console.log(
  526. `${this.type}---${this.skucode}---${this.spucode}---${this.iscgd}`
  527. );
  528. this.columns = [];
  529. this.loading = true;
  530. if (this.type) {
  531. let res = {};
  532. if (
  533. this.type === "1" ||
  534. this.type === "2" ||
  535. this.type === "5" ||
  536. this.type === "6"
  537. ) {
  538. if (this.iscgd) {
  539. res = await asyncRequest.cost_detail({
  540. spuCode: this.spucode,
  541. });
  542. } else {
  543. res = await asyncRequest.online_detail({
  544. skuCode: this.skucode,
  545. });
  546. }
  547. } else {
  548. if (this.iscgd) {
  549. res = await asyncRequest.cove_detail({
  550. spuCode: this.spucode,
  551. });
  552. } else {
  553. res = await asyncRequest.re_detail({
  554. spuCode: this.spucode,
  555. });
  556. }
  557. }
  558. const { code, message, data } = res;
  559. this.loading = false;
  560. if (code === 0) {
  561. this.sitem = JSON.parse(JSON.stringify(data));
  562. const { cat_info } = this.sitem;
  563. let cat = "";
  564. if (cat_info && cat_info.length > 0) {
  565. cat_info.forEach((e, i) => {
  566. cat += i === 0 ? e.name : "_" + e.name;
  567. });
  568. }
  569. this.sitem.cat = cat;
  570. //线上商品字段转换
  571. if (this.sitem && this.sitem.good_img) {
  572. this.sitem.good_img = this.sitem.good_img.split(",");
  573. }
  574. if (this.sitem && this.sitem.good_info_img) {
  575. this.sitem.good_info_img = this.sitem.good_info_img.split(",");
  576. }
  577. } else if (code >= 100 && code <= 104) {
  578. await this.logout();
  579. } else {
  580. this.$message.warning(message);
  581. }
  582. }
  583. },
  584. },
  585. };
  586. </script>
  587. <style lang="scss" scoped>
  588. </style>