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

1059 lines
37 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. <!-- 景区类型 -->
  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}} <text class="lf-m-l-20" v-if="totalLive">{{totalLive}}</text>
  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. if(e.startDate == e.endDate) {
  542. this.$msg('不能选择同一天!');
  543. return
  544. }else {
  545. this.total_hotel_price = 0;
  546. this.total_hotel_orginalprice = 0;
  547. this.live_date = e.startDate;
  548. this.leave_date = e.endDate;
  549. let live_date = new Date(new Date(this.live_date).toLocaleDateString()).getTime();
  550. let leave_date = new Date(new Date(this.leave_date).toLocaleDateString()).getTime();
  551. this.totalLive = parseInt(Math.abs(leave_date - live_date) / 1000 / 60 / 60 / 24);
  552. let differrentList = this.goods_detail.spec[this.type_index].list;
  553. differrentList.forEach((item, index) => {
  554. if (item.date == this.live_date) {
  555. this.live_index = index;
  556. } else if (item.date == this.leave_date) {
  557. this.leave_index = index;
  558. }
  559. })
  560. let total_date = differrentList.slice(this.live_index, this.leave_index);
  561. this.hotel_specid = [];
  562. total_date.reduce((list, item) => {
  563. this.total_hotel_price += parseFloat(item.price);
  564. this.total_hotel_orginalprice += parseFloat(item.original_price);
  565. this.hotel_specid.push(item.id);
  566. console.log('当前价格',this.total_hotel_price);
  567. console.log('当前11',item.price);
  568. }, []);
  569. }
  570. },
  571. change(e) {
  572. console.log(e);
  573. this.go_date = e.result
  574. let differrentList = this.goods_detail.spec[this.type_index].list;
  575. console.log(differrentList)
  576. differrentList.forEach((item, index) => {
  577. if (item.date == this.go_date) {
  578. this.choose_date_price = this.goods_detail.spec[this.type_index].list[index].price;
  579. this.choose_date_orangilprice = this.goods_detail.spec[this.type_index].list[index]
  580. .original_price;
  581. this.choose_date_specid = this.goods_detail.spec[this.type_index].list[index].id;
  582. }
  583. })
  584. },
  585. compareDate(val) {
  586. var nowTime = new Date(new Date().toLocaleDateString()).getTime();
  587. let oldTime = new Date(new Date(val).toLocaleDateString()).getTime();
  588. if (nowTime > oldTime) {
  589. return false;
  590. } else {
  591. return true;
  592. }
  593. },
  594. chooseType(index) {
  595. this.type_index = index;
  596. this.choose_date_price = 0;
  597. this.choose_date_orangilprice = 0;
  598. let differrentList = this.goods_detail.spec[this.type_index].list;
  599. differrentList.forEach((item, index) => {
  600. if (item.date == this.go_date) {
  601. this.choose_date_price = this.goods_detail.spec[this.type_index].list[index].price;
  602. this.choose_date_orangilprice = this.goods_detail.spec[this.type_index].list[index]
  603. .original_price;
  604. this.choose_date_specid = this.goods_detail.spec[this.type_index].list[index].id;
  605. }
  606. })
  607. },
  608. chooseTypehotel(index) {
  609. this.type_index = index;
  610. this.total_hotel_price = 0;
  611. this.total_hotel_orginalprice = 0;
  612. let differrentList = this.goods_detail.spec[this.type_index].list;
  613. console.log(differrentList)
  614. differrentList.forEach((item, index) => {
  615. if (item.date == this.live_date) {
  616. this.live_index = index;
  617. } else if (item.date == this.leave_date) {
  618. this.leave_index = index;
  619. }
  620. })
  621. let total_date = differrentList.slice(this.live_index, this.leave_index);
  622. this.hotel_specid = [];
  623. total_date.reduce((list, item) => {
  624. this.total_hotel_price += parseInt(item.price);
  625. this.total_hotel_orginalprice += parseInt(item.original_price);
  626. this.hotel_specid.push(item.id);
  627. console.log(this.hotel_specid);
  628. }, []);
  629. },
  630. changePop(type) {
  631. if (type == 2) {
  632. //景区
  633. this.scenic_spot = true;
  634. } else if (type == 1) {
  635. //酒店
  636. this.hotel = true;
  637. } else if (type == 0) {
  638. //旅游路线
  639. this.travel_route = true;
  640. } else if (type == 3) {
  641. //餐厅
  642. this.canteen = true;
  643. } else if (type == 4) {
  644. //车队
  645. this.car = true;
  646. } else if (type == 5) {
  647. //单项
  648. this.single = true;
  649. }
  650. },
  651. // 打开地图
  652. openMap(address, lat, lng) {
  653. // let { address, lat, lng } = this.goods_detail?.store || {};
  654. uni.openLocation({
  655. longitude: Number(lng),
  656. latitude: Number(lat),
  657. scale: 20,
  658. name: address
  659. });
  660. },
  661. getGoodsDetail() {
  662. this.$http(this.API.API_ADVICEDETAILS, {
  663. id: this.goods_id
  664. }).then(res => {
  665. this.skeletonLoading = false;
  666. this.goods_detail = res.data;
  667. this.is_collect = Boolean(res.data.is_collect) || false;
  668. }).catch(err => {
  669. this.skeletonLoading = false;
  670. setTimeout(() => {
  671. this.$toBack();
  672. }, 1000);
  673. })
  674. },
  675. // 切换商品收藏
  676. switchCollect() {
  677. let userInfo = uni.getStorageSync('userinfo') || {};
  678. if (!userInfo.id || !userInfo.nickname || !userInfo.avatar) {
  679. this.$url('/pages/login/index?type=userinfo');
  680. return;
  681. }
  682. if (this.is_collect) {
  683. this.$http(this.API.API_DELCOLLECT, {
  684. agent_product_id: this.goods_id
  685. }).then(res => {
  686. this.$msg('取消收藏成功!')
  687. this.is_collect = false
  688. console.log(res)
  689. })
  690. } else {
  691. this.$http(this.API.API_ADDCOLLECT, {
  692. agent_product_id: this.goods_id
  693. }).then(res => {
  694. this.$msg('添加收藏成功!')
  695. this.is_collect = true
  696. console.log(res)
  697. })
  698. }
  699. },
  700. // 拨打电话
  701. makePhoneCall(phoneStr) {
  702. uni.makePhoneCall({
  703. phoneNumber: String(phoneStr)
  704. })
  705. },
  706. // 跳转到确认下单页面
  707. toAddOrder() {
  708. //0旅游路线1酒店2景区3餐厅
  709. if(this.goods_detail.product.type == 1) {
  710. if(this.live_date=='请选择入住日期') {
  711. this.$msg('请选择住店日期!')
  712. return
  713. }
  714. if(this.leave_date=='请选择离店日期') {
  715. this.$msg('请选择住店日期!')
  716. return
  717. }
  718. if(this.arrive_date=='请选择到店日期') {
  719. this.$msg('请选择到店日期!')
  720. return
  721. }
  722. let arrival_timedate = this.arrive_date;
  723. let goods_id = this.goods_detail.id;
  724. let godds_type = this.goods_detail.product.type;
  725. let spec_id = this.hotel_specid;
  726. let type_text = this.goods_detail.spec[this.type_index].name;
  727. //酒店
  728. let check_in_time = this.live_date;
  729. let check_out_time = this.leave_date;
  730. let totalLive = this.totalLive;
  731. let form_type = encodeURIComponent(JSON.stringify(this.goods_detail.product.diy_form));
  732. this.$url('/pages/order/confirm_order?goods_id=' + goods_id + '&spec_id=' + spec_id +
  733. '&goods_type=' + godds_type + '&check_in_time=' + check_in_time + '&goods_typetext=' +
  734. type_text + '&check_out_time=' + check_out_time + '&arrival_time=' + arrival_timedate +
  735. '&totalLive=' + totalLive+'&form_type='+form_type+'&buy_num='+this.buy_num);
  736. }else {
  737. if(this.go_date=='请选择使用时间') {
  738. this.$msg('请选择使用时间!')
  739. return
  740. }
  741. let goods_id = this.goods_detail.id;
  742. let godds_type = this.goods_detail.product.type;
  743. let departure_time = this.go_date;
  744. let spec_id = this.choose_date_specid;
  745. let type_text = this.goods_detail.spec[this.type_index].name;
  746. let form_type = encodeURIComponent(JSON.stringify(this.goods_detail.product.diy_form));
  747. this.$url('/pages/order/confirm_order?goods_id=' + goods_id + '&spec_id=' + spec_id +
  748. '&goods_type=' + godds_type + '&departure_time=' + departure_time +
  749. '&goods_typetext=' + type_text+'&form_type='+form_type+'&buy_num='+this.buy_num);
  750. }
  751. },
  752. // 预览图片
  753. lookImg(index) {
  754. this.$u.throttle(() => {
  755. let goods_banner = this.goods_detail.banners || [];
  756. let banners = goods_banner.map(item => item.cover);
  757. uni.previewImage({
  758. urls: banners,
  759. current: index
  760. })
  761. }, 200);
  762. },
  763. // 富文本处理
  764. formatRichText(richText) {
  765. if (richText != null) {
  766. let newRichText = richText.replace(/<img[^>]*>/gi, function(match, capture) {
  767. match = match.replace(/style="[^"]+"/gi, '').replace(/style='[^']+'/gi, '');
  768. match = match.replace(/width="[^"]+"/gi, '').replace(/width='[^']+'/gi, '');
  769. match = match.replace(/height="[^"]+"/gi, '').replace(/height='[^']+'/gi, '');
  770. return match;
  771. });
  772. newRichText = newRichText.replace(/style="[^"]+"/gi, function(match, capture) {
  773. match = match.replace(/width:[^;]+;/gi, 'width:100%;').replace(/width:[^;]+;/gi,
  774. 'width:100%;');
  775. return match;
  776. });
  777. newRichText = newRichText.replace(/<br[^>]*\/>/gi, '');
  778. newRichText = newRichText.replace(/\<img/gi,
  779. '<img style="width:100%;height:auto;display:block;margin:10px 0;"');
  780. return newRichText;
  781. } else {
  782. return null;
  783. }
  784. }
  785. },
  786. onShareAppMessage() {
  787. let goods = this.goods_detail;
  788. let title = goods.title;
  789. let imageUrl = goods.pictures[0] || goods.picture;
  790. let path = '/pages/route/index?route=goods_detail&id=' + goods.id;
  791. console.log("path", path);
  792. return {
  793. title,
  794. path,
  795. imageUrl
  796. }
  797. }
  798. }
  799. </script>
  800. <style>
  801. page {
  802. background-color: #f5f5f5;
  803. overflow-x: hidden;
  804. }
  805. </style>
  806. <style lang="scss" scoped="scoped">
  807. /deep/.pop-self .u-drawer .u-mask {
  808. z-index: 99 !important;
  809. }
  810. .choose_btn {
  811. width: 686rpx;
  812. height: 100rpx;
  813. background: #1998FE;
  814. border-radius: 10rpx;
  815. font-size: 32rpx;
  816. color: white;
  817. display: flex;
  818. justify-content: center;
  819. align-items: center;
  820. }
  821. .choose-father {
  822. display: flex;
  823. width: 700rpx;
  824. flex-wrap: wrap;
  825. }
  826. .choose-active {
  827. background: #1998FE !important;
  828. font-size: 24rpx;
  829. color: white !important;
  830. }
  831. .choose-span {
  832. width: max-content;
  833. margin: 0 30rpx 30rpx 0;
  834. height: 64rpx;
  835. background: #F5F5F5;
  836. border-radius: 32rpx;
  837. font-size: 24rpx;
  838. color: #333333;
  839. padding: 0 32rpx;
  840. display: flex;
  841. justify-content: center;
  842. align-items: center;
  843. }
  844. .pop-price {
  845. text-decoration: line-through;
  846. color: #777777;
  847. margin-right: 22rpx;
  848. }
  849. .list-item {
  850. height: 80rpx;
  851. background-color: white;
  852. box-sizing: border-box;
  853. padding: 0 32rpx;
  854. position: relative;
  855. .feedback-btn {
  856. position: absolute;
  857. width: 100%;
  858. height: 100%;
  859. z-index: 1;
  860. background: transparent;
  861. }
  862. }
  863. .child-tag {
  864. margin-bottom: 20rpx;
  865. &:last-child {
  866. margin-bottom: 0;
  867. }
  868. }
  869. .swiper-box {
  870. width: 750rpx;
  871. height: 490rpx;
  872. background-color: #FFFFFF;
  873. }
  874. .head-info {
  875. width: 750rpx;
  876. height: auto;
  877. box-sizing: border-box;
  878. padding: 0 32rpx;
  879. padding-top: 20rpx;
  880. background-color: #FFFFFF;
  881. // .price>view:nth-of-type(1){
  882. // color: #FF0000;
  883. // margin-right: 22rpx;
  884. // font-weight: bold;
  885. // }
  886. .price>view:nth-of-type(1) {
  887. text-decoration: line-through;
  888. color: #777777;
  889. margin-right: 22rpx;
  890. }
  891. .price>view:nth-of-type(2) {
  892. width: max-content;
  893. padding: 0 18rpx;
  894. height: 46rpx;
  895. background-color: #1998FE;
  896. border-radius: 10rpx;
  897. display: flex;
  898. justify-content: center;
  899. align-items: center;
  900. color: #FFFFFF;
  901. }
  902. }
  903. .label-box {
  904. min-height: 130rpx;
  905. width: 100%;
  906. border-top: 1rpx solid #E5E5E5;
  907. display: flex;
  908. flex-wrap: wrap;
  909. padding: 30rpx 0 10rpx 0;
  910. .label-item {
  911. width: max-content;
  912. padding: 20rpx;
  913. height: 70rpx;
  914. border-radius: 10rpx;
  915. border: 2rpx solid #1998FE;
  916. display: flex;
  917. justify-content: center;
  918. align-items: center;
  919. font-size: 28rpx;
  920. color: #1998FE;
  921. margin-right: 20rpx;
  922. margin-bottom: 20rpx;
  923. }
  924. }
  925. .label-box1 {
  926. min-height: 130rpx;
  927. width: 100%;
  928. border-top: 1rpx solid #E5E5E5;
  929. display: flex;
  930. flex-wrap: wrap;
  931. padding: 30rpx 0 10rpx 0;
  932. .label-item {
  933. width: max-content;
  934. padding: 0 10rpx;
  935. height: 54rpx;
  936. border-radius: 10rpx;
  937. border: 2rpx solid #1998FE;
  938. display: flex;
  939. justify-content: center;
  940. align-items: center;
  941. font-size: 24rpx;
  942. color: #1998FE;
  943. background: rgba(25, 152, 254, 0.05);
  944. margin-right: 20rpx;
  945. margin-bottom: 20rpx;
  946. }
  947. }
  948. .address-box {
  949. width: 750rpx;
  950. height: auto;
  951. box-sizing: border-box;
  952. background-color: #FFFFFF;
  953. padding: 32rpx;
  954. margin-top: 20rpx;
  955. .shop-img {
  956. width: 60rpx;
  957. height: 60rpx;
  958. border-radius: 50%;
  959. }
  960. }
  961. .goods-detail {
  962. width: 750rpx;
  963. height: auto;
  964. background-color: #FFFFFF;
  965. padding: 32rpx;
  966. box-sizing: border-box;
  967. margin-top: 20rpx;
  968. .goods-img {
  969. width: 100%;
  970. }
  971. }
  972. .extra {
  973. width: 100%;
  974. height: 120rpx;
  975. padding-bottom: constant(safe-area-inset-bottom);
  976. padding-bottom: env(safe-area-inset-bottom);
  977. box-sizing: content-box;
  978. }
  979. .fixed-bottom {
  980. position: fixed;
  981. bottom: 0;
  982. left: 0;
  983. background-color: #FFFFFF;
  984. width: 100%;
  985. height: auto;
  986. padding: 0 32rpx;
  987. border-top: 1rpx solid #e5e5e5;
  988. padding-bottom: constant(safe-area-inset-bottom);
  989. padding-bottom: env(safe-area-inset-bottom);
  990. .icon-item {
  991. margin-right: 16rpx;
  992. background-color: transparent;
  993. margin: 0;
  994. line-height: initial;
  995. font-size: 28rpx;
  996. font-weight: inherit;
  997. margin-right: 10rpx;
  998. padding: 0;
  999. width: 88rpx;
  1000. position: relative;
  1001. &:first-child {
  1002. padding-left: 0;
  1003. }
  1004. .icon-img {
  1005. height: 50rpx;
  1006. width: 50rpx;
  1007. }
  1008. }
  1009. .btn {
  1010. margin: 0;
  1011. padding: 0;
  1012. width: 208rpx;
  1013. height: 80rpx;
  1014. background-color: #1998FE;
  1015. color: #FFFFFF;
  1016. line-height: 80rpx;
  1017. font-size: 32rpx;
  1018. border-radius: 42rpx;
  1019. }
  1020. }
  1021. </style>