scenicDetail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  1. <template>
  2. <div class="scenicDetail">
  3. <div class="card">
  4. <div class="productName">{{ D.productName }}</div>
  5. <div class="advanTime" v-if="D.advanceDay == 0">
  6. <span class="corg">{{ D.advanceTime }}</span><span>前可订今日</span>
  7. </div>
  8. <div class="oderinfo">
  9. <div class="tit">选择日期</div>
  10. <scroll-view class="scroll_view" :scroll-x="true">
  11. <div class="rommnum">
  12. <div :class="{'r_num':true,'active':selectDay.date==i.date}" v-for="(i,s) in D.priceCalendar" :key="s" @click="onSelectDay(i)">{{ thatDay(i.date) }}</div>
  13. </div>
  14. </scroll-view>
  15. </div>
  16. <div class="oderinfo flex_r flex_jb flex_ac">
  17. <div class="tit">购买数量</div>
  18. <numbox v-model="qda.quantity" :min="D.minBuyCount" :max="D.maxBuyCount" @change="computef"/>
  19. </div>
  20. </div>
  21. <div class="card uinfo">
  22. <div class="tit">游客信息</div>
  23. <div class="user_item" v-for="(i,s) in users" :key="s">
  24. <div class="p flex_r flex_jb flex_ac">
  25. <span class="label">出游人:</span>
  26. <input v-model="i.name" placeholder="请填写游客真实姓名" placeholder-class="inp_pl"/>
  27. </div>
  28. <div class="p flex_r flex_jb flex_ac">
  29. <span class="label">手机号:</span>
  30. <input v-model="i.mobile" placeholder="请填写游客联系方式" placeholder-class="inp_pl"/>
  31. </div>
  32. <div class="p flex_r flex_jb flex_ac" v-if="[2,4].includes(D.touristInfoType)">
  33. <span class="label">身份证:</span>
  34. <input v-model="i.cardNo" placeholder="请填写与姓名一致的身份证号" placeholder-class="inp_pl"/>
  35. </div>
  36. </div>
  37. </div>
  38. <div class="money card">
  39. <div class="li flex_r flex_jb">
  40. <span>消费金额</span>
  41. <span>¥{{ cartTotal || 0 }}</span>
  42. </div>
  43. <div class="li flex_r flex_jb">
  44. <span>消费券抵扣<span class="corg">{{Integral}}%</span></span>
  45. <span class="corg">-¥{{ deduction || 0 }}</span>
  46. </div>
  47. <div class="li flex_r flex_jb">
  48. <span>实付金额</span>
  49. <span>¥{{ actuallypaid || 0 }}</span>
  50. </div>
  51. </div>
  52. <div class="money card mar_b60">
  53. <div class="li flex_r flex_jb">
  54. <span>赠送贡献值</span>
  55. <span>{{ chabao || 0 }}</span>
  56. </div>
  57. </div>
  58. <div class="scenic_msg" v-if="D.bookNotice">
  59. <div class="title">预订说明</div>
  60. <div class="smsg" v-for="(i,s) in D.bookNotice" :key="s">
  61. <div class="stit">{{ i.name }}</div>
  62. <div class="msg_con" v-html="i.value"></div>
  63. </div>
  64. </div>
  65. <div class="scenic_msg" v-if="D.costDescription">
  66. <div class="title">费用说明</div>
  67. <div class="smsg" v-for="(i,s) in D.costDescription" :key="s">
  68. <div class="stit">{{ i.name }}</div>
  69. <div class="msg_con" v-html="i.value"></div>
  70. </div>
  71. </div>
  72. <div class="scenic_msg" v-if="D.refundChangeRule">
  73. <div class="title">退改说明</div>
  74. <div class="smsg" v-for="(i,s) in D.refundChangeRule" :key="s">
  75. <div class="stit">{{ i.name }}</div>
  76. <div class="msg_con" v-html="i.value"></div>
  77. </div>
  78. </div>
  79. <div class="scenic_msg" v-if="D.useDescription">
  80. <div class="title">使用说明</div>
  81. <div class="smsg" v-for="(i,s) in D.useDescription" :key="s">
  82. <div class="stit">{{ i.name }}</div>
  83. <div class="msg_con" v-html="i.value"></div>
  84. </div>
  85. </div>
  86. <div class="scenic_msg" v-if="D.otherDescription">
  87. <div class="title">其他说明</div>
  88. <div class="smsg" v-for="(i,s) in D.otherDescription" :key="s">
  89. <div class="stit">{{ i.name }}</div>
  90. <div class="msg_con" v-html="i.value"></div>
  91. </div>
  92. </div>
  93. <div class="footbtn" @click="onpay">立即支付</div>
  94. </div>
  95. </template>
  96. <script>
  97. import numbox from "@/pagesB/components/number-box/number-box.vue"
  98. import { post } from "@/request/api.js";
  99. import { ToPayOpre } from "@/utils/reqTools.js";
  100. let toPayOpre = new ToPayOpre();
  101. import { getThatDay } from "@/utils/myfun.js"
  102. export default {
  103. name: "scenicDetail",
  104. props: {},
  105. components: { numbox },
  106. data() {
  107. return {
  108. qda: {
  109. quantity: 1
  110. },
  111. D: {}, // 门票详情
  112. selectDay: {},
  113. userinfo: uni.getStorageSync("userinfo"),
  114. users: [],
  115. ratio: {},
  116. cartTotal: 0,
  117. Integral: 0,
  118. deduction: 0,
  119. actuallypaid: 0,
  120. chabao: 0,
  121. };
  122. },
  123. methods: {
  124. getDetail(da) {
  125. post("local/ticket/ticketDetail", da).then((res) => {
  126. if (res.code == 0) {
  127. let da = res.data.data;
  128. if(da.bookNotice) da.bookNotice = JSON.parse(da.bookNotice);
  129. if(da.costDescription) da.costDescription = JSON.parse(da.costDescription);
  130. if(da.otherDescription) da.otherDescription = JSON.parse(da.otherDescription);
  131. if(da.refundChangeRule) da.refundChangeRule = JSON.parse(da.refundChangeRule);
  132. if(da.useDescription) da.useDescription = JSON.parse(da.useDescription);
  133. this.qda.quantity = da.minBuyCount
  134. if([3,4].includes(da.touristInfoType)){
  135. this.users.length = da.unitQuantity
  136. }
  137. this.selectDay = da.priceCalendar[0];
  138. this.getIntegral();
  139. this.D = da;
  140. }
  141. });
  142. },
  143. getIntegral() {
  144. post("local/getIntegral", { type: 4 }).then((res) => {
  145. if (res.code == 0) {
  146. this.ratio = res.data;
  147. this.computef();
  148. }
  149. });
  150. },
  151. computef() {
  152. let { integral, chabao } = this.ratio
  153. let i1 = integral, i2 = chabao;
  154. this.cartTotal = this.$h.Mul(this.selectDay.marketPrice, this.qda.quantity);
  155. this.Integral = this.$h.Mul(i1, 100);
  156. this.deduction = this.$h.Mul(this.cartTotal, i1);
  157. this.actuallypaid = this.$h.Sub(this.cartTotal, this.deduction);
  158. this.chabao = this.$h.Mul(this.actuallypaid, i2).toFixed(2);
  159. },
  160. onSelectDay(va){
  161. this.selectDay = va
  162. },
  163. onpay() {
  164. let that = this
  165. let localInfo = uni.getStorageSync("localInfo");
  166. let um = localInfo.property;
  167. let str = um > this.actuallypaid ? "将优先使用付宝抵扣" : "将使用付宝抵扣部分支付"
  168. if(um > 0){
  169. uni.showModal({
  170. title: "温馨提示",
  171. content: `您的可用付宝为 ${um},` + str,
  172. showCancel: true,
  173. confirmText: "确认",
  174. confirmColor: "#f02f2f",
  175. success(res) {
  176. if (res.confirm) {
  177. that.payok();
  178. }
  179. },
  180. });
  181. }else this.payok();
  182. },
  183. payok(){
  184. let type = "";
  185. // #ifdef H5
  186. type = "H5";
  187. // #endif
  188. // #ifdef APP
  189. type = "app";
  190. // #endif
  191. // #ifdef MP-WEIXIN
  192. type = "jsapi";
  193. // #endif
  194. let da = {
  195. ...this.qda,
  196. travelDate: this.selectDay.date,
  197. contact: JSON.stringify(this.users[0]),
  198. tourists: JSON.stringify(this.users),
  199. productID: this.qda.productId,
  200. ...this.users[0],
  201. trade_type: type,
  202. }
  203. post("local/ticket/addOrder", da).then(res => {
  204. if(res.data && res.data != 200){
  205. let data = JSON.parse(res.data)
  206. data.prepayid = data.package?data.package.split('prepay_id=')[1]:''
  207. if (res.code == 0 && data.prepayid) {
  208. toPayOpre.toPay(data, (rea) => {
  209. if (!rea) {
  210. // 支付成功
  211. this.goto("/pagesB/orderingfood/orderlist")
  212. } else {
  213. // 支付失败
  214. }
  215. });
  216. }
  217. }else if (res.code == 0 && res.data == 200) this.goto("/pagesB/orderingfood/orderlist")
  218. })
  219. },
  220. thatDay(va){
  221. let s = getThatDay(va);
  222. if(s) {
  223. return s + " " + va.slice(5)
  224. }else return va
  225. }
  226. },
  227. onLoad(da) {
  228. this.qda = { ...this.qda, ...da };
  229. this.users[0] = {
  230. // name: this.userinfo.nickname,
  231. mobile: this.userinfo.mobile
  232. }
  233. this.getDetail(da);
  234. },
  235. onShow() {},
  236. mounted() {},
  237. };
  238. </script>
  239. <style scoped lang='scss'>
  240. .mar_b60 {margin-bottom: 60rpx;}
  241. .scenicDetail{
  242. padding: 28rpx 32rpx 110rpx;
  243. }
  244. .productName{
  245. font-size: 30rpx;
  246. font-weight: 600;
  247. }
  248. .advanTime{
  249. font-size: 25rpx;
  250. .corg{
  251. color: #18bb88;
  252. }
  253. }
  254. .oderinfo{
  255. margin-top: 30rpx;
  256. .tit{
  257. font-size: 28rpx;
  258. font-weight: 600;
  259. margin-bottom: 16rpx;
  260. }
  261. .rommnum{
  262. white-space: nowrap;
  263. .r_num{
  264. display: inline-block;
  265. }
  266. }
  267. }
  268. .rommnum {
  269. white-space: nowrap;
  270. .r_num {
  271. display: inline-block;
  272. margin-right: 18rpx;
  273. padding: 10rpx 20rpx;
  274. font-size: 26rpx;
  275. border-radius: 8rpx;
  276. border: 1rpx solid rgba($color: #000, $alpha: 0.032);
  277. background-color: rgba($color: #000, $alpha: 0.032);
  278. &:last-child {
  279. margin-right: 0;
  280. }
  281. &.active {
  282. border-color: rgba($color: #00B76C, $alpha: 0.36);
  283. background-color: rgba($color: #00B76C, $alpha: 0.06);
  284. }
  285. }
  286. }
  287. .uinfo{
  288. .tit{
  289. font-size: 28rpx;
  290. font-weight: 600;
  291. margin-bottom: 16rpx;
  292. }
  293. .user_item{
  294. border-radius: 10rpx;
  295. background-color: rgba($color: #000, $alpha: 0.05);
  296. padding: 8rpx 26rpx;
  297. .p{
  298. padding: 3rpx 6rpx;
  299. font-size: 26rpx;
  300. }
  301. .label{
  302. width: 120rpx;
  303. }
  304. input{
  305. width: calc(100% - 130rpx);
  306. }
  307. }
  308. }
  309. .scenic_msg {
  310. margin-bottom: 60rpx;
  311. .title {
  312. font-size: 30rpx;
  313. font-weight: bold;
  314. margin-bottom: 16rpx;
  315. }
  316. .msg_con {
  317. font-size: 24rpx;
  318. color: #555;
  319. margin-top: 16rpx;
  320. }
  321. .smsg{
  322. margin-bottom: 30rpx;
  323. &:last-child{
  324. margin-bottom: 0;
  325. }
  326. }
  327. .stit{
  328. padding-left: 12rpx;
  329. font-size: 26rpx;
  330. height: 26rpx;
  331. line-height: 26rpx;
  332. border-left: 6rpx solid #00B76C;
  333. }
  334. }
  335. .money {
  336. .li {
  337. margin-bottom: 16rpx;
  338. &:last-child {
  339. margin-bottom: 0;
  340. }
  341. span {
  342. font-size: 30rpx;
  343. }
  344. }
  345. .corg {
  346. color: #18bb88;
  347. margin-left: 12rpx;
  348. }
  349. }
  350. .card {
  351. background-color: #fff;
  352. border-radius: 16rpx;
  353. margin-bottom: 30rpx;
  354. padding: 28rpx 30rpx;
  355. font-size: 32rpx;
  356. box-shadow: 4rpx 4rpx 8rpx 4rpx rgba(0, 0, 0, 0.12);
  357. &:last-child {
  358. margin-bottom: 0;
  359. }
  360. }
  361. .footbtn {
  362. width: calc(100% - 60rpx);
  363. height: 80rpx;
  364. background: #17bb87;
  365. border-radius: 45rpx;
  366. position: fixed;
  367. bottom: 50rpx;
  368. left: 30rpx;
  369. color: #fff;
  370. font-size: 36rpx;
  371. text-align: center;
  372. line-height: 80rpx;
  373. }
  374. </style>