order1.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  1. <template>
  2. <view class="app">
  3. <!-- <view class="header">
  4. <view class="header_inner">
  5. <image src="../../static/order/clock.png"></image>
  6. <text class="txt1">配送剩余时间<text class="txt2">{{preTime}}</text></text>
  7. </view>
  8. <view class="tip">你需要在{{sdTime=='aN:aN'?'':sdTime}}前送达</view>
  9. </view> -->
  10. <view class="goods">
  11. <view class="goods_tit">商品信息</view>
  12. <view class="goods_details">
  13. <view class="detials_l">
  14. <scroll-view scroll-x="true">
  15. <image mode="aspectFit" v-for="(item,index) in details.productList" :key="index"
  16. :src="JSON.parse(item.img)[0].url" class="details_img"></image>
  17. </scroll-view>
  18. </view>
  19. <view class="detials_r">
  20. <view class="detials_r_inner">
  21. <text style="margin-left: 20rpx;">共{{count}}件</text>
  22. <image @click="open()" src="../../static/order/dian.png"></image>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="count">
  28. <!-- <view class="count_item">
  29. <text class="txt3">配送费</text>
  30. <text class="txt4">{{details.freightPrice}}元</text>
  31. </view>
  32. <view class="count_item nobor">
  33. <text class="txt3">商品费用</text>
  34. <text class="txt4 txt5">¥{{details.totalPrice}}</text>
  35. </view>
  36. <view class="count_item nobor">
  37. <text class="txt3">合计</text>
  38. <text
  39. class="txt4 txt5">¥{{ (parseFloat(details.totalPrice) + parseFloat(details.freightPrice)).toFixed(2)}}</text>
  40. </view> -->
  41. <view class="count_item">
  42. <text class="txt3">订单编号</text>
  43. <text class="txt4">{{ details.orderId }}</text>
  44. </view>
  45. <view class="count_item">
  46. <text class="txt3">订单状态</text>
  47. <text class="txt4">{{ getStatus(details.status) }}</text>
  48. </view>
  49. <view class="count_item">
  50. <text class="txt3">下单时间</text>
  51. <text class="txt4">{{ details.createTime }}</text>
  52. </view>
  53. <view class="count_item">
  54. <text class="txt3">要求送达时间</text>
  55. <text class="txt4">{{ details.predictTime }}</text>
  56. </view>
  57. <view class="count_item">
  58. <text class="txt3">备注</text>
  59. <text class="txt4">{{ details.remark }}</text>
  60. </view>
  61. <view class="count_item">
  62. <text class="txt3">客户姓名</text>
  63. <text class="txt4">{{ details.realName }}</text>
  64. </view>
  65. <view class="count_item">
  66. <text class="txt3">客户电话</text>
  67. <text class="txt4">{{ details.userPhone }}</text>
  68. </view>
  69. <view class="count_item">
  70. <text class="txt3">客户地址</text>
  71. <text class="txt4">{{ details.userAddress }}</text>
  72. </view>
  73. <view class="count_item">
  74. <text class="txt3">支付状态</text>
  75. <text class="txt4">{{ getStatus(details.status) }}</text>
  76. </view>
  77. <view class="count_item">
  78. <text class="txt3">支付方式</text>
  79. <text class="txt4">{{ details.payTypeName }}</text>
  80. </view>
  81. <view class="count_item">
  82. <text class="txt3">支付金额</text>
  83. <text class="txt4 txt5">¥{{ details.payPrice }}</text>
  84. </view>
  85. <view class="count_item">
  86. <text class="txt3">交易号</text>
  87. <text class="txt4">{{ details.payId }}</text>
  88. </view>
  89. <view class="count_item">
  90. <text class="txt3">支付时间</text>
  91. <text class="txt4">{{ details.payTime }}</text>
  92. </view>
  93. <view class="count_item">
  94. <text class="txt3">运费</text>
  95. <text class="txt4 txt5">¥{{ details.freightPrice }}</text>
  96. </view>
  97. <view class="count_item">
  98. <text class="txt3">优惠</text>
  99. <text
  100. class="txt4 txt5">¥{{ (parseFloat(details.originalTotalPrice)-parseFloat(details.payPrice) + -parseFloat(details.freightPrice)).toFixed(2) }}</text>
  101. </view>
  102. <view class="count_item">
  103. <text class="txt3">商品金额</text>
  104. <text class="txt4 txt5">¥{{ details.originalTotalPrice }}</text>
  105. </view>
  106. <view class="count_item">
  107. <text class="txt3">总金额</text>
  108. <text class="txt4 txt5">¥{{ details.payPrice }}</text>
  109. </view>
  110. </view>
  111. <!-- <view class="count">
  112. <view class="count_item">
  113. <text class="txt3">配送信息</text>
  114. <text class="txt4"></text>
  115. </view>
  116. <view class="count_item">
  117. <text class="txt3 txt6">收货人</text>
  118. <text class="txt4 txt5 txt7">{{details.consignee}}</text>
  119. </view>
  120. <view class="count_item">
  121. <text class="txt3 txt6">联系电话</text>
  122. <text class="txt4 txt5 txt7">{{details.phone}}</text>
  123. </view>
  124. <view class="count_item nobor">
  125. <text class="txt3 txt6">收货地址</text>
  126. <text class="txt4 txt5 txt7">{{details.province}}{{details.city}}{{details.county}}{{details.address}}</text>
  127. </view>
  128. </view> -->
  129. <!-- <view class="count">
  130. <view class="count_item">
  131. <text class="txt3">订单信息</text>
  132. <text class="txt4"></text>
  133. </view>
  134. <view class="count_item">
  135. <text class="txt3 txt6">订单编号</text>
  136. <text class="txt4 txt5 txt7">{{details.orderNo}}<text style="padding-left: 20rpx;color: #3662DD;"
  137. @click="copy(details.orderNo)">复制</text> </text>
  138. </view>
  139. <view class="count_item">
  140. <text class="txt3 txt6">备注信息</text>
  141. <text class="txt4 txt5 txt7">{{details.mono}}</text>
  142. </view>
  143. <view class="count_item">
  144. <text class="txt3 txt6">支付方式</text>
  145. <text class="txt4 txt5 txt7">{{details.payChannel}}</text>
  146. </view>
  147. <view class="count_item">
  148. <text class="txt3 txt6">下单时间</text>
  149. <text class="txt4 txt5 txt7">{{orderCreateTime}}</text>
  150. </view>
  151. <view class="count_item nobor">
  152. <text class="txt3 txt6">支付时间</text>
  153. <text class="txt4 txt5 txt7">{{payTime}}</text>
  154. </view>
  155. </view> -->
  156. <uni-popup ref="popup" type="bottom">
  157. <view class="popup_mask">
  158. <view class="popup_mask_tit">
  159. <text class="pop_t1">配送清单</text>
  160. <text class="pop_t2">共{{count}}件</text>
  161. <image @click="closePop()" src="../../static/order/mask_close.png"></image>
  162. </view>
  163. <view class="pop_item" v-for="(item,index) in details.productList" :key="'dt'+index">
  164. <view class="pop_item_l">
  165. <view class="item_l_l">
  166. <image mode="aspectFit" class="pil_img" :src="JSON.parse(item.img)[0].url"></image>
  167. </view>
  168. <view class="item_l_r">
  169. <view>{{item.productTitle}}</view>
  170. <view style="padding-top: 10rpx;">x{{item.num}}{{item.unitName}}</view>
  171. </view>
  172. <!-- <image class="pil_img" src="../../static/login/logo.png"></image>
  173. <text>上海小白菜\n<text>x2</text> </text> -->
  174. </view>
  175. <view class="pop_item_r">
  176. ¥{{(item.num*item.price).toFixed(2)}}
  177. </view>
  178. </view>
  179. </view>
  180. </uni-popup>
  181. </view>
  182. </template>
  183. <script>
  184. import uniPopup from "@/components/uni-popup/uni-popup.vue";
  185. import {
  186. mapState
  187. } from 'vuex';
  188. export default {
  189. components: {
  190. uniPopup
  191. },
  192. computed: {
  193. ...mapState(['token', 'userInfo'])
  194. },
  195. data() {
  196. return {
  197. goods: [1, 2, 3, 4, 5],
  198. id: '',
  199. details: '',
  200. preTime: '',
  201. count: 0,
  202. sdTime: '',
  203. orderCreateTime: '',
  204. payTime: '',
  205. interval: '',
  206. flag: false,
  207. }
  208. },
  209. onLoad(e) {
  210. this.getDetails(e.id)
  211. },
  212. onHide() {
  213. clearInterval(this.interval)
  214. },
  215. methods: {
  216. getStatus(s) {
  217. const status = {
  218. 14: '待配货',
  219. 16: '配货中',
  220. 20: '待配送',
  221. 30: '配送中',
  222. 50: '已完成',
  223. 40: '已完成',
  224. 32: '配送异常',
  225. 34: '超时订单',
  226. 10: '待支付',
  227. 70: '已退款',
  228. 80: '已取消',
  229. 90: '已取消(系统)'
  230. }
  231. return status[s]
  232. },
  233. closePop() {
  234. this.$refs.popup.close()
  235. },
  236. open() {
  237. this.$refs.popup.open()
  238. },
  239. copy(msg) {
  240. uni.setClipboardData({
  241. data: msg,
  242. success: function() {
  243. uni.showToast({
  244. title: '复制成功',
  245. icon: 'none',
  246. duration: 1500
  247. })
  248. }
  249. });
  250. },
  251. getDetails(id) {
  252. let that = this
  253. that.request("get", "order/storeOrder/" + id, that.token).then(res => {
  254. if (res.code == 200) {
  255. // let num = 0
  256. // for (let i = 0; i < res.data.productList.length; i++) {
  257. // res.data.productList[i].amount = parseInt(res.data.productList[i].amount)
  258. // num = num + parseInt(res.data.productList[i].amount)
  259. // }
  260. that.details = res.data
  261. // console.log(that.details)
  262. that.count = res.data.productList.length
  263. that.orderCreateTime = that.dateFtt("yyyy-MM-dd hh:mm:ss", new Date(that.details.orderCreateTime))
  264. that.payTime = that.dateFtt("yyyy-MM-dd hh:mm:ss", new Date(that.details.payTime))
  265. that.sdTime = that.dateFtt("hh:mm", new Date(that.details.predictTime))
  266. // console.log(that.dateFtt("yyyy-MM-dd hh:mm:ss", new Date(that.details.predictTime)))
  267. that.preTime = new Date(that.details.predictTime).getTime() >= new Date().getTime() ? that.dateFtt(
  268. "hh:mm:ss", new Date(that.details.predictTime)) : 0
  269. if (new Date(that.details.predictTime).getTime() >= new Date().getTime()) {
  270. that.preTime = true
  271. }
  272. }
  273. })
  274. that.interval = setInterval(function() {
  275. // console.log(new Date(that.details.predictTime).getTime()>=new Date().getTime())
  276. if (new Date(that.details.predictTime).getTime() > new Date().getTime()) {
  277. let d = new Date(that.details.predictTime).getTime() - new Date().getTime()
  278. // that.preTime = that.dateFtt("hh:mm:ss", d)
  279. //计算出相差天数
  280. var days = Math.floor(d / (24 * 3600 * 1000))
  281. //计算出小时数
  282. var leave1 = d % (24 * 3600 * 1000) //计算天数后剩余的毫秒数
  283. var hours = Math.floor(leave1 / (3600 * 1000))
  284. //计算相差分钟数
  285. var leave2 = leave1 % (3600 * 1000) //计算小时数后剩余的毫秒数
  286. var minutes = Math.floor(leave2 / (60 * 1000))
  287. //计算相差秒数
  288. var leave3 = leave2 % (60 * 1000) //计算分钟数后剩余的毫秒数
  289. var seconds = Math.round(leave3 / 1000)
  290. that.preTime = days > 0 ? (days + ":" + hours + ":" + minutes + ":" + seconds) : (hours > 0 ? (hours +
  291. ":" + minutes + ":" + seconds) : (minutes + ":" + seconds))
  292. //alert(" 相差 "+days+"天 "+hours+"小时 "+minutes+" 分钟"+seconds+" 秒")
  293. } else {
  294. that.preTime = 0
  295. console.log(that.flag)
  296. if (that.flag == true) {
  297. let nav_index = 2
  298. uni.redirectTo({
  299. url: '../task/task?nav_index=' + nav_index
  300. })
  301. }
  302. clearInterval(that.interval)
  303. }
  304. }, 1000)
  305. }
  306. }
  307. }
  308. </script>
  309. <style scoped>
  310. scroll-view {
  311. white-space: nowrap;
  312. height: 110rpx;
  313. width: 100%;
  314. margin-top: 42rpx;
  315. box-sizing: border-box;
  316. }
  317. .popup_mask {
  318. width: 690rpx;
  319. padding: 0 30rpx;
  320. height: 500rpx;
  321. background-color: #FFFFFF;
  322. border-top-left-radius: 24rpx;
  323. border-top-right-radius: 24rpx;
  324. padding-bottom: 6rpx;
  325. }
  326. .popup_mask_tit {
  327. height: 104rpx;
  328. line-height: 104rpx;
  329. position: relative;
  330. }
  331. .pop_t1 {
  332. font-size: 32rpx;
  333. color: #333333;
  334. font-weight: bold;
  335. }
  336. .pop_t2 {
  337. font-size: 28rpx;
  338. color: #1B1C33;
  339. margin-left: 40rpx;
  340. }
  341. .popup_mask_tit image {
  342. width: 30rpx;
  343. height: 30rpx;
  344. position: absolute;
  345. right: 20rpx;
  346. top: 38rpx;
  347. }
  348. .pop_item {
  349. height: 184rpx;
  350. border-bottom: 2rpx solid #F1F1F1;
  351. display: flex;
  352. flex-direction: row;
  353. }
  354. .pop_item_l {
  355. width: 520rpx;
  356. height: 184rpx;
  357. display: flex;
  358. flex-direction: row;
  359. }
  360. .item_l_l {
  361. width: 168rpx;
  362. height: 148rpx;
  363. padding-top: 36rpx;
  364. }
  365. .item_l_r {
  366. width: 452rpx;
  367. height: 148rpx;
  368. padding-top: 36rpx;
  369. }
  370. .pop_item_r {
  371. width: 150rpx;
  372. height: 148rpx;
  373. padding-top: 36rpx;
  374. font-size: 32rpx;
  375. color: #333333;
  376. font-weight: bold;
  377. text-align: right;
  378. }
  379. .pil_img {
  380. width: 118rpx;
  381. height: 110rpx;
  382. }
  383. .item_l_r view {
  384. font-size: 32rpx;
  385. color: #333333;
  386. }
  387. .test {
  388. width: 220upx;
  389. height: 220upx;
  390. display: inline-block;
  391. background-color: red;
  392. }
  393. .app {
  394. background-color: #F6F6F6;
  395. }
  396. .header {
  397. text-align: center;
  398. background-color: #FFFFFF;
  399. }
  400. .header_inner {
  401. display: inline-block;
  402. padding-top: 90rpx;
  403. }
  404. .header_inner image {
  405. width: 48rpx;
  406. height: 48rpx;
  407. position: relative;
  408. top: 8rpx;
  409. }
  410. .txt1 {
  411. font-size: 40rpx;
  412. color: #000000;
  413. font-weight: bold;
  414. margin-left: 24rpx;
  415. }
  416. .txt2 {
  417. color: #3662DD;
  418. padding-left: 20rpx;
  419. }
  420. .tip {
  421. text-align: center;
  422. font-size: 32rpx;
  423. color: #717171;
  424. padding-top: 24rpx;
  425. padding-bottom: 70rpx;
  426. }
  427. .goods {
  428. height: 282rpx;
  429. margin-top: 20rpx;
  430. background-color: #FFFFFF;
  431. padding: 0 30rpx;
  432. }
  433. .goods_tit {
  434. height: 86rpx;
  435. line-height: 86rpx;
  436. border-bottom: 2rpx solid #F1F1F1;
  437. font-size: 32rpx;
  438. color: #333333;
  439. font-weight: bold;
  440. }
  441. .goods_details {
  442. height: 194rpx;
  443. display: flex;
  444. flex-direction: row;
  445. }
  446. .detials_l {
  447. width: 496rpx;
  448. height: 194rpx;
  449. }
  450. .detials_r {
  451. width: 174rpx;
  452. height: 194rpx;
  453. }
  454. .details_img {
  455. display: inline-block;
  456. width: 118rpx;
  457. height: 110rpx;
  458. margin-right: 36rpx;
  459. }
  460. .detials_r_inner {
  461. height: 110rpx;
  462. margin-top: 42rpx;
  463. line-height: 110rpx;
  464. font-size: 28rpx;
  465. color: #1B1C33;
  466. position: relative;
  467. }
  468. .detials_r_inner image {
  469. width: 44rpx;
  470. height: 10rpx;
  471. position: absolute;
  472. right: 0;
  473. top: 48rpx;
  474. }
  475. .count {
  476. margin-top: 20rpx;
  477. padding: 0 30rpx;
  478. background-color: #FFFFFF;
  479. }
  480. .count_item {
  481. height: 99rpx;
  482. line-height: 99rpx;
  483. border-bottom: 2rpx solid #F1F1F1;
  484. font-size: 28rpx;
  485. }
  486. .txt3,
  487. .txt5 {
  488. font-weight: bold;
  489. color: #333333;
  490. }
  491. .txt4 {
  492. color: #666666;
  493. float: right;
  494. }
  495. .nobor {
  496. border: none;
  497. }
  498. .txt6 {
  499. color: #999999;
  500. font-weight: normal;
  501. }
  502. .txt7 {
  503. font-weight: normal;
  504. color: #333333;
  505. }
  506. </style>