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

575 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
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 @click="$url('/pages/shop/shopdetail?id='+ order_details.brand.id)">
  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" @click="$url('/pages/shop/goodsdetail?id='+ item.item_meta.detail_id)"></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">¥{{unitConversion(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">¥{{unitConversion(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. import Bigc from '@/common/js/bigc.js';
  217. export default {
  218. data() {
  219. return {
  220. type: 'default', // point积分订单详情, default默认普通商品订单详情
  221. time: '',
  222. order_no: '',
  223. order_details: '',
  224. countdown_minute: '',
  225. show: false,
  226. pick_type: 0,
  227. config: {
  228. bar: {
  229. code: 'E01181016286106',
  230. color: '#000', // 条形码的颜色
  231. bgColor: '#FFFFFF', // 背景色
  232. width: 586, // 宽度
  233. height: 210 // 高度
  234. },
  235. qrc: {
  236. code: "",
  237. size: 352, // 二维码大小
  238. level: 4, //等级 0~4
  239. bgColor: '#FFFFFF', //二维码背景色 默认白色
  240. // border: {
  241. // color: ['#8A2387', '#F27121'], //边框颜色支持渐变色
  242. // lineWidth: 3, //边框宽度
  243. // },
  244. // img: '/static/logo.png', //图片
  245. // iconSize: 40, //二维码图标的大小
  246. color: '#000000', //边框颜色支持渐变色
  247. }
  248. },
  249. logistics_data: {},
  250. show_count: 0
  251. }
  252. },
  253. components: {
  254. countdownTime,
  255. lfQrcode
  256. },
  257. computed: {
  258. unitConversion(){
  259. return function(val){
  260. return new Bigc(val).div(100);
  261. }
  262. }
  263. },
  264. onLoad(options) {
  265. this.type = options.type || this.type;
  266. this.order_no = options.order_id;
  267. this.pick_type = options.pick_type;
  268. console.log('字体',this.pick_type)
  269. if (this.order_no) {
  270. this.getOrderDetails();
  271. this.searchLogistics();
  272. }
  273. },
  274. onShow(){
  275. this.show_count++;
  276. if(this.show_count > 1){
  277. this.getOrderDetails();
  278. this.searchLogistics();
  279. }
  280. },
  281. methods: {
  282. // 去到付款页面
  283. toPay(){
  284. let order_details = this.order_details;
  285. this.$cookieStorage.set('last_pay_time', order_details.last_pay_time);
  286. this.$url('/pages/order/cashier/cashier?amount='+ order_details.total_yuan+'&order_no='+order_details.order_no)
  287. },
  288. // 确认收货
  289. confirmReceiving(){
  290. this.$http.post({
  291. api: 'api/shopping/order/received',
  292. data: {
  293. order_no: this.order_no
  294. },
  295. header: {
  296. Authorization: this.$cookieStorage.get('user_token')
  297. }
  298. }).then(res => {
  299. if(res.data.status){
  300. this.$msg('确认收货成功', {icon: 'success'}).then(() => {
  301. this.getOrderDetails();
  302. })
  303. }else{
  304. this.$msg(res.data.message || '确认收货失败');
  305. }
  306. })
  307. },
  308. searchLogistics() {
  309. this.$http.get({
  310. api: 'api/express/query',
  311. data: {
  312. no: this.order_no
  313. },
  314. header: {
  315. Authorization: this.$cookieStorage.get('user_token')
  316. }
  317. }).then(res => {
  318. this.logistics_data = res.data.data;
  319. })
  320. },
  321. // 点击复制
  322. copy(text) {
  323. console.log(text)
  324. uni.setClipboardData({
  325. data: text
  326. });
  327. },
  328. dateFinish() {
  329. this.show = false;
  330. console.log("倒计时结束");
  331. },
  332. // 取消订单
  333. cancelOrder(){
  334. this.$http.post({
  335. api: 'api/shopping/order/cancel',
  336. data: {
  337. order_no: this.order_no
  338. },
  339. header: {
  340. Authorization: this.$cookieStorage.get('user_token')
  341. }
  342. }).then(res => {
  343. if(res.data.code == 200){
  344. this.$msg('订单取消成功', {icon: 'success'}).then(() => {
  345. this.$toBack();
  346. })
  347. }else{
  348. this.$msg(res.data.message || '订单取消失败');
  349. }
  350. })
  351. },
  352. countDown(munite, second) {
  353. let m = munite;
  354. let s = second;
  355. let m2, s2;
  356. let _this = this;
  357. let tiem = setInterval(function() {
  358. s--;
  359. if (s < 0) {
  360. s = 59;
  361. m--;
  362. if (m < 0) {
  363. _this.time = '00分00秒';
  364. _this.show = false;
  365. // _this.getOrderDetails();
  366. clearTimeout(tiem);
  367. return;
  368. }
  369. }
  370. m2 = m < 10? '0' + m : m;
  371. s2 = s < 10 ? ('0' + s) : s;
  372. _this.time = m2 + '分' + s2 + '秒';
  373. }, 1000)
  374. },
  375. s_to_hs(s) {
  376. //计算分钟
  377. //算法:将秒数除以60,然后下舍入,既得到分钟数
  378. var h;
  379. h = Math.floor(s / 60);
  380. //计算秒
  381. //算法:取得秒%60的余数,既得到秒数
  382. s = s % 60;
  383. //将变量转换为字符串
  384. h += '';
  385. s += '';
  386. //如果只有一位数,前面增加一个0
  387. // h = (h.length == 1) ? '0' + h : h;
  388. // s = (s.length == 1) ? '0' + s : s;
  389. this.countDown(h,s)
  390. // return h + ':' + s;
  391. },
  392. getTime(){
  393. var date = new Date(),
  394. year = date.getFullYear(),
  395. month = date.getMonth() + 1,
  396. day = date.getDate(),
  397. hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours(),
  398. minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes(),
  399. second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
  400. month >= 1 && month <= 9 ? (month = "0" + month) : "";
  401. day >= 0 && day <= 9 ? (day = "0" + day) : "";
  402. var timer = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second;
  403. return timer;
  404. },
  405. getOrderDetails() {
  406. this.$http.get({
  407. api: 'api/order/' + this.order_no,
  408. header: {
  409. Authorization: this.$cookieStorage.get('user_token')
  410. }
  411. }).then(res => {
  412. this.order_details = res.data.data;
  413. this.config.qrc.code = JSON.stringify({
  414. u_id: this.order_details.user_id,
  415. no: this.order_details.order_no
  416. })
  417. var date = this.getTime()
  418. this.time = new Date(this.order_details.will_closed_at).getTime() - new Date(date).getTime()
  419. if(this.time > 0) {
  420. this.show = true;
  421. }
  422. console.log(this.order_details);
  423. })
  424. },
  425. }
  426. }
  427. </script>
  428. <style>
  429. page {
  430. background-color: #F8F8F8;
  431. }
  432. </style>
  433. <style lang="scss" scoped="scoped">
  434. .btn-gray {
  435. width: 220rpx;background: white;height: 90rpx;border-radius: 45rpx;border: 2rpx solid #999999;display: flex;align-items: center;justify-content: center;
  436. color: #777777;
  437. font-size: 28rpx;
  438. }
  439. .btn-red {
  440. width: 220rpx;background: #F63434;height: 90rpx;border-radius: 45rpx;display: flex;align-items: center;justify-content: center;
  441. color: white;
  442. font-size: 28rpx;
  443. }
  444. .tips-waitconfirm {
  445. width: 100%;
  446. height: max-content;
  447. background: #15716E;
  448. display: flex;
  449. justify-content: space-between;
  450. padding: 10rpx 32rpx;
  451. align-items: center;
  452. }
  453. .waitconfirm-tag {
  454. width: 136rpx;
  455. height: 53rpx;
  456. border-radius: 27rpx;
  457. border: 2rpx solid #FFFFFF;
  458. font-size: 24rpx;
  459. color: white;
  460. display: flex;
  461. justify-content: center;
  462. align-items: center;
  463. }
  464. .btn-cancel {
  465. width: 220rpx;
  466. height: 90rpx;
  467. border-radius: 45rpx;
  468. border: 2rpx solid #999999;
  469. color: #777;
  470. font-size: 28rpx;
  471. display: flex;
  472. justify-content: center;
  473. align-items: center;
  474. }
  475. .btn-confirm {
  476. width: 220rpx;
  477. height: 90rpx;
  478. border-radius: 45rpx;
  479. background-color: #15716E;
  480. color: #fff;
  481. font-size: 28rpx;
  482. display: flex;
  483. justify-content: center;
  484. align-items: center;
  485. }
  486. .btn-atonce {
  487. width: 220rpx;
  488. height: 90rpx;
  489. border-radius: 45rpx;
  490. background-color: #F63434;
  491. color: #fff;
  492. font-size: 28rpx;
  493. display: flex;
  494. justify-content: center;
  495. align-items: center;
  496. }
  497. .order-btn {
  498. width: 100%;
  499. height: 120rpx;
  500. background: #FFFFFF;
  501. display: flex;
  502. justify-content: space-between;
  503. padding: 0 32rpx;
  504. position: fixed;
  505. bottom: 0;
  506. }
  507. .tips {
  508. display: flex;
  509. background-color: #F63434;
  510. height: 64rpx;
  511. width: 100%;
  512. justify-content: center;
  513. align-items: center;
  514. }
  515. .card {
  516. height: max-content;
  517. width: 750rpx;
  518. padding: 30rpx 32rpx;
  519. background-color: #FFFFFF;
  520. &:nth-child(n+2) {
  521. margin-top: 20rpx;
  522. }
  523. }
  524. .goods {
  525. .shop-name {
  526. font-size: 28rpx;
  527. color: #222222;
  528. font-weight: bold;
  529. margin: 0 15rpx;
  530. }
  531. .goods-img {
  532. width: 130rpx;
  533. height: 130rpx;
  534. border-radius: 4rpx;
  535. margin-right: 15rpx;
  536. background-color: #EEEEEE;
  537. }
  538. .info {
  539. width: 540rpx;
  540. height: 130rpx;
  541. display: flex;
  542. flex-direction: column;
  543. justify-content: space-around;
  544. .price {
  545. font-size: 32rpx;
  546. color: #F63434;
  547. font-weight: bold;
  548. }
  549. }
  550. .order-num {
  551. font-size: 24rpx;
  552. color: #999999;
  553. display: flex;
  554. justify-content: space-between;
  555. margin-top: 28rpx;
  556. }
  557. }
  558. </style>