storeDetails.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. <template>
  2. <view class="container-view">
  3. <navBar type="index"></navBar>
  4. <!-- <view class="store-img-view" style="background-image: url('https://qiniu.bms16.com/FhG-xwyMdxPVjYNrxXnq5enGFT-2');background-repeat: no-repeat;background-size: 100% 500rpx;">
  5. </view> -->
  6. <view class="store-img-view">
  7. <swiper v-if="shop_image.length!=0" class="swiper" :indicator-dots="true" :autoplay="true" :interval="2000"
  8. indicator-color="rgba(0, 0, 0, 0.3)" indicator-active-color="#000000" :duration="1000" circular>
  9. <swiper-item class="swiper-item" v-for="(item,index) in shop_image" :key="index">
  10. <image class="swiper-item-img" :src="item" mode="aspectFill"></image>
  11. </swiper-item>
  12. </swiper>
  13. <image v-else class="bg-img" src="https://qiniu.bms16.com/FhRnr7rADHHsOFfpWO4duD15SgIt" mode="aspectFill">
  14. </image>
  15. </view>
  16. <view class="p-bg">
  17. <view class="store-info-view">
  18. <view class="store-name">{{storeInfo.shop_name}}</view>
  19. <view class="flex-row align-center" style="margin-bottom: 24rpx;">
  20. <view v-for="(item,index) of storeInfo.service_type_list" :key="index" class="store-type">
  21. {{item.title}}
  22. </view>
  23. <view class="store-num-type"> <text class="store-num">{{storeInfo.model_list.length || 0}}</text>
  24. 款车型
  25. </view>
  26. <view class="store-phone" @tap="tapPhone"><img style="width: 84rpx;height: 64rpx;"
  27. src="https://qiniu.bms16.com/Ft0YA1JYmq66hdoeEN-PgBHy5vLa" alt=""></view>
  28. </view>
  29. <view class="flex-row flex-between">
  30. <view :class="isWorkTimer ? 'left_grid_2' : 'left_grid_1'">
  31. <view class="flex-row">
  32. <img style="width: 40rpx;height: 40rpx;"
  33. :src="!isWorkTimer ? 'https://zxappfile.bms16.com/zx_admin/cab_timer.png' : 'https://zxappfile.bms16.com/zx_admin/cab_timer_work.png'">
  34. <view :class="isWorkTimer ? 'grid_text_1' : 'grid_text_rest' ">
  35. {{isWorkTimer ? '营业中' : '已休息'}}
  36. </view>
  37. </view>
  38. <view v-if="storeInfo.work_begin_time" class="grid_text_2">
  39. {{storeInfo.work_begin_time[0]}}:{{storeInfo.work_begin_time[1]}}-{{storeInfo.work_end_time[0]}}:{{storeInfo.work_end_time[1]}}
  40. </view>
  41. </view>
  42. <view @tap="bindToNav" class="right_grid flex-between">
  43. <view>
  44. <view class="cab_distance">
  45. 直线距您 {{storeInfo.distance}}
  46. </view>
  47. <view class="cab_address">{{storeInfo.address}}</view>
  48. </view>
  49. <view>
  50. <img class="icon_grid_1" src="https://zxappfile.bms16.com/zx_admin/cab_nav.png">
  51. <view class="grid_nav">导航</view>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. <view class="tip-view">
  57. <view class="tip-title-view flex-row align-center">
  58. <image style="width: 144rpx;height: 40rpx;" src="https://qiniu.bms16.com/FjUW1kuRvXWTEftyn9nH1AbGWuxK"
  59. mode='aspectFit'></image>
  60. <image style="width: 86rpx;height: 80rpx;" src="https://qiniu.bms16.com/FibAaPERzqi6m95EP2jREUKixjUi"
  61. mode='aspectFill'></image>
  62. <view class="w-bg flex-row"></view>
  63. </view>
  64. <view class="step-view flex-row align-center">
  65. <view class="icon-list-view">
  66. <image class="img1" src="https://qiniu.bms16.com/Fp0BE27Q0VTD8qUJRHUVhWO6VEbO" mode='aspectFit'></image>
  67. </view>
  68. <view class="dashed-line"></view>
  69. <view class="icon-list-view">
  70. <image class="img1" src="https://qiniu.bms16.com/FqDzYwAbnSEgf3yv9SAb92Vq4ZEB"
  71. mode='aspectFit'></image>
  72. </view>
  73. <view class="dashed-line"></view>
  74. <view class="icon-list-view">
  75. <image class="img1" src="https://qiniu.bms16.com/FlFMHzco6j9XOpMI21tSnR9500Un"
  76. mode='aspectFit'></image>
  77. </view>
  78. </view>
  79. <view class="step-tip-view flex-row align-center">
  80. <view class="step-tip-text">
  81. <image class="step-num-1" src="https://qiniu.bms16.com/Fm4gMRmW6UOwLcU-eW8LDLNfiUJe" mode='aspectFill'>
  82. </image>线上选择用车方案生成待支付订单
  83. </view>
  84. <view class="step-tip-text">
  85. <image class="step-num-2" src="https://qiniu.bms16.com/FvYN7SxOYIhXEqSAJZrQIBQuTx79" mode='aspectFill'>
  86. </image>导航到店向商家支付订单金额
  87. </view>
  88. <view class="step-tip-text">
  89. <image class="step-num-3" src="https://qiniu.bms16.com/FhZ7w0X8iVuxFPdetEF9C3YYkJ7Z" mode='aspectFill'>
  90. </image>支付完成后直接现场取车
  91. </view>
  92. </view>
  93. </view>
  94. <view class="unit-type-view">
  95. <view @click="status = 0;modelListsFn()" class="unit-type " :class="{'unit-type-i' : status == 0}">短租
  96. </view>
  97. <view @click="status = 1;modelListsFn()" class="unit-type" :class="{'unit-type-i' : status == 1}">长租
  98. </view>
  99. <view @click="status = 2;modelListsFn()" class="unit-type " :class="{'unit-type-i' : status == 2}">出售
  100. </view>
  101. </view>
  102. <view class="car-info-list-view">
  103. <view v-for="(item,index) of modelListsFn()" :key="index" class="car-info-view align-center flex-row">
  104. <!-- <img class="car-img" src="https://qiniu.bms16.com/FsxOysJT2V3KNYev2YWadvjyKn2j" alt=""> -->
  105. <image class="car-img" :src="item.model_images" mode="aspectFill"></image>
  106. <view class="car-info">
  107. <view class="car-name flex-row">{{item.model_name}}</view>
  108. <view class="car-model-info">续航{{item.endurance}}km|重量{{item.weight}}kg</view>
  109. <view class="flex-row flex-between">
  110. <view class="unit-type-price flex-row">
  111. <text v-if="status == 0" style="margin-right: 8rpx;">短租</text>
  112. <text v-if="status == 1" style="margin-right: 8rpx;">长租</text>
  113. <text v-if="status == 2" style="margin-right: 8rpx;">出售</text>
  114. <priceTool :price="Number(item.money)" :font_size="40" />
  115. </view>
  116. <view @click="srcFn(`/pages/carDetail/carDetail?model_id=${item.model_id}`)"
  117. class="lease-btn">购/租</view>
  118. </view>
  119. </view>
  120. </view>
  121. </view>
  122. </view>
  123. </view>
  124. </template>
  125. <script module="tools" lang="wxs" src="@/pages/common/wxs/tools.wxs"></script>
  126. <script module="tools" lang="sjs" src="@/pages/common/wxs/tools.sjs"></script>
  127. <script>
  128. var config = require('../../common/config.js');
  129. var common = require('../../common/common.js');
  130. var http = require('../../common/http.js');
  131. var storage = require('../../common/storage.js');
  132. import priceTool from '@/component/priceTool/priceTool';
  133. // import UseGuidance from '@/component/useGuidance/useGuidance';
  134. export default {
  135. components: {
  136. priceTool,
  137. // UseGuidance
  138. },
  139. data() {
  140. return {
  141. shop_id:0,
  142. status: 0,
  143. shop_image: [],
  144. storeInfo: {
  145. model_list: []
  146. },
  147. isWorkTimer: null
  148. };
  149. },
  150. computed: {},
  151. /**
  152. * 生命周期函数--监听页面加载
  153. */
  154. onLoad: function(options) {
  155. console.log(options, 'options');
  156. this.shop_id = options.admin_id || ''
  157. this.locationFn()
  158. },
  159. /**
  160. * 生命周期函数--监听页面显示
  161. */
  162. onShow: function() {
  163. },
  164. methods: {
  165. modelListsFn() {
  166. let obj = []
  167. for (let index = 0; index < this.storeInfo.model_list.length; index++) {
  168. let item = this.storeInfo.model_list[index];
  169. if(item.sell_price){
  170. obj.push({
  171. ...item,
  172. money:(item.sell_price / 100).toFixed(2)
  173. })
  174. }
  175. for (var i = 0; i < item.price_setting.length; i++) {
  176. var items = item.price_setting[i];
  177. let money = (items.hire_price / 100).toFixed(2)
  178. if (!item.sell_price && this.status == 0 && (items.hire_duration_unit == 1 || items.hire_duration_unit == 4 || items
  179. .hire_duration_unit == 5 || items.hire_duration_unit == 6)) {
  180. obj.push({
  181. ...item,
  182. money
  183. })
  184. break
  185. }
  186. if (!item.sell_price && this.status == 1 && (items.hire_duration_unit == 2 || items.hire_duration_unit == 3 || items
  187. .hire_duration_unit == 4)) {
  188. obj.push({
  189. ...item,
  190. money
  191. })
  192. break
  193. }
  194. }
  195. }
  196. return obj
  197. },
  198. locationFn() {
  199. let _this = this
  200. uni.getLocation({
  201. success(res) {
  202. _this.loadStoreDetail(_this.shop_id, res.longitude, res.latitude)
  203. }
  204. })
  205. },
  206. srcFn(url) {
  207. uni.navigateTo({
  208. url
  209. })
  210. },
  211. isWorkTimerFn() {
  212. this.storeInfo.work_end_time = ''
  213. this.storeInfo.work_end_time = ''
  214. },
  215. loadStoreDetail(shop_id, longitude, latitude) {
  216. const me = this
  217. console.log(shop_id)
  218. console.log(longitude)
  219. console.log(latitude)
  220. http.postApi(config.API_NEAR_SHOP_INFO, {
  221. shop_id,
  222. longitude,
  223. latitude,
  224. }, (resp) => {
  225. if (resp.data.code === 200) {
  226. me.setData({
  227. storeInfo: resp.data.data.info
  228. })
  229. this.storeInfo.distance = common.formatDistance(Number(this.storeInfo.distance))
  230. this.shop_image = JSON.parse(resp.data.data.info.shop_image) || []
  231. var cabinetInfo = resp.data.data.info
  232. this.storeInfo.work_begin_time = (cabinetInfo.work_begin_time == null ? '00:00:00' :
  233. cabinetInfo
  234. .work_begin_time).split(':')
  235. this.storeInfo.work_end_time = (cabinetInfo.work_end_time == null ? '00:00:00' :
  236. cabinetInfo
  237. .work_end_time).split(':')
  238. this.isWorkTimer = this.isWithinTimeRange(cabinetInfo.work_begin_time,
  239. cabinetInfo.work_end_time)
  240. } else {
  241. common.simpleToast(resp.data.msg)
  242. }
  243. })
  244. },
  245. isWithinTimeRange(startTime, endTime) {
  246. // 获取当前时间
  247. const now = new Date();
  248. const currentMinutes = now.getHours() * 60 + now.getMinutes();
  249. // 将传入的时间转换为分钟
  250. const [startHour, startMinute] = startTime.map(Number);
  251. const [endHour, endMinute] = endTime.map(Number);
  252. const startMinutes = startHour * 60 + startMinute;
  253. const endMinutes = endHour * 60 + endMinute;
  254. // 判断当前时间是否在指定范围内
  255. return currentMinutes >= startMinutes && currentMinutes <= endMinutes;
  256. },
  257. tapPhone() {
  258. const me = this
  259. uni.showModal({
  260. content: `您是否要拨打电话${me.storeInfo.link_phone}?`,
  261. confirmText: '确定',
  262. success: (res) => {
  263. if (res.confirm) {
  264. me.clearTimer()
  265. uni.makePhoneCall({
  266. phoneNumber: me.storeInfo.link_phone,
  267. success() {},
  268. fail() {}
  269. })
  270. }
  271. },
  272. fail: (res) => {}
  273. })
  274. },
  275. bindToNav() {
  276. const {
  277. address,
  278. latitude,
  279. longitude,
  280. shop_name
  281. } = this.storeInfo
  282. uni.openLocation({
  283. latitude: latitude - 0,
  284. longitude: longitude - 0,
  285. scale: 15,
  286. name: shop_name,
  287. address: address,
  288. success: function(res) {},
  289. })
  290. },
  291. }
  292. };
  293. </script>
  294. <style scoped>
  295. @import './storeDetails.css';
  296. </style>