carDetail.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <template>
  2. <view class="car-detail-main">
  3. <view class="flex-row">
  4. <img style="width: 600rpx;height: 406rpx;" :src="car_detail.image"
  5. alt="">
  6. </view>
  7. <view class="car-detail-model">
  8. <view class="car-detail-name">{{car_detail.car_model_name}}</view>
  9. <view class="car-detail-price"><allPrice :amount="price"/></view>
  10. <view class="flex-row car-detail-time">
  11. <view v-for="(item,index) in car_detail.rental_setting" :key="index" @tap="tapSelectType" :data-price="item.hire_price"
  12. :data-select_type="item.hire_duration_unit"
  13. :class="['time-unit',selectType==item.hire_duration_unit? 'time-unit-i':'']">
  14. <text v-if="item.hire_duration_unit==1">日租</text>
  15. <text v-if="item.hire_duration_unit==2">月租</text>
  16. <text v-if="item.hire_duration_unit==3">年租</text>
  17. </view>
  18. <view @tap="tapSelectType" :data-select_type="100" :data-price="car_detail.sell_price"
  19. :class="['time-unit',selectType==100? 'time-unit-i':'']">购买</view>
  20. </view>
  21. </view>
  22. <!-- <view class="free-num-model">
  23. <view class="flex-row flex-between">
  24. <view class="free-num-view">
  25. <img style="width: 40rpx;height: 40rpx;" src="https://qiniu.bms16.com/FtlfBtBE5-TeTI5EdrciX_u8u_Sx" alt="">
  26. <text class="free-num-text">免费换电次数</text>
  27. </view>
  28. <view class="free-num-time">1 次/日</view>
  29. </view>
  30. <view class="free-num-tip">日租享1次免费换电数,超出后需要单独支付换电费用;</view>
  31. </view> -->
  32. <useGuidance />
  33. <view class="card-car-detail">
  34. <view class="step-title-view flex-row align-center">
  35. <img style="width: 208rpx;height: 40rpx;" src="https://qiniu.bms16.com/Fms8V0l4bNwGUgWwkdRku4dIx_tt"
  36. alt="">
  37. <img style="width: 86rpx;height: 80rpx;" src="https://qiniu.bms16.com/FibAaPERzqi6m95EP2jREUKixjUi"
  38. alt="">
  39. <view class="w-bg flex-row"></view>
  40. </view>
  41. <view class="step-car-view">
  42. <view class="step-img-view"></view>
  43. <view class="flex-row flex-between" style="margin-bottom: 24rpx;">
  44. <view class="store-name-view">
  45. <view>{{car_detail.shop_name}}</view>
  46. <view class="address-txt">{{car_detail.address}}</view>
  47. </view>
  48. <view class="distance-num">{{car_detail.destance}}m</view>
  49. </view>
  50. <view class="flex-row flex-between align-center">
  51. <view class="time-view flex-row alert-center">
  52. <img class="time-icon" src="https://qiniu.bms16.com/FlGVpR2fdrD1GfeHfDgt-dUMgkOq" alt="">
  53. <text>{{car_detail.work_begin_time + '-' + car_detail.work_end_time}}</text>
  54. </view>
  55. <view class="phone-or-nav flex-row">
  56. <view @tap="tapCallPhone">
  57. <img style="width: 84rpx;height: 64rpx;margin-right: 20rpx;" src="https://qiniu.bms16.com/FkZYljvsgGtXUGnQaA0wk_sbjlUC" alt="">
  58. </view>
  59. <view @tap="">
  60. <img style="width: 112rpx;height: 64rpx;" src="https://qiniu.bms16.com/Fts38M35doVjK09GfOza5qD-wwkK" alt="">
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. <view style="height: 150rpx;"></view>
  67. <view class="use-car-view flex-row">
  68. <view @tap="useCarBtn" class="use-car-btn">我要用车</view>
  69. </view>
  70. <carPlan v-if="showCarPlan" @changeSelectType="changeSelectType" @closeShowMore="closeShowMore" :params="params" :selectType="selectType"/>
  71. </view>
  72. </template>
  73. <script module="tools" lang="wxs" src="@/pages/common/wxs/tools.wxs"></script>
  74. <script module="tools" lang="sjs" src="@/pages/common/wxs/tools.sjs"></script>
  75. <script>
  76. import CarPlan from '@/component/carPlan/carPlan';
  77. import UseGuidance from '@/component/useGuidance/useGuidance';
  78. import allPrice from '@/component/allPrice/allPrice';
  79. import {
  80. LEASE_TYPE_ARR
  81. } from '@/common/constant.js'
  82. var app = getApp();
  83. var config = require('@/common/config.js');
  84. var common = require('@/common/common.js');
  85. var http = require('@/common/http.js');
  86. var storage = require('@/common/storage.js');
  87. export default {
  88. data() {
  89. return {
  90. recommend_id: '',
  91. car_detail: {},
  92. showCarPlan: false,
  93. selectType: 1,
  94. myLocation: {
  95. latitude: 23.099994,
  96. longitude: 113.324004,
  97. },
  98. destance: 0,
  99. price:0,
  100. params:{}
  101. };
  102. },
  103. components: {
  104. CarPlan,
  105. UseGuidance,
  106. allPrice
  107. },
  108. onLoad: function(options) {
  109. console.log(options, 'options');
  110. if(options.model_id){
  111. this.model_id=options.model_id
  112. this.loadCarInfo()
  113. }
  114. // this.loadCarInfo()
  115. // getFlatternDistance 获取直线距离
  116. },
  117. methods: {
  118. loadCarInfo() {
  119. const me = this
  120. // let test = {
  121. // "recommend_id": 3,
  122. // "title": "噢抬哇塞红擦无论谁",
  123. // "image": "https://loremflickr.com/400/400?lock=201810282360670",
  124. // "desc": "voluptate commodo quis fugiat ut",
  125. // "model_id": 1,
  126. // "car_model_name": "电摩-12",
  127. // "sell_price": 100,
  128. // "deposit": 10,
  129. // "rental_setting": [
  130. // {
  131. // "setting_id": 1,
  132. // "admin_id": 1,
  133. // "hire_duration": 1,
  134. // "hire_duration_unit": 1,
  135. // "hire_price": 15,
  136. // "ctime": 1736330909,
  137. // "delete_time": 0
  138. // },
  139. // {
  140. // "setting_id": 2,
  141. // "admin_id": 1,
  142. // "hire_duration": 1,
  143. // "hire_duration_unit": 2,
  144. // "hire_price": 5,
  145. // "ctime": 1736386379,
  146. // "delete_time": 0
  147. // }
  148. // ],
  149. // "services_list": [
  150. // {
  151. // "service_id": 3,
  152. // "admin_id": 1,
  153. // "service_name": "手套",
  154. // "ctime": 1736476283,
  155. // "delete_time": 0
  156. // }
  157. // ],
  158. // "shop_name": "智寻出行 - 测试",
  159. // "longitude": "115.815236",
  160. // "latitude": "28.691463",
  161. // "address": "江西省南昌市新建区友谊路与自强路交叉口北80米",
  162. // "work_begin_time": "03:00:00",
  163. // "work_end_time": "23:59:59",
  164. // "link_phone": "18779187403",
  165. // "distance": 11
  166. // }
  167. // me.destance = common.getFlatternDistance(me.myLocation.latitude, me.myLocation.longitude, test.latitude,test.longitude)
  168. // console.log(me.destance);
  169. // me.setData({
  170. // car_detail: test
  171. // })
  172. http.postApi(config.API_FLK_INDEX_CAR_MODEL_DETAIL, {model_id:me.model_id}, (resp) => {
  173. if (resp.data.code === 200) {
  174. me.setData({
  175. car_detail:resp.data.data,
  176. price:(resp.data.data.rental_setting[0].hire_price/100).toFixed(2)
  177. })
  178. } else {
  179. common.simpleToast(resp.data.msg);
  180. }
  181. })
  182. },
  183. tapSelectType(e) {
  184. const {select_type,price} = e.currentTarget.dataset
  185. console.log(select_type,price,'select_type,price');
  186. this.setData({
  187. selectType: select_type,
  188. price:(price/100).toFixed(2)
  189. })
  190. },
  191. tapCallPhone(){
  192. const me = this
  193. const phone = this.car_detail.link_phone
  194. // const phone = 18170410707
  195. uni.showModal({
  196. content: `您是否要拨打电话${phone}?`,
  197. confirmText: '确定',
  198. success: (res) => {
  199. if (res.confirm) {
  200. me.clearTimer()
  201. uni.makePhoneCall({
  202. phoneNumber: phone,
  203. success() {},
  204. fail() {}
  205. })
  206. }
  207. },
  208. fail: (res) => {}
  209. })
  210. },
  211. navAddress(){
  212. const {
  213. address,
  214. latitude,
  215. longitude,
  216. shop_name
  217. } = this.car_detail
  218. uni.openLocation({
  219. latitude: latitude - 0,
  220. longitude: longitude - 0,
  221. scale: 15,
  222. name: shop_name,
  223. address: address,
  224. success: function (res) {},
  225. })
  226. },
  227. useCarBtn(){
  228. const pData={
  229. ...this.car_detail,
  230. price:this.price
  231. }
  232. this.setData({
  233. showCarPlan:true,
  234. params:pData
  235. })
  236. },
  237. changeSelectType(select_type,price){
  238. this.setData({
  239. selectType: select_type,
  240. price:(price/100).toFixed(2)
  241. })
  242. },
  243. closeShowMore(){
  244. this.setData({
  245. showCarPlan:false
  246. })
  247. }
  248. }
  249. };
  250. </script>
  251. <style>
  252. @import './carDetail.css';
  253. </style>