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

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