|
|
@ -8,12 +8,8 @@ |
|
|
|
<swiper class="swiper" indicator-dots indicator-color="rgba(255, 255, 255, 0.50)" |
|
|
|
indicator-active-color="#ffffff" autoplay interval="5000"> |
|
|
|
<swiper-item v-for="(item,i) in bannerList" :key="i"> |
|
|
|
<img :src="item&&item.dictValue" style="width: 100%;" mode="widthFix" /> |
|
|
|
<image :src="item&&item.dictValue" style="width: 100%;" mode="widthFix" /> |
|
|
|
</swiper-item> |
|
|
|
<!-- <swiper-item> |
|
|
|
<img src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/banner/banner/banner2_3x.png" |
|
|
|
style="width: 100%;" mode="widthFix" /> |
|
|
|
</swiper-item> --> |
|
|
|
</swiper> |
|
|
|
</uni-swiper-dot> |
|
|
|
</view> |
|
|
@ -64,7 +60,6 @@ |
|
|
|
:startDate="startDate" :endDate="endDate" :showMonth="false" |
|
|
|
@change="changeCalendar" @confirm="changeCalendar" @close="close" /> |
|
|
|
<view style="display: flex; justify-content: center; align-items: center;"> |
|
|
|
<!-- <button class="bottom-btn" @click="closePopup">确定</button> --> |
|
|
|
<image @click="closePopup" style="width: 670rpx; height: 80rpx;" slot='cover' src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/petServiceOrder/yesButton.png" /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -76,11 +71,11 @@ |
|
|
|
<view style="display: flex;"> |
|
|
|
<view @click="getOrder(true)" style="margin-right: 20rpx;"> |
|
|
|
<image style="width: 304rpx; height: 100rpx;" slot='cover' |
|
|
|
src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/petServiceOrder/OrderByCompanion.png"> |
|
|
|
src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/petServiceOrder/OrderByCompanion.png" /> |
|
|
|
</view> |
|
|
|
<view @click="getOrder(false)"> |
|
|
|
<image style="width: 304rpx; height: 100rpx;" |
|
|
|
src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/petServiceOrder/OrderBySystem.png"> |
|
|
|
src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/petServiceOrder/OrderBySystem.png" /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -117,13 +112,11 @@ |
|
|
|
<text class="card-type-text">专业喂养</text> |
|
|
|
<text class="card-type-text">专业遛狗</text> |
|
|
|
</view> |
|
|
|
<view class="card-time">有效期至: {{item.availableEndTime.slice(0, 16)}}</view> |
|
|
|
<view class="card-time">有效期至: {{item && item.availableEndTime ? item.availableEndTime.slice(0, 16) : ''}}</view> |
|
|
|
</view> |
|
|
|
<view> |
|
|
|
<!-- <u-button @click="receiveCoupon(item.id)" shape="circle" size="mini" |
|
|
|
color="#ffaa48" text="立即领取"></u-button> --> |
|
|
|
<view style="width: 132rpx;height: 52rpx;background-color: #FFAA48; display: flex;align-items: center;justify-content: center;border-radius: 56rpx;"> |
|
|
|
<text style="font-size: 24rpx; font-weight: 500; color: #FFFFFF;">立即领取</text> |
|
|
|
<text @click="receiveCoupon(item.id)" style="font-size: 24rpx; font-weight: 500; color: #FFFFFF;">立即领取</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -132,7 +125,7 @@ |
|
|
|
<view class="card-bottom-text"> |
|
|
|
优惠券不可兑换现金 |
|
|
|
</view> |
|
|
|
<view class="card-bottom-text"> |
|
|
|
<view class="card-bottom-text" @click="showRulePopup(item)"> |
|
|
|
查看详细规则> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -160,7 +153,7 @@ |
|
|
|
<view class="companion-item"> |
|
|
|
<view class="companion-info"> |
|
|
|
<image class="companion-img" slot='cover' |
|
|
|
:src="defaultCompanion&&defaultCompanion.staffImages&&defaultCompanion.staffImages.length>0?defaultCompanion.staffImages[0].url:defaultStaffIamge"> |
|
|
|
:src="defaultCompanion.staffImages && defaultCompanion.staffImages.length > 0 ? defaultCompanion.staffImages[0].url : defaultStaffIamge"> |
|
|
|
</image> |
|
|
|
<view class="companion-info-1"> |
|
|
|
<view class="companion-info-2"> |
|
|
@ -169,8 +162,7 @@ |
|
|
|
{{defaultCompanion.name}} |
|
|
|
</view> |
|
|
|
<view class="companion-sex"> |
|
|
|
<img :src="defaultCompanion.gender=='1'?'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/pet/sex_m.png': |
|
|
|
'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/pet/sex_f.png'" alt="sex" |
|
|
|
<image :src="defaultCompanion.gender == '1' ? 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/pet/sex_m.png' : 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/pet/sex_f.png'" alt="sex" |
|
|
|
style="width: 40rpx;height: 40rpx;" /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -244,8 +236,8 @@ |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="service-content"> |
|
|
|
<img src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/second_stage/ysbz.png" |
|
|
|
style="width: 100%;" mode="widthFix" alt="service"> |
|
|
|
<image src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/second_stage/ysbz.png" |
|
|
|
style="width: 100%;" mode="widthFix" alt="service" /> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="card-container"> |
|
|
@ -271,7 +263,7 @@ |
|
|
|
<view> |
|
|
|
<image style="height: 132rpx; width: 710rpx; margin: 0 20rpx 20rpx 20rpx;" |
|
|
|
slot='cover' |
|
|
|
src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/petServiceOrder/joinus.png"> |
|
|
|
src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/petServiceOrder/joinus.png" /> |
|
|
|
</view> |
|
|
|
|
|
|
|
<Kefu></Kefu> |
|
|
@ -279,7 +271,6 @@ |
|
|
|
<view class="details-subscribe"> |
|
|
|
<view @click="getCoupon" class="details-btn">点击领取到卡包</view> |
|
|
|
</view> |
|
|
|
<!-- 领取弹窗 --> |
|
|
|
<view v-if="showMask" @closeMask="closeMask"> |
|
|
|
<view class="mask-coupon" @click="closeMask"> |
|
|
|
<view class="wx-coupon"> |
|
|
@ -290,7 +281,6 @@ |
|
|
|
<view class="content"> |
|
|
|
优惠券列表显示 |
|
|
|
</view> |
|
|
|
<!-- 小程序领券插件 --> |
|
|
|
<view class="" v-for="(item,index) in couponList" :key="index"> |
|
|
|
<send-coupon @sendcoupon="getSendCoupon" @userconfirm="redirectuser" :sign="item.sign" |
|
|
|
:send_coupon_params="item.sendCouponParams" |
|
|
@ -304,6 +294,36 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- 优惠券详细规则弹窗 --> |
|
|
|
<uni-popup ref="rulePopup" type="center"> |
|
|
|
<view class="rule-popup"> |
|
|
|
<view class="rule-popup-title">优惠券详细规则</view> |
|
|
|
<view class="rule-popup-content"> |
|
|
|
<view class="rule-item"> |
|
|
|
<view class="rule-label">名称:</view> |
|
|
|
<view class="rule-value">{{currentCoupon && currentCoupon.stockName || ''}}</view> |
|
|
|
</view> |
|
|
|
<view class="rule-item"> |
|
|
|
<view class="rule-label">折扣:</view> |
|
|
|
<view class="rule-value">{{getDiscountText(currentCoupon)}}</view> |
|
|
|
</view> |
|
|
|
<view class="rule-item"> |
|
|
|
<view class="rule-label">使用规则:</view> |
|
|
|
<view class="rule-value">可用于专业喂养和专业遛狗服务</view> |
|
|
|
</view> |
|
|
|
<view class="rule-item"> |
|
|
|
<view class="rule-label">有效日期:</view> |
|
|
|
<view class="rule-value">{{currentCoupon && currentCoupon.availableEndTime ? currentCoupon.availableEndTime.slice(0, 16) : ''}}</view> |
|
|
|
</view> |
|
|
|
<view class="rule-item"> |
|
|
|
<view class="rule-label">特别说明:</view> |
|
|
|
<view class="rule-value">单笔订单仅限使用1张优惠券;优惠券仅限用户本人使用,不可赠送、不可提现、不得找零。</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="rule-popup-close" @click="closeRulePopup">关闭</view> |
|
|
|
</view> |
|
|
|
</uni-popup> |
|
|
|
|
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
@ -317,19 +337,20 @@ |
|
|
|
getOpenId, |
|
|
|
receiveCoupon, |
|
|
|
} from "@/api/system/user" |
|
|
|
import { |
|
|
|
getCompanionList |
|
|
|
} from "@/api/system/companion" |
|
|
|
import { |
|
|
|
setToken, |
|
|
|
getToken, |
|
|
|
getOpenIdKey, |
|
|
|
setOpenIdKey |
|
|
|
} from '@/utils/auth' |
|
|
|
import { getTeacherListIndex } from '@/api/home' |
|
|
|
import Kefu from './common/kefu.vue' |
|
|
|
import uniPopup from '@/uni_modules/uni-popup/components/uni-popup/uni-popup.vue'; |
|
|
|
import NewUserCoupon from './components/NewUserCoupon.vue'; |
|
|
|
import positionMixin from '@/mixins/position.js'; |
|
|
|
|
|
|
|
export default { |
|
|
|
mixins: [positionMixin], |
|
|
|
data() { |
|
|
|
return { |
|
|
|
current: 0, |
|
|
@ -387,6 +408,7 @@ |
|
|
|
num: "47131", |
|
|
|
numTime: "2024.12.12", |
|
|
|
}, |
|
|
|
currentCoupon: null, |
|
|
|
} |
|
|
|
}, |
|
|
|
components: { |
|
|
@ -400,12 +422,9 @@ |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
checkNewUser() { |
|
|
|
// 检查是否为新用户,这里可以根据实际需求修改判断逻辑 |
|
|
|
// 例如:检查本地存储中是否有首次访问的标记 |
|
|
|
const isFirstVisit = !uni.getStorageSync('hasVisited'); |
|
|
|
if (isFirstVisit) { |
|
|
|
this.isNewUser = true; |
|
|
|
// 设置访问标记 |
|
|
|
uni.setStorageSync('hasVisited', true); |
|
|
|
} |
|
|
|
}, |
|
|
@ -413,11 +432,9 @@ |
|
|
|
this.isNewUser = false; |
|
|
|
}, |
|
|
|
handleGetCoupon() { |
|
|
|
// 如果用户已登录,则直接调用领券方法 |
|
|
|
if (getToken()) { |
|
|
|
this.getCoupon(); |
|
|
|
} else { |
|
|
|
// 未登录,跳转到登录页面 |
|
|
|
uni.navigateTo({ |
|
|
|
url: '/pages/personalCenter/index' |
|
|
|
}); |
|
|
@ -475,11 +492,9 @@ |
|
|
|
changeCalendar(e) { |
|
|
|
console.log('change 返回:', e) |
|
|
|
this.selectedDateShowText = '' |
|
|
|
// 选中日期 |
|
|
|
const selectedValue = this.selectedDate.find(item => item.date === e.fulldate) |
|
|
|
console.log('const selectedValue', selectedValue) |
|
|
|
if (selectedValue) { |
|
|
|
// 存在则移除 |
|
|
|
this.selectedDate = this.selectedDate.filter(item => item.date !== e.fulldate); |
|
|
|
this.allInfo.selectedDate = this.selectedDate; |
|
|
|
} else { |
|
|
@ -518,7 +533,6 @@ |
|
|
|
let tomorrow = new Date() |
|
|
|
tomorrow.setDate(tomorrow.getDate() + 2); |
|
|
|
this.startDate = this.formatDate(tomorrow); |
|
|
|
// 获取三个月后的日期 |
|
|
|
let threeMonthsLater = new Date(); |
|
|
|
threeMonthsLater.setMonth(threeMonthsLater.getMonth() + 3); |
|
|
|
this.endDate = this.formatDate(threeMonthsLater); |
|
|
@ -531,9 +545,8 @@ |
|
|
|
}, |
|
|
|
getLocationInfo() { |
|
|
|
wx.chooseLocation({ |
|
|
|
type: 'gcj02', // 坐标系,默认为 wgs84 返回 gps 原始坐标,gcj02 返回可用于 wx.openLocation 的坐标 |
|
|
|
type: 'gcj02', |
|
|
|
success: (res) => { |
|
|
|
// 成功回调 |
|
|
|
this.isCheckLocation = true |
|
|
|
this.locationName = res.address |
|
|
|
this.locationLongitude = res.longitude |
|
|
@ -545,18 +558,26 @@ |
|
|
|
this.allInfo.locationLongitude = res.longitude |
|
|
|
this.allInfo.locationLatitude = res.latitude |
|
|
|
this.allInfo.locationAddress = res.address |
|
|
|
|
|
|
|
// 保存位置信息到Vuex |
|
|
|
this.$store.commit('setPosition', { |
|
|
|
address: res.address, |
|
|
|
longitude: res.longitude, |
|
|
|
latitude: res.latitude |
|
|
|
}); |
|
|
|
|
|
|
|
// 获取周边伴宠师 |
|
|
|
this.getCompanionList(); |
|
|
|
}, |
|
|
|
fail: (err) => { |
|
|
|
// 失败回调 |
|
|
|
console.error('选择位置失败:', err); |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
getLocationFirst() { |
|
|
|
wx.chooseLocation({ |
|
|
|
type: 'gcj02', // 坐标系,默认为 wgs84 返回 gps 原始坐标,gcj02 返回可用于 wx.openLocation 的坐标 |
|
|
|
type: 'gcj02', |
|
|
|
success: (res) => { |
|
|
|
// 成功回调 |
|
|
|
this.isCheckLocation = true |
|
|
|
this.locationName = res.address |
|
|
|
this.locationLongitude = res.longitude |
|
|
@ -567,44 +588,87 @@ |
|
|
|
this.allInfo.locationLongitude = res.longitude |
|
|
|
this.allInfo.locationLatitude = res.latitude |
|
|
|
this.allInfo.locationAddress = res.address |
|
|
|
this.getCompanionList() |
|
|
|
|
|
|
|
// 保存位置信息到Vuex |
|
|
|
this.$store.commit('setPosition', { |
|
|
|
address: res.address, |
|
|
|
longitude: res.longitude, |
|
|
|
latitude: res.latitude |
|
|
|
}); |
|
|
|
|
|
|
|
// 获取周边伴宠师 |
|
|
|
this.getCompanionList(); |
|
|
|
}, |
|
|
|
fail: (err) => { |
|
|
|
// 失败回调 |
|
|
|
console.error('选择位置失败:', err); |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
getCompanionList() { |
|
|
|
// let data = { |
|
|
|
// longitude: this.locationLongitude, |
|
|
|
// latitude: this.locationLatitude, |
|
|
|
// petTypes: this.selectedPet, |
|
|
|
// staffName: '', |
|
|
|
// address: this.locationAddress |
|
|
|
// } |
|
|
|
// 构建参数,使用当前位置坐标 |
|
|
|
let data = { |
|
|
|
address: "上海市浦东新区浦东南路150弄", |
|
|
|
latitude: 29.56471, |
|
|
|
longitude: 106.55073, |
|
|
|
address: this.locationAddress || "上海市浦东新区浦东南路150弄", |
|
|
|
latitude: this.locationLatitude || 31.22514, |
|
|
|
longitude: this.locationLongitude || 121.49857, |
|
|
|
petTypes: ["1", "2"], |
|
|
|
staffName: "君" |
|
|
|
staffName: "" |
|
|
|
} |
|
|
|
console.log('data', data); |
|
|
|
getCompanionList(data).then(response => { |
|
|
|
if (response.code == 200) { |
|
|
|
// this.companionList = response.rows |
|
|
|
this.defaultCompanion.name = response.rows[0].name |
|
|
|
this.defaultCompanion.gender = response.rows[0].gender |
|
|
|
this.defaultCompanion.star = response.rows[0].id |
|
|
|
this.defaultCompanion.distance = response.rows[0].id |
|
|
|
this.defaultCompanion.shortDescription = response.rows[0].shortDescription |
|
|
|
this.defaultCompanion.staffImages = response.rows[0].staffImages |
|
|
|
this.defaultCompanion.year = 4 |
|
|
|
this.defaultCompanion.record = 11 |
|
|
|
this.defaultCompanion.serviceNum = 13 |
|
|
|
console.log('获取周边伴宠师参数:', data); |
|
|
|
|
|
|
|
// 保存当前位置到Vuex,让position mixin能使用 |
|
|
|
this.$store.commit('setPosition', { |
|
|
|
address: this.locationAddress, |
|
|
|
longitude: this.locationLongitude, |
|
|
|
latitude: this.locationLatitude |
|
|
|
}); |
|
|
|
|
|
|
|
getTeacherListIndex(data).then(response => { |
|
|
|
if (response.code == 200 && response.rows && response.rows.length > 0) { |
|
|
|
const nearbyTeacher = response.rows[0]; |
|
|
|
console.log('伴宠师原始数据:', nearbyTeacher); |
|
|
|
|
|
|
|
// 如果伴宠师有地址信息,使用mixin的calculateDistanceAddress计算距离 |
|
|
|
let distance = 0; |
|
|
|
if (nearbyTeacher.addressList && nearbyTeacher.addressList.length > 0) { |
|
|
|
distance = this.calculateDistanceAddress(nearbyTeacher.addressList); |
|
|
|
} else if (nearbyTeacher.latitude && nearbyTeacher.longitude) { |
|
|
|
// 如果没有地址列表但有经纬度信息,则构造地址对象 |
|
|
|
const addressList = [{ |
|
|
|
latitude: nearbyTeacher.latitude, |
|
|
|
longitude: nearbyTeacher.longitude |
|
|
|
}]; |
|
|
|
distance = this.calculateDistanceAddress(addressList); |
|
|
|
} |
|
|
|
|
|
|
|
// 处理用户图片 |
|
|
|
let userImageUrl = ""; |
|
|
|
if (typeof nearbyTeacher.userImage === 'string') { |
|
|
|
userImageUrl = nearbyTeacher.userImage; |
|
|
|
} else if (nearbyTeacher.userImage && Array.isArray(nearbyTeacher.userImage) && nearbyTeacher.userImage.length > 0) { |
|
|
|
userImageUrl = nearbyTeacher.userImage[0].url || ""; |
|
|
|
} |
|
|
|
|
|
|
|
// 构建伴宠师信息对象 |
|
|
|
this.defaultCompanion = { |
|
|
|
name: nearbyTeacher.userName || '宠小二', |
|
|
|
gender: nearbyTeacher.gender || '1', // 性别,1-男,2-女 |
|
|
|
star: nearbyTeacher.likeNum || 0, |
|
|
|
distance: distance.toFixed(1), |
|
|
|
shortDescription: nearbyTeacher.shortDescription || '专业伴宠师,用心照顾每一位小宠物', |
|
|
|
staffImages: [{ |
|
|
|
url: userImageUrl || "https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/pet/catdog.png" |
|
|
|
}], |
|
|
|
year: nearbyTeacher.serviceAge || 1, // 服务年限 |
|
|
|
record: nearbyTeacher.commentNum || 0, // 评价数 |
|
|
|
serviceNum: nearbyTeacher.serviceSummaryNum || 0 // 服务小结数 |
|
|
|
} |
|
|
|
|
|
|
|
console.log('周边伴宠师信息:', this.defaultCompanion); |
|
|
|
} else { |
|
|
|
console.log('没有找到周边伴宠师或返回数据有误'); |
|
|
|
} |
|
|
|
console.log(response); |
|
|
|
}).catch(err => { |
|
|
|
console.error('获取周边伴宠师失败:', err); |
|
|
|
}) |
|
|
|
}, |
|
|
|
getOrder(value) { |
|
|
@ -625,7 +689,6 @@ |
|
|
|
}) |
|
|
|
|
|
|
|
uni.navigateTo({ |
|
|
|
// url: '/pages/companionPetList/companionPetList', |
|
|
|
url: `/pages/companionPetList/companionPetList?info=` |
|
|
|
+ encodeURIComponent(JSON |
|
|
|
.stringify(this.allInfo)) |
|
|
@ -635,22 +698,20 @@ |
|
|
|
this.$store.commit('setPosition', {}) |
|
|
|
this.buyInfo.teacher = null |
|
|
|
uni.navigateTo({ |
|
|
|
// url: '/pages_order/order/payOrderSuccessful', |
|
|
|
url: '/pages/newOrder/serviceNew', |
|
|
|
// url: '/pages/newOrder/serviceNew2', |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
getCoupon() { |
|
|
|
getCouponList().then(res => { |
|
|
|
if (res.code == 200) { |
|
|
|
this.couponList = res.rows |
|
|
|
this.showMask = true |
|
|
|
} else { |
|
|
|
this.$modal.showToast('获取优惠券失败') |
|
|
|
} |
|
|
|
// getCouponList().then(res => { |
|
|
|
// if (res.code == 200) { |
|
|
|
// this.couponList = res.rows |
|
|
|
// this.showMask = true |
|
|
|
// } else { |
|
|
|
// this.$modal.showToast('获取优惠券失败') |
|
|
|
// } |
|
|
|
|
|
|
|
}) |
|
|
|
// }) |
|
|
|
|
|
|
|
}, |
|
|
|
getCouponListAuth() { |
|
|
@ -689,20 +750,28 @@ |
|
|
|
}) |
|
|
|
}, |
|
|
|
getCouponListNoAuth() { |
|
|
|
console.log('进入 getCouponListNoAuth:'); |
|
|
|
getCouponListNoAuth().then(res => { |
|
|
|
if (res.code == 200) { |
|
|
|
this.couponData = res.rows |
|
|
|
} else { |
|
|
|
this.$modal.showToast('获取优惠券失败') |
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
// console.log('进入 getCouponListNoAuth:'); |
|
|
|
// getCouponListNoAuth().then(res => { |
|
|
|
// if (res.code == 200) { |
|
|
|
// if (res.rows && Array.isArray(res.rows)) { |
|
|
|
// this.couponData = res.rows.filter(item => item !== null); |
|
|
|
// console.log("优惠券数据加载成功:", this.couponData); |
|
|
|
// } else if (res.data && Array.isArray(res.data)) { |
|
|
|
// this.couponData = res.data.filter(item => item !== null); |
|
|
|
// console.log("优惠券数据加载成功:", this.couponData); |
|
|
|
// } else { |
|
|
|
// console.log("获取优惠券数据格式异常:", res); |
|
|
|
// } |
|
|
|
// } else { |
|
|
|
// this.$modal.showToast('获取优惠券失败') |
|
|
|
// } |
|
|
|
// }).catch(err => { |
|
|
|
// console.error("获取优惠券列表出错:", err); |
|
|
|
// }) |
|
|
|
}, |
|
|
|
closeMask() { |
|
|
|
this.showMask = false |
|
|
|
}, |
|
|
|
// 点击领券获取优惠券信息 |
|
|
|
getSendCoupon(res) { |
|
|
|
let that = this |
|
|
|
console.log('res', res) |
|
|
@ -733,7 +802,6 @@ |
|
|
|
that.showMask = false |
|
|
|
} |
|
|
|
}, |
|
|
|
// 点击确认收券按钮后回调 |
|
|
|
redirectuser() {}, |
|
|
|
getBanner() { |
|
|
|
getBannerList().then(res => { |
|
|
@ -770,9 +838,6 @@ |
|
|
|
}, |
|
|
|
goDetails(item) { |
|
|
|
if (item) { |
|
|
|
// uni.navigateTo({ |
|
|
|
// url: `/pages/details/successful` |
|
|
|
// }); |
|
|
|
uni.navigateTo({ |
|
|
|
url: `/pages/details/detail?id=${item.id}` |
|
|
|
}); |
|
|
@ -813,7 +878,6 @@ |
|
|
|
this.getOpenId(loginRes.code) |
|
|
|
}, |
|
|
|
fail: function(error) { |
|
|
|
// 授权失败处理 |
|
|
|
uni.showToast('授权失败,请授权后再试') |
|
|
|
} |
|
|
|
}); |
|
|
@ -831,23 +895,80 @@ |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
showRulePopup(coupon) { |
|
|
|
if (!coupon) { |
|
|
|
console.warn('尝试显示空优惠券详情'); |
|
|
|
return; |
|
|
|
} |
|
|
|
this.currentCoupon = coupon; |
|
|
|
this.$refs.rulePopup.open(); |
|
|
|
}, |
|
|
|
closeRulePopup() { |
|
|
|
this.$refs.rulePopup.close(); |
|
|
|
}, |
|
|
|
getDiscountText(coupon) { |
|
|
|
if (!coupon || !coupon.stockType) return ''; |
|
|
|
|
|
|
|
if (coupon.stockType === 'PNORMAL') { |
|
|
|
return '满100可减10元'; |
|
|
|
} else if (coupon.stockType === 'PDISCOUNT') { |
|
|
|
return '打8折'; |
|
|
|
} else if (coupon.stockType === 'PTRAIL') { |
|
|
|
return '免费体验一次'; |
|
|
|
} |
|
|
|
return ''; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
onShow() { |
|
|
|
if (!getToken() || !getOpenIdKey()) { |
|
|
|
this.login() |
|
|
|
} |
|
|
|
if(this.$globalData.mainSku.length < 1 || !this.$globalData.mainSku[0].price){ |
|
|
|
// 获取主产品 |
|
|
|
this.getProductList() |
|
|
|
} |
|
|
|
this.currentAddress = this.$globalData.newOrderData.currentAddress |
|
|
|
if(this.currentAddress&&this.currentAddress.name){ |
|
|
|
this.isAddressSelected=true |
|
|
|
} |
|
|
|
this.currentPets = this.$globalData.newOrderData.currentPets |
|
|
|
if(this.currentPets&&this.currentPets.length>0){ |
|
|
|
this.isPetSelected=true |
|
|
|
} |
|
|
|
this.needPreFamiliarize = this.$globalData.newOrderData.needPreFamiliarize |
|
|
|
// 初始化伴宠师等级 |
|
|
|
if(this.$globalData.newOrderData.companionLevel) { |
|
|
|
this.companionLevel = this.$globalData.newOrderData.companionLevel |
|
|
|
} |
|
|
|
|
|
|
|
// 获取周边伴宠师数据 |
|
|
|
this.getCompanionList(); |
|
|
|
}, |
|
|
|
|
|
|
|
onLoad: function() { |
|
|
|
this.init() |
|
|
|
this.getPeopleList() |
|
|
|
this.getProductList() |
|
|
|
this.getBanner() |
|
|
|
// this.getCouponListNoAuth() |
|
|
|
const accountInfo = wx.getAccountInfoSync(); |
|
|
|
this.envVersion = accountInfo.miniProgram.envVersion; |
|
|
|
if (!getToken() || !getOpenIdKey()) { |
|
|
|
this.login() |
|
|
|
} else { |
|
|
|
// this.getLocationFirst() |
|
|
|
this.getCouponListAuth() |
|
|
|
} |
|
|
|
this.getCouponListAuth() |
|
|
|
|
|
|
|
// 获取优惠券列表(无需登录) |
|
|
|
this.getCouponListNoAuth() |
|
|
|
|
|
|
|
// 设置默认位置,这样即使用户不选择位置也能显示一些伴宠师 |
|
|
|
this.$store.commit('setPosition', { |
|
|
|
address: "上海市浦东新区浦东南路150弄", |
|
|
|
longitude: 121.49857, |
|
|
|
latitude: 31.22514 |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
@ -859,12 +980,10 @@ |
|
|
|
|
|
|
|
.home-content { |
|
|
|
position: relative; |
|
|
|
// background: linear-gradient(360deg, #F5F5F7 0%, #FFBF60 99%); |
|
|
|
|
|
|
|
|
|
|
|
.swiper { |
|
|
|
height: calc(100vw * 1098/1125); |
|
|
|
// background-image: linear-gradient(180deg, #FFBF60 0%, #FFBF60 90%, #ffffff 99.41%); |
|
|
|
} |
|
|
|
|
|
|
|
.banner { |
|
|
@ -879,15 +998,9 @@ |
|
|
|
.float-button { |
|
|
|
position: fixed; |
|
|
|
bottom: 150px; |
|
|
|
/* 距离底部的距离 */ |
|
|
|
right: 10px; |
|
|
|
/* 距离右侧的距离 */ |
|
|
|
width: 50px; |
|
|
|
/* 按钮的宽度 */ |
|
|
|
height: 50px; |
|
|
|
|
|
|
|
/* 按钮的高度 */ |
|
|
|
/* 其他样式 */ |
|
|
|
.kf-btn { |
|
|
|
background-color: rgba(255, 255, 255, 1); |
|
|
|
height: 52px; |
|
|
@ -944,17 +1057,7 @@ |
|
|
|
align-items: center; |
|
|
|
width: 100%; |
|
|
|
padding: 10px 0; |
|
|
|
// background: #fff; |
|
|
|
// background: #f6f5f8; |
|
|
|
// border: 1px solid #FFBF60; |
|
|
|
border-radius: 8px 8px 0 0; |
|
|
|
// -webkit-mask-image: radial-gradient(circle at 88px 4px, transparent 4px, #d8d8d8 4.5px), radial-gradient(closest-side circle at 50%, #d8d8d8 99%, transparent 100%); |
|
|
|
// -webkit-mask-size: 100%, 2px 4px; |
|
|
|
// -webkit-mask-repeat: repeat, repeat-y; |
|
|
|
// -webkit-mask-position: 0 -4px, 87px; |
|
|
|
// -webkit-mask-composite: source-out; |
|
|
|
// mask-composite: subtract; |
|
|
|
// background: linear-gradient(45deg, orange, red); |
|
|
|
} |
|
|
|
|
|
|
|
.card-bottom { |
|
|
@ -984,7 +1087,6 @@ |
|
|
|
.card-center { |
|
|
|
display: flex; |
|
|
|
flex-direction: column; |
|
|
|
// align-items: center; |
|
|
|
|
|
|
|
.card-center-top { |
|
|
|
width: 40rpx; |
|
|
@ -1011,7 +1113,6 @@ |
|
|
|
padding: 0 16rpx 0 0; |
|
|
|
display: flex; |
|
|
|
flex: 1; |
|
|
|
/* flex-direction: column; */ |
|
|
|
justify-content: space-between; |
|
|
|
align-items: center; |
|
|
|
height: 60px; |
|
|
@ -1026,42 +1127,6 @@ |
|
|
|
top: -10px; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.card-info { |
|
|
|
margin: 0; |
|
|
|
font-size: 28rpx; |
|
|
|
line-height: 28rpx; |
|
|
|
color: #333333; |
|
|
|
font-weight: 500; |
|
|
|
} |
|
|
|
|
|
|
|
.card-type { |
|
|
|
font-size: 24rpx; |
|
|
|
font-weight: 400; |
|
|
|
line-height: 24rpx; |
|
|
|
font-weight: 400; |
|
|
|
color: #AAAAAA; |
|
|
|
margin-top: 10rpx; |
|
|
|
|
|
|
|
.card-type-text { |
|
|
|
color: #FFAA48; |
|
|
|
font-size: 24rpx; |
|
|
|
font-weight: 400; |
|
|
|
line-height: 24rpx; |
|
|
|
border: #FFAA48 1px solid; |
|
|
|
border-radius: 7rpx; |
|
|
|
margin-left: 8rpx; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.card-time { |
|
|
|
font-size: 24rpx; |
|
|
|
font-weight: 400; |
|
|
|
line-height: 24rpx; |
|
|
|
font-weight: 400; |
|
|
|
color: #AAAAAA; |
|
|
|
margin-top: 10rpx; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -1138,7 +1203,6 @@ |
|
|
|
.companion-name { |
|
|
|
color: #333; |
|
|
|
font-size: 32rpx; |
|
|
|
// line-height: 32rpx; |
|
|
|
margin-right: 10rpx; |
|
|
|
font-weight: 900; |
|
|
|
font-style: normal; |
|
|
@ -1354,7 +1418,6 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/* #ifndef APP-NVUE */ |
|
|
|
page { |
|
|
|
display: flex; |
|
|
|
flex-direction: column; |
|
|
@ -1364,8 +1427,6 @@ |
|
|
|
height: auto; |
|
|
|
} |
|
|
|
|
|
|
|
/* #endif */ |
|
|
|
|
|
|
|
.text { |
|
|
|
text-align: center; |
|
|
|
font-size: 26rpx; |
|
|
@ -1400,9 +1461,7 @@ |
|
|
|
} |
|
|
|
|
|
|
|
.swiper-item { |
|
|
|
/* #ifndef APP-NVUE */ |
|
|
|
display: flex; |
|
|
|
/* #endif */ |
|
|
|
flex-direction: column; |
|
|
|
justify-content: center; |
|
|
|
align-items: center; |
|
|
@ -1426,7 +1485,6 @@ |
|
|
|
} |
|
|
|
|
|
|
|
.service-content-img { |
|
|
|
// height: 208px; |
|
|
|
padding: 5px; |
|
|
|
margin-top: 5px; |
|
|
|
border-radius: 8px; |
|
|
@ -1479,7 +1537,6 @@ |
|
|
|
font-size: 10px; |
|
|
|
font-style: normal; |
|
|
|
line-height: 14px; |
|
|
|
/* 140% */ |
|
|
|
position: absolute; |
|
|
|
top: 15px; |
|
|
|
left: 0; |
|
|
@ -1531,11 +1588,8 @@ |
|
|
|
.text-wrapper { |
|
|
|
position: absolute; |
|
|
|
bottom: 83px; |
|
|
|
/* 根据需要调整文字距离图片底部的距离 */ |
|
|
|
left: 10px; |
|
|
|
/* 根据需要调整文字距离图片左边的距离 */ |
|
|
|
color: #fff; |
|
|
|
/* 根据需要调整文字颜色 */ |
|
|
|
font-size: 10px; |
|
|
|
font-weight: blod; |
|
|
|
font-family: PingFang SC; |
|
|
@ -1632,9 +1686,7 @@ |
|
|
|
@media screen and (min-width: 500px) { |
|
|
|
.uni-swiper-dot-box { |
|
|
|
width: 400px; |
|
|
|
/* #ifndef APP-NVUE */ |
|
|
|
margin: 0 auto; |
|
|
|
/* #endif */ |
|
|
|
margin-top: 8px; |
|
|
|
} |
|
|
|
|
|
|
@ -1642,4 +1694,54 @@ |
|
|
|
width: 100%; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/* 优惠券规则弹窗样式 */ |
|
|
|
.rule-popup { |
|
|
|
width: 600rpx; |
|
|
|
background-color: #FFFFFF; |
|
|
|
border-radius: 16rpx; |
|
|
|
overflow: hidden; |
|
|
|
} |
|
|
|
|
|
|
|
.rule-popup-title { |
|
|
|
height: 100rpx; |
|
|
|
line-height: 100rpx; |
|
|
|
text-align: center; |
|
|
|
font-size: 32rpx; |
|
|
|
font-weight: 600; |
|
|
|
color: #FFFFFF; |
|
|
|
background-color: #FFAA48; |
|
|
|
} |
|
|
|
|
|
|
|
.rule-popup-content { |
|
|
|
padding: 30rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.rule-item { |
|
|
|
display: flex; |
|
|
|
margin-bottom: 20rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.rule-label { |
|
|
|
width: 140rpx; |
|
|
|
font-size: 28rpx; |
|
|
|
color: #666666; |
|
|
|
flex-shrink: 0; |
|
|
|
} |
|
|
|
|
|
|
|
.rule-value { |
|
|
|
flex: 1; |
|
|
|
font-size: 28rpx; |
|
|
|
color: #333333; |
|
|
|
line-height: 40rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.rule-popup-close { |
|
|
|
height: 90rpx; |
|
|
|
line-height: 90rpx; |
|
|
|
text-align: center; |
|
|
|
font-size: 30rpx; |
|
|
|
color: #FFAA48; |
|
|
|
border-top: 1px solid #EEEEEE; |
|
|
|
} |
|
|
|
</style> |