storeDetails.vue 10 KB

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