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",
"style": {
"navigationBarTitleText": "uni-app"
"navigationBarTitleText": "登录"
}
}
],

31
pages/login/login.vue

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

10
pages/user/user.vue

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

4
static/js/request.js

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

2
subPackages/homestay/index.vue

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

49
subPackages/homestay/order.vue

@ -97,8 +97,9 @@
<text>优惠券</text>
<view style="display: flex;align-items: center;">
<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>-{{coupon.CouponActivity.discounts/100}}</view>
<view style="display: flex;align-items: center;color: #6A8A2D;font-weight: bold;" v-if="coupon && coupon.activity">
<view v-if="coupon.activity.discount_type == 'pricebreak'">-{{coupon.activity.money/100}}</view>
<view v-else>{{coupon.activity.fold}}</view>
</view>
<img src="https://static.ticket.sz-trip.com/changyoutaihu/images/user/rightIcon.png" class="icon-coupon">
</view>
@ -121,17 +122,17 @@
<view class="popup-content-date">
<view class="popup-content-title flex">
<view class="flex-1 w-1rpx text-overflow">
{{skuInfo.title}}
{{skuInfo.sku_name}}
</view>
<img src="https://static.ticket.sz-trip.com/taizhou/images/cha.png" @click="closePopupRule"
style="width: 31rpx;height: 31rpx;" class="flex-shrink-0">
</view>
<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
indicator-dots indicator-color="rgba(255,255,255,.5)" indicator-active-color="#fff"
@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;">
<image class="item-img pop-swiper-image" :src="showImg(item)" mode="aspectFill">
</image>
@ -140,13 +141,13 @@
</swiper>
<view class="swiper-pointer" style="right:30rpx;bottom: 20rpx;">
{{popSwiperCurrent}}/{{skuInfo.list_images.split(',').length}}
{{popSwiperCurrent}}/{{skuInfo.listimg.length}}
</view>
</view>
<view class="pop-detail-container">
<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>
@ -188,6 +189,7 @@
},
onShow() {
this.coupon = this.$store.state.user.coupon
console.log(this.coupon)
},
onLoad(options) {
this.initOrderDate()
@ -252,10 +254,10 @@
this.price = ((disfferMoney * this.buyNum) || 0).toFixed(2)
if(this.coupon) {
if (this.coupon.percent == 0) {
disfferMoney = disfferMoney - this.coupon.CouponActivity.discounts
if (this.coupon.activity.discount_type == 'pricebreak') {
disfferMoney = disfferMoney - this.coupon.activity.money
} else{
disfferMoney = disfferMoney - (disfferMoney * this.coupon.CouponActivity.percent/100)
disfferMoney = disfferMoney - (disfferMoney * this.coupon.activity.fold/10)
}
}
return disfferMoney < 0 ? 0 : disfferMoney
@ -294,28 +296,29 @@
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 = {
goods: goods,
reserve_name: roomNames.toString(),
reserve_phone: this.phone,
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({
method: 'POST',
data: JSON.stringify(data)
}, '/api/order/place').then(res => {
}, '/api/order/create').then(res => {
console.log('成功');
if (res.code == 1) {
return;
uni.removeStorageSync('hotelOrderInfo')
this.Post({
order_id: res.data.order_id,

1
subPackages/line/index.vue

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

11
subPackages/line/orders.vue

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

Loading…
Cancel
Save