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

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