order.vue 10 KB

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