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

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