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

487 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" v-if="order_details.pick_self == 0">
  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.brand.name}}</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 && order_details.pick_self != 0">
  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">
  136. <text class="lf-color-777">备注</text>
  137. <text class="lf-color-222">{{ order_details.note || '暂无备注' }}</text>
  138. </view>
  139. <view class="lf-row-between lf-font-28 lf-m-t-30" v-if="order_details.pay_time">
  140. <text class="lf-color-777">支付时间</text>
  141. <text class="lf-color-222">{{order_details.pay_time}}</text>
  142. </view>
  143. </view>
  144. <view style="height: 120rpx;margin-top: 20rpx;"></view>
  145. <!-- 待付款 -->
  146. <!-- <view class="order-btn">
  147. <view class="lf-font-28 lf-row-center" style="color:#F63434">
  148. 待付款
  149. </view>
  150. <view class="lf-flex">
  151. <view class="btn-cancel lf-m-r-20">
  152. 取消订单
  153. </view>
  154. <view class="btn-atonce">
  155. 立即付款
  156. </view>
  157. </view>
  158. </view> -->
  159. <!-- 待发货 -->
  160. <view class="order-btn" v-if="order_details.status == 2">
  161. <view class="lf-font-28 lf-row-center lf-color-777">
  162. 待发货
  163. </view>
  164. <view class="lf-flex">
  165. <view style="width: 220rpx;"></view>
  166. <view style="width: 220rpx;"></view>
  167. </view>
  168. </view>
  169. <!-- 代付款 -->
  170. <view class="order-btn" v-if="order_details.status == 1">
  171. <view class="lf-font-28 lf-row-center lf-color-777">
  172. 待付款
  173. </view>
  174. <view class="lf-flex">
  175. <view class="btn-gray lf-m-r-20">取消订单</view>
  176. <view class="btn-red" @click="$url('/pages/order/cashier/cashier?amount='+ order_details.total_yuan+'&order_no='+order_details.order_no)">立即付款</view>
  177. </view>
  178. </view>
  179. <!-- 待收货 -->
  180. <view class="order-btn" v-if="order_details.status == 3">
  181. <view class="lf-font-28 lf-row-center lf-color-black">
  182. 待收货
  183. </view>
  184. <view class="lf-flex">
  185. <view style="width: 220rpx;"></view>
  186. <view class="btn-confirm">
  187. 确认收货
  188. </view>
  189. </view>
  190. </view>
  191. <!-- 已完成 -->
  192. <view class="order-btn" v-if="order_details.status == 4">
  193. <view class="lf-font-28 lf-row-center" style="color: #22A19F;">
  194. 已完成
  195. </view>
  196. <view class="lf-flex">
  197. <view style="width: 220rpx;"></view>
  198. <view style="width: 220rpx;"></view>
  199. </view>
  200. </view>
  201. </view>
  202. </template>
  203. <script>
  204. import lfQrcode from '@/components/lf-code/lf-qrcode.vue';
  205. import countdownTimer from '@/components/countdown-timer/countdown-timer';
  206. export default {
  207. data() {
  208. return {
  209. type: 'default', // point积分订单详情, default默认普通商品订单详情
  210. time: '',
  211. order_no: '',
  212. order_details: '',
  213. countdown_minute: '',
  214. show: false,
  215. pick_type: 0,
  216. config: {
  217. bar: {
  218. code: 'E01181016286106',
  219. color: '#000', // 条形码的颜色
  220. bgColor: '#FFFFFF', // 背景色
  221. width: 586, // 宽度
  222. height: 210 // 高度
  223. },
  224. qrc: {
  225. code: "",
  226. size: 352, // 二维码大小
  227. level: 4, //等级 0~4
  228. bgColor: '#FFFFFF', //二维码背景色 默认白色
  229. // border: {
  230. // color: ['#8A2387', '#F27121'], //边框颜色支持渐变色
  231. // lineWidth: 3, //边框宽度
  232. // },
  233. // img: '/static/logo.png', //图片
  234. // iconSize: 40, //二维码图标的大小
  235. color: '#000000', //边框颜色支持渐变色
  236. }
  237. },
  238. }
  239. },
  240. components: {
  241. countdownTimer,
  242. lfQrcode
  243. },
  244. onLoad(options) {
  245. this.type = options.type || this.type;
  246. this.order_no = options.order_id;
  247. this.pick_type = options.pick_type;
  248. console.log('字体',this.pick_type)
  249. if (this.order_no) {
  250. this.getOrderDetails();
  251. }
  252. },
  253. methods: {
  254. // 点击复制
  255. copy(text) {
  256. uni.setClipboardData({
  257. data: text
  258. });
  259. },
  260. dateFinish() {
  261. this.show = false;
  262. console.log("倒计时结束");
  263. },
  264. countDown(munite, second) {
  265. let m = munite;
  266. let s = second;
  267. let m2, s2;
  268. let _this = this;
  269. let tiem = setInterval(function() {
  270. s--;
  271. if (s < 0) {
  272. s = 59;
  273. m--;
  274. if (m < 0) {
  275. _this.time = '00分00秒';
  276. _this.show = false;
  277. // _this.getOrderDetails();
  278. clearTimeout(tiem);
  279. return;
  280. }
  281. }
  282. m2 = m < 10? '0' + m : m;
  283. s2 = s < 10 ? ('0' + s) : s;
  284. _this.time = m2 + '分' + s2 + '秒';
  285. }, 1000)
  286. },
  287. s_to_hs(s) {
  288. //计算分钟
  289. //算法:将秒数除以60,然后下舍入,既得到分钟数
  290. var h;
  291. h = Math.floor(s / 60);
  292. //计算秒
  293. //算法:取得秒%60的余数,既得到秒数
  294. s = s % 60;
  295. //将变量转换为字符串
  296. h += '';
  297. s += '';
  298. //如果只有一位数,前面增加一个0
  299. // h = (h.length == 1) ? '0' + h : h;
  300. // s = (s.length == 1) ? '0' + s : s;
  301. this.countDown(h,s)
  302. // return h + ':' + s;
  303. },
  304. getTime(){
  305. var date = new Date(),
  306. year = date.getFullYear(),
  307. month = date.getMonth() + 1,
  308. day = date.getDate(),
  309. hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours(),
  310. minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes(),
  311. second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
  312. month >= 1 && month <= 9 ? (month = "0" + month) : "";
  313. day >= 0 && day <= 9 ? (day = "0" + day) : "";
  314. var timer = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second;
  315. return timer;
  316. },
  317. getOrderDetails() {
  318. this.$http.get({
  319. api: 'api/order/' + this.order_no,
  320. header: {
  321. Authorization: this.$cookieStorage.get('user_token')
  322. }
  323. }).then(res => {
  324. this.order_details = res.data.data
  325. this.config.qrc.code = JSON.stringify({
  326. u_id: this.order_details.user_id,
  327. no: this.order_details.order_no
  328. })
  329. var date = this.getTime()
  330. this.time = new Date(this.order_details.will_closed_at).getTime() - new Date(date).getTime()
  331. if(this.time > 0) {
  332. this.show = true;
  333. }
  334. console.log(this.order_details);
  335. })
  336. },
  337. }
  338. }
  339. </script>
  340. <style>
  341. page {
  342. background-color: #F8F8F8;
  343. }
  344. </style>
  345. <style lang="scss" scoped="scoped">
  346. .btn-gray {
  347. width: 220rpx;background: white;height: 90rpx;border-radius: 45rpx;border: 2rpx solid #999999;display: flex;align-items: center;justify-content: center;
  348. color: #777777;
  349. font-size: 28rpx;
  350. }
  351. .btn-red {
  352. width: 220rpx;background: #F63434;height: 90rpx;border-radius: 45rpx;display: flex;align-items: center;justify-content: center;
  353. color: white;
  354. font-size: 28rpx;
  355. }
  356. .tips-waitconfirm {
  357. width: 100%;
  358. height: 113rpx;
  359. background: #15716E;
  360. display: flex;
  361. justify-content: space-between;
  362. padding: 0 32rpx;
  363. align-items: center;
  364. }
  365. .waitconfirm-tag {
  366. width: 136rpx;
  367. height: 53rpx;
  368. border-radius: 27rpx;
  369. border: 2rpx solid #FFFFFF;
  370. font-size: 24rpx;
  371. color: white;
  372. display: flex;
  373. justify-content: center;
  374. align-items: center;
  375. }
  376. .btn-cancel {
  377. width: 220rpx;
  378. height: 90rpx;
  379. border-radius: 45rpx;
  380. border: 2rpx solid #999999;
  381. color: #777;
  382. font-size: 28rpx;
  383. display: flex;
  384. justify-content: center;
  385. align-items: center;
  386. }
  387. .btn-confirm {
  388. width: 220rpx;
  389. height: 90rpx;
  390. border-radius: 45rpx;
  391. background-color: #15716E;
  392. color: #fff;
  393. font-size: 28rpx;
  394. display: flex;
  395. justify-content: center;
  396. align-items: center;
  397. }
  398. .btn-atonce {
  399. width: 220rpx;
  400. height: 90rpx;
  401. border-radius: 45rpx;
  402. background-color: #F63434;
  403. color: #fff;
  404. font-size: 28rpx;
  405. display: flex;
  406. justify-content: center;
  407. align-items: center;
  408. }
  409. .order-btn {
  410. width: 100%;
  411. height: 120rpx;
  412. background: #FFFFFF;
  413. display: flex;
  414. justify-content: space-between;
  415. padding: 0 32rpx;
  416. position: fixed;
  417. bottom: 0;
  418. }
  419. .tips {
  420. display: flex;
  421. background-color: #F63434;
  422. height: 64rpx;
  423. width: 100%;
  424. justify-content: center;
  425. align-items: center;
  426. }
  427. .card {
  428. height: max-content;
  429. width: 750rpx;
  430. padding: 30rpx 32rpx;
  431. background-color: #FFFFFF;
  432. &:nth-child(n+2) {
  433. margin-top: 20rpx;
  434. }
  435. }
  436. .goods {
  437. .shop-name {
  438. font-size: 28rpx;
  439. color: #222222;
  440. font-weight: bold;
  441. margin: 0 15rpx;
  442. }
  443. .goods-img {
  444. width: 130rpx;
  445. height: 130rpx;
  446. border-radius: 4rpx;
  447. margin-right: 15rpx;
  448. background-color: #EEEEEE;
  449. }
  450. .info {
  451. width: 540rpx;
  452. height: 130rpx;
  453. display: flex;
  454. flex-direction: column;
  455. justify-content: space-around;
  456. .price {
  457. font-size: 32rpx;
  458. color: #F63434;
  459. font-weight: bold;
  460. }
  461. }
  462. .order-num {
  463. font-size: 24rpx;
  464. color: #999999;
  465. display: flex;
  466. justify-content: space-between;
  467. margin-top: 28rpx;
  468. }
  469. }
  470. </style>