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

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