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

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