storeDetails.vue 11 KB

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