海南旅游项目 前端仓库
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.

1113 lines
39 KiB

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