transmission.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441
  1. <template>
  2. <div class="app-container">
  3. <div class="header">
  4. <div class="left">
  5. <div class="title">
  6. <div class="status">
  7. 订单状态:
  8. <dict-text
  9. :options="dict.type.sys_order_query_orderstatus_transmission"
  10. :value="spuInfo.orderStatusEnum"
  11. />
  12. {{ spuInfo.pickupCode }}
  13. <el-tag
  14. type="warning"
  15. style="margin-left: 10px"
  16. v-if="spuInfo.deliveryType == 1"
  17. >上门服务</el-tag
  18. >
  19. <el-tag
  20. type="success"
  21. style="margin-left: 10px"
  22. v-if="spuInfo.deliveryType == 0"
  23. >到店</el-tag
  24. >
  25. </div>
  26. <div style="display: flex; flex-direction: row; align-items: center">
  27. <div style="margin-right: 10px">
  28. 预计
  29. {{
  30. spuInfo.receiveTime
  31. ? $moment(spuInfo.receiveTime).format("HH:mm")
  32. : $moment().format("HH:mm")
  33. }}
  34. -
  35. {{
  36. spuInfo.exceptArriveTime
  37. ? $moment(spuInfo.exceptArriveTime).format("HH:mm")
  38. : ""
  39. }}
  40. 送达
  41. </div>
  42. <el-button size="small" @click="cancalOrder">取消订单</el-button>
  43. <el-button
  44. size="small"
  45. type="primary"
  46. @click="takingOrder"
  47. v-if="spuInfo.orderStatusEnum == 'WAIT_DRIVER_ORDER'"
  48. >接单</el-button
  49. >
  50. <el-button
  51. size="small"
  52. type="primary"
  53. @click="takingOrder"
  54. v-if="spuInfo.orderStatusEnum == 'WAIT_PENDING_ORDERS'"
  55. >确认出单</el-button
  56. >
  57. </div>
  58. </div>
  59. <div class="info">
  60. <div class="remark">备注:{{ spuInfo.porderRemark }}</div>
  61. <div
  62. class="surplus"
  63. v-if="spuInfo.orderStatusEnum == 'WAIT_DRIVER_ORDER'"
  64. >
  65. 距离接单还剩:{{ countdown }}
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. <div class="main">
  71. <div class="subTitle">订单信息</div>
  72. <div class="main-info">
  73. <el-row>
  74. <el-col :span="8">
  75. <el-descriptions title="交易信息" column="1">
  76. <el-descriptions-item label="订单编号">
  77. {{ spuInfo ? spuInfo.carPayNo : "" }}</el-descriptions-item
  78. >
  79. <el-descriptions-item label="下单时间">
  80. {{
  81. spuInfo.createTime
  82. ? $moment(spuInfo.createTime).format("HH:mm")
  83. : ""
  84. }}</el-descriptions-item
  85. >
  86. <el-descriptions-item label="支付总金额">
  87. {{ spuInfo ? spuInfo.totalOrderAmount : "" }}
  88. </el-descriptions-item>
  89. <el-descriptions-item label="支付方式">
  90. <dict-text
  91. :options="dict.type.sys_order_paymentType"
  92. :value="spuInfo.paymentType"
  93. />
  94. </el-descriptions-item>
  95. <el-descriptions-item label="支付时间">
  96. {{
  97. spuInfo.paymentTime
  98. ? $moment(spuInfo.paymentTime).format("yyyy-MM-DD HH:mm:ss")
  99. : ""
  100. }}
  101. </el-descriptions-item>
  102. </el-descriptions>
  103. </el-col>
  104. <el-col :span="8">
  105. <el-descriptions title="买家信息" column="1">
  106. <el-descriptions-item label="昵称">
  107. {{ spuInfo ? spuInfo.nick : "" }}
  108. </el-descriptions-item>
  109. <el-descriptions-item label="ID">
  110. {{ spuInfo ? spuInfo.userId : "" }}
  111. </el-descriptions-item>
  112. <el-descriptions-item label="注册手机号">
  113. {{
  114. spuInfo ? spuInfo.consigneeContactMobile : ""
  115. }}</el-descriptions-item
  116. >
  117. <el-descriptions-item label="提货人">
  118. {{ spuInfo ? spuInfo.consigneeContactName : "" }}
  119. </el-descriptions-item>
  120. <el-descriptions-item label="提货时间">
  121. {{
  122. spuInfo.receiveTime
  123. ? $moment(spuInfo.receiveTime).format("yyyy-MM-DD HH:mm:ss")
  124. : ""
  125. }}
  126. </el-descriptions-item>
  127. </el-descriptions>
  128. </el-col>
  129. <el-col :span="8">
  130. <el-descriptions title="配送信息" column="1">
  131. <el-descriptions-item label="骑手">
  132. {{ spuInfo ? spuInfo.riderName : "" }}
  133. </el-descriptions-item>
  134. <el-descriptions-item label="手机号">
  135. {{ spuInfo ? spuInfo.riderPhone : "" }}
  136. </el-descriptions-item>
  137. <el-descriptions-item label="接单时间">
  138. {{
  139. spuInfo.riderReceiveTime
  140. ? $moment(spuInfo.riderReceiveTime).format(
  141. "yyyy-MM-DD HH:mm:ss"
  142. )
  143. : ""
  144. }}
  145. </el-descriptions-item>
  146. <el-descriptions-item label="送达时间">
  147. {{
  148. spuInfo.deliveryTime
  149. ? $moment(spuInfo.deliveryTime).format(
  150. "yyyy-MM-DD HH:mm:ss"
  151. )
  152. : ""
  153. }}
  154. </el-descriptions-item>
  155. </el-descriptions>
  156. </el-col>
  157. </el-row>
  158. </div>
  159. </div>
  160. <div class="table">
  161. <el-table
  162. ref="multipleTable"
  163. v-loading="loading"
  164. :data="spuList"
  165. :border="true"
  166. @selection-change="handleSelectionChange"
  167. row-key="id"
  168. >
  169. <el-table-column label="商品信息" align="center" width="200">
  170. <template slot-scope="scope">
  171. <div class="tableRow">
  172. <div>
  173. <img :src="scope.row.goodsInfo[0].skuPic" style="width: 50px" />
  174. </div>
  175. <div style="margin-left: 10px">
  176. <div>{{ scope.row.goodsInfo[0].skuName }}</div>
  177. <div>ID:{{ scope.row.goodsInfo[0].skuId }}</div>
  178. </div>
  179. </div>
  180. </template>
  181. </el-table-column>
  182. <el-table-column label="商品规格" align="center" prop="price">
  183. <template slot-scope="scope">
  184. <div>
  185. <div>
  186. {{ scope.row.goodsInfo[0].specsValue[0].specsName }}:{{
  187. scope.row.goodsInfo[0].specsValue[0].specsValue
  188. }}
  189. </div>
  190. </div>
  191. </template>
  192. </el-table-column>
  193. <el-table-column label="退款售后状态" align="center" prop="price">
  194. <template slot-scope="scope">
  195. <dict-tag
  196. :options="dict.type.sys_order_aftersalestatus"
  197. :value="scope.row.afterSaleStatus"
  198. />
  199. </template>
  200. </el-table-column>
  201. <el-table-column
  202. label="单价"
  203. align="center"
  204. prop="paymentAmount"
  205. width="100"
  206. >
  207. <template slot-scope="scope">
  208. ¥{{ scope.row.goodsInfo[0].price }}/{{
  209. scope.row.goodsInfo[0].unit
  210. }}
  211. </template>
  212. </el-table-column>
  213. <el-table-column label="数量" align="center" width="120">
  214. <template slot-scope="scope">
  215. {{ scope.row.goodsInfo[0].quantity
  216. }}{{ scope.row.goodsInfo[0].unit }}
  217. </template>
  218. </el-table-column>
  219. <el-table-column label="优惠" align="center">
  220. <template slot-scope="scope">
  221. {{
  222. scope.row.discountAmount == 0
  223. ? 0
  224. : "-¥" + scope.row.discountAmount
  225. }}
  226. </template>
  227. </el-table-column>
  228. <el-table-column label="包装费" align="center">
  229. <template slot-scope="scope">
  230. {{
  231. scope.row.packingPrice == 0 ? 0 : "¥" + scope.row.packingPrice
  232. }}
  233. </template>
  234. </el-table-column>
  235. <el-table-column label="配送费" align="center">
  236. <template slot-scope="scope">
  237. {{
  238. scope.row.freightFee == 0 ? 0 : "¥" + scope.row.freightFee
  239. }}</template
  240. >
  241. </el-table-column>
  242. <el-table-column label="总金额" align="center">
  243. <template slot-scope="scope">
  244. {{
  245. scope.row.totalOrderAmount == 0
  246. ? 0
  247. : "¥" + scope.row.totalOrderAmount
  248. }}
  249. </template>
  250. </el-table-column>
  251. </el-table>
  252. </div>
  253. </div>
  254. </template>
  255. <script>
  256. import moment from "moment";
  257. import { sendSecondOrderInfo } from "@/api/manage/order";
  258. export default {
  259. dicts: [
  260. "sys_order_query_orderstatus_transmission",
  261. "sys_order_paymentType",
  262. "sys_order_aftersalestatus",
  263. ],
  264. data() {
  265. return {
  266. activeName: "1",
  267. spuList: [],
  268. spuInfo: {},
  269. countdown: "", // 初始倒计时为30分钟
  270. timer: null, // 用于存储定时器ID
  271. endTime: null,
  272. loading: false,
  273. };
  274. },
  275. mounted() {
  276. this.getSecondOrderInfo();
  277. // 计算30分钟后的结束时间
  278. },
  279. methods: {
  280. updateCountdown() {
  281. const now = moment();
  282. let end = moment(this.spuInfo.paymentTime).add(30, "minutes");
  283. // 使用 diff 方法计算差值,并指定单位为秒
  284. const diff = end.diff(now, "seconds");
  285. if (diff > 0) {
  286. const minutes = Math.floor(diff / 60);
  287. const seconds = diff % 60;
  288. this.countdown = `${minutes.toString().padStart(2, "0")}:${seconds
  289. .toString()
  290. .padStart(2, "0")}`;
  291. } else {
  292. clearInterval(this.timer);
  293. this.countdown = "00:00";
  294. this.isCountingDown = false;
  295. }
  296. },
  297. getSecondOrderInfo() {
  298. sendSecondOrderInfo(this.$route.query.carPayNo).then((res) => {
  299. if (res.code == 200) {
  300. this.spuList = res.data;
  301. if (this.spuList.length > 0) {
  302. this.spuList.forEach((e) => {
  303. if (e.goodsInfo) {
  304. e.goodsInfo = JSON.parse(e.goodsInfo);
  305. }
  306. });
  307. this.spuInfo = this.spuList[0];
  308. }
  309. if (this.spuInfo.orderStatusEnum == "WAIT_DRIVER_ORDER") {
  310. this.timer = setInterval(() => {
  311. this.updateCountdown();
  312. }, 1000);
  313. }
  314. }
  315. });
  316. },
  317. //倒计时
  318. getCountdown() {},
  319. takingOrder() {
  320. this.$confirm("是否确认接单?", "提示", {
  321. confirmButtonText: "确定",
  322. cancelButtonText: "取消",
  323. type: "warning",
  324. })
  325. .then(() => {})
  326. .catch(() => {
  327. this.$message({
  328. type: "info",
  329. message: "已取消",
  330. });
  331. });
  332. },
  333. cancalOrder() {
  334. this.$confirm("是否确认取消订单?", "提示", {
  335. confirmButtonText: "确定",
  336. cancelButtonText: "取消",
  337. type: "warning",
  338. })
  339. .then(() => {})
  340. .catch(() => {
  341. this.$message({
  342. type: "info",
  343. message: "已取消",
  344. });
  345. });
  346. },
  347. },
  348. beforeDestroy() {
  349. if (this.timer) {
  350. clearInterval(this.timer);
  351. }
  352. },
  353. };
  354. </script>
  355. <style>
  356. .el-descriptions__body {
  357. background: none;
  358. }
  359. </style>
  360. <style scoped lang="scss">
  361. .tableRow {
  362. text-align: left;
  363. display: flex;
  364. flex-direction: row;
  365. // justify-content: center;
  366. align-items: center;
  367. }
  368. .header {
  369. border-radius: 10px;
  370. height: 150px;
  371. background: #f4f4f4;
  372. padding: 30px;
  373. display: flex;
  374. flex-direction: row;
  375. align-items: center;
  376. .left {
  377. width: 100%;
  378. display: flex;
  379. flex-direction: column;
  380. justify-content: center;
  381. align-items: flex-start;
  382. line-height: 30px;
  383. .title {
  384. font-size: 20px;
  385. font-weight: bold;
  386. display: flex;
  387. flex-direction: row;
  388. justify-content: space-between;
  389. align-items: center;
  390. width: 100%;
  391. .status {
  392. display: flex;
  393. flex-direction: row;
  394. align-items: center;
  395. }
  396. }
  397. .info {
  398. display: flex;
  399. flex-direction: row;
  400. justify-content: space-between;
  401. align-items: center;
  402. .remark {
  403. min-width: 70vw;
  404. min-height: 50px;
  405. width: 70%;
  406. margin-top: 10px;
  407. color: orange;
  408. font-size: 16px;
  409. }
  410. .surplus {
  411. font-weight: bold;
  412. }
  413. }
  414. }
  415. }
  416. .main {
  417. .subTitle {
  418. font-size: 18px;
  419. font-weight: bold;
  420. margin: 20px 0px;
  421. }
  422. .main-info {
  423. border-radius: 10px;
  424. padding: 20px;
  425. background: #f4f4f4;
  426. }
  427. }
  428. .table {
  429. margin-top: 20px;
  430. }
  431. </style>