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

557 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
  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="$url('/pages/order/cashier/cashier?amount='+ order_details.total_yuan+'&order_no='+order_details.order_no)">立即付款</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. confirmReceiving(){
  276. this.$http.post({
  277. api: 'api/shopping/order/received',
  278. data: {
  279. order_no: this.order_no
  280. },
  281. header: {
  282. Authorization: this.$cookieStorage.get('user_token')
  283. }
  284. }).then(res => {
  285. this.$msg(res.data.message).then(() => {
  286. this.getOrderDetails();
  287. })
  288. })
  289. },
  290. searchLogistics() {
  291. this.$http.get({
  292. api: 'api/express/query',
  293. data: {
  294. no: this.order_no
  295. },
  296. header: {
  297. Authorization: this.$cookieStorage.get('user_token')
  298. }
  299. }).then(res => {
  300. this.logistics_data = res.data.data;
  301. })
  302. },
  303. // 点击复制
  304. copy(text) {
  305. console.log(text)
  306. uni.setClipboardData({
  307. data: text
  308. });
  309. },
  310. dateFinish() {
  311. this.show = false;
  312. console.log("倒计时结束");
  313. },
  314. // 取消订单
  315. cancelOrder(){
  316. this.$http.post({
  317. api: 'api/shopping/order/cancel',
  318. data: {
  319. order_no: this.order_no
  320. },
  321. header: {
  322. Authorization: this.$cookieStorage.get('user_token')
  323. }
  324. }).then(res => {
  325. if(res.data.code == 200){
  326. this.$msg('订单取消成功', {icon: 'success'}).then(() => {
  327. this.$toBack();
  328. })
  329. }else{
  330. this.$msg(res.data.message || '订单取消失败');
  331. }
  332. })
  333. },
  334. countDown(munite, second) {
  335. let m = munite;
  336. let s = second;
  337. let m2, s2;
  338. let _this = this;
  339. let tiem = setInterval(function() {
  340. s--;
  341. if (s < 0) {
  342. s = 59;
  343. m--;
  344. if (m < 0) {
  345. _this.time = '00分00秒';
  346. _this.show = false;
  347. // _this.getOrderDetails();
  348. clearTimeout(tiem);
  349. return;
  350. }
  351. }
  352. m2 = m < 10? '0' + m : m;
  353. s2 = s < 10 ? ('0' + s) : s;
  354. _this.time = m2 + '分' + s2 + '秒';
  355. }, 1000)
  356. },
  357. s_to_hs(s) {
  358. //计算分钟
  359. //算法:将秒数除以60,然后下舍入,既得到分钟数
  360. var h;
  361. h = Math.floor(s / 60);
  362. //计算秒
  363. //算法:取得秒%60的余数,既得到秒数
  364. s = s % 60;
  365. //将变量转换为字符串
  366. h += '';
  367. s += '';
  368. //如果只有一位数,前面增加一个0
  369. // h = (h.length == 1) ? '0' + h : h;
  370. // s = (s.length == 1) ? '0' + s : s;
  371. this.countDown(h,s)
  372. // return h + ':' + s;
  373. },
  374. getTime(){
  375. var date = new Date(),
  376. year = date.getFullYear(),
  377. month = date.getMonth() + 1,
  378. day = date.getDate(),
  379. hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours(),
  380. minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes(),
  381. second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
  382. month >= 1 && month <= 9 ? (month = "0" + month) : "";
  383. day >= 0 && day <= 9 ? (day = "0" + day) : "";
  384. var timer = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second;
  385. return timer;
  386. },
  387. getOrderDetails() {
  388. this.$http.get({
  389. api: 'api/order/' + this.order_no,
  390. header: {
  391. Authorization: this.$cookieStorage.get('user_token')
  392. }
  393. }).then(res => {
  394. this.order_details = res.data.data;
  395. this.config.qrc.code = JSON.stringify({
  396. u_id: this.order_details.user_id,
  397. no: this.order_details.order_no
  398. })
  399. var date = this.getTime()
  400. this.time = new Date(this.order_details.will_closed_at).getTime() - new Date(date).getTime()
  401. if(this.time > 0) {
  402. this.show = true;
  403. }
  404. console.log(this.order_details);
  405. })
  406. },
  407. }
  408. }
  409. </script>
  410. <style>
  411. page {
  412. background-color: #F8F8F8;
  413. }
  414. </style>
  415. <style lang="scss" scoped="scoped">
  416. .btn-gray {
  417. width: 220rpx;background: white;height: 90rpx;border-radius: 45rpx;border: 2rpx solid #999999;display: flex;align-items: center;justify-content: center;
  418. color: #777777;
  419. font-size: 28rpx;
  420. }
  421. .btn-red {
  422. width: 220rpx;background: #F63434;height: 90rpx;border-radius: 45rpx;display: flex;align-items: center;justify-content: center;
  423. color: white;
  424. font-size: 28rpx;
  425. }
  426. .tips-waitconfirm {
  427. width: 100%;
  428. height: max-content;
  429. background: #15716E;
  430. display: flex;
  431. justify-content: space-between;
  432. padding: 10rpx 32rpx;
  433. align-items: center;
  434. }
  435. .waitconfirm-tag {
  436. width: 136rpx;
  437. height: 53rpx;
  438. border-radius: 27rpx;
  439. border: 2rpx solid #FFFFFF;
  440. font-size: 24rpx;
  441. color: white;
  442. display: flex;
  443. justify-content: center;
  444. align-items: center;
  445. }
  446. .btn-cancel {
  447. width: 220rpx;
  448. height: 90rpx;
  449. border-radius: 45rpx;
  450. border: 2rpx solid #999999;
  451. color: #777;
  452. font-size: 28rpx;
  453. display: flex;
  454. justify-content: center;
  455. align-items: center;
  456. }
  457. .btn-confirm {
  458. width: 220rpx;
  459. height: 90rpx;
  460. border-radius: 45rpx;
  461. background-color: #15716E;
  462. color: #fff;
  463. font-size: 28rpx;
  464. display: flex;
  465. justify-content: center;
  466. align-items: center;
  467. }
  468. .btn-atonce {
  469. width: 220rpx;
  470. height: 90rpx;
  471. border-radius: 45rpx;
  472. background-color: #F63434;
  473. color: #fff;
  474. font-size: 28rpx;
  475. display: flex;
  476. justify-content: center;
  477. align-items: center;
  478. }
  479. .order-btn {
  480. width: 100%;
  481. height: 120rpx;
  482. background: #FFFFFF;
  483. display: flex;
  484. justify-content: space-between;
  485. padding: 0 32rpx;
  486. position: fixed;
  487. bottom: 0;
  488. }
  489. .tips {
  490. display: flex;
  491. background-color: #F63434;
  492. height: 64rpx;
  493. width: 100%;
  494. justify-content: center;
  495. align-items: center;
  496. }
  497. .card {
  498. height: max-content;
  499. width: 750rpx;
  500. padding: 30rpx 32rpx;
  501. background-color: #FFFFFF;
  502. &:nth-child(n+2) {
  503. margin-top: 20rpx;
  504. }
  505. }
  506. .goods {
  507. .shop-name {
  508. font-size: 28rpx;
  509. color: #222222;
  510. font-weight: bold;
  511. margin: 0 15rpx;
  512. }
  513. .goods-img {
  514. width: 130rpx;
  515. height: 130rpx;
  516. border-radius: 4rpx;
  517. margin-right: 15rpx;
  518. background-color: #EEEEEE;
  519. }
  520. .info {
  521. width: 540rpx;
  522. height: 130rpx;
  523. display: flex;
  524. flex-direction: column;
  525. justify-content: space-around;
  526. .price {
  527. font-size: 32rpx;
  528. color: #F63434;
  529. font-weight: bold;
  530. }
  531. }
  532. .order-num {
  533. font-size: 24rpx;
  534. color: #999999;
  535. display: flex;
  536. justify-content: space-between;
  537. margin-top: 28rpx;
  538. }
  539. }
  540. </style>