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

494 lines
14 KiB

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