海南旅游项目 前端仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1140 lines
40 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
4 years ago
  1. <template>
  2. <view>
  3. <skeleton :loading="skeletonLoading" :row="12" :showAvatar="false" :showTitle="true">
  4. <block v-if="isRight(goods_detail)">
  5. <!-- 商品图片轮播 -->
  6. <swiper :current="current" :autoplay="false" :interval="2500"
  7. :indicator-dots="goods_detail.pictures.length > 1 ? true : false" :circular="true"
  8. class="swiper-box" indicator-active-color="#1998FE">
  9. <swiper-item v-for="(item, index) in goods_detail.pictures" :key="index">
  10. <image mode="aspectFill" :src="item" style="width: 100%; height: 100%;" @click="lookImg(index)">
  11. </image>
  12. </swiper-item>
  13. </swiper>
  14. <!-- 商品主要信息 -->
  15. <view class="head-info">
  16. <view class="lf-font-32 lf-color-333 lf-font-bold">{{ goods_detail.title }}</view>
  17. <view class="lf-row-between lf-font-24 lf-m-t-30 lf-p-b-20">
  18. <view class="lf-flex price">
  19. <lf-price :price="goods_detail.price"></lf-price>
  20. <view class="lf-m-l-20">¥{{ goods_detail.original_price }}</view>
  21. <view v-if="goods_detail.cost">{{ goods_detail.cost }}</view>
  22. </view>
  23. <view class="lf-font-24 lf-text-right">
  24. <view class="lf-color-gray">已售 {{ goods_detail.sale }}</view>
  25. <view class="lf-color-gray">库存 {{ goods_detail.stock }}</view>
  26. <!-- <view class="lf-color-primary">{{ goods_detail.specs[0].stock_text }}</view> -->
  27. </view>
  28. </view>
  29. <view class="label-box" v-if="goods_detail.coupon && goods_detail.coupon.length">
  30. <view class="label-item" v-for="(item, index) in goods_detail.coupon" :key="index">
  31. {{ item.tag }}</view>
  32. </view>
  33. </view>
  34. <view class="lf-row-between list-item lf-m-t-20" @click="changePop(goods_detail.product.type)">
  35. <view class="lf-row-center">
  36. <text class="lf-font-28 lf-color-gray">操作</text>
  37. <text class="lf-text-vertical lf-m-l-40 lf-font-28 lf-color-black">套餐/类型</text>
  38. </view>
  39. <view>
  40. <text class="lf-iconfont lf-icon-xiangyou lf-text-vertical"></text>
  41. </view>
  42. </view>
  43. <view v-if="goods_detail.product.type == 0 && goods_detail.product.extends.field_0_departure_place && goods_detail.product.extends.field_0_destination">
  44. <view class="lf-row-between list-item lf-m-t-20">
  45. <view class="lf-row-center">
  46. <text class="lf-font-28 lf-color-gray">出发地</text>
  47. <text class="lf-text-vertical lf-m-l-40 lf-font-28 lf-color-black">{{goods_detail.product.extends.field_0_departure_place}}</text>
  48. </view>
  49. </view>
  50. <view class="lf-row-between list-item">
  51. <view class="lf-row-center">
  52. <text class="lf-font-28 lf-color-gray">目的地</text>
  53. <text class="lf-text-vertical lf-m-l-40 lf-font-28 lf-color-black">{{goods_detail.product.extends.field_0_destination}}</text>
  54. </view>
  55. </view>
  56. </view>
  57. <!-- 景区类型 -->
  58. <view v-if="goods_detail.product.extends && goods_detail.product && goods_detail.product.type == 2">
  59. <view class="goods-detail"
  60. v-if="goods_detail.product.extends.field_2_name && goods_detail.product.extends.field_2_address"
  61. @click="openMap(goods_detail.product.extends.field_2_address,goods_detail.product.extends.field_2_latitude,goods_detail.product.extends.field_2_longitude)">
  62. <view class="lf-font-32 lf-font-bold lf-m-b-20">{{goods_detail.product.extends.field_2_name}}
  63. </view>
  64. <view class="lf-row-between">
  65. <view class="lf-line-2 lf-font-28 lf-color-333">
  66. {{goods_detail.product.extends.field_2_address}}</view>
  67. <view class="lf-flex-column lf-row-center">
  68. <view class="lf-iconfont lf-icon-dizhi lf-color-blue"></view>
  69. <view class="lf-font-24 lf-color-222 lf-m-t-10" v-if="$isRight(shop_distance)">距您{{shop_distance}}</view>
  70. </view>
  71. </view>
  72. </view>
  73. <view class="goods-detail" v-if="goods_detail.product.extends.field_2_open_time">
  74. <view class="lf-font-32 lf-font-bold lf-m-b-20">景区开放时间</view>
  75. <view>
  76. <u-table>
  77. <u-tr v-for="(item,index) in goods_detail.product.extends.field_2_open_time"
  78. :key="index">
  79. <u-th>{{item.node}}</u-th>
  80. <u-th>{{item.summer}}</u-th>
  81. <u-th>{{item.winter}}</u-th>
  82. </u-tr>
  83. </u-table>
  84. </view>
  85. </view>
  86. <view class="goods-detail" v-if="goods_detail.product.extends.field_2_project">
  87. <view class="lf-font-32 lf-font-bold lf-m-b-20">包含项目</view>
  88. <view class="lf-flex-column">
  89. <view v-for="(item,index) in goods_detail.product.extends.field_2_project" :key="index"
  90. class="lf-row-between child-tag">
  91. <view class="lf-font-28 lf-color-black lf-flex-1">{{item.name}}</view>
  92. <view class="lf-font-28 lf-color-black lf-flex-1" style="text-align: center;">
  93. {{item.num}}</view>
  94. <view class="lf-font-28 lf-color-black lf-flex-1" style="text-align: right;">
  95. {{item.price}}</view>
  96. </view>
  97. </view>
  98. </view>
  99. </view>
  100. <block v-if="$isRight(goods_detail.spec)">
  101. <!-- 景区类型弹窗 -->
  102. <u-calendar v-model="show" mode="date" zIndex="100000" :monthPrice="goods_detail.spec[type_index].list"
  103. :min-date='goods_detail.spec[type_index].date_start'
  104. :max-date="goods_detail.spec[type_index].date_end" @change="change" z-index="9999"></u-calendar>
  105. <u-popup class="pop-self" v-model="scenic_spot" mode="bottom" :closeable="true" border-radius="20">
  106. <view class="lf-p-32">
  107. <view class="price lf-flex">
  108. <lf-price :price="choose_date_price*buy_num || goods_detail.spec[type_index].price*buy_num"></lf-price>
  109. <view class="pop-price lf-m-l-20 lf-font-24">
  110. ¥{{ choose_date_orangilprice*buy_num || goods_detail.spec[type_index].original_price*buy_num}}</view>
  111. </view>
  112. <view class="lf-font-24 lf-m-t-20 lf-color-555">
  113. 使用时间{{ go_date }}
  114. </view>
  115. <view style="margin-top: 60rpx;">
  116. <text class="lf-font-32 lf-font-bold" style="color: #131315;">套餐类型</text>
  117. <view class="lf-m-t-30 choose-father">
  118. <view class="choose-span" :class="type_index==index?'choose-active':''"
  119. v-for="(item,index) of goods_detail.spec" :key="index" @click="chooseType(index)">
  120. {{item.name}}</view>
  121. </view>
  122. </view>
  123. <view class="lf-m-t-30">
  124. <text class="lf-font-32 lf-font-bold" style="color: #131315;">使用时间</text>
  125. <view class="lf-row-between list-item lf-m-t-20" style="padding: 0!important;">
  126. <view class="lf-row-center">
  127. <text class="lf-font-28 lf-color-gray" @click="show = true">使用时间</text>
  128. </view>
  129. <view class="lf-flex">
  130. <!-- <picker mode="date" :end="goods_detail.spec[type_index].date_end" :start="goods_detail.spec[type_index].date_start" :value="go_date" @change="goChange">
  131. <view class="lf-color-333 lf-text-right lf-font-28" style="width: 400rpx;">{{ go_date }}</view>
  132. </picker> -->
  133. <text @click="show = true">{{go_date}}</text>
  134. <text class="lf-iconfont lf-icon-xiangyou lf-text-vertical lf-m-l-10"></text>
  135. </view>
  136. </view>
  137. </view>
  138. <view class="lf-m-t-30 lf-row-between">
  139. <view class="lf-font-28 lf-color-gray">数量</view>
  140. <view>
  141. <u-number-box :min="1" v-model="buy_num" @change="valChange"></u-number-box>
  142. </view>
  143. </view>
  144. <view style="margin-top: 60rpx;">
  145. <button class="choose_btn" @click="toAddOrder()">立即购买</button>
  146. </view>
  147. </view>
  148. </u-popup>
  149. </block>
  150. <!-- 餐厅类型 -->
  151. <view v-if="goods_detail.product.extends && goods_detail.product && goods_detail.product.type == 3">
  152. <view class="goods-detail"
  153. @click="openMap(goods_detail.product.extends.field_3_address,goods_detail.product.extends.field_3_latitude,goods_detail.product.extends.field_3_longitude)">
  154. <view class="lf-font-32 lf-font-bold lf-m-b-20">{{goods_detail.product.extends.field_3_name}}
  155. </view>
  156. <view class="lf-row-between">
  157. <view class="lf-line-2 lf-font-28 lf-color-333">
  158. {{goods_detail.product.extends.field_3_address}}</view>
  159. <view class="lf-flex-column lf-row-center">
  160. <view class="lf-iconfont lf-icon-dizhi lf-color-blue"></view>
  161. <view class="lf-font-24 lf-color-222 lf-m-t-10" v-if="$isRight(shop_distance)">距您{{shop_distance}}</view>
  162. </view>
  163. </view>
  164. </view>
  165. <view class="goods-detail">
  166. <view class="lf-font-32 lf-font-bold lf-m-b-20">开放时间</view>
  167. <view>
  168. <u-table>
  169. <u-tr v-for="(item,index) in goods_detail.product.extends.field_3_open_time"
  170. :key="index">
  171. <u-th>{{item.section}}</u-th>
  172. <u-th>{{item.time}}</u-th>
  173. <u-th>{{item.week}}</u-th>
  174. </u-tr>
  175. </u-table>
  176. </view>
  177. </view>
  178. <view class="goods-detail">
  179. <view class="lf-font-32 lf-font-bold lf-m-b-20">包含套餐</view>
  180. <view class="lf-flex-column">
  181. <view class="lf-row-between child-tag"
  182. v-for="(item,index) in goods_detail.product.extends.field_3_package" :key="index">
  183. <view class="lf-color-333 lf-font-28">{{item.name}} {{item.num}}</view>
  184. <view class="lf-color-333 lf-font-28">{{item.price}}</view>
  185. </view>
  186. </view>
  187. </view>
  188. </view>
  189. <!-- 酒店类型 -->
  190. <view v-if="goods_detail.product && goods_detail.product.extends && goods_detail.product.type == 1">
  191. <view class="goods-detail" v-if="goods_detail.product.extends.field_1_name"
  192. @click="openMap(goods_detail.product.extends.field_1_address,goods_detail.product.extends.field_1_latitude,goods_detail.product.extends.field_1_longitude)">
  193. <view class="lf-font-32 lf-font-bold lf-m-b-20"
  194. v-if="goods_detail.product.extends.field_1_name">
  195. {{goods_detail.product.extends.field_1_name}}</view>
  196. <view class="lf-row-between" v-if="goods_detail.product.extends.field_1_address">
  197. <view class="lf-line-2 lf-font-28 lf-color-333">
  198. {{goods_detail.product.extends.field_1_address}}</view>
  199. <view class="lf-flex-column lf-row-center">
  200. <view class="lf-iconfont lf-icon-dizhi lf-color-blue"></view>
  201. <view class="lf-font-24 lf-color-222 lf-m-t-10" v-if="$isRight(shop_distance)">距您{{shop_distance}}</view>
  202. </view>
  203. </view>
  204. </view>
  205. <!-- <zwyCalendar class="lf-m-t-20" type="sign" :startTime="'2021-10-01'" :endTime="'2021-11-01'"/> -->
  206. <view class="goods-detail" style="padding-bottom: 0;">
  207. <view class="lf-font-32 lf-font-bold lf-m-b-20">酒店设施</view>
  208. <view>
  209. <view class="label-box1">
  210. <view class="label-item"
  211. v-for="(item,index) in goods_detail.product.extends.field_1_tags" :key="index" v-if="item.tag">
  212. {{item.tag}}
  213. </view>
  214. </view>
  215. </view>
  216. </view>
  217. </view>
  218. <block v-if="$isRight(goods_detail.spec)">
  219. <!-- 酒店类型弹窗 -->
  220. <u-calendar v-model="hotel_show_range" mode="range" zIndex="100000" :monthPrice="goods_detail.spec[type_index].list"
  221. :min-date='goods_detail.spec[type_index].date_start'
  222. :max-date="goods_detail.spec[type_index].date_end" @change="changeRange()" z-index="9999"></u-calendar>
  223. <u-picker v-model="hotel_show_single" @confirm="changeArrive()" mode="time" :params="params" zIndex="100000"></u-picker>
  224. <u-popup v-model="hotel" mode="bottom" :closeable="true" border-radius="20">
  225. <view class="lf-p-32">
  226. <view class="price lf-flex">
  227. <lf-price :price="total_hotel_price*buy_num || goods_detail.spec[type_index].price*buy_num"></lf-price>
  228. <view class="pop-price lf-m-l-20 lf-font-24">
  229. ¥{{ total_hotel_orginalprice*buy_num || goods_detail.spec[type_index].original_price*buy_num }}</view>
  230. </view>
  231. <view class="lf-font-24 lf-m-t-20 lf-color-555">
  232. 酒店住房日期{{live_date}}~{{leave_date}} <text class="lf-m-l-20" v-if="totalLive">{{totalLive}}</text>
  233. </view>
  234. <view style="margin-top: 60rpx;">
  235. <text class="lf-font-32 lf-font-bold" style="color: #131315;">套餐类型</text>
  236. <view class="lf-m-t-30 choose-father">
  237. <view class="choose-span" :class="type_index==index?'choose-active':''"
  238. v-for="(item,index) of goods_detail.spec" :key="index"
  239. @click="chooseTypehotel(index)">{{item.name}}</view>
  240. </view>
  241. </view>
  242. <view class="lf-m-t-30">
  243. <view class="lf-row-between list-item lf-m-t-20" style="padding: 0!important;">
  244. <view class="lf-row-center">
  245. <text class="lf-font-28 lf-color-gray" @click="hotel_show_range = true">住店时间</text>
  246. </view>
  247. <view class="lf-flex">
  248. <text @click="hotel_show_range = true">{{live_date}}~{{leave_date}}</text>
  249. <text class="lf-iconfont lf-icon-xiangyou lf-text-vertical lf-m-l-10"></text>
  250. </view>
  251. </view>
  252. </view>
  253. <view class="lf-m-t-30">
  254. <view class="lf-row-between list-item lf-m-t-20" style="padding: 0!important;">
  255. <view class="lf-row-center">
  256. <text class="lf-font-28 lf-color-gray" @click="hotel_show_single = true">到店时间</text>
  257. </view>
  258. <view class="lf-flex">
  259. <text @click="hotel_show_single = true">{{arrive_date}}</text>
  260. <text class="lf-iconfont lf-icon-xiangyou lf-text-vertical lf-m-l-10"></text>
  261. </view>
  262. </view>
  263. </view>
  264. <view class="lf-m-t-30 lf-row-between">
  265. <view class="lf-font-28 lf-color-gray">数量</view>
  266. <view>
  267. <u-number-box :min="1" v-model="buy_num" @change="valChange"></u-number-box>
  268. </view>
  269. </view>
  270. <view style="margin-top: 60rpx;">
  271. <button class="choose_btn" @click="toAddOrder()">立即购买</button>
  272. </view>
  273. </view>
  274. </u-popup>
  275. </block>
  276. <!-- 旅游路线类型 -->
  277. <view
  278. v-if="goods_detail.product && goods_detail.product.type == 0 && goods_detail.product.extends.field_0_project">
  279. <view class="goods-detail">
  280. <view class="lf-font-32 lf-font-bold lf-m-b-20">包含项目</view>
  281. <view class="lf-flex-column">
  282. <view class="lf-row-between child-tag"
  283. v-for="(item,index) in goods_detail.product.extends.field_0_project" :key="index">
  284. <view class="lf-font-28 lf-color-black lf-flex-1">{{item.name}}</view>
  285. <view class="lf-font-28 lf-color-black lf-flex-1" style="text-align: center;">
  286. {{item.num}}</view>
  287. <view class="lf-font-28 lf-color-black lf-flex-1" style="text-align: right;">
  288. {{item.price}}</view>
  289. </view>
  290. </view>
  291. </view>
  292. <view class="goods-detail"
  293. v-if="goods_detail.product.extends.field_0_date.end && goods_detail.product.extends.field_0_date.start">
  294. <view class="lf-row-between">
  295. <view class="lf-font-32 lf-font-bold">
  296. 行程时间
  297. </view>
  298. <view class="lf-font-28 lf-color-black">
  299. <view>
  300. {{goods_detail.product.extends.field_0_date.start}}~{{goods_detail.product.extends.field_0_date.end}}
  301. </view>
  302. </view>
  303. </view>
  304. <!-- <zwyCalendar class="lf-m-t-20" type="sign" :startTime="'2021-10-01'" :endTime="'2021-11-01'"/> -->
  305. </view>
  306. </view>
  307. <block v-if="$isRight(goods_detail.spec)">
  308. <!-- 旅游路线类型弹窗 -->
  309. <u-popup v-model="travel_route" mode="bottom" :closeable="true" border-radius="20">
  310. <view class="lf-p-32">
  311. <view class="price lf-flex">
  312. <lf-price :price="choose_date_price*buy_num || goods_detail.spec[type_index].price*buy_num"></lf-price>
  313. <view class="pop-price lf-m-l-20 lf-font-24">
  314. ¥{{ choose_date_orangilprice*buy_num || goods_detail.spec[type_index].original_price*buy_num}}</view>
  315. </view>
  316. <view class="lf-font-24 lf-m-t-20 lf-color-555">
  317. 套餐类型{{goods_detail.spec[type_index].name}}
  318. </view>
  319. <view style="margin-top: 60rpx;">
  320. <text class="lf-font-32 lf-font-bold" style="color: #131315;">套餐类型</text>
  321. <view class="lf-m-t-30 choose-father">
  322. <view class="choose-span" :class="type_index==index?'choose-active':''"
  323. v-for="(item,index) of goods_detail.spec" @click="chooseType(index)" :key="index">
  324. {{item.name}}</view>
  325. </view>
  326. </view>
  327. <view class="lf-m-t-30">
  328. <view class="lf-row-between list-item lf-m-t-20" style="padding: 0!important;">
  329. <view class="lf-row-center">
  330. <text class="lf-font-28 lf-color-gray" @click="show = true">使用时间</text>
  331. </view>
  332. <view class="lf-flex">
  333. <!-- <picker mode="date" :end="goods_detail.spec[type_index].date_end" :start="goods_detail.spec[type_index].date_start" :value="go_date" @change="goChange">
  334. <view class="lf-color-333 lf-text-right lf-font-28" style="width: 400rpx;">{{ go_date }}</view>
  335. </picker> -->
  336. <text @click="show = true">{{go_date}}</text>
  337. <text class="lf-iconfont lf-icon-xiangyou lf-text-vertical lf-m-l-10"></text>
  338. </view>
  339. </view>
  340. </view>
  341. <view class="lf-m-t-30 lf-row-between">
  342. <view class="lf-font-28 lf-color-gray">数量</view>
  343. <view>
  344. <u-number-box :min="1" v-model="buy_num" @change="valChange"></u-number-box>
  345. </view>
  346. </view>
  347. <view style="margin-top: 60rpx;">
  348. <button class="choose_btn" @click="toAddOrder()">立即购买</button>
  349. </view>
  350. </view>
  351. </u-popup>
  352. <!-- 车队 -->
  353. <u-popup v-model="car" mode="bottom" :closeable="true" border-radius="20">
  354. <view class="lf-p-32">
  355. <view class="price lf-flex">
  356. <lf-price :price="choose_date_price*buy_num || goods_detail.spec[type_index].price*buy_num"></lf-price>
  357. <view class="pop-price lf-m-l-20 lf-font-24">
  358. ¥{{ choose_date_orangilprice*buy_num || goods_detail.spec[type_index].original_price*buy_num}}</view>
  359. </view>
  360. <view class="lf-font-24 lf-m-t-20 lf-color-555">
  361. 套餐类型{{goods_detail.spec[type_index].name}}
  362. </view>
  363. <view style="margin-top: 60rpx;">
  364. <text class="lf-font-32 lf-font-bold" style="color: #131315;">套餐类型</text>
  365. <view class="lf-m-t-30 choose-father">
  366. <view class="choose-span" :class="type_index==index?'choose-active':''"
  367. v-for="(item,index) of goods_detail.spec" @click="chooseType(index)" :key="index">
  368. {{item.name}}</view>
  369. </view>
  370. </view>
  371. <view class="lf-m-t-30">
  372. <view class="lf-row-between list-item lf-m-t-20" style="padding: 0!important;">
  373. <view class="lf-row-center">
  374. <text class="lf-font-28 lf-color-gray" @click="show = true">使用时间</text>
  375. </view>
  376. <view class="lf-flex">
  377. <!-- <picker mode="date" :end="goods_detail.spec[type_index].date_end" :start="goods_detail.spec[type_index].date_start" :value="go_date" @change="goChange">
  378. <view class="lf-color-333 lf-text-right lf-font-28" style="width: 400rpx;">{{ go_date }}</view>
  379. </picker> -->
  380. <text @click="show = true">{{go_date}}</text>
  381. <text class="lf-iconfont lf-icon-xiangyou lf-text-vertical lf-m-l-10"></text>
  382. </view>
  383. </view>
  384. </view>
  385. <view class="lf-m-t-30 lf-row-between">
  386. <view class="lf-font-28 lf-color-gray">数量</view>
  387. <view>
  388. <u-number-box :min="1" v-model="buy_num" @change="valChange"></u-number-box>
  389. </view>
  390. </view>
  391. <view style="margin-top: 60rpx;">
  392. <button class="choose_btn" @click="toAddOrder()">立即购买</button>
  393. </view>
  394. </view>
  395. </u-popup>
  396. <!-- 单项 -->
  397. <u-popup v-model="single" mode="bottom" :closeable="true" border-radius="20">
  398. <view class="lf-p-32">
  399. <view class="price lf-flex">
  400. <lf-price :price="choose_date_price*buy_num || goods_detail.spec[type_index].price*buy_num"></lf-price>
  401. <view class="pop-price lf-m-l-20 lf-font-24">
  402. ¥{{ choose_date_orangilprice*buy_num || goods_detail.spec[type_index].original_price*buy_num}}</view>
  403. </view>
  404. <view class="lf-font-24 lf-m-t-20 lf-color-555">
  405. 套餐类型{{goods_detail.spec[type_index].name}}
  406. </view>
  407. <view style="margin-top: 60rpx;">
  408. <text class="lf-font-32 lf-font-bold" style="color: #131315;">套餐类型</text>
  409. <view class="lf-m-t-30 choose-father">
  410. <view class="choose-span" :class="type_index==index?'choose-active':''"
  411. v-for="(item,index) of goods_detail.spec" @click="chooseType(index)" :key="index">
  412. {{item.name}}</view>
  413. </view>
  414. </view>
  415. <view class="lf-m-t-30">
  416. <view class="lf-row-between">
  417. <text class="lf-font-32 lf-font-bold" style="color: #131315;">出行日期</text>
  418. </view>
  419. <view class="lf-row-between list-item lf-m-t-20" style="padding: 0!important;">
  420. <view class="lf-row-center">
  421. <text class="lf-font-28 lf-color-gray" @click="show = true">使用时间</text>
  422. </view>
  423. <view class="lf-flex">
  424. <!-- <picker mode="date" :end="goods_detail.spec[type_index].date_end" :start="goods_detail.spec[type_index].date_start" :value="go_date" @change="goChange">
  425. <view class="lf-color-333 lf-text-right lf-font-28" style="width: 400rpx;">{{ go_date }}</view>
  426. </picker> -->
  427. <text @click="show = true">{{go_date}}</text>
  428. <text class="lf-iconfont lf-icon-xiangyou lf-text-vertical lf-m-l-10"></text>
  429. </view>
  430. </view>
  431. </view>
  432. <view class="lf-m-t-30 lf-row-between">
  433. <view class="lf-font-28 lf-color-gray">数量</view>
  434. <view>
  435. <u-number-box :min="1" v-model="buy_num" @change="valChange"></u-number-box>
  436. </view>
  437. </view>
  438. <view style="margin-top: 60rpx;">
  439. <button class="choose_btn" @click="toAddOrder()">立即购买</button>
  440. </view>
  441. </view>
  442. </u-popup>
  443. </block>
  444. <!-- 公共部分 -->
  445. <!-- 商品详情 -->
  446. <view class="goods-detail" v-if="goods_detail.know">
  447. <view class="lf-font-32 lf-font-bold lf-m-b-20">购买须知</view>
  448. <rich-text :nodes="formatRichText(goods_detail.know)"></rich-text>
  449. </view>
  450. <view class="goods-detail" v-if="goods_detail.content">
  451. <view class="lf-font-32 lf-font-bold lf-m-b-20">商品详情</view>
  452. <rich-text :nodes="formatRichText(goods_detail.content)"></rich-text>
  453. </view>
  454. <!-- 修饰专用 -->
  455. <view class="extra"></view>
  456. <!-- 吸底操作按钮 -->
  457. <view class="lf-row-between fixed-bottom">
  458. <view class="lf-flex lf-p-t-10 lf-p-b-10">
  459. <view class="lf-flex-column lf-row-center icon-item"
  460. @click="$url('/pages/index/index', {type: 'switch'})">
  461. <image class="icon-img" src="../../static/tabbar/home1.png"></image>
  462. <view class="lf-m-t-1">首页</view>
  463. </view>
  464. <button class="lf-flex-column lf-row-center icon-item" open-type="contact">
  465. <image class="icon-img" src="../../static/center/service.png"></image>
  466. <view class="lf-m-t-1">客服</view>
  467. </button>
  468. <view class="lf-flex-column lf-row-center icon-item" @click="switchCollect">
  469. <image class="icon-img" src="../../static/center/collect-active.png" v-if="is_collect">
  470. </image>
  471. <image class="icon-img" src="../../static/center/collect.png" v-else></image>
  472. <view class="lf-m-t-1">{{ is_collect ? '已收藏' : '收藏' }}</view>
  473. </view>
  474. <button class="lf-flex-column lf-row-center icon-item" open-type="share">
  475. <image class="icon-img" src="../../static/center/share.png"></image>
  476. <view class="lf-m-t-1">分享</view>
  477. </button>
  478. </view>
  479. <button class="btn" @click="changePop(goods_detail.product.type)">立即购买</button>
  480. </view>
  481. <!-- 回到顶部 -->
  482. <!-- <u-back-top :scroll-top="pageScrollTop" :custom-style="{background: 'rgba(51, 51 51, 0.3)'}" :icon-style="{color: '#ffffff'}"></u-back-top> -->
  483. <u-back-top :scroll-top="pageScrollTop" :custom-style="{background: 'rgba(51, 51 51, 0.3)'}">
  484. </u-back-top>
  485. </block>
  486. </skeleton>
  487. </view>
  488. </template>
  489. <script>
  490. export default {
  491. data() {
  492. return {
  493. params: {
  494. year: true,
  495. month: true,
  496. day: true,
  497. hour: true,
  498. minute: true,
  499. second: false
  500. },
  501. buy_num: 1,
  502. year: new Date().getFullYear(), // 当前年
  503. month: new Date().getMonth() + 1, // 当前月
  504. now_time: '',
  505. current: 0, // 轮播下标
  506. goods_id: 0,
  507. goods_detail: {},
  508. is_collect: false, // 1为当前收藏商品了,0为否
  509. skeletonLoading: true,
  510. //景区类型相关
  511. scenic_spot: false,
  512. type_index: 0,
  513. choose_date: '请选择使用时间',
  514. //酒店相关
  515. hotel: false,
  516. live_date: '请选择入住日期',
  517. leave_date: '请选择离店日期',
  518. arrive_date: '请选择到店日期',
  519. arrive_time: '请选择到店时间',
  520. totalLive: '', //住宿时间
  521. //旅游路线相关
  522. travel_route: false,
  523. go_date: '请选择使用时间',
  524. back_date: '请选择回程日期',
  525. //餐厅
  526. canteen: false,
  527. car: false,
  528. single: false,
  529. choose_date_price: '',
  530. choose_date_orangilprice: '',
  531. choose_date_specid: '',
  532. //酒店
  533. total_hotel_price: 0,
  534. total_hotel_orginalprice: 0,
  535. live_index: 0,
  536. leave_index: 0,
  537. hotel_specid: [],
  538. //uview picker
  539. show: false,
  540. hotel_show_range: false,
  541. hotel_show_single: false,
  542. shop_distance: 0
  543. }
  544. },
  545. onLoad(options) {
  546. this.goods_id = options.goods_id || options.id;
  547. console.log('商品', this.goods_id)
  548. this.getGoodsDetail();
  549. },
  550. computed: {
  551. isRight() {
  552. return function(val) {
  553. return this.$shared.isRight(val);
  554. }
  555. }
  556. },
  557. methods: {
  558. getGoodsDetail() {
  559. this.$http(this.API.API_ADVICEDETAILS, {
  560. id: this.goods_id
  561. }).then(res => {
  562. this.skeletonLoading = false;
  563. this.goods_detail = res.data;
  564. if(this.goods_detail) {
  565. this.getShopDistance();
  566. }
  567. if(!this.$isRight(this.goods_detail.spec)){
  568. uni.showModal({
  569. title: '',
  570. content: '该商品暂无规格,无法购买',
  571. showCancel: false,
  572. success: result => {
  573. this.$toBack();
  574. }
  575. })
  576. }
  577. this.is_collect = Boolean(res.data.is_collect) || false;
  578. }).catch(err => {
  579. this.skeletonLoading = false;
  580. setTimeout(() => {
  581. this.$toBack();
  582. }, 1000);
  583. })
  584. },
  585. //获取当前位置 计算商店距离
  586. getShopDistance() {
  587. let that = this;
  588. wx.getLocation({
  589. type: 'wgs84',
  590. isHighAccuracy: true,
  591. success (res) {
  592. const self_latitude = res.latitude
  593. const self_longitude = res.longitude
  594. console.log('当前经纬度',self_latitude,self_longitude,res);
  595. if(that.goods_detail.product && that.$isRight(that.goods_detail.product.extends)) {
  596. const shop_latitude = that.goods_detail.latitude;
  597. const shop_longitude = that.goods_detail.longitude;
  598. console.log('商家经纬度',shop_latitude,shop_longitude);
  599. //计算
  600. var radLat1 = self_latitude* Math.PI / 180.0;
  601. var radLat2 = shop_latitude* Math.PI / 180.0;
  602. var a = radLat1 - radLat2;
  603. var b = (self_longitude* Math.PI / 180.0) - (shop_longitude* Math.PI / 180.0);
  604. var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
  605. s = s * 6378.137;//地球半径
  606. s = Math.round(s * 10000) / 10000;
  607. s = s.toFixed(2) + 'km' //保留两位小数
  608. that.shop_distance = s
  609. console.log('经纬度计算的距离:' + s)
  610. }
  611. },
  612. fail(err) {
  613. console.log(err)
  614. }
  615. })
  616. },
  617. valChange(e) {
  618. this.buy_num = e.value;
  619. },
  620. changeArrive(e) {
  621. let arrrive_day = e.year+'-'+e.month+'-'+e.day;
  622. this.compareDate(arrrive_day)
  623. if(this.compareDate(arrrive_day)) {
  624. this.arrive_date = e.year+'-'+e.month+'-'+e.day+' '+e.hour+':'+e.minute;
  625. }else {
  626. this.$msg('不能选择过去的时间!');
  627. }
  628. },
  629. changeRange(e) {
  630. if(e.startDate == e.endDate) {
  631. this.$msg('不能选择同一天!');
  632. return
  633. }else {
  634. this.total_hotel_price = 0;
  635. this.total_hotel_orginalprice = 0;
  636. this.live_date = e.startDate;
  637. this.leave_date = e.endDate;
  638. let live_date = new Date(new Date(this.live_date).toLocaleDateString()).getTime();
  639. let leave_date = new Date(new Date(this.leave_date).toLocaleDateString()).getTime();
  640. this.totalLive = parseInt(Math.abs(leave_date - live_date) / 1000 / 60 / 60 / 24);
  641. let differrentList = this.goods_detail.spec[this.type_index].list;
  642. differrentList.forEach((item, index) => {
  643. if (item.date == this.live_date) {
  644. this.live_index = index;
  645. } else if (item.date == this.leave_date) {
  646. this.leave_index = index;
  647. }
  648. })
  649. let total_date = differrentList.slice(this.live_index, this.leave_index);
  650. this.hotel_specid = [];
  651. total_date.reduce((list, item) => {
  652. this.total_hotel_price += parseFloat(item.price);
  653. this.total_hotel_orginalprice += parseFloat(item.original_price);
  654. this.hotel_specid.push(item.id);
  655. console.log('当前价格',this.total_hotel_price);
  656. console.log('当前11',item.price);
  657. }, []);
  658. }
  659. },
  660. change(e) {
  661. console.log(e);
  662. this.go_date = e.result
  663. let differrentList = this.goods_detail.spec[this.type_index].list;
  664. console.log(differrentList)
  665. differrentList.forEach((item, index) => {
  666. if (item.date == this.go_date) {
  667. this.choose_date_price = this.goods_detail.spec[this.type_index].list[index].price;
  668. this.choose_date_orangilprice = this.goods_detail.spec[this.type_index].list[index]
  669. .original_price;
  670. this.choose_date_specid = this.goods_detail.spec[this.type_index].list[index].id;
  671. }
  672. })
  673. },
  674. compareDate(val) {
  675. var nowTime = new Date(new Date().toLocaleDateString()).getTime();
  676. let oldTime = new Date(new Date(val).toLocaleDateString()).getTime();
  677. if (nowTime > oldTime) {
  678. return false;
  679. } else {
  680. return true;
  681. }
  682. },
  683. chooseType(index) {
  684. this.type_index = index;
  685. this.choose_date_price = 0;
  686. this.choose_date_orangilprice = 0;
  687. let differrentList = this.goods_detail.spec[this.type_index].list;
  688. differrentList.forEach((item, index) => {
  689. if (item.date == this.go_date) {
  690. this.choose_date_price = this.goods_detail.spec[this.type_index].list[index].price;
  691. this.choose_date_orangilprice = this.goods_detail.spec[this.type_index].list[index]
  692. .original_price;
  693. this.choose_date_specid = this.goods_detail.spec[this.type_index].list[index].id;
  694. }
  695. })
  696. },
  697. chooseTypehotel(index) {
  698. this.type_index = index;
  699. this.total_hotel_price = 0;
  700. this.total_hotel_orginalprice = 0;
  701. let differrentList = this.goods_detail.spec[this.type_index].list;
  702. console.log(differrentList)
  703. differrentList.forEach((item, index) => {
  704. if (item.date == this.live_date) {
  705. this.live_index = index;
  706. } else if (item.date == this.leave_date) {
  707. this.leave_index = index;
  708. }
  709. })
  710. let total_date = differrentList.slice(this.live_index, this.leave_index);
  711. this.hotel_specid = [];
  712. total_date.reduce((list, item) => {
  713. this.total_hotel_price += parseInt(item.price);
  714. this.total_hotel_orginalprice += parseInt(item.original_price);
  715. this.hotel_specid.push(item.id);
  716. console.log(this.hotel_specid);
  717. }, []);
  718. },
  719. changePop(type) {
  720. if (type == 2) {
  721. //景区
  722. this.scenic_spot = true;
  723. } else if (type == 1) {
  724. //酒店
  725. this.hotel = true;
  726. } else if (type == 0) {
  727. //旅游路线
  728. this.travel_route = true;
  729. } else if (type == 3) {
  730. //餐厅
  731. this.canteen = true;
  732. this.scenic_spot = true; // PS 餐厅弹窗未开发,直接与景区弹窗共用!!!!!!
  733. } else if (type == 4) {
  734. //车队
  735. this.car = true;
  736. } else if (type == 5) {
  737. //单项
  738. this.single = true;
  739. }
  740. },
  741. // 打开地图
  742. openMap(address, lat, lng) {
  743. // let { address, lat, lng } = this.goods_detail?.store || {};
  744. uni.openLocation({
  745. longitude: Number(lng),
  746. latitude: Number(lat),
  747. scale: 20,
  748. name: address
  749. });
  750. },
  751. // 切换商品收藏
  752. switchCollect() {
  753. let userInfo = uni.getStorageSync('userinfo') || {};
  754. if (!userInfo.id || !userInfo.nickname || !userInfo.avatar) {
  755. this.$url('/pages/login/index?type=userinfo');
  756. return;
  757. }
  758. if (this.is_collect) {
  759. this.$http(this.API.API_DELCOLLECT, {
  760. agent_product_id: this.goods_id
  761. }).then(res => {
  762. this.$msg('取消收藏成功!')
  763. this.is_collect = false
  764. console.log(res)
  765. })
  766. } else {
  767. this.$http(this.API.API_ADDCOLLECT, {
  768. agent_product_id: this.goods_id
  769. }).then(res => {
  770. this.$msg('添加收藏成功!')
  771. this.is_collect = true
  772. console.log(res)
  773. })
  774. }
  775. },
  776. // 拨打电话
  777. makePhoneCall(phoneStr) {
  778. uni.makePhoneCall({
  779. phoneNumber: String(phoneStr)
  780. })
  781. },
  782. // 跳转到确认下单页面
  783. toAddOrder() {
  784. //0旅游路线1酒店2景区3餐厅
  785. if(this.goods_detail.product.type == 1) {
  786. if(this.live_date=='请选择入住日期') {
  787. this.$msg('请选择住店日期!')
  788. return
  789. }
  790. if(this.leave_date=='请选择离店日期') {
  791. this.$msg('请选择住店日期!')
  792. return
  793. }
  794. if(this.arrive_date=='请选择到店日期') {
  795. this.$msg('请选择到店日期!')
  796. return
  797. }
  798. let arrival_timedate = this.arrive_date;
  799. let goods_id = this.goods_detail.id;
  800. let godds_type = this.goods_detail.product.type;
  801. let spec_id = this.hotel_specid;
  802. let type_text = this.goods_detail.spec[this.type_index].name;
  803. //酒店
  804. let check_in_time = this.live_date;
  805. let check_out_time = this.leave_date;
  806. let totalLive = this.totalLive;
  807. let form_type = encodeURIComponent(JSON.stringify(this.goods_detail.product.diy_form));
  808. this.$url('/pages/order/confirm_order?goods_id=' + goods_id + '&spec_id=' + spec_id +
  809. '&goods_type=' + godds_type + '&check_in_time=' + check_in_time + '&goods_typetext=' +
  810. type_text + '&check_out_time=' + check_out_time + '&arrival_time=' + arrival_timedate +
  811. '&totalLive=' + totalLive+'&form_type='+form_type+'&buy_num='+this.buy_num);
  812. }else {
  813. if(this.go_date=='请选择使用时间') {
  814. this.$msg('请选择使用时间!')
  815. return
  816. }
  817. let goods_id = this.goods_detail.id;
  818. let godds_type = this.goods_detail.product.type;
  819. let departure_time = this.go_date;
  820. let spec_id = this.choose_date_specid;
  821. let type_text = this.goods_detail.spec[this.type_index].name;
  822. let form_type = encodeURIComponent(JSON.stringify(this.goods_detail.product.diy_form));
  823. this.$url('/pages/order/confirm_order?goods_id=' + goods_id + '&spec_id=' + spec_id +
  824. '&goods_type=' + godds_type + '&departure_time=' + departure_time +
  825. '&goods_typetext=' + type_text+'&form_type='+form_type+'&buy_num='+this.buy_num);
  826. }
  827. },
  828. // 预览图片
  829. lookImg(index) {
  830. this.$u.throttle(() => {
  831. let goods_banner = this.goods_detail.banners || [];
  832. let banners = goods_banner.map(item => item.cover);
  833. uni.previewImage({
  834. urls: banners,
  835. current: index
  836. })
  837. }, 200);
  838. },
  839. // 富文本处理
  840. formatRichText(richText) {
  841. if (richText != null) {
  842. let newRichText = richText.replace(/<img[^>]*>/gi, function(match, capture) {
  843. match = match.replace(/style="[^"]+"/gi, '').replace(/style='[^']+'/gi, '');
  844. match = match.replace(/width="[^"]+"/gi, '').replace(/width='[^']+'/gi, '');
  845. match = match.replace(/height="[^"]+"/gi, '').replace(/height='[^']+'/gi, '');
  846. return match;
  847. });
  848. newRichText = newRichText.replace(/style="[^"]+"/gi, function(match, capture) {
  849. match = match.replace(/width:[^;]+;/gi, 'width:100%;').replace(/width:[^;]+;/gi,
  850. 'width:100%;');
  851. return match;
  852. });
  853. newRichText = newRichText.replace(/<br[^>]*\/>/gi, '');
  854. newRichText = newRichText.replace(/\<img/gi,
  855. '<img style="width:100%;height:auto;display:block;margin:10px 0;"');
  856. return newRichText;
  857. } else {
  858. return null;
  859. }
  860. }
  861. },
  862. onShareAppMessage() {
  863. let goods = this.goods_detail;
  864. let title = goods.title;
  865. let imageUrl = goods.pictures[0] || goods.picture;
  866. let path = '/pages/route/index?route=goods_detail&id=' + goods.id;
  867. console.log("path", path);
  868. return {
  869. title,
  870. path,
  871. imageUrl
  872. }
  873. }
  874. }
  875. </script>
  876. <style>
  877. page {
  878. background-color: #f5f5f5;
  879. overflow-x: hidden;
  880. }
  881. </style>
  882. <style lang="scss" scoped="scoped">
  883. /deep/.pop-self .u-drawer .u-mask {
  884. z-index: 99 !important;
  885. }
  886. .choose_btn {
  887. width: 686rpx;
  888. height: 100rpx;
  889. background: #1998FE;
  890. border-radius: 10rpx;
  891. font-size: 32rpx;
  892. color: white;
  893. display: flex;
  894. justify-content: center;
  895. align-items: center;
  896. }
  897. .choose-father {
  898. display: flex;
  899. width: 700rpx;
  900. flex-wrap: wrap;
  901. }
  902. .choose-active {
  903. background: #1998FE !important;
  904. font-size: 24rpx;
  905. color: white !important;
  906. }
  907. .choose-span {
  908. width: max-content;
  909. margin: 0 30rpx 30rpx 0;
  910. height: 64rpx;
  911. background: #F5F5F5;
  912. border-radius: 32rpx;
  913. font-size: 24rpx;
  914. color: #333333;
  915. padding: 0 32rpx;
  916. display: flex;
  917. justify-content: center;
  918. align-items: center;
  919. }
  920. .pop-price {
  921. text-decoration: line-through;
  922. color: #777777;
  923. margin-right: 22rpx;
  924. }
  925. .list-item {
  926. height: 80rpx;
  927. background-color: white;
  928. box-sizing: border-box;
  929. padding: 0 32rpx;
  930. position: relative;
  931. .feedback-btn {
  932. position: absolute;
  933. width: 100%;
  934. height: 100%;
  935. z-index: 1;
  936. background: transparent;
  937. }
  938. }
  939. .child-tag {
  940. margin-bottom: 20rpx;
  941. &:last-child {
  942. margin-bottom: 0;
  943. }
  944. }
  945. .swiper-box {
  946. width: 750rpx;
  947. height: 490rpx;
  948. background-color: #FFFFFF;
  949. }
  950. .head-info {
  951. width: 750rpx;
  952. height: auto;
  953. box-sizing: border-box;
  954. padding: 0 32rpx;
  955. padding-top: 20rpx;
  956. background-color: #FFFFFF;
  957. // .price>view:nth-of-type(1){
  958. // color: #FF0000;
  959. // margin-right: 22rpx;
  960. // font-weight: bold;
  961. // }
  962. .price>view:nth-of-type(1) {
  963. text-decoration: line-through;
  964. color: #777777;
  965. margin-right: 22rpx;
  966. }
  967. .price>view:nth-of-type(2) {
  968. width: max-content;
  969. padding: 0 18rpx;
  970. height: 46rpx;
  971. background-color: #1998FE;
  972. border-radius: 10rpx;
  973. display: flex;
  974. justify-content: center;
  975. align-items: center;
  976. color: #FFFFFF;
  977. }
  978. }
  979. .label-box {
  980. min-height: 130rpx;
  981. width: 100%;
  982. border-top: 1rpx solid #E5E5E5;
  983. display: flex;
  984. flex-wrap: wrap;
  985. padding: 30rpx 0 10rpx 0;
  986. .label-item {
  987. width: max-content;
  988. padding: 20rpx;
  989. height: 70rpx;
  990. border-radius: 10rpx;
  991. border: 2rpx solid #1998FE;
  992. display: flex;
  993. justify-content: center;
  994. align-items: center;
  995. font-size: 28rpx;
  996. color: #1998FE;
  997. margin-right: 20rpx;
  998. margin-bottom: 20rpx;
  999. }
  1000. }
  1001. .label-box1 {
  1002. min-height: 130rpx;
  1003. width: 100%;
  1004. border-top: 1rpx solid #E5E5E5;
  1005. display: flex;
  1006. flex-wrap: wrap;
  1007. padding: 30rpx 0 10rpx 0;
  1008. .label-item {
  1009. width: max-content;
  1010. padding: 0 10rpx;
  1011. height: 54rpx;
  1012. border-radius: 10rpx;
  1013. border: 2rpx solid #1998FE;
  1014. display: flex;
  1015. justify-content: center;
  1016. align-items: center;
  1017. font-size: 24rpx;
  1018. color: #1998FE;
  1019. background: rgba(25, 152, 254, 0.05);
  1020. margin-right: 20rpx;
  1021. margin-bottom: 20rpx;
  1022. }
  1023. }
  1024. .address-box {
  1025. width: 750rpx;
  1026. height: auto;
  1027. box-sizing: border-box;
  1028. background-color: #FFFFFF;
  1029. padding: 32rpx;
  1030. margin-top: 20rpx;
  1031. .shop-img {
  1032. width: 60rpx;
  1033. height: 60rpx;
  1034. border-radius: 50%;
  1035. }
  1036. }
  1037. .goods-detail {
  1038. width: 750rpx;
  1039. height: auto;
  1040. background-color: #FFFFFF;
  1041. padding: 32rpx;
  1042. box-sizing: border-box;
  1043. margin-top: 20rpx;
  1044. .goods-img {
  1045. width: 100%;
  1046. }
  1047. }
  1048. .extra {
  1049. width: 100%;
  1050. height: 120rpx;
  1051. padding-bottom: constant(safe-area-inset-bottom);
  1052. padding-bottom: env(safe-area-inset-bottom);
  1053. box-sizing: content-box;
  1054. }
  1055. .fixed-bottom {
  1056. position: fixed;
  1057. bottom: 0;
  1058. left: 0;
  1059. background-color: #FFFFFF;
  1060. width: 100%;
  1061. height: auto;
  1062. padding: 0 32rpx;
  1063. border-top: 1rpx solid #e5e5e5;
  1064. padding-bottom: constant(safe-area-inset-bottom);
  1065. padding-bottom: env(safe-area-inset-bottom);
  1066. .icon-item {
  1067. margin-right: 16rpx;
  1068. background-color: transparent;
  1069. margin: 0;
  1070. line-height: initial;
  1071. font-size: 28rpx;
  1072. font-weight: inherit;
  1073. margin-right: 10rpx;
  1074. padding: 0;
  1075. width: 88rpx;
  1076. position: relative;
  1077. &:first-child {
  1078. padding-left: 0;
  1079. }
  1080. .icon-img {
  1081. height: 50rpx;
  1082. width: 50rpx;
  1083. }
  1084. }
  1085. .btn {
  1086. margin: 0;
  1087. padding: 0;
  1088. width: 208rpx;
  1089. height: 80rpx;
  1090. background-color: #1998FE;
  1091. color: #FFFFFF;
  1092. line-height: 80rpx;
  1093. font-size: 32rpx;
  1094. border-radius: 42rpx;
  1095. }
  1096. }
  1097. </style>