金诚优选前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

416 lines
11 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. <template>
  2. <view v-if="$isRight(order_details)">
  3. <lf-nav title="订单详情" :showIcon="true"></lf-nav>
  4. <!-- v-if="order_details.last_pay_time" -->
  5. <view class="tips" v-if="show">
  6. <view class="lf-font-24 lf-color-white">剩余支付时间</view>
  7. <view class="lf-font-24 lf-color-white">
  8. <!-- {{time}} -->
  9. <countdown-timer :time="time" :autoStart="true" @finish="dateFinish">
  10. <template v-slot="{minute, second}">
  11. <view class="lf-flex">
  12. <view class="lf-font-24 lf-color-white">{{ minute >= 10 ? minute : "0" + minute }}</view>
  13. <view class="lf-font-24 lf-color-white">:</view>
  14. <view class="lf-font-24 lf-color-white">{{ second >= 10 ? second : "0" + second }}</view>
  15. </view>
  16. </template>
  17. </countdown-timer>
  18. </view>
  19. </view>
  20. <!-- 待收货 -->
  21. <view class="tips-waitconfirm">
  22. <view class="lf-flex-column">
  23. <view class="lf-font-28 lf-color-white">运输中</view>
  24. <view class="lf-font-24 lf-color-white" v-if="true">广州转运中心公司 已发出下一站南宁转运中心</view>
  25. <view class="lf-font-24 lf-color-white" v-else>[自提柜]已签收签收人凭取货码签收</view>
  26. </view>
  27. <view class="waitconfirm-tag">
  28. 查看详情
  29. </view>
  30. </view>
  31. <view class="card" style="margin-top: 0;">
  32. <view class="lf-font-28">
  33. <text class="lf-color-222 lf-font-bold">{{order_details.accept_name}}</text>
  34. <text class="lf-color-777 lf-m-l-20">{{order_details.mobile}}</text>
  35. </view>
  36. <view class="lf-font-28 lf-color-333 lf-m-t-20">
  37. <text>{{order_details.address_name}}{{order_details.address}}</text>
  38. </view>
  39. </view>
  40. <view class="card goods">
  41. <view>
  42. <text class="lf-iconfont icon-Group- lf-font-30"></text>
  43. <text class="shop-name">{{order_details.from}}</text>
  44. <text class="lf-iconfont icon-xiangyou lf-font-24"></text>
  45. </view>
  46. <view class="lf-flex lf-m-t-20" v-for="(item,index) of order_details.items" :key="index">
  47. <image class="goods-img" :src="item.item_meta.image"></image>
  48. <view class="info">
  49. <view class="lf-font-26 lf-color-333 lf-line-1">{{item.item_name}}</view>
  50. <view class="lf-font-24 lf-color-777">{{item.item_meta.specs_text}}</view>
  51. <view class="lf-row-between" style="line-height: 1;">
  52. <text class="price">¥{{item.total_yuan}}</text>
  53. <text class="lf-font-28 lf-color-777">x {{item.quantity}}</text>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. <view class="card" v-if="type == 'point'">
  59. <view class="lf-row-between lf-font-28">
  60. <text class="lf-color-777">积分数量</text>
  61. <text class="lf-color-222">{{order_details.redeem_point}}</text>
  62. </view>
  63. <view class="lf-row-between lf-m-t-30 lf-font-28">
  64. <text class="lf-color-777">应付运费</text>
  65. <text class="lf-color-222">+¥{{order_details.payable_freight}}</text>
  66. </view>
  67. <view class="lf-row-between lf-m-t-30 lf-font-28">
  68. <text class="lf-color-777">实付运费</text>
  69. <text class="lf-color-222">+¥{{order_details.real_freight}}</text>
  70. </view>
  71. </view>
  72. <view class="card" v-if="type == 'default'">
  73. <view class="lf-row-between lf-font-28">
  74. <text class="lf-color-777">优惠券</text>
  75. <text style="color: #F63434;">-¥20</text>
  76. </view>
  77. <view class="lf-row-between lf-m-t-30 lf-font-28">
  78. <text class="lf-color-777">运费</text>
  79. <text class="lf-color-222">+¥10</text>
  80. </view>
  81. <view class="lf-row-between lf-m-t-30 lf-font-28">
  82. <text class="lf-color-777">订单总价</text>
  83. <text class="lf-color-222">¥{{order_details.total_yuan}}</text>
  84. </view>
  85. </view>
  86. <view class="card">
  87. <view class="lf-row-between lf-font-28">
  88. <text class="lf-color-777">商品订单编号</text>
  89. <text>
  90. <text class="lf-color-222">{{order_details.order_no}}</text>
  91. <text class="lf-font-28 lf-m-l-20" style="color: #22A19F;"
  92. @click="copy(order_details.order_no)">复制</text>
  93. </text>
  94. </view>
  95. <view class="lf-row-between lf-font-28 lf-m-t-30">
  96. <text class="lf-color-777">创建时间</text>
  97. <text class="lf-color-222">{{order_details.created_at}}</text>
  98. </view>
  99. <!-- <view class="lf-row-between lf-font-28 lf-m-t-30">
  100. <text class="lf-color-777">留言</text>
  101. <text class="lf-color-222">暂无留言</text>
  102. </view> -->
  103. <view class="lf-row-between lf-font-28 lf-m-t-30" v-if="order_details.status_text">
  104. <text class="lf-color-777">订单状态</text>
  105. <text class="lf-color-222">{{order_details.status_text}}</text>
  106. </view>
  107. <!-- 待发货 -->
  108. <view class="lf-row-between lf-font-28 lf-m-t-30">
  109. <text class="lf-color-777">支付方式</text>
  110. <text class="lf-color-222">{{order_details.payment_text}}</text>
  111. </view>
  112. <view class="lf-row-between lf-font-28 lf-m-t-30" v-if="order_details.pick_self == 0">
  113. <text class="lf-color-777">收货方式</text>
  114. <text class="lf-color-222">快递</text>
  115. </view>
  116. <view class="lf-row-between lf-font-28 lf-m-t-30" v-else>
  117. <text class="lf-color-777">收货方式</text>
  118. <text class="lf-color-222">自提</text>
  119. </view>
  120. <view class="lf-row-between lf-font-28 lf-m-t-30" v-if="order_details.pay_time">
  121. <text class="lf-color-777">支付时间</text>
  122. <text class="lf-color-222">{{order_details.pay_time}}</text>
  123. </view>
  124. </view>
  125. <view style="height: 120rpx;margin-top: 20rpx;"></view>
  126. <!-- 待付款 -->
  127. <!-- <view class="order-btn">
  128. <view class="lf-font-28 lf-row-center" style="color:#F63434">
  129. 待付款
  130. </view>
  131. <view class="lf-flex">
  132. <view class="btn-cancel lf-m-r-20">
  133. 取消订单
  134. </view>
  135. <view class="btn-atonce">
  136. 立即付款
  137. </view>
  138. </view>
  139. </view> -->
  140. <!-- 待发货 -->
  141. <view class="order-btn" v-if="order_details.status == 2">
  142. <view class="lf-font-28 lf-row-center lf-color-777">
  143. 待发货
  144. </view>
  145. <view class="lf-flex">
  146. <view style="width: 220rpx;"></view>
  147. <view style="width: 220rpx;"></view>
  148. </view>
  149. </view>
  150. <!-- 待收货 -->
  151. <view class="order-btn" v-if="order_details.status == 3">
  152. <view class="lf-font-28 lf-row-center lf-color-black">
  153. 待收货
  154. </view>
  155. <view class="lf-flex">
  156. <view style="width: 220rpx;"></view>
  157. <view class="btn-confirm">
  158. 确认收货
  159. </view>
  160. </view>
  161. </view>
  162. <!-- 已完成 -->
  163. <view class="order-btn" v-if="order_details.status == 4">
  164. <view class="lf-font-28 lf-row-center" style="color: #22A19F;">
  165. 已完成
  166. </view>
  167. <view class="lf-flex">
  168. <view style="width: 220rpx;"></view>
  169. <view style="width: 220rpx;"></view>
  170. </view>
  171. </view>
  172. </view>
  173. </template>
  174. <script>
  175. import countdownTimer from '@/components/countdown-timer/countdown-timer';
  176. export default {
  177. data() {
  178. return {
  179. type: 'default', // point积分订单详情, default默认普通商品订单详情
  180. time: '',
  181. order_no: '',
  182. order_details: '',
  183. countdown_minute: '',
  184. time: '',
  185. show: false
  186. }
  187. },
  188. components: {
  189. countdownTimer
  190. },
  191. onLoad(options) {
  192. this.type = options.type || this.type;
  193. this.order_no = options.order_id;
  194. if (this.order_no) {
  195. this.getOrderDetails();
  196. }
  197. },
  198. methods: {
  199. // 点击复制
  200. copy(text) {
  201. uni.setClipboardData({
  202. data: text
  203. });
  204. },
  205. dateFinish() {
  206. this.show = false;
  207. console.log("倒计时结束");
  208. },
  209. countDown(munite, second) {
  210. let m = munite;
  211. let s = second;
  212. let m2, s2;
  213. let _this = this;
  214. let tiem = setInterval(function() {
  215. s--;
  216. if (s < 0) {
  217. s = 59;
  218. m--;
  219. if (m < 0) {
  220. _this.time = '00分00秒';
  221. _this.show = false;
  222. // _this.getOrderDetails();
  223. clearTimeout(tiem);
  224. return;
  225. }
  226. }
  227. m2 = m < 10? '0' + m : m;
  228. s2 = s < 10 ? ('0' + s) : s;
  229. _this.time = m2 + '分' + s2 + '秒';
  230. }, 1000)
  231. },
  232. s_to_hs(s) {
  233. //计算分钟
  234. //算法:将秒数除以60,然后下舍入,既得到分钟数
  235. var h;
  236. h = Math.floor(s / 60);
  237. //计算秒
  238. //算法:取得秒%60的余数,既得到秒数
  239. s = s % 60;
  240. //将变量转换为字符串
  241. h += '';
  242. s += '';
  243. //如果只有一位数,前面增加一个0
  244. // h = (h.length == 1) ? '0' + h : h;
  245. // s = (s.length == 1) ? '0' + s : s;
  246. this.countDown(h,s)
  247. // return h + ':' + s;
  248. },
  249. getTime(){
  250. var date = new Date(),
  251. year = date.getFullYear(),
  252. month = date.getMonth() + 1,
  253. day = date.getDate(),
  254. hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours(),
  255. minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes(),
  256. second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
  257. month >= 1 && month <= 9 ? (month = "0" + month) : "";
  258. day >= 0 && day <= 9 ? (day = "0" + day) : "";
  259. var timer = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second;
  260. return timer;
  261. },
  262. getOrderDetails() {
  263. this.$http.get({
  264. api: 'api/order/' + this.order_no,
  265. header: {
  266. Authorization: this.$cookieStorage.get('user_token')
  267. }
  268. }).then(res => {
  269. this.order_details = res.data.data
  270. var date = this.getTime()
  271. this.time = new Date(this.order_details.will_closed_at).getTime() - new Date(date).getTime()
  272. if(this.time > 0) {
  273. this.show = true;
  274. }
  275. console.log(this.order_details);
  276. })
  277. },
  278. }
  279. }
  280. </script>
  281. <style>
  282. page {
  283. background-color: #F8F8F8;
  284. }
  285. </style>
  286. <style lang="scss" scoped="scoped">
  287. .tips-waitconfirm {
  288. width: 100%;
  289. height: 113rpx;
  290. background: #15716E;
  291. display: flex;
  292. justify-content: space-between;
  293. padding: 0 32rpx;
  294. align-items: center;
  295. }
  296. .waitconfirm-tag {
  297. width: 136rpx;
  298. height: 53rpx;
  299. border-radius: 27rpx;
  300. border: 2rpx solid #FFFFFF;
  301. font-size: 24rpx;
  302. color: white;
  303. display: flex;
  304. justify-content: center;
  305. align-items: center;
  306. }
  307. .btn-cancel {
  308. width: 220rpx;
  309. height: 90rpx;
  310. border-radius: 45rpx;
  311. border: 2rpx solid #999999;
  312. color: #777;
  313. font-size: 28rpx;
  314. display: flex;
  315. justify-content: center;
  316. align-items: center;
  317. }
  318. .btn-confirm {
  319. width: 220rpx;
  320. height: 90rpx;
  321. border-radius: 45rpx;
  322. background-color: #15716E;
  323. color: #fff;
  324. font-size: 28rpx;
  325. display: flex;
  326. justify-content: center;
  327. align-items: center;
  328. }
  329. .btn-atonce {
  330. width: 220rpx;
  331. height: 90rpx;
  332. border-radius: 45rpx;
  333. background-color: #F63434;
  334. color: #fff;
  335. font-size: 28rpx;
  336. display: flex;
  337. justify-content: center;
  338. align-items: center;
  339. }
  340. .order-btn {
  341. width: 100%;
  342. height: 120rpx;
  343. background: #FFFFFF;
  344. display: flex;
  345. justify-content: space-between;
  346. padding: 0 32rpx;
  347. position: fixed;
  348. bottom: 0;
  349. }
  350. .tips {
  351. display: flex;
  352. background-color: #F63434;
  353. height: 64rpx;
  354. width: 100%;
  355. justify-content: center;
  356. align-items: center;
  357. }
  358. .card {
  359. height: max-content;
  360. width: 750rpx;
  361. padding: 30rpx 32rpx;
  362. background-color: #FFFFFF;
  363. &:nth-child(n+2) {
  364. margin-top: 20rpx;
  365. }
  366. }
  367. .goods {
  368. .shop-name {
  369. font-size: 28rpx;
  370. color: #222222;
  371. font-weight: bold;
  372. margin: 0 15rpx;
  373. }
  374. .goods-img {
  375. width: 130rpx;
  376. height: 130rpx;
  377. border-radius: 4rpx;
  378. margin-right: 15rpx;
  379. background-color: #EEEEEE;
  380. }
  381. .info {
  382. width: 540rpx;
  383. height: 130rpx;
  384. display: flex;
  385. flex-direction: column;
  386. justify-content: space-around;
  387. .price {
  388. font-size: 32rpx;
  389. color: #F63434;
  390. font-weight: bold;
  391. }
  392. }
  393. .order-num {
  394. font-size: 24rpx;
  395. color: #999999;
  396. display: flex;
  397. justify-content: space-between;
  398. margin-top: 28rpx;
  399. }
  400. }
  401. </style>