index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  1. <template>
  2. <view class="setMealDetail">
  3. <image :src="'https://biaodianfuhao.oss-cn-beijing.aliyuncs.com/'+setMeal.imgUrl" alt="">
  4. <view class="header-card">
  5. <view class="header">
  6. {{setMeal.name}}
  7. </view>
  8. <view class="content">
  9. {{setMeal.title}}
  10. </view>
  11. <view class="bottom">
  12. <view class="left">
  13. {{setMeal.endTime}}
  14. </view>
  15. <view class="right">
  16. 已售{{setMeal.buyNum}}
  17. </view>
  18. </view>
  19. </view>
  20. <!-- 套餐项目 -->
  21. <view class="servicesAvailable">
  22. <view class="header">
  23. <view class="title">
  24. 套餐项目
  25. </view>
  26. <view class="border"></view>
  27. </view>
  28. <view class="body" v-for="(item, index) in setMeal.serviceList" :key="index">
  29. <view class="title">
  30. {{item.serviceName}}
  31. </view>
  32. <view class="border">
  33. </view>
  34. <view class="length">
  35. ×{{item.sum||0}}
  36. </view>
  37. </view>
  38. </view>
  39. <!-- 可用门店 -->
  40. <view class="shop">
  41. <view class="header">
  42. <view class="title">
  43. 可用门店
  44. </view>
  45. <view class="border"></view>
  46. </view>
  47. <view class="flexView">
  48. <view class="body" v-for="(item, index) in setMeal.shopList" :key="index">
  49. <image :src="'https://biaodianfuhao.oss-cn-beijing.aliyuncs.com/'+item.logoUrl" alt="">
  50. <view class="subbody">
  51. <view class="title">
  52. {{item.name}}
  53. </view>
  54. <view class="content">
  55. <view class="location">
  56. {{item.address}}
  57. </view>
  58. <view class="right">
  59. <image :src="require('../../../../static/address.png')" alt="">
  60. <view class="km">
  61. {{item.distance}}km
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. <!-- 套餐详情 -->
  70. <view class="detail">
  71. <view class="header">
  72. <view class="title">
  73. 套餐详情
  74. </view>
  75. <view class="border"></view>
  76. </view>
  77. <view class="content">
  78. {{setMeal.title}}
  79. </view>
  80. </view>
  81. <view style="height: 200rpx;">
  82. </view>
  83. <!-- 底部按钮 -->
  84. <view class="bottomBtn">
  85. <view class="leftView">
  86. <view class="chooseNum">
  87. <view style="font-size: 26rpx;">
  88. </view>
  89. <view style="font-size: 56rpx;">
  90. {{price}}
  91. </view>
  92. </view>
  93. </view>
  94. <view class="rightView" @click="routerTo()">
  95. 立即购买
  96. </view>
  97. </view>
  98. </view>
  99. </template>
  100. <script>
  101. const app = getApp();
  102. import {
  103. packageDetail
  104. } from "@/api/maintain.js";
  105. import {
  106. getUserCar
  107. } from "@/api/shop.js"
  108. export default {
  109. components: {},
  110. data() {
  111. return {
  112. setMeal: {},
  113. shopList: [{
  114. name: "海通洗车华南店",
  115. url: "https://biaodianfuhao.oss-cn-beijing.aliyuncs.com/1539087000475328514.png",
  116. location: "大连市甘井子区友好路236号 拷贝 3",
  117. km: "8.9km"
  118. },
  119. {
  120. name: "海通洗车华南店",
  121. url: "https://biaodianfuhao.oss-cn-beijing.aliyuncs.com/1539087000475328514.png",
  122. location: "大连市甘井子区友好路236号 拷贝 3",
  123. km: "8.9km"
  124. },
  125. {
  126. name: "海通洗车华南店",
  127. url: "https://biaodianfuhao.oss-cn-beijing.aliyuncs.com/1539087000475328514.png",
  128. location: "大连市甘井子区友好路236号 拷贝 3",
  129. km: "8.9km"
  130. },
  131. {
  132. name: "海通洗车华南店",
  133. url: "https://biaodianfuhao.oss-cn-beijing.aliyuncs.com/1539087000475328514.png",
  134. location: "大连市甘井子区友好路236号 拷贝 3",
  135. km: "8.9km"
  136. },
  137. ],
  138. servicesAvailableList: [{
  139. name: "普通洗车",
  140. list: [{
  141. name: "xxxxxxx"
  142. },
  143. {
  144. name: "xxxxxxx"
  145. },
  146. ]
  147. },
  148. {
  149. name: "常规保养",
  150. list: [{
  151. name: "xxxxxxx"
  152. },
  153. {
  154. name: "xxxxxxx"
  155. },
  156. ]
  157. },
  158. {
  159. name: "二级保养",
  160. list: [{
  161. name: "xxxxxxx"
  162. },
  163. {
  164. name: "xxxxxxx"
  165. },
  166. ]
  167. },
  168. {
  169. name: "钣金修复",
  170. list: [{
  171. name: "xxxxxxx"
  172. },
  173. {
  174. name: "xxxxxxx"
  175. },
  176. {
  177. name: "xxxxxxx"
  178. },
  179. ]
  180. },
  181. {
  182. name: "磨泥打蜡",
  183. list: [{
  184. name: "xxxxxxx"
  185. }, ]
  186. },
  187. ],
  188. price: "",
  189. longitude: app.globalData.longitude,
  190. latitude: app.globalData.latitude,
  191. userCar:{}
  192. };
  193. },
  194. onLoad(options) {
  195. // this.setMeal = JSON.parse(options.item);
  196. console.log(options);
  197. this.$nextTick(()=> {
  198. console.log(options);
  199. this.packageDetail(JSON.parse(options.item).id)
  200. this.getUserCar();
  201. });
  202. },
  203. methods: {
  204. getUserCar(){
  205. getUserCar().then(res=>{
  206. this.userCar = res.data;
  207. })
  208. },
  209. packageDetail(id) {
  210. console.log(id);
  211. packageDetail({
  212. longitude: this.longitude || "111",
  213. latitude: this.latitude || "111",
  214. id: id
  215. }).then(res => {
  216. console.log(res);
  217. this.setMeal = res.data;
  218. this.price = this.setMeal.carPrice < this.setMeal.suvPrice ? (this.setMeal.carPrice < this
  219. .setMeal.truckPrice ?
  220. this.setMeal.carPrice : this.setMeal.truckPrice) : (this.setMeal.suvPrice < this
  221. .setMeal.truckPrice ?
  222. this.setMeal.suvPrice : this.setMeal.truckPrice)
  223. console.log(setMeal.buyNum);
  224. })
  225. },
  226. routerTo(item) {
  227. if(this.userCar.id == null){
  228. uni.showToast({
  229. title: '请添加默认车辆',
  230. icon: 'none',
  231. duration: 2000
  232. });
  233. }else{
  234. this.$yrouter.push({
  235. path: "/pages/maintenance/setMeal/buySetMeal/index?item=" + JSON.stringify(this.setMeal)
  236. });
  237. }
  238. }
  239. }
  240. }
  241. </script>
  242. <style lang="less">
  243. page {
  244. background: #EDEDED;
  245. }
  246. .bottomBtn {
  247. width: 690rpx;
  248. height: 110rpx;
  249. background: #FFFFFF;
  250. border: 1px solid #EEEEEE;
  251. box-shadow: 0px 8rpx 17rpx 0px rgba(168, 165, 165, 0.26);
  252. border-radius: 55rpx;
  253. margin-left: 30rpx;
  254. position: fixed;
  255. bottom: 67rpx;
  256. z-index: 9998;
  257. .leftView {
  258. float: left;
  259. height: 100%;
  260. display: flex;
  261. align-items: center;
  262. margin-left: 57rpx;
  263. .chooseNum {
  264. font-size: 30rpx;
  265. font-family: PingFang SC;
  266. font-weight: 500;
  267. color: #FF3C00;
  268. line-height: 31rpx;
  269. display: flex;
  270. align-items: baseline;
  271. }
  272. }
  273. .rightView {
  274. float: right;
  275. width: 210rpx;
  276. height: 108rpx;
  277. background: linear-gradient(0deg, #005AFF 0%, #0078FF 100%);
  278. border-radius: 0 55rpx 55rpx 0;
  279. font-size: 34rpx;
  280. font-family: PingFang SC;
  281. font-weight: 500;
  282. color: #FEFEFE;
  283. line-height: 108rpx;
  284. text-align: center;
  285. }
  286. }
  287. .detail {
  288. background: #FFFFFF;
  289. border-radius: 10px;
  290. margin-top: 20rpx;
  291. padding: 36rpx 30rpx;
  292. .header {
  293. padding-bottom: 36rpx;
  294. .title {
  295. font-size: 28rpx;
  296. font-family: PingFang SC;
  297. font-weight: bold;
  298. color: #333333;
  299. line-height: 29rpx;
  300. }
  301. .border {
  302. width: 106rpx;
  303. height: 6rpx;
  304. background: linear-gradient(90deg, #005BFF 0%, #FFFFFF 100%);
  305. opacity: 0.6;
  306. }
  307. }
  308. .content {
  309. font-size: 26rpx;
  310. font-family: PingFang SC;
  311. font-weight: 500;
  312. color: #666666;
  313. line-height: 36rpx;
  314. }
  315. }
  316. .shop {
  317. max-height: 514rpx;
  318. background: #FFFFFF;
  319. border-radius: 10rpx;
  320. margin-top: 20rpx;
  321. padding: 36rpx 30rpx;
  322. .header {
  323. padding-bottom: 36rpx;
  324. .title {
  325. font-size: 28rpx;
  326. font-family: PingFang SC;
  327. font-weight: bold;
  328. color: #333333;
  329. line-height: 29rpx;
  330. }
  331. .border {
  332. width: 106rpx;
  333. height: 6rpx;
  334. background: linear-gradient(90deg, #005BFF 0%, #FFFFFF 100%);
  335. opacity: 0.6;
  336. }
  337. }
  338. .flexView {
  339. max-height: 420rpx;
  340. overflow-x: auto;
  341. display: flex;
  342. flex-wrap: wrap;
  343. flex-direction: column;
  344. .body {
  345. width: 655rpx;
  346. height: 101rpx;
  347. background: #FFFFFF;
  348. border-radius: 10rpx;
  349. display: flex;
  350. align-items: center;
  351. padding-bottom: 36rpx;
  352. image {
  353. width: 100rpx;
  354. height: 100rpx;
  355. }
  356. .subbody {
  357. width: 76%;
  358. padding: 11rpx 21rpx 0rpx 21rpx;
  359. .title {
  360. font-size: 32rpx;
  361. font-family: PingFang SC;
  362. font-weight: bold;
  363. color: #333333;
  364. line-height: 31rpx;
  365. }
  366. .content {
  367. padding-top: 21rpx;
  368. .location {
  369. width: 350rpx;
  370. font-size: 24rpx;
  371. font-family: PingFang SC;
  372. font-weight: 500;
  373. color: #999999;
  374. line-height: 31rpx;
  375. float: left;
  376. }
  377. .right {
  378. display: flex;
  379. align-items: center;
  380. float: right;
  381. image {
  382. width: 23rpx;
  383. height: 23rpx;
  384. }
  385. .km {
  386. font-size: 24rpx;
  387. font-family: PingFang SC;
  388. font-weight: 500;
  389. color: #333333;
  390. }
  391. }
  392. }
  393. }
  394. }
  395. }
  396. }
  397. .servicesAvailable {
  398. background: #FFFFFF;
  399. border-radius: 10rpx;
  400. margin-top: 20rpx;
  401. padding: 36rpx 30rpx;
  402. .header {
  403. padding-bottom: 36rpx;
  404. .title {
  405. font-size: 28rpx;
  406. font-family: PingFang SC;
  407. font-weight: bold;
  408. color: #333333;
  409. line-height: 29rpx;
  410. }
  411. .border {
  412. width: 106rpx;
  413. height: 6rpx;
  414. background: linear-gradient(90deg, #005BFF 0%, #FFFFFF 100%);
  415. opacity: 0.6;
  416. }
  417. }
  418. .body {
  419. display: flex;
  420. padding: 19rpx;
  421. align-items: center;
  422. justify-content: space-around;
  423. .title {
  424. font-size: 26rpx;
  425. font-family: PingFang SC;
  426. font-weight: 500;
  427. color: #666666;
  428. line-height: 29rpx;
  429. }
  430. .border {
  431. width: 437rpx;
  432. height: 1rpx;
  433. border-bottom: 1px dashed #CCCCCC;
  434. }
  435. .length {
  436. font-size: 26rpx;
  437. font-family: PingFang SC;
  438. font-weight: 500;
  439. color: #666666;
  440. line-height: 29rpx;
  441. }
  442. }
  443. }
  444. .setMealDetail {
  445. image {
  446. width: 100%;
  447. height: 750rpx;
  448. }
  449. .header-card {
  450. background: #FFFFFF;
  451. border-radius: 0px 0px 16rpx 16rpx;
  452. padding: 40rpx 29rpx 35rpx 29rpx;
  453. .header {
  454. font-size: 32rpx;
  455. font-family: PingFang SC;
  456. font-weight: bold;
  457. color: #333333;
  458. line-height: 31rpx;
  459. }
  460. .content {
  461. font-size: 26rpx;
  462. font-family: PingFang SC;
  463. font-weight: 500;
  464. color: #999999;
  465. line-height: 36rpx;
  466. padding-top: 25rpx;
  467. }
  468. .bottom {
  469. display: flex;
  470. justify-content: space-between;
  471. padding-top: 37rpx;
  472. .left {
  473. font-size: 26rpx;
  474. font-family: PingFang SC;
  475. font-weight: 500;
  476. color: #005BFF;
  477. line-height: 55rpx;
  478. }
  479. .right {
  480. font-size: 26rpx;
  481. font-family: PingFang SC;
  482. font-weight: 500;
  483. color: #666666;
  484. line-height: 55rpx;
  485. }
  486. }
  487. }
  488. }
  489. </style>