jiazhipeng 4 months ago
parent
commit
7b71ddae98
  1. 2
      pages.json
  2. 31
      pages/login/login.vue
  3. 10
      pages/user/user.vue
  4. 4
      static/js/request.js
  5. 2
      subPackages/homestay/index.vue
  6. 49
      subPackages/homestay/order.vue
  7. 1
      subPackages/line/index.vue
  8. 11
      subPackages/line/orders.vue

2
pages.json

@ -35,7 +35,7 @@
{ {
"path": "pages/login/login", "path": "pages/login/login",
"style": { "style": {
"navigationBarTitleText": "uni-app" "navigationBarTitleText": "登录"
} }
} }
], ],

31
pages/login/login.vue

@ -1,24 +1,24 @@
<template> <template>
<div style="padding-top: 88rpx;"> <view style="padding-top: 88rpx;">
<div class="login-tip">项目名称 申请获得</div> <view class="login-tip">时味苏州 申请获得</view>
<div class="login-tip2">以下权限</div> <view class="login-tip2">以下权限</view>
<div class="login-tip-box"> <view class="login-tip-box">
<text>获得你的公开信息昵称头像地区及性别</text> <text>获得你的公开信息昵称头像地区及性别</text>
</div> </view>
<div class="btn-box"> <view class="btn-box">
<button bindtap="cancel" type="default" @click="redirectIndex">取消</button> <button bindtap="cancel" type="default" @click="redirectIndex">取消</button>
<button type="primary" @click="getUserInfo">同意</button> <button type="primary" @click="getUserInfo">同意</button>
</div> </view>
<div class="flex-center article-box"> <view class="flex-center article-box">
<radio-group @change="toggleAgreement"> <radio-group @change="toggleAgreement">
<radio value="1" :checked="isAgreed" style="transform:scale(0.7)"></radio> <radio value="1" :checked="isAgreed" style="transform:scale(0.7)"></radio>
</radio-group> </radio-group>
<div>同意<text @click="gotoInfo">用户服务协议隐私政策</text></div> <view>同意<text @click="gotoInfo(9)">用户服务协议</text><text @click="gotoInfo(12)">隐私政策</text></view>
</div> </view>
<uni-popup ref="popup" type="bottom" background-color="#fff"> <uni-popup ref="popup" type="bottom" background-color="#fff">
<button type="default" open-type="getPhoneNumber" @getphonenumber="handlePhoneNumber" style="width: 100%;height: 12vh;line-height: 12vh;">点击授权手机号</button> <button type="default" open-type="getPhoneNumber" @getphonenumber="handlePhoneNumber" style="width: 100%;height: 12vh;line-height: 12vh;">点击授权手机号</button>
</uni-popup> </uni-popup>
</div> </view>
</template> </template>
<script> <script>
@ -68,9 +68,9 @@ export default {
} }
}, },
// //
gotoInfo() { gotoInfo(id) {
uni.navigateTo({ uni.navigateTo({
url: '/subPackages/user/privacy' url: '/subPackages/user/privacyInfo?id=' + id
}); });
}, },
// //
@ -103,8 +103,9 @@ export default {
userInfo: res.userInfo, userInfo: res.userInfo,
encryptedData: res.encryptedData, encryptedData: res.encryptedData,
iv: res.iv, iv: res.iv,
wechat_qrcode: uni.getStorageSync('wechat_qrcode') || '' wechat_qrcode: uni.getStorageSync('wechat_qrcode') || '',
}, '/api/mini_program/login') loginType: 3
}, '/api/uservice/user/wxLogin')
.then(resTwo => { .then(resTwo => {
this.$store.commit('changeUserInfo', resTwo.data.userinfo); this.$store.commit('changeUserInfo', resTwo.data.userinfo);
if (resTwo.data.userinfo.mobile) { if (resTwo.data.userinfo.mobile) {

10
pages/user/user.vue

@ -176,11 +176,11 @@
}, },
onShow() { onShow() {
// token // token
this.Post({ // this.Post({
token: '' // token: ''
},'/api/uservice/user/getMyInfo').then(res => { // },'/api/uservice/user/getMyInfo').then(res => {
this.$store.commit('changeUserInfo', res.data); // this.$store.commit('changeUserInfo', res.data);
}) // })
this.userInfo = (uni.getStorageSync('userInfo') && JSON.parse(uni.getStorageSync('userInfo'))) || this.$store.state.user.userInfo || {} this.userInfo = (uni.getStorageSync('userInfo') && JSON.parse(uni.getStorageSync('userInfo'))) || this.$store.state.user.userInfo || {}
console.log(this.userInfo) console.log(this.userInfo)

4
static/js/request.js

@ -40,8 +40,8 @@ Vue.prototype.NEWAPIURL = '/api';
// #endif // #endif
Vue.prototype.Post = (params = {}, apiurl) => { Vue.prototype.Post = (params = {}, apiurl) => {
const token = getToken() || '0caa10fc-6d65-4d9c-8e57-b344be3fc526'; const token = getToken() || '0caa10fc-6d65-4d9c-8e57-b344be3fc526'; // 君到苏州
// const token = getToken() || 'a090644d-2bdb-4807-833b-bb5bc2182ac5' // const token = getToken() || 'a090644d-2bdb-4807-833b-bb5bc2182ac5' // 时味苏州
if (token) { if (token) {
params.token = token; params.token = token;
} }

2
subPackages/homestay/index.vue

@ -41,7 +41,7 @@
offset: this.list.length, offset: this.list.length,
limit: 10, limit: 10,
tag_id: 8, tag_id: 8,
title: '青年' title: ''
}, '/api/scene/get_scene_by_tag').then(res => { }, '/api/scene/get_scene_by_tag').then(res => {
if (res) { if (res) {
this.list = [...res.data.list, ...this.list] this.list = [...res.data.list, ...this.list]

49
subPackages/homestay/order.vue

@ -97,8 +97,9 @@
<text>优惠券</text> <text>优惠券</text>
<view style="display: flex;align-items: center;"> <view style="display: flex;align-items: center;">
<view class="add-btn" v-if="!coupon">选择优惠券</view> <view class="add-btn" v-if="!coupon">选择优惠券</view>
<view style="display: flex;align-items: center;color: #6A8A2D;font-weight: bold;" v-if="coupon && coupon.CouponActivity"> <view style="display: flex;align-items: center;color: #6A8A2D;font-weight: bold;" v-if="coupon && coupon.activity">
<view>-{{coupon.CouponActivity.discounts/100}}</view> <view v-if="coupon.activity.discount_type == 'pricebreak'">-{{coupon.activity.money/100}}</view>
<view v-else>{{coupon.activity.fold}}</view>
</view> </view>
<img src="https://static.ticket.sz-trip.com/changyoutaihu/images/user/rightIcon.png" class="icon-coupon"> <img src="https://static.ticket.sz-trip.com/changyoutaihu/images/user/rightIcon.png" class="icon-coupon">
</view> </view>
@ -121,17 +122,17 @@
<view class="popup-content-date"> <view class="popup-content-date">
<view class="popup-content-title flex"> <view class="popup-content-title flex">
<view class="flex-1 w-1rpx text-overflow"> <view class="flex-1 w-1rpx text-overflow">
{{skuInfo.title}} {{skuInfo.sku_name}}
</view> </view>
<img src="https://static.ticket.sz-trip.com/taizhou/images/cha.png" @click="closePopupRule" <img src="https://static.ticket.sz-trip.com/taizhou/images/cha.png" @click="closePopupRule"
style="width: 31rpx;height: 31rpx;" class="flex-shrink-0"> style="width: 31rpx;height: 31rpx;" class="flex-shrink-0">
</view> </view>
<view class="content"> <view class="content">
<view class="swipe-box" style="height: 347rpx;" v-if="skuInfo.list_images"> <view class="swipe-box" style="height: 347rpx;" v-if="skuInfo.listimg && skuInfo.listimg.length > 0">
<swiper class="swiper" :autoplay="true" :interval="3000" :duration="1000" circular <swiper class="swiper" :autoplay="true" :interval="3000" :duration="1000" circular
indicator-dots indicator-color="rgba(255,255,255,.5)" indicator-active-color="#fff" indicator-dots indicator-color="rgba(255,255,255,.5)" indicator-active-color="#fff"
@change="popSwiperChange" :current="0"> @change="popSwiperChange" :current="0">
<swiper-item v-for="(item, index) in skuInfo.list_images.split(',')" :key="item.id"> <swiper-item v-for="(item, index) in skuInfo.listimg" :key="item.id">
<view class="swiper-item" style="height: 347rpx;"> <view class="swiper-item" style="height: 347rpx;">
<image class="item-img pop-swiper-image" :src="showImg(item)" mode="aspectFill"> <image class="item-img pop-swiper-image" :src="showImg(item)" mode="aspectFill">
</image> </image>
@ -140,13 +141,13 @@
</swiper> </swiper>
<view class="swiper-pointer" style="right:30rpx;bottom: 20rpx;"> <view class="swiper-pointer" style="right:30rpx;bottom: 20rpx;">
{{popSwiperCurrent}}/{{skuInfo.list_images.split(',').length}} {{popSwiperCurrent}}/{{skuInfo.listimg.length}}
</view> </view>
</view> </view>
<view class="pop-detail-container"> <view class="pop-detail-container">
<view class="pop-detail-title">房型信息</view> <view class="pop-detail-title">房型信息</view>
<view v-html="formateRichText(skuInfo.use_explain)"></view> <view v-html="formateRichText(skuInfo.sku_name)"></view>
</view> </view>
</view> </view>
</view> </view>
@ -188,6 +189,7 @@
}, },
onShow() { onShow() {
this.coupon = this.$store.state.user.coupon this.coupon = this.$store.state.user.coupon
console.log(this.coupon)
}, },
onLoad(options) { onLoad(options) {
this.initOrderDate() this.initOrderDate()
@ -252,10 +254,10 @@
this.price = ((disfferMoney * this.buyNum) || 0).toFixed(2) this.price = ((disfferMoney * this.buyNum) || 0).toFixed(2)
if(this.coupon) { if(this.coupon) {
if (this.coupon.percent == 0) { if (this.coupon.activity.discount_type == 'pricebreak') {
disfferMoney = disfferMoney - this.coupon.CouponActivity.discounts disfferMoney = disfferMoney - this.coupon.activity.money
} else{ } else{
disfferMoney = disfferMoney - (disfferMoney * this.coupon.CouponActivity.percent/100) disfferMoney = disfferMoney - (disfferMoney * this.coupon.activity.fold/10)
} }
} }
return disfferMoney < 0 ? 0 : disfferMoney return disfferMoney < 0 ? 0 : disfferMoney
@ -294,28 +296,29 @@
return; return;
} }
let goods = []
let goodsItem = {
num: this.buyNum,
specifications_id: this.skuInfo.id,
start_date: this.selectDate.startDay,
end_date: this.selectDate.endDay,
}
goods.push(goodsItem)
let data = { let data = {
goods: goods,
reserve_name: roomNames.toString(),
reserve_phone: this.phone,
coupon_id: this.coupon ? this.coupon.id : null, coupon_id: this.coupon ? this.coupon.id : null,
product_list: [
{
type: 'hotel',
customer_name: roomNames.toString(),
reserve_mobile: this.phone,
product_id: this.skuInfo.product_id,
sku_id: this.skuInfo.id,
start_date: this.selectDate.startDay,
end_date: this.selectDate.endDay,
product_num: this.buyNum
}
]
} }
this.Post({ this.Post({
method: 'POST', method: 'POST',
data: JSON.stringify(data) data: JSON.stringify(data)
}, '/api/order/place').then(res => { }, '/api/order/create').then(res => {
console.log('成功'); console.log('成功');
if (res.code == 1) { if (res.code == 1) {
return;
uni.removeStorageSync('hotelOrderInfo') uni.removeStorageSync('hotelOrderInfo')
this.Post({ this.Post({
order_id: res.data.order_id, order_id: res.data.order_id,

1
subPackages/line/index.vue

@ -41,7 +41,6 @@
this.Post({ this.Post({
offset: this.list.length, offset: this.list.length,
limit: 10, limit: 10,
type_id: 23,
tag_id: 17, tag_id: 17,
sort: 'weight' sort: 'weight'
},'/api/product/get_product_by_tag').then(res => { },'/api/product/get_product_by_tag').then(res => {

11
subPackages/line/orders.vue

@ -46,8 +46,9 @@
<text>优惠券</text> <text>优惠券</text>
<view style="display: flex;align-items: center;"> <view style="display: flex;align-items: center;">
<view class="add-btn" v-if="!coupon">选择优惠券</view> <view class="add-btn" v-if="!coupon">选择优惠券</view>
<view style="display: flex;align-items: center;color: #6A8A2D;font-weight: bold;" v-if="coupon && coupon.CouponActivity"> <view style="display: flex;align-items: center;color: #6A8A2D;font-weight: bold;" v-if="coupon && coupon.activity">
<view>-{{coupon.CouponActivity.discounts/100}}</view> <view v-if="coupon.activity.discount_type == 'pricebreak'">-{{coupon.activity.money/100}}</view>
<view v-else>{{coupon.activity.fold}}</view>
</view> </view>
<img src="https://static.ticket.sz-trip.com/changyoutaihu/images/user/rightIcon.png" class="icon-coupon"> <img src="https://static.ticket.sz-trip.com/changyoutaihu/images/user/rightIcon.png" class="icon-coupon">
</view> </view>
@ -291,10 +292,10 @@
priceTotal() { priceTotal() {
let price = 0 let price = 0
if(this.coupon) { if(this.coupon) {
if (this.coupon.percent == 0) { if (this.coupon.activity.discount_type == 'pricebreak') {
price = this.price - this.coupon.CouponActivity.discounts price = this.price - this.coupon.activity.money
} else{ } else{
price = this.price - (this.price * this.coupon.CouponActivity.percent/100) price = this.price - (this.price * this.coupon.activity.fold/10)
} }
}else { }else {
price = this.price price = this.price

Loading…
Cancel
Save