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

400 lines
13 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
  1. <template>
  2. <view v-if="$isRight(goods_details)">
  3. <view class="bg-white" v-if="enter_type!=1">
  4. <view class="cu-bar1 padding-lr">
  5. <text class="lf-color-555 lf-font-28">联系人</text>
  6. <input type="text" v-model="contact" class="lf-color-999 lf-font-28 lf-text-left" style="position:absolute;right:180rpx" placeholder="请输入联系人" />
  7. </view>
  8. <view class="cu-bar1 padding-lr">
  9. <text class="lf-color-555 lf-font-28">联系方式</text>
  10. <view class="lf-row-between">
  11. <input type="text" v-model="phone" class="lf-color-999 lf-font-28 lf-text-left" style="position:absolute;right:180rpx" placeholder="请输入联系电话" maxlength="11" />
  12. </view>
  13. <button style="position: absolute;right: 0rpx;" class="lf-bg-white" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
  14. <u-icon name="phone"></u-icon>
  15. </button>
  16. </view>
  17. <view class="cu-bar1 padding-lr" v-if="goods_type!=3">
  18. <text class="lf-color-555 lf-font-28">身份证号码</text>
  19. <input type="text" v-model="vertify_code" class="lf-color-999 lf-font-28 lf-text-left" style="position:absolute;right:180rpx" placeholder="请输入身份证号码"/>
  20. </view>
  21. <view class="cu-bar1 padding-lr" v-if="goods_type!=3">
  22. <text class="lf-color-555 lf-font-28">性别</text>
  23. <input type="text" v-model="sex" class="lf-color-999 lf-font-28 lf-text-left" style="position:absolute;right:180rpx" placeholder="请输入性别"/>
  24. </view>
  25. <view class="cu-bar1 padding-lr" v-if="goods_type!=3">
  26. <text class="lf-color-555 lf-font-28">年龄</text>
  27. <input type="number" v-model="age" class="lf-color-999 lf-font-28 lf-text-left" style="position:absolute;right:180rpx" placeholder="请输入年龄"/>
  28. </view>
  29. </view>
  30. <self-line/>
  31. <view class="lf-bg-white lf-p-t-30 lf-p-b-30 lf-p-l-32 lf-p-r-32">
  32. <view class="lf-row-between">
  33. <image :src="goods_details.picture" mode="aspectFill" style="width: 240rpx; height: 240rpx;border-radius: 20rpx;"></image>
  34. <view class="flex-sub padding-left-sm">
  35. <view class="bref-box lf-font-32 lf-color-333 lf-line-2" style="height: 88rpx;line-height: 44rpx;">
  36. {{goods_details.title}}
  37. </view>
  38. <view class="flex lf-m-t-25 align-center text-center">
  39. <text class="block lf-color-gray lf-font-24" style="line-height: 40rpx;">数量</text>
  40. <text class="lf-m-l-10 lf-color-gray lf-font-24">x {{goods_details.num}}</text>
  41. </view>
  42. <view class="flex align-center text-center lf-m-t-25">
  43. <lf-price :price="goods_details.price" />
  44. <view class="lf-m-l-20 lf-line-through lf-color-gray">
  45. {{goods_details.original_price}}
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. <!-- <self-line/>
  52. <view class="bg-white">
  53. <view class="cu-bar padding-lr">
  54. <text class="lf-color-555 lf-font-28">优惠</text>
  55. <view v-if="goods_details.coupon != ''">
  56. <text class="lf-color-price lf-font-28 lf-m-l-10" v-for="(item,index) of goods_details.coupon">{{item.tag}}</text>
  57. </view>
  58. <view v-else>
  59. <text class="lf-color-price lf-font-28 lf-m-l-10">暂无优惠</text>
  60. </view>
  61. </view>
  62. </view> -->
  63. <self-line/>
  64. <view class="bg-white" v-if="enter_type!=1">
  65. <!-- 酒店 -->
  66. <view v-if="goods_type == 1">
  67. <view class="cu-bar padding-lr">
  68. <text class="lf-color-555 lf-font-28">套餐类型</text>
  69. <text class="lf-font-28" style="color: #131315;">{{goods_typetext}}</text>
  70. </view>
  71. <view class="cu-bar padding-lr">
  72. <text class="lf-color-555 lf-font-28">酒店住房日期</text>
  73. <text class="lf-font-28" style="color: #131315;">{{check_in_time}}-{{check_out_time}} {{totalLive}}</text>
  74. </view>
  75. <view class="cu-bar padding-lr">
  76. <text class="lf-color-555 lf-font-28">到店时间</text>
  77. <text class="lf-font-28" style="color: #131315;">{{arrival_time}}</text>
  78. </view>
  79. </view>
  80. <!-- 景区 -->
  81. <view v-if="goods_type == 2">
  82. <view class="cu-bar padding-lr">
  83. <text class="lf-color-555 lf-font-28">套餐类型</text>
  84. <text class="lf-font-28" style="color: #131315;">{{goods_typetext}}</text>
  85. </view>
  86. <view class="cu-bar padding-lr">
  87. <text class="lf-color-555 lf-font-28">开始时间</text>
  88. <text class="lf-font-28" style="color: #131315;">{{enter_time}}</text>
  89. </view>
  90. </view>
  91. <!-- 旅游路线 -->
  92. <view v-if="goods_type == 0">
  93. <view class="cu-bar padding-lr">
  94. <text class="lf-color-555 lf-font-28">套餐类型</text>
  95. <text class="lf-font-28" style="color: #131315;">{{goods_typetext}}</text>
  96. </view>
  97. <view class="cu-bar padding-lr">
  98. <text class="lf-color-555 lf-font-28">开始时间</text>
  99. <text class="lf-font-28" style="color: #131315;">{{departure_time}}</text>
  100. </view>
  101. </view>
  102. </view>
  103. <self-line/>
  104. <view class="bg-white" v-if="enter_type!=1">
  105. <view class="lf-p-t-30 lf-p-l-32 lf-p-b-36">
  106. <view class="lf-font-28 lf-color-555">支付方式</view>
  107. </view>
  108. <view class="lf-p-r-32 lf-p-l-32">
  109. <button class="cu-btn bg-white margin-self" :class="pay_type==0?'border-green':'border'" @tap="payStatus(0)">
  110. <text class="lf-iconfont lf-icon-weixin text-green lf-font-44 lf-m-r-23"></text>
  111. <text class="lf-font-32" :class="pay_type==0?'text-green':'lf-color-333'">微信支付</text>
  112. <text class="lf-iconfont lf-icon-dui lf-font-44 lf-color-primary" v-if="pay_type==0" style="position: absolute;right: 22rpx;"></text>
  113. </button>
  114. </view>
  115. <view class="lf-p-r-32 lf-p-l-32 lf-m-t-30">
  116. <button class="cu-btn bg-white margin-self" :class="pay_type==1?'border-green':'border'" @tap="payStatus(1)">
  117. <text class="lf-font-32" :class="pay_type==1?'text-green':'lf-color-333'">线下支付</text>
  118. <text class="lf-iconfont lf-icon-dui lf-font-44 lf-color-primary" v-if="pay_type==1" style="position: absolute;right: 22rpx;"></text>
  119. </button>
  120. </view>
  121. <view class="lf-p-r-32 lf-p-l-32 lf-m-t-30" v-if="goods_details.deposit != '0.00'">
  122. <button class="cu-btn bg-white margin-self" :class="pay_type==2?'border-green':'border'" @tap="payStatus(2)">
  123. <text class="lf-font-32" :class="pay_type==2?'text-green':'lf-color-333'">订金支付</text>
  124. <text class="lf-iconfont lf-icon-dui lf-font-44 lf-color-primary" v-if="pay_type==2" style="position: absolute;right: 22rpx;"></text>
  125. </button>
  126. </view>
  127. <view class="lf-p-r-32 lf-p-l-32 lf-m-t-30">
  128. <button class="cu-btn bg-white margin-self" v-if="goods_details.earnest != '0.00'" :class="pay_type==3?'border-green':'border'" @tap="payStatus(3)">
  129. <text class="lf-font-32" :class="pay_type==3?'text-green':'lf-color-333'">定金支付</text>
  130. <text class="lf-iconfont lf-icon-dui lf-font-44 lf-color-primary" v-if="pay_type==3" style="position: absolute;right: 22rpx;"></text>
  131. </button>
  132. </view>
  133. <!-- <view class="lf-p-r-32 lf-p-l-32 lf-m-t-30">
  134. <button class="cu-btn bg-white margin-self" :class="pay_type==4?'border-green':'border'" @tap="payStatus(4)">
  135. <text class="lf-font-32" :class="pay_type==4?'text-green':'lf-color-333'">首款支付</text>
  136. <text class="lf-iconfont lf-icon-dui lf-font-44 lf-color-primary" v-if="pay_type==4" style="position: absolute;right: 22rpx;"></text>
  137. </button>
  138. </view> -->
  139. </view>
  140. <view style="height: 200rpx;"></view>
  141. <view class="btn-bottom solid-top1">
  142. <view class="padding-lr lf-p-t-10 lf-p-b-10 bg-white flex justify-between align-center shadow">
  143. <view class="flex align-center">
  144. <text class="lf-font-24 lf-font-555">应付款</text>
  145. <lf-price :price="goods_details.final_price" />
  146. </view>
  147. <button class="btn" @tap="submit">
  148. <text class="lf-font-32 text-white" v-if="btn_type == 1">下单付款</text>
  149. <text class="lf-font-32 text-white" v-else>支付尾款</text>
  150. </button>
  151. </view>
  152. </view>
  153. </view>
  154. </template>
  155. <script>
  156. export default {
  157. data() {
  158. return {
  159. goods_id: 0,
  160. goods_details: {},
  161. contact: '',
  162. phone: '',
  163. pay_type: 0,
  164. btn_type: 1,
  165. ifPay: true,
  166. order_id: 0,
  167. enter_type: 0,
  168. payState: true,
  169. pay_order_id: 0,
  170. vertify_code: '',
  171. sex: '',
  172. age: '',
  173. goods_type: 0,
  174. spec_id: 0,
  175. goods_typetext: '',
  176. //景区
  177. enter_time: '',
  178. //旅游路线
  179. departure_time: '',
  180. return_time: '',
  181. //酒店
  182. check_in_time: '',
  183. check_out_time: '',
  184. arrival_time: '',
  185. totalLive: ''
  186. }
  187. },
  188. onLoad(e) {
  189. //0旅游路线1酒店2景区3餐厅
  190. this.goods_id = e.goods_id;
  191. this.goods_type = e.goods_type;
  192. this.btn_type = e.btn_type;
  193. this.order_id = e.order_id;
  194. this.spec_id = e.spec_id;
  195. this.enter_type = e.enter_type;
  196. this.goods_typetext = e.goods_typetext;
  197. if(this.goods_id) {
  198. this.getGoodsData(this.pay_type);
  199. if(this.goods_type == 2) {
  200. this.enter_time = e.enter_time;
  201. }else if(this.goods_type == 0) {
  202. this.departure_time = e.departure_time;
  203. }else if(this.goods_type == 1) {
  204. this.check_in_time = e.check_in_time;
  205. this.check_out_time = e.check_out_time;
  206. this.arrival_time = e.arrival_time;
  207. this.totalLive = e.totalLive;
  208. console.log(this.check_in_time,this.check_out_time,this.arrival_time)
  209. }
  210. }
  211. if(this.order_id && this.enter_type == 1) {
  212. console.log('con列表执行')
  213. this.payOnce()
  214. }
  215. },
  216. onShow(e) {
  217. let that = this
  218. uni.$on('payState',(data) => {
  219. that.payState = data.msg;
  220. that.pay_order_id = data.payorder_id;
  221. console.log('传来的订单id',that.pay_order_id)
  222. if(that.payState == true) {
  223. that.$url('/pages/payState/paystate?ifSuccess=1&order_id='+that.pay_order_id,{type: 'redirect'})
  224. }else {
  225. that.$url('/pages/payState/paystate?ifSuccess=2&order_id='+that.pay_order_id,{type: 'redirect'})
  226. }
  227. })
  228. },
  229. onUnload() {
  230. uni.$off('payState');
  231. },
  232. methods: {
  233. getPhoneNumber(event){
  234. if(event.detail.errMsg == 'getPhoneNumber:ok'){
  235. let encryptedData = event.detail.encryptedData;
  236. let iv = event.detail.iv;
  237. this.$http(this.API.API_WECHAT_SETPHONE, {
  238. encryptedData,
  239. iv,
  240. // token: userInfo.token // 已在公共参数传
  241. }).then(res => {
  242. this.phone = res.data.mobile;
  243. })
  244. }
  245. },
  246. payStatus(type) {
  247. if(type == this.pay_type) {
  248. this.pay_type = type;
  249. return
  250. }else {
  251. this.pay_type = type;
  252. this.getGoodsData(type);
  253. }
  254. },
  255. getGoodsData(type){
  256. this.$http(this.API.API_CONFIRMDETAILS,{id: this.goods_id,num: 1,pay_type: type}).then(res => {
  257. this.goods_details = res.data;
  258. console.log('数据',res)
  259. })
  260. },
  261. submit() {
  262. if(this.order_id && this.enter_type == 1) {
  263. this.payOnce()
  264. return
  265. }
  266. if(!this.contact) {
  267. this.$msg('请输入联系人!');
  268. return;
  269. }
  270. if(!this.phone) {
  271. this.$msg('请输入联系电话!');
  272. return;
  273. }
  274. if(this.goods_type != 3) {
  275. if(!this.vertify_code) {
  276. this.$msg('请输入身份证号!');
  277. return;
  278. }
  279. if(!this.sex) {
  280. this.$msg('请输入性别!');
  281. return;
  282. }
  283. if(!this.age) {
  284. this.$msg('请输入年龄!');
  285. return;
  286. }
  287. }
  288. if(!this.ifPay) return;
  289. this.ifPay = false;
  290. this.$http(this.API.API_CREATEORDER,{
  291. id: this.goods_id,
  292. num: 1,
  293. pay_type: this.pay_type,
  294. name:this.contact,
  295. mobile:this.phone,
  296. spec_id: this.spec_id,
  297. enter_time: this.enter_time,
  298. sex: this.sex,
  299. age: this.age,
  300. id_card: this.vertify_code,
  301. departure_time: this.departure_time,
  302. return_time: this.return_time,
  303. check_in_time: this.check_in_time,
  304. check_out_time: this.check_out_time,
  305. arrival_time: this.arrival_time
  306. }).then(res => {
  307. this.pay_order_id = res.data.id
  308. if(this.pay_type == 1) {
  309. this.ifPay = true
  310. this.$url('/pages/payState/paystate?ifSuccess=1&order_id='+res.data.id,{type: 'redirect'})
  311. }else if(res.data.jump == true) {
  312. let that = this;
  313. wx.navigateToMiniProgram({
  314. appId: res.data.jump_appid,
  315. path: '/pages/order/confirm_atonce',
  316. envVersion: 'release',
  317. extraData: {
  318. order_id: res.data.id
  319. },
  320. success(res) {
  321. console.log('---res---');
  322. that.ifPay = true;
  323. console.log(res);
  324. },
  325. fail(err) {
  326. console.log('---err---');
  327. console.log(err);
  328. that.ifPay = true;
  329. }
  330. })
  331. }
  332. }).catch(err => {
  333. this.ifPay = true
  334. })
  335. },
  336. payOnce() {
  337. this.$http(this.API.API_ORDERPAY,{id: this.order_id}).then(res => {
  338. if(res.data.jump) {
  339. wx.navigateToMiniProgram({
  340. appId: res.data.jump_appid,
  341. path: '/pages/order/confirm_atonce',
  342. envVersion: 'release',
  343. extraData: {
  344. order_id: res.data.id
  345. },
  346. success(res) {
  347. console.log('---res---')
  348. console.log(res)
  349. },
  350. fail(err) {
  351. console.log('---err---')
  352. console.log(err)
  353. }
  354. })
  355. }
  356. }).catch(err => {})
  357. }
  358. }
  359. }
  360. </script>
  361. <style scoped lang="scss">
  362. .cu-bar1 {
  363. display: flex;
  364. position: relative;
  365. align-items: center;
  366. min-height: 100rpx;
  367. }
  368. .btn{
  369. margin: 0;
  370. padding: 0;
  371. width: 212rpx;
  372. height: 82rpx;
  373. background-color: #1998FE;
  374. color: #FFFFFF;
  375. line-height: 80rpx;
  376. font-size: 32rpx;
  377. border-radius: 41rpx;
  378. }
  379. .bref-box {
  380. text-overflow: -o-ellipsis-lastline;
  381. overflow: hidden;
  382. text-overflow: ellipsis;
  383. display: -webkit-box;
  384. -webkit-line-clamp: 2;
  385. -webkit-box-orient: vertical;
  386. }
  387. </style>