detail.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. <template>
  2. <div class="othgoodsOnlineDetail">
  3. <div class="othgoodsOnlineDetail-main" v-if="powers.some((i) => i == '007')">
  4. <el-tabs v-model="activeTabs">
  5. <el-tab-pane label="商品上线详情" name="1" v-if="queryType !== 'add'">
  6. <el-collapse v-model="activeNames" style="margin: -18px 0 0 0">
  7. <el-collapse-item title="商品上线详情" name="0">
  8. <show-data-table
  9. :newTime="newTime"
  10. v-if="newTime !== ''"
  11. :sitem="sitem"
  12. :columns="public_listCol"
  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><span>{{ sitem.plat_code }}</span>
  46. </li>
  47. </ul>
  48. <i class="el-icon-warning-outline fr" slot="reference"></i>
  49. </el-popover>
  50. </template>
  51. <template slot="company">
  52. <span>{{ sitem.company }}</span>
  53. <el-popover placement="top" width="300" trigger="hover">
  54. <ul>
  55. <li>
  56. <span>业务企业编号:</span><span>{{ sitem.companyNo }}</span>
  57. </li>
  58. </ul>
  59. <i class="el-icon-warning-outline fr" slot="reference"></i>
  60. </el-popover>
  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="exclusive">
  73. <span v-for="(si, sii) in sitem.exclusive" :key="si.id">
  74. <span v-if="sii !== 0">/</span> <span>{{ si.name }}</span>
  75. </span>
  76. </template>
  77. <template slot="supply_area">
  78. <el-tag
  79. :size="'mini'"
  80. v-text="
  81. (options6.find((item) => item.id == sitem.supply_area) || {})
  82. .name || '--'
  83. "
  84. />
  85. </template>
  86. <template slot="is_stock">
  87. <el-tag
  88. :size="'mini'"
  89. v-text="
  90. (options4.find((item) => item.id == sitem.is_stock) || {}).name ||
  91. '--'
  92. "
  93. />
  94. </template>
  95. <template slot="exam_status">
  96. <el-tag
  97. :size="'mini'"
  98. v-text="
  99. (options8.find((item) => item.id == sitem.exam_status) || {})
  100. .name || '--'
  101. "
  102. />
  103. </template>
  104. <template slot="good_type">
  105. <el-tag
  106. :size="'mini'"
  107. v-text="
  108. (options1.find((item) => item.id == sitem.good_type) || {}).name ||
  109. '--'
  110. "
  111. />
  112. <span v-if="String(sitem.good_type) === '1'" style="padding: 0 0 0 5px"
  113. >{{ sitem.moq }}起订/工期{{ sitem.customized }}天</span
  114. >
  115. </template>
  116. <template slot="noble">
  117. <span v-if="sitem.noble_metal"
  118. >{{ sitem.noble_weight ? sitem.noble_weight : "0" }}g-{{
  119. sitem.noble_name
  120. }}-{{ sitem.gold_price ? sitem.gold_price : "0" }}元/g-{{
  121. String(sitem.is_gold_price) === "0" ? "不" : ""
  122. }}启用实时金价-{{ String(sitem.is_diff) === "1" ? "有" : "无" }}工差-{{
  123. sitem.config
  124. }}-{{ sitem.other_config }}</span
  125. >
  126. </template>
  127. </show-data-table>
  128. <show-data-table
  129. :newTime="newTime"
  130. v-if="
  131. newTime !== '' &&
  132. private_field &&
  133. private_field.length > 0 &&
  134. private_field.some((item) => item == '2') &&
  135. nakelist &&
  136. nakelist.length > 0 &&
  137. status + '' !== '0'
  138. "
  139. :sitem="sitem"
  140. :columns="sale_listCol"
  141. >
  142. <template slot="yz_cat_info">
  143. <span v-for="(si, sii) in sitem.yz_cat_info" :key="si.yz_cat_id">
  144. <span v-if="sii !== 0">/</span> <span>{{ si.yz_cat_name }}</span>
  145. </span>
  146. </template>
  147. <template slot="is_support_barter">
  148. <el-tag
  149. :size="'mini'"
  150. v-text="
  151. (
  152. is_support_barter_list.find(
  153. (item) => item.value == sitem.is_support_barter
  154. ) || {}
  155. ).label || '--'
  156. "
  157. />
  158. </template>
  159. <template slot="nakelist">
  160. <el-table
  161. :data="nakelist"
  162. :size="'mini'"
  163. border
  164. stripe
  165. style="width: 99%; margin: 10px 10px 10px 0"
  166. >
  167. <el-table-column label="系统阶梯" width="80px">
  168. <template slot-scope="scope">
  169. <i
  170. v-if="scope.row.min_num + '' === '1'"
  171. class="el-icon-check"
  172. style="color: #1890ff; font-size: 16px; font-weight: bolder"
  173. />
  174. </template>
  175. </el-table-column>
  176. <el-table-column prop="min_num" label="采购起订量" />
  177. <el-table-column label="销售">
  178. <el-table-column prop="start_sale_num" label="起订量">
  179. <template slot-scope="scope">
  180. <span v-if="sitem.good_ladder_id + '' === scope.row.id + ''">
  181. {{ sitem.start_sale_num }}
  182. </span>
  183. </template>
  184. </el-table-column>
  185. <el-table-column prop="sale_good_price" label="系统售价" />
  186. <el-table-column prop="sale_cost_fee" label="系统工艺费" />
  187. <el-table-column prop="final_price" label="最终售价">
  188. <template slot-scope="scope">
  189. <span v-if="sitem.good_ladder_id + '' === scope.row.id + ''">
  190. {{ sitem.final_price }}
  191. </span>
  192. </template></el-table-column
  193. >
  194. </el-table-column>
  195. </el-table>
  196. </template>
  197. </show-data-table>
  198. </el-collapse-item>
  199. </el-collapse>
  200. </el-tab-pane>
  201. <el-tab-pane label="审批记录" name="2">
  202. <process-time-line
  203. v-if="newTime !== ''"
  204. :newTime="newTime"
  205. :type="'YZSX'"
  206. :orderCode="queryId"
  207. /></el-tab-pane>
  208. <el-tab-pane label="流程图" name="3">
  209. <flow-chart process_id="19" type="YZSX" :orderCode="queryId" />
  210. </el-tab-pane>
  211. </el-tabs>
  212. </div>
  213. <div v-else>
  214. <no-auth></no-auth>
  215. </div>
  216. </div>
  217. </template>
  218. <script>
  219. import asyncRequest from "@/apis/service/youzan/othgoodsOnline";
  220. import resToken from "@/mixins/resToken";
  221. import { mapGetters } from "vuex";
  222. import onlineExamForm from "./components/online-exam-form";
  223. import {
  224. options1,
  225. options2,
  226. options3,
  227. options4,
  228. options5,
  229. options6,
  230. options7,
  231. options8,
  232. public_listCol,
  233. sale_listCol,
  234. is_support_barter_list,
  235. } from "./columns";
  236. import { isArray } from "@/utils/validate";
  237. export default {
  238. name: "othgoodsOnlineDetail",
  239. mixins: [resToken],
  240. components: {
  241. onlineExamForm,
  242. },
  243. computed: {
  244. ...mapGetters(["tablebtnSize", "searchSize", "size", "private_field"]),
  245. powers() {
  246. const tran =
  247. this.$store.getters.btnList.find(
  248. (item) => item.menu_route == "othLiveGoodsDetail"
  249. ) || {};
  250. const { action } = tran ?? {};
  251. return action ?? [];
  252. }
  253. },
  254. data() {
  255. return {
  256. platform_id: "",
  257. public_listCol,
  258. sale_listCol,
  259. is_support_barter_list,
  260. options1,
  261. options2,
  262. options3,
  263. options4,
  264. options5,
  265. options6,
  266. options7,
  267. options8,
  268. ladderlist: [],
  269. nakelist: [],
  270. spuCode: "",
  271. size: "small",
  272. activeTabs: "1",
  273. activeNames: ["0", "1", "2", "3", "4", "5", "6", "7"],
  274. newTime: "",
  275. loading: false,
  276. queryType: "",
  277. queryId: "",
  278. status: "",
  279. sitem: null,
  280. };
  281. },
  282. mounted() {
  283. this.initForm();
  284. },
  285. methods: {
  286. async initForm() {
  287. const { id, type } = this.$route.query;
  288. this.queryId = id;
  289. this.queryType = type;
  290. this.activeTabs = type === "add" ? "0" : "1";
  291. this.loading = true;
  292. if (this.queryType === "add") {
  293. this.sitem = {};
  294. this.getNewTime();
  295. } else {
  296. await this.initData();
  297. }
  298. this.loading = false;
  299. },
  300. // 点击业务审核的按钮
  301. async examForm(e) {
  302. console.log(e);
  303. if (!this.loading) {
  304. let model = {
  305. skuCode: this.queryId,
  306. exam_status: e.numStatus,
  307. online_time: e.online_time,
  308. remark: e.remark,
  309. };
  310. if ((e.numStatus ?? "") == "") {
  311. //驳回重新审核
  312. await this.setstatus("提交产品部门审核结果", model);
  313. } else if (e.numStatus == "3") {
  314. //点击保存
  315. // return;
  316. await this.setstatus("提交产品部门审核结果", model);
  317. } else {
  318. //驳回下线
  319. await this.setstatus("驳回下线吗", model);
  320. }
  321. }
  322. },
  323. // 点击财务定价的驳回按钮
  324. async examForm1(e) {
  325. if ((e.numStatus ?? "") == "") {
  326. if (!this.loading) {
  327. let model = {
  328. skuCode: this.queryId,
  329. exam_status: e.numStatus,
  330. remark: e.remark,
  331. };
  332. await this.setstatus("驳回重新审核吗", model);
  333. }
  334. } else {
  335. // return;
  336. if (!this.loading) {
  337. let model = {
  338. skuCode: this.queryId,
  339. exam_status: e.numStatus,
  340. remark: e.remark,
  341. };
  342. await this.setstatus("驳回下线吗", model);
  343. }
  344. }
  345. },
  346. // 财务审核的保存按钮
  347. async examForm2(e) {
  348. console.log(e);
  349. if (!this.loading) {
  350. let model = {
  351. skuCode: this.queryId,
  352. exam_status: e.numStatus,
  353. remark: e.remark,
  354. };
  355. if ((e.numStatus ?? "") == "") {
  356. //驳回重新审核
  357. await this.setstatus("驳回重新审核吗", model);
  358. } else if (e.numStatus == "5") {
  359. //点击保存
  360. // return;
  361. await this.setstatus("提交财务审核结果", model);
  362. } else {
  363. //驳回下线
  364. await this.setstatus("驳回下线吗", model);
  365. }
  366. }
  367. },
  368. // 操作上线的保存按钮
  369. async examForm3(e) {
  370. console.log(e);
  371. if (!this.loading) {
  372. let model = {
  373. skuCode: this.queryId,
  374. exam_status: e.numStatus,
  375. plat_code: e.plat_code,
  376. remark: e.remark || "",
  377. };
  378. if ((e.numStatus ?? "") == "") {
  379. //驳回重新审核
  380. await this.setstatus("驳回重新审核吗", model);
  381. } else if (e.numStatus == "6") {
  382. //点击保存
  383. // return;
  384. await this.setstatus("提交商品上线结果", model);
  385. } else {
  386. //驳回下线
  387. await this.setstatus("驳回下线吗", model);
  388. }
  389. }
  390. },
  391. async setstatus(detail, model) {
  392. await this.$confirm(`确定要${detail}?`, {
  393. confirmButtonText: "确定",
  394. cancelButtonText: "取消",
  395. type: "warning",
  396. })
  397. .then(async () => {
  398. let res = null;
  399. if (model.exam_status == "") {
  400. res = await asyncRequest.goodupreject(model);
  401. } else {
  402. res = await asyncRequest.status(model);
  403. }
  404. if (res && res.code === 0) {
  405. this.$notify.success({
  406. title: "提交成功!",
  407. message: "",
  408. });
  409. await this.initForm();
  410. } else if (res && res.code >= 100 && res.code <= 104) {
  411. await this.logout();
  412. } else {
  413. this.$message.warning(res.message);
  414. }
  415. })
  416. .catch(() => {
  417. console.log("取消");
  418. });
  419. },
  420. refresh(e) {
  421. const { spuCode } = e;
  422. let model = {
  423. id: this.queryType === "add" ? spuCode : this.queryId,
  424. type: "view",
  425. };
  426. this.routeReGoto("othgoodsOnlineDetail", model);
  427. },
  428. async initData() {
  429. this.loading = true;
  430. const { code, message, data } = await asyncRequest.detail({
  431. platform_youzan_id: this.queryId,
  432. });
  433. this.loading = false;
  434. if (code === 0) {
  435. this.sitem = JSON.parse(JSON.stringify(data));
  436. const {
  437. exam_status,
  438. cat_info,
  439. ladderlist,
  440. nakelist,
  441. spuCode,
  442. platform_id,
  443. } = this.sitem;
  444. this.spuCode = spuCode;
  445. this.platform_id = platform_id;
  446. // this.ladderlist = JSON.parse(JSON.stringify(ladderlist));
  447. const _nakelist = JSON.parse(JSON.stringify(nakelist));
  448. // console.log(this.ladderlist);
  449. let cat = "";
  450. if (cat_info && cat_info.length > 0) {
  451. cat_info.forEach((e, i) => {
  452. cat += i === 0 ? e.name : "/" + e.name;
  453. });
  454. }
  455. this.sitem.cat = cat;
  456. this.sitem.platform_youzan_id = this.queryId;
  457. if (!isArray(this.sitem.good_info_img)) {
  458. this.sitem.good_info_img = this.sitem.good_info_img.split(",");
  459. }
  460. _nakelist.forEach(async (si, sii) => {
  461. si.start_sale_num = si.min_num;
  462. let { isok, price, sale_cost_fee } = await this.get_new(sii,si.min_num);
  463. if (isok === 0) {
  464. _nakelist[sii].sale_good_price = price;
  465. _nakelist[sii].sale_cost_fee = sale_cost_fee;
  466. _nakelist[sii].newTime = new Date().valueOf() + "";
  467. } else if (isok >= 100 && isok <= 104) {
  468. await this.logout();
  469. } else {
  470. _nakelist[sii].sale_good_price = price;
  471. _nakelist[sii].sale_cost_fee = sale_cost_fee;
  472. _nakelist[sii].newTime = new Date().valueOf() + "";
  473. }
  474. this.$set(this.nakelist, sii, _nakelist[sii]);
  475. });
  476. // this.nakelist = _nakelist
  477. console.log(this.nakelist)
  478. this.status = exam_status;
  479. this.getNewTime();
  480. } else if (code >= 100 && code <= 104) {
  481. await this.logout();
  482. } else {
  483. this.$message.warning(message);
  484. }
  485. },
  486. async get_new(index,min_num) {
  487. const { code, data, message } = await asyncRequest.goodupprice({
  488. min_num: min_num,
  489. platform_id: this.platform_id,
  490. spuCode: this.spuCode,
  491. });
  492. const { sale_price, new_cost_fee } = data || {};
  493. const resModel = {
  494. isok: code,
  495. price: code === 0 ? sale_price : "0",
  496. sale_cost_fee: code === 0 ? new_cost_fee : "0",
  497. message: message,
  498. };
  499. return resModel;
  500. },
  501. getNewTime() {
  502. this.newTime = new Date().valueOf();
  503. },
  504. },
  505. };
  506. </script>
  507. <style lang="scss" scoped>
  508. .othgoodsOnlineDetail {
  509. width: 100%;
  510. box-sizing: border-box;
  511. .othgoodsOnlineDetail-main {
  512. padding: 10px 16px 200px 16px;
  513. width: 100%;
  514. }
  515. .othgoodsOnlineDetail-title {
  516. border-top: 1px solid #ebeef5;
  517. span {
  518. height: 50px;
  519. line-height: 50px;
  520. font-family: "微软雅黑", sans-serif;
  521. font-weight: 400;
  522. font-style: normal;
  523. font-size: 16fpx;
  524. text-align: left;
  525. }
  526. }
  527. /deep/ .ddiv {
  528. border-top: 1px solid #dcdfe6;
  529. }
  530. /deep/ .dtitle {
  531. width: 40px;
  532. text-align: center;
  533. height: 100%;
  534. min-height: 100%;
  535. ul {
  536. padding: 12px 0 0 0;
  537. }
  538. }
  539. /deep/ .dmain {
  540. padding: 20px 0 0 0;
  541. width: calc(100% - 40px);
  542. border-left: 1px solid #dcdfe6;
  543. }
  544. }
  545. </style>