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

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