金诚优选前端代码
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.

438 lines
12 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
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 == 1">
  152. <view class="lf-font-28 lf-row-center lf-color-777">
  153. 待付款
  154. </view>
  155. <view class="lf-flex">
  156. <view class="btn-gray lf-m-r-20">取消订单</view>
  157. <view class="btn-red" @click="$url('/pages/order/cashier/cashier?amount='+ order_details.total_yuan+'&order_no='+order_details.order_no)">立即付款</view>
  158. </view>
  159. </view>
  160. <!-- 待收货 -->
  161. <view class="order-btn" v-if="order_details.status == 3">
  162. <view class="lf-font-28 lf-row-center lf-color-black">
  163. 待收货
  164. </view>
  165. <view class="lf-flex">
  166. <view style="width: 220rpx;"></view>
  167. <view class="btn-confirm">
  168. 确认收货
  169. </view>
  170. </view>
  171. </view>
  172. <!-- 已完成 -->
  173. <view class="order-btn" v-if="order_details.status == 4">
  174. <view class="lf-font-28 lf-row-center" style="color: #22A19F;">
  175. 已完成
  176. </view>
  177. <view class="lf-flex">
  178. <view style="width: 220rpx;"></view>
  179. <view style="width: 220rpx;"></view>
  180. </view>
  181. </view>
  182. </view>
  183. </template>
  184. <script>
  185. import countdownTimer from '@/components/countdown-timer/countdown-timer';
  186. export default {
  187. data() {
  188. return {
  189. type: 'default', // point积分订单详情, default默认普通商品订单详情
  190. time: '',
  191. order_no: '',
  192. order_details: '',
  193. countdown_minute: '',
  194. time: '',
  195. show: false
  196. }
  197. },
  198. components: {
  199. countdownTimer
  200. },
  201. onLoad(options) {
  202. this.type = options.type || this.type;
  203. this.order_no = options.order_id;
  204. if (this.order_no) {
  205. this.getOrderDetails();
  206. }
  207. },
  208. methods: {
  209. // 点击复制
  210. copy(text) {
  211. uni.setClipboardData({
  212. data: text
  213. });
  214. },
  215. dateFinish() {
  216. this.show = false;
  217. console.log("倒计时结束");
  218. },
  219. countDown(munite, second) {
  220. let m = munite;
  221. let s = second;
  222. let m2, s2;
  223. let _this = this;
  224. let tiem = setInterval(function() {
  225. s--;
  226. if (s < 0) {
  227. s = 59;
  228. m--;
  229. if (m < 0) {
  230. _this.time = '00分00秒';
  231. _this.show = false;
  232. // _this.getOrderDetails();
  233. clearTimeout(tiem);
  234. return;
  235. }
  236. }
  237. m2 = m < 10? '0' + m : m;
  238. s2 = s < 10 ? ('0' + s) : s;
  239. _this.time = m2 + '分' + s2 + '秒';
  240. }, 1000)
  241. },
  242. s_to_hs(s) {
  243. //计算分钟
  244. //算法:将秒数除以60,然后下舍入,既得到分钟数
  245. var h;
  246. h = Math.floor(s / 60);
  247. //计算秒
  248. //算法:取得秒%60的余数,既得到秒数
  249. s = s % 60;
  250. //将变量转换为字符串
  251. h += '';
  252. s += '';
  253. //如果只有一位数,前面增加一个0
  254. // h = (h.length == 1) ? '0' + h : h;
  255. // s = (s.length == 1) ? '0' + s : s;
  256. this.countDown(h,s)
  257. // return h + ':' + s;
  258. },
  259. getTime(){
  260. var date = new Date(),
  261. year = date.getFullYear(),
  262. month = date.getMonth() + 1,
  263. day = date.getDate(),
  264. hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours(),
  265. minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes(),
  266. second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
  267. month >= 1 && month <= 9 ? (month = "0" + month) : "";
  268. day >= 0 && day <= 9 ? (day = "0" + day) : "";
  269. var timer = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second;
  270. return timer;
  271. },
  272. getOrderDetails() {
  273. this.$http.get({
  274. api: 'api/order/' + this.order_no,
  275. header: {
  276. Authorization: this.$cookieStorage.get('user_token')
  277. }
  278. }).then(res => {
  279. this.order_details = res.data.data
  280. var date = this.getTime()
  281. this.time = new Date(this.order_details.will_closed_at).getTime() - new Date(date).getTime()
  282. if(this.time > 0) {
  283. this.show = true;
  284. }
  285. console.log(this.order_details);
  286. })
  287. },
  288. }
  289. }
  290. </script>
  291. <style>
  292. page {
  293. background-color: #F8F8F8;
  294. }
  295. </style>
  296. <style lang="scss" scoped="scoped">
  297. .btn-gray {
  298. width: 220rpx;background: white;height: 90rpx;border-radius: 45rpx;border: 2rpx solid #999999;display: flex;align-items: center;justify-content: center;
  299. color: #777777;
  300. font-size: 28rpx;
  301. }
  302. .btn-red {
  303. width: 220rpx;background: #F63434;height: 90rpx;border-radius: 45rpx;display: flex;align-items: center;justify-content: center;
  304. color: white;
  305. font-size: 28rpx;
  306. }
  307. .tips-waitconfirm {
  308. width: 100%;
  309. height: 113rpx;
  310. background: #15716E;
  311. display: flex;
  312. justify-content: space-between;
  313. padding: 0 32rpx;
  314. align-items: center;
  315. }
  316. .waitconfirm-tag {
  317. width: 136rpx;
  318. height: 53rpx;
  319. border-radius: 27rpx;
  320. border: 2rpx solid #FFFFFF;
  321. font-size: 24rpx;
  322. color: white;
  323. display: flex;
  324. justify-content: center;
  325. align-items: center;
  326. }
  327. .btn-cancel {
  328. width: 220rpx;
  329. height: 90rpx;
  330. border-radius: 45rpx;
  331. border: 2rpx solid #999999;
  332. color: #777;
  333. font-size: 28rpx;
  334. display: flex;
  335. justify-content: center;
  336. align-items: center;
  337. }
  338. .btn-confirm {
  339. width: 220rpx;
  340. height: 90rpx;
  341. border-radius: 45rpx;
  342. background-color: #15716E;
  343. color: #fff;
  344. font-size: 28rpx;
  345. display: flex;
  346. justify-content: center;
  347. align-items: center;
  348. }
  349. .btn-atonce {
  350. width: 220rpx;
  351. height: 90rpx;
  352. border-radius: 45rpx;
  353. background-color: #F63434;
  354. color: #fff;
  355. font-size: 28rpx;
  356. display: flex;
  357. justify-content: center;
  358. align-items: center;
  359. }
  360. .order-btn {
  361. width: 100%;
  362. height: 120rpx;
  363. background: #FFFFFF;
  364. display: flex;
  365. justify-content: space-between;
  366. padding: 0 32rpx;
  367. position: fixed;
  368. bottom: 0;
  369. }
  370. .tips {
  371. display: flex;
  372. background-color: #F63434;
  373. height: 64rpx;
  374. width: 100%;
  375. justify-content: center;
  376. align-items: center;
  377. }
  378. .card {
  379. height: max-content;
  380. width: 750rpx;
  381. padding: 30rpx 32rpx;
  382. background-color: #FFFFFF;
  383. &:nth-child(n+2) {
  384. margin-top: 20rpx;
  385. }
  386. }
  387. .goods {
  388. .shop-name {
  389. font-size: 28rpx;
  390. color: #222222;
  391. font-weight: bold;
  392. margin: 0 15rpx;
  393. }
  394. .goods-img {
  395. width: 130rpx;
  396. height: 130rpx;
  397. border-radius: 4rpx;
  398. margin-right: 15rpx;
  399. background-color: #EEEEEE;
  400. }
  401. .info {
  402. width: 540rpx;
  403. height: 130rpx;
  404. display: flex;
  405. flex-direction: column;
  406. justify-content: space-around;
  407. .price {
  408. font-size: 32rpx;
  409. color: #F63434;
  410. font-weight: bold;
  411. }
  412. }
  413. .order-num {
  414. font-size: 24rpx;
  415. color: #999999;
  416. display: flex;
  417. justify-content: space-between;
  418. margin-top: 28rpx;
  419. }
  420. }
  421. </style>