detail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. <template>
  2. <div class="salesOrderDetail pagePadding">
  3. <div style="width: 100%" v-if="powers.some((i) => i == '007')">
  4. <div style="height: 30px" v-if="queryType !== 'add'">
  5. <span>订单编号:</span>
  6. <span v-if="sitem">{{ sitem.orderCode }}</span>
  7. <el-button
  8. style="margin: 0 0 0 10px"
  9. class="fr"
  10. type="primary"
  11. :size="'mini'"
  12. @click="setShowModel = true"
  13. >设置部分字段</el-button>
  14. </div>
  15. <el-tabs v-model="activeTabs">
  16. <el-tab-pane label="新建销售订单" name="0" v-if="queryType === 'add'">
  17. <add-form
  18. :newTime="newTime"
  19. v-if="newTime !== ''"
  20. :type="queryType"
  21. :sitem="sitem"
  22. :id="queryId"
  23. @refresh="routeReGoto('salesOrder', {})"
  24. />
  25. </el-tab-pane>
  26. <el-tab-pane label="业务详情" name="1" v-if="queryType !== 'add'">
  27. <el-collapse v-model="activeNames" style="margin: -18px 0 0 0">
  28. <el-collapse-item title="销售订单信息" name="-1">
  29. <show-data-table
  30. style="margin: 0; padding: 0"
  31. :sitem="sitem"
  32. v-if="status"
  33. :columns="showColumns"
  34. >
  35. <template slot="status">
  36. <el-tag
  37. :size="'mini'"
  38. v-text="
  39. (statusOptions.find((item) => item.value == sitem.status) || {})
  40. .label || '--'
  41. "
  42. ></el-tag>
  43. </template>
  44. <template slot="order_type">
  45. <el-tag
  46. :size="'mini'"
  47. v-text="
  48. (
  49. xs_order_type_options.find(
  50. (item) => item.id == sitem.order_type
  51. ) || {}
  52. ).label || '--'
  53. "
  54. ></el-tag>
  55. </template>
  56. <template slot="order_source">
  57. <el-tag
  58. :size="'mini'"
  59. v-text="
  60. (
  61. xs_order_source_options.find(
  62. (item) => item.id == sitem.order_source
  63. ) || {}
  64. ).label || '--'
  65. "
  66. ></el-tag>
  67. </template>
  68. <template slot="supplierName">
  69. <span>{{ sitem.supplierName }}</span>
  70. <el-popover placement="top" width="300" trigger="hover">
  71. <ul>
  72. <li>
  73. <span>销售方公司编号:</span>
  74. <span>{{ sitem.supplierNo }}</span>
  75. </li>
  76. </ul>
  77. <i class="el-icon-warning-outline fr" slot="reference"></i>
  78. </el-popover>
  79. </template>
  80. <template slot="companyName">
  81. <span>{{ sitem.companyName }}</span>
  82. <el-popover placement="top" width="300" trigger="hover">
  83. <ul>
  84. <li>
  85. <span>购买方公司编号:</span>
  86. <span>{{ sitem.customer_code }}</span>
  87. </li>
  88. </ul>
  89. <i class="el-icon-warning-outline fr" slot="reference"></i>
  90. </el-popover>
  91. </template>
  92. <template slot="is_active">
  93. <span>{{ sitem.is_activity + "" === "1" ? "参与活动" : "不参与活动" }}</span>
  94. <span v-if="sitem.is_activity + '' === '0'">
  95. /{{
  96. (
  97. goodtype_options.find(
  98. (item) => item.value == sitem.good_type
  99. ) || {}
  100. ).label || "--"
  101. }}
  102. </span>
  103. </template>
  104. <template slot="proof_id">
  105. <el-popover
  106. placement="top"
  107. width="300"
  108. trigger="hover"
  109. style="height:36px"
  110. v-if="sitem.proof_type === '1' && sitem.proof_url"
  111. >
  112. <video width="275" controls class="fl">
  113. <source :src="sitem.proof_url" type="video/mp4" />
  114. <source :src="sitem.proof_url" type="video/avi" />您的浏览器不支持Video标签。
  115. </video>
  116. <i
  117. class="el-icon-video-camera-solid hover"
  118. style="font-size: 18px"
  119. slot="reference"
  120. ></i>
  121. </el-popover>
  122. <img
  123. v-else-if="sitem.proof_type + '' === '2' && sitem.proof_url"
  124. style="width: 22px; height: 22px"
  125. :src="sitem.proof_url"
  126. class="avatar fl hover"
  127. v-viewer
  128. />
  129. <a
  130. v-else-if="sitem.proof_type + '' === '3' && sitem.proof_url"
  131. :href="sitem.proof_url"
  132. download="凭证文件"
  133. >点击下载</a>
  134. <span v-else>暂无凭证</span>
  135. </template>
  136. <template slot="send_type">
  137. <el-tag :size="'mini'">
  138. {{
  139. sitem.send_type + "" === "1"
  140. ? "有地址下单"
  141. : sitem.send_type + "" === "2"
  142. ? "无地址下单"
  143. : "--"
  144. }}
  145. </el-tag>
  146. </template>
  147. </show-data-table>
  148. </el-collapse-item>
  149. <!-- && String(sitem.order_source) !== '9' -->
  150. <el-collapse-item
  151. title="商品信息"
  152. name="2"
  153. v-if="sitem"
  154. >
  155. <show-goods-data-table
  156. :newTime="newTime"
  157. v-if="newTime !== ''"
  158. :type="sitem.order_type"
  159. :skucode="sitem.skuCode"
  160. :spucode="sitem.good_code"
  161. />
  162. </el-collapse-item>
  163. <el-collapse-item title="发货单" name="3">
  164. <order-out-table
  165. :newTime="newTime"
  166. v-if="newTime !== ''"
  167. :sitem="sitem"
  168. :id="queryId"
  169. @refresh="initData()"
  170. />
  171. </el-collapse-item>
  172. <el-collapse-item title="发货工单" name="4">
  173. <child-list v-if="newTime !== ''" :sitem="sitem" />
  174. </el-collapse-item>
  175. </el-collapse>
  176. </el-tab-pane>
  177. <el-tab-pane label="审批记录" name="2" v-if="queryType !== 'add'">
  178. <process-time-line
  179. v-if="newTime !== ''"
  180. :newTime="newTime"
  181. :type="'XSQRD'"
  182. :orderCode="queryId"
  183. />
  184. </el-tab-pane>
  185. <el-tab-pane label="流程图" name="3" v-if="queryType !== 'add'">
  186. <flow-chart process_id="4" type="XSQRD" :orderCode="queryId" />
  187. </el-tab-pane>
  188. </el-tabs>
  189. <set-partial
  190. :sitem="sitem"
  191. :show-model="setShowModel"
  192. @refresh="initData"
  193. @cancel="setShowModel = false"
  194. />
  195. </div>
  196. <div v-else>
  197. <no-auth></no-auth>
  198. </div>
  199. </div>
  200. </template>
  201. <script>
  202. import mixinPage from "@/mixins/elPaginationHandle";
  203. import resToken from "@/mixins/resToken";
  204. import asyncRequest from "@/apis/service/sellOut/salesOrder/detail";
  205. import addForm from "./components/addForm";
  206. import orderOutTable from "./components/order-out-table";
  207. import ChildList from "./components/child-list.vue";
  208. import { showColumns } from "./components/ShowDataTableColumns";
  209. import setPartial from "./setPartial";
  210. import {
  211. xs_order_source_options,
  212. xs_order_type_options
  213. } from "@/assets/js/statusList";
  214. export default {
  215. name: "salesOrderDetail",
  216. mixins: [mixinPage, resToken],
  217. components: {
  218. addForm,
  219. orderOutTable,
  220. setPartial,
  221. ChildList
  222. },
  223. computed: {
  224. powers() {
  225. const tran =
  226. this.$store.getters.btnList.find(
  227. item => item.menu_route == "salesOrderDetail"
  228. ) || {};
  229. const { action } = tran ?? {};
  230. return action ?? [];
  231. }
  232. },
  233. data() {
  234. return {
  235. finishStatus: "finish",
  236. activeTabs: "1",
  237. activeNames: ["-1", "0", "1", "2", "3", "4", "5", "6"],
  238. showColumns: showColumns,
  239. setShowModel: false,
  240. goodtype_options: [
  241. {
  242. value: "1",
  243. label: "常规商品"
  244. },
  245. {
  246. value: "2",
  247. label: "赠品"
  248. },
  249. {
  250. value: "3",
  251. label: "样品"
  252. }
  253. ],
  254. xs_order_type_options,
  255. xs_order_source_options,
  256. statusOptions: [
  257. { value: "0", label: "待发货" },
  258. { value: "1", label: "待发货完成" },
  259. { value: "2", label: "发货已完成" },
  260. { value: "3", label: "订单已取消" }
  261. ],
  262. sitem: null,
  263. orderCode: "",
  264. status: "",
  265. newTime: "",
  266. loading: false,
  267. queryId: "",
  268. queryType: ""
  269. };
  270. },
  271. mounted() {
  272. this.status = "";
  273. const { id, type } = this.$route.query;
  274. this.queryId = id;
  275. this.queryType = type;
  276. this.activeTabs = type === "add" ? "0" : "1";
  277. this.loading = true;
  278. if (this.queryType === "add") {
  279. this.sitem = {};
  280. this.getNewTime();
  281. } else {
  282. this.initData();
  283. }
  284. this.loading = false;
  285. },
  286. methods: {
  287. async statusConfirm(status, message) {
  288. await this.$confirm(`确定要${message}?`, {
  289. confirmButtonText: "确定",
  290. cancelButtonText: "取消",
  291. type: "warning"
  292. })
  293. .then(async () => {
  294. if (status + "" === "-1") {
  295. await this.deleteById(message);
  296. } else {
  297. await this.setStatus(status, message);
  298. }
  299. })
  300. .catch(() => {
  301. console.log("取消");
  302. });
  303. },
  304. getNewTime() {
  305. this.newTime = new Date().valueOf() + "";
  306. },
  307. async deleteById(message) {
  308. const res = await asyncRequest.delete({ id: this.queryId });
  309. if (res && res.code === 0) {
  310. this.$notify.success({
  311. title: message + "成功!",
  312. message: ""
  313. });
  314. this.routeGoto("check", {});
  315. } else if (res && res.code >= 100 && res.code <= 104) {
  316. await this.logout();
  317. } else {
  318. this.$message.warning(res.message);
  319. }
  320. },
  321. async setStatus(status, message, remark) {
  322. let model = {
  323. id: this.queryId,
  324. remark: remark || "",
  325. status: status
  326. };
  327. const res = await asyncRequest.status(model);
  328. this.loading = false;
  329. if (res && res.code === 0) {
  330. this.$notify.success({
  331. title: message + "成功!",
  332. message: ""
  333. });
  334. this.initData();
  335. } else if (res && res.code >= 100 && res.code <= 104) {
  336. await this.logout();
  337. } else {
  338. this.$message.warning(res.message);
  339. }
  340. },
  341. async examForm(e) {
  342. if (!this.loading) {
  343. let type = e.state + "" === "1" ? "2" : "0";
  344. await this.setStatus(type, "提交入库方审核", e.remark);
  345. }
  346. },
  347. async initData() {
  348. this.loading = true;
  349. const res = await asyncRequest.detail({ id: this.queryId });
  350. if (res && res.code === 0 && res.data) {
  351. this.sitem = res.data;
  352. this.status = this.sitem.status;
  353. this.orderCode = this.sitem.orderCode;
  354. this.getNewTime();
  355. } else if (res && res.code >= 100 && res.code <= 104) {
  356. await this.logout();
  357. } else {
  358. this.$message.warning(res.message);
  359. }
  360. this.loading = false;
  361. }
  362. }
  363. };
  364. </script>
  365. <style lang="scss" scoped>
  366. .salesOrderDetail {
  367. // text-overflow: ellipsis;
  368. }
  369. </style>