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

484 lines
14 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 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;" v-if="order_details.pick_self == 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" style="margin-top: 0;" v-else>
  41. <view class="lf-font-28">
  42. <text class="lf-color-222 lf-font-bold">{{order_details.brand.name}}</text>
  43. <text class="lf-color-777 lf-m-l-20">{{order_details.brand.tel}}</text>
  44. </view>
  45. <view class="lf-font-28 lf-color-333 lf-m-t-20">
  46. <text>{{order_details.brand.floor}}</text>
  47. </view>
  48. </view>
  49. <view class="card goods">
  50. <view>
  51. <text class="lf-iconfont icon-Group- lf-font-30"></text>
  52. <text class="shop-name">{{order_details.from}}</text>
  53. <text class="lf-iconfont icon-xiangyou lf-font-24"></text>
  54. </view>
  55. <view class="lf-flex lf-m-t-20" v-for="(item,index) of order_details.items" :key="index">
  56. <image class="goods-img" :src="item.item_meta.image"></image>
  57. <view class="info">
  58. <view class="lf-font-26 lf-color-333 lf-line-1">{{item.item_name}}</view>
  59. <view class="lf-font-24 lf-color-777">{{item.item_meta.specs_text}}</view>
  60. <view class="lf-row-between" style="line-height: 1;">
  61. <text class="price">¥{{item.total_yuan}}</text>
  62. <text class="lf-font-28 lf-color-777">x {{item.quantity}}</text>
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. <view style="margin-top: 60rpx;display: flex;justify-content: center;" v-if="$isRight(order_details) && order_details.status == 2">
  68. <view class="lf-flex-column">
  69. <lf-qrcode :options="config.qrc"></lf-qrcode>
  70. <view class="lf-font-28 lf-row-center" style="color: #15716E;">{{order_details.status_text}}</view>
  71. </view>
  72. </view>
  73. <view class="card" v-if="type == 'point'">
  74. <view class="lf-row-between lf-font-28">
  75. <text class="lf-color-777">积分数量</text>
  76. <text class="lf-color-222">{{order_details.redeem_point}}</text>
  77. </view>
  78. <view class="lf-row-between lf-m-t-30 lf-font-28">
  79. <text class="lf-color-777">应付运费</text>
  80. <text class="lf-color-222">+¥{{order_details.payable_freight}}</text>
  81. </view>
  82. <view class="lf-row-between lf-m-t-30 lf-font-28">
  83. <text class="lf-color-777">实付运费</text>
  84. <text class="lf-color-222">+¥{{order_details.real_freight}}</text>
  85. </view>
  86. </view>
  87. <view class="card" v-if="type == 'default'">
  88. <view class="lf-row-between lf-font-28">
  89. <text class="lf-color-777">优惠券</text>
  90. <text style="color: #F63434;">-¥20</text>
  91. </view>
  92. <view class="lf-row-between lf-m-t-30 lf-font-28">
  93. <text class="lf-color-777">运费</text>
  94. <text class="lf-color-222">+¥10</text>
  95. </view>
  96. <view class="lf-row-between lf-m-t-30 lf-font-28">
  97. <text class="lf-color-777">订单总价</text>
  98. <text class="lf-color-222">¥{{order_details.total_yuan}}</text>
  99. </view>
  100. </view>
  101. <view class="card">
  102. <view class="lf-row-between lf-font-28">
  103. <text class="lf-color-777">商品订单编号</text>
  104. <text>
  105. <text class="lf-color-222">{{order_details.order_no}}</text>
  106. <text class="lf-font-28 lf-m-l-20" style="color: #22A19F;"
  107. @click="copy(order_details.order_no)">复制</text>
  108. </text>
  109. </view>
  110. <view class="lf-row-between lf-font-28 lf-m-t-30">
  111. <text class="lf-color-777">创建时间</text>
  112. <text class="lf-color-222">{{order_details.created_at}}</text>
  113. </view>
  114. <!-- <view class="lf-row-between lf-font-28 lf-m-t-30">
  115. <text class="lf-color-777">留言</text>
  116. <text class="lf-color-222">暂无留言</text>
  117. </view> -->
  118. <view class="lf-row-between lf-font-28 lf-m-t-30" v-if="order_details.status_text">
  119. <text class="lf-color-777">订单状态</text>
  120. <text class="lf-color-222">{{order_details.status_text}}</text>
  121. </view>
  122. <!-- 待发货 -->
  123. <view class="lf-row-between lf-font-28 lf-m-t-30">
  124. <text class="lf-color-777">支付方式</text>
  125. <text class="lf-color-222">{{order_details.payment_text}}</text>
  126. </view>
  127. <view class="lf-row-between lf-font-28 lf-m-t-30" v-if="order_details.pick_self == 0">
  128. <text class="lf-color-777">收货方式</text>
  129. <text class="lf-color-222">快递</text>
  130. </view>
  131. <view class="lf-row-between lf-font-28 lf-m-t-30" v-else>
  132. <text class="lf-color-777">收货方式</text>
  133. <text class="lf-color-222">自提</text>
  134. </view>
  135. <view class="lf-row-between lf-font-28 lf-m-t-30" v-if="order_details.pay_time">
  136. <text class="lf-color-777">支付时间</text>
  137. <text class="lf-color-222">{{order_details.pay_time}}</text>
  138. </view>
  139. </view>
  140. <view style="height: 120rpx;margin-top: 20rpx;"></view>
  141. <!-- 待付款 -->
  142. <!-- <view class="order-btn">
  143. <view class="lf-font-28 lf-row-center" style="color:#F63434">
  144. 待付款
  145. </view>
  146. <view class="lf-flex">
  147. <view class="btn-cancel lf-m-r-20">
  148. 取消订单
  149. </view>
  150. <view class="btn-atonce">
  151. 立即付款
  152. </view>
  153. </view>
  154. </view> -->
  155. <!-- 待发货 -->
  156. <view class="order-btn" v-if="order_details.status == 2">
  157. <view class="lf-font-28 lf-row-center lf-color-777">
  158. 待发货
  159. </view>
  160. <view class="lf-flex">
  161. <view style="width: 220rpx;"></view>
  162. <view style="width: 220rpx;"></view>
  163. </view>
  164. </view>
  165. <!-- 代付款 -->
  166. <view class="order-btn" v-if="order_details.status == 1">
  167. <view class="lf-font-28 lf-row-center lf-color-777">
  168. 待付款
  169. </view>
  170. <view class="lf-flex">
  171. <view class="btn-gray lf-m-r-20">取消订单</view>
  172. <view class="btn-red" @click="$url('/pages/order/cashier/cashier?amount='+ order_details.total_yuan+'&order_no='+order_details.order_no)">立即付款</view>
  173. </view>
  174. </view>
  175. <!-- 待收货 -->
  176. <view class="order-btn" v-if="order_details.status == 3">
  177. <view class="lf-font-28 lf-row-center lf-color-black">
  178. 待收货
  179. </view>
  180. <view class="lf-flex">
  181. <view style="width: 220rpx;"></view>
  182. <view class="btn-confirm">
  183. 确认收货
  184. </view>
  185. </view>
  186. </view>
  187. <!-- 已完成 -->
  188. <view class="order-btn" v-if="order_details.status == 4">
  189. <view class="lf-font-28 lf-row-center" style="color: #22A19F;">
  190. 已完成
  191. </view>
  192. <view class="lf-flex">
  193. <view style="width: 220rpx;"></view>
  194. <view style="width: 220rpx;"></view>
  195. </view>
  196. </view>
  197. </view>
  198. </template>
  199. <script>
  200. import lfQrcode from '@/components/lf-code/lf-qrcode.vue';
  201. import countdownTimer from '@/components/countdown-timer/countdown-timer';
  202. export default {
  203. data() {
  204. return {
  205. type: 'default', // point积分订单详情, default默认普通商品订单详情
  206. time: '',
  207. order_no: '',
  208. order_details: '',
  209. countdown_minute: '',
  210. time: '',
  211. show: false,
  212. pick_type: 0,
  213. config: {
  214. bar: {
  215. code: 'E01181016286106',
  216. color: '#000', // 条形码的颜色
  217. bgColor: '#FFFFFF', // 背景色
  218. width: 586, // 宽度
  219. height: 210 // 高度
  220. },
  221. qrc: {
  222. code: "",
  223. size: 352, // 二维码大小
  224. level: 4, //等级 0~4
  225. bgColor: '#FFFFFF', //二维码背景色 默认白色
  226. // border: {
  227. // color: ['#8A2387', '#F27121'], //边框颜色支持渐变色
  228. // lineWidth: 3, //边框宽度
  229. // },
  230. // img: '/static/logo.png', //图片
  231. // iconSize: 40, //二维码图标的大小
  232. color: '#000000', //边框颜色支持渐变色
  233. }
  234. },
  235. }
  236. },
  237. components: {
  238. countdownTimer,
  239. lfQrcode
  240. },
  241. onLoad(options) {
  242. this.type = options.type || this.type;
  243. this.order_no = options.order_id;
  244. this.pick_type = options.pick_type;
  245. console.log('字体',this.pick_type)
  246. if (this.order_no) {
  247. this.getOrderDetails();
  248. }
  249. },
  250. methods: {
  251. // 点击复制
  252. copy(text) {
  253. uni.setClipboardData({
  254. data: text
  255. });
  256. },
  257. dateFinish() {
  258. this.show = false;
  259. console.log("倒计时结束");
  260. },
  261. countDown(munite, second) {
  262. let m = munite;
  263. let s = second;
  264. let m2, s2;
  265. let _this = this;
  266. let tiem = setInterval(function() {
  267. s--;
  268. if (s < 0) {
  269. s = 59;
  270. m--;
  271. if (m < 0) {
  272. _this.time = '00分00秒';
  273. _this.show = false;
  274. // _this.getOrderDetails();
  275. clearTimeout(tiem);
  276. return;
  277. }
  278. }
  279. m2 = m < 10? '0' + m : m;
  280. s2 = s < 10 ? ('0' + s) : s;
  281. _this.time = m2 + '分' + s2 + '秒';
  282. }, 1000)
  283. },
  284. s_to_hs(s) {
  285. //计算分钟
  286. //算法:将秒数除以60,然后下舍入,既得到分钟数
  287. var h;
  288. h = Math.floor(s / 60);
  289. //计算秒
  290. //算法:取得秒%60的余数,既得到秒数
  291. s = s % 60;
  292. //将变量转换为字符串
  293. h += '';
  294. s += '';
  295. //如果只有一位数,前面增加一个0
  296. // h = (h.length == 1) ? '0' + h : h;
  297. // s = (s.length == 1) ? '0' + s : s;
  298. this.countDown(h,s)
  299. // return h + ':' + s;
  300. },
  301. getTime(){
  302. var date = new Date(),
  303. year = date.getFullYear(),
  304. month = date.getMonth() + 1,
  305. day = date.getDate(),
  306. hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours(),
  307. minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes(),
  308. second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
  309. month >= 1 && month <= 9 ? (month = "0" + month) : "";
  310. day >= 0 && day <= 9 ? (day = "0" + day) : "";
  311. var timer = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second;
  312. return timer;
  313. },
  314. getOrderDetails() {
  315. this.$http.get({
  316. api: 'api/order/' + this.order_no,
  317. header: {
  318. Authorization: this.$cookieStorage.get('user_token')
  319. }
  320. }).then(res => {
  321. this.order_details = res.data.data
  322. this.config.qrc.code = JSON.stringify({
  323. u_id: this.order_details.user_id,
  324. no: this.order_details.order_no
  325. })
  326. var date = this.getTime()
  327. this.time = new Date(this.order_details.will_closed_at).getTime() - new Date(date).getTime()
  328. if(this.time > 0) {
  329. this.show = true;
  330. }
  331. console.log(this.order_details);
  332. })
  333. },
  334. }
  335. }
  336. </script>
  337. <style>
  338. page {
  339. background-color: #F8F8F8;
  340. }
  341. </style>
  342. <style lang="scss" scoped="scoped">
  343. .btn-gray {
  344. width: 220rpx;background: white;height: 90rpx;border-radius: 45rpx;border: 2rpx solid #999999;display: flex;align-items: center;justify-content: center;
  345. color: #777777;
  346. font-size: 28rpx;
  347. }
  348. .btn-red {
  349. width: 220rpx;background: #F63434;height: 90rpx;border-radius: 45rpx;display: flex;align-items: center;justify-content: center;
  350. color: white;
  351. font-size: 28rpx;
  352. }
  353. .tips-waitconfirm {
  354. width: 100%;
  355. height: 113rpx;
  356. background: #15716E;
  357. display: flex;
  358. justify-content: space-between;
  359. padding: 0 32rpx;
  360. align-items: center;
  361. }
  362. .waitconfirm-tag {
  363. width: 136rpx;
  364. height: 53rpx;
  365. border-radius: 27rpx;
  366. border: 2rpx solid #FFFFFF;
  367. font-size: 24rpx;
  368. color: white;
  369. display: flex;
  370. justify-content: center;
  371. align-items: center;
  372. }
  373. .btn-cancel {
  374. width: 220rpx;
  375. height: 90rpx;
  376. border-radius: 45rpx;
  377. border: 2rpx solid #999999;
  378. color: #777;
  379. font-size: 28rpx;
  380. display: flex;
  381. justify-content: center;
  382. align-items: center;
  383. }
  384. .btn-confirm {
  385. width: 220rpx;
  386. height: 90rpx;
  387. border-radius: 45rpx;
  388. background-color: #15716E;
  389. color: #fff;
  390. font-size: 28rpx;
  391. display: flex;
  392. justify-content: center;
  393. align-items: center;
  394. }
  395. .btn-atonce {
  396. width: 220rpx;
  397. height: 90rpx;
  398. border-radius: 45rpx;
  399. background-color: #F63434;
  400. color: #fff;
  401. font-size: 28rpx;
  402. display: flex;
  403. justify-content: center;
  404. align-items: center;
  405. }
  406. .order-btn {
  407. width: 100%;
  408. height: 120rpx;
  409. background: #FFFFFF;
  410. display: flex;
  411. justify-content: space-between;
  412. padding: 0 32rpx;
  413. position: fixed;
  414. bottom: 0;
  415. }
  416. .tips {
  417. display: flex;
  418. background-color: #F63434;
  419. height: 64rpx;
  420. width: 100%;
  421. justify-content: center;
  422. align-items: center;
  423. }
  424. .card {
  425. height: max-content;
  426. width: 750rpx;
  427. padding: 30rpx 32rpx;
  428. background-color: #FFFFFF;
  429. &:nth-child(n+2) {
  430. margin-top: 20rpx;
  431. }
  432. }
  433. .goods {
  434. .shop-name {
  435. font-size: 28rpx;
  436. color: #222222;
  437. font-weight: bold;
  438. margin: 0 15rpx;
  439. }
  440. .goods-img {
  441. width: 130rpx;
  442. height: 130rpx;
  443. border-radius: 4rpx;
  444. margin-right: 15rpx;
  445. background-color: #EEEEEE;
  446. }
  447. .info {
  448. width: 540rpx;
  449. height: 130rpx;
  450. display: flex;
  451. flex-direction: column;
  452. justify-content: space-around;
  453. .price {
  454. font-size: 32rpx;
  455. color: #F63434;
  456. font-weight: bold;
  457. }
  458. }
  459. .order-num {
  460. font-size: 24rpx;
  461. color: #999999;
  462. display: flex;
  463. justify-content: space-between;
  464. margin-top: 28rpx;
  465. }
  466. }
  467. </style>