Merge branch 'dev' into test
This commit is contained in:
+13
@@ -167,6 +167,19 @@
|
||||
"navigationBarTitleText": "提现结果"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/user/promotion/PromoterOrder/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "分销详情"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/user/promotion/PromoterList/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "分销列表",
|
||||
"navigationBarBackgroundColor": "#FFFFFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/user/promotion/UserPromotion/index",
|
||||
"style": {
|
||||
|
||||
@@ -341,10 +341,11 @@ export default {
|
||||
},
|
||||
async getMapData() {
|
||||
const map = await getLocation()
|
||||
if (map) {
|
||||
if (map.length > 1) {
|
||||
const {latitude, longitude} = map[1]
|
||||
const address = await getCurAddress(latitude, longitude)
|
||||
this.location = address[1].data.result.ad_info.city
|
||||
getCurAddress(latitude, longitude, address => {
|
||||
this.location = address.city
|
||||
})
|
||||
}
|
||||
},
|
||||
init() {
|
||||
|
||||
+11
-48
@@ -74,7 +74,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import config from '@/utils/mapConfig'
|
||||
import { getCurAddress, getLocation } from "@/utils/common"
|
||||
import {
|
||||
getHotelTypeList,
|
||||
getHotelList
|
||||
@@ -124,56 +124,19 @@ export default {
|
||||
})
|
||||
},
|
||||
//获取当前定位地址
|
||||
getCurAddress() {
|
||||
async getCurAddressFn() {
|
||||
const that = this
|
||||
//定位
|
||||
uni.showLoading({
|
||||
title: '定位中...'
|
||||
})
|
||||
uni.getLocation({
|
||||
type: 'wgs84',
|
||||
success: function(res) {
|
||||
let latitude = res.latitude
|
||||
let longitude = res.longitude
|
||||
// #ifdef H5
|
||||
Vue.jsonp(
|
||||
'https://apis.map.qq.com/ws/geocoder/v1/?location=' + latitude + ',' + longitude + '&key=' +
|
||||
config.key, {
|
||||
output: 'jsonp',
|
||||
}).then(json => {
|
||||
// Success.
|
||||
uni.hideLoading();
|
||||
that.cityName = json.result.ad_info.city
|
||||
that.paramCity = json.result.ad_info.city
|
||||
//定位成功刷新数据
|
||||
that.fetchList()
|
||||
}).catch(err => {
|
||||
uni.hideLoading()
|
||||
})
|
||||
// #endif
|
||||
|
||||
// #ifndef H5
|
||||
uni.request({
|
||||
url: 'https://apis.map.qq.com/ws/geocoder/v1/?location=' + latitude + ',' + longitude +
|
||||
'&key=' + config.key,
|
||||
success: function(res) {
|
||||
uni.hideLoading();
|
||||
|
||||
that.cityName = res.data.result.ad_info.city
|
||||
that.paramCity = res.data.result.ad_info.city
|
||||
//定位成功刷新数据
|
||||
that.fetchList()
|
||||
},
|
||||
fail: function(res) {
|
||||
uni.hideLoading()
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
},
|
||||
fail: function(res) {
|
||||
uni.hideLoading()
|
||||
}
|
||||
})
|
||||
const map = await getLocation()
|
||||
if (map.length > 1) {
|
||||
const {latitude, longitude} = map[1]
|
||||
getCurAddress(latitude, longitude, address => {
|
||||
that.cityName = address.city
|
||||
that.paramCity = address.city
|
||||
})
|
||||
}
|
||||
},
|
||||
fetchTypeList() {
|
||||
this.hotelList = []
|
||||
@@ -195,7 +158,7 @@ export default {
|
||||
this.fetchList()
|
||||
uni.removeStorageSync('cityName')
|
||||
} else {
|
||||
this.getCurAddress()
|
||||
this.getCurAddressFn()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -457,13 +457,11 @@ export default {
|
||||
},
|
||||
async getMapData() {
|
||||
const map = await getLocation()
|
||||
if (map.length > 1) {
|
||||
if (map.length > 1 && !this.cityName) {
|
||||
const {latitude, longitude} = map[1]
|
||||
const address = await getCurAddress(latitude, longitude)
|
||||
if(!this.cityName) {
|
||||
this.cityName = address[1].data.result.ad_info.city
|
||||
}
|
||||
// this.search()
|
||||
getCurAddress(latitude, longitude, address => {
|
||||
this.cityName = address.city
|
||||
})
|
||||
}
|
||||
},
|
||||
tapType(index) {
|
||||
|
||||
@@ -1399,13 +1399,12 @@ export default {
|
||||
getLocationPromise().then(mapData => {
|
||||
if (mapData.errMsg) {
|
||||
const { latitude, longitude } = mapData
|
||||
getCurAddress(latitude, longitude).then(address => {
|
||||
this.cityName = address[1].data.result.ad_info.city
|
||||
getCurAddress(latitude, longitude, address => {
|
||||
console.log(address)
|
||||
this.cityName = address.city
|
||||
uni.setStorageSync('locationCityName', this.cityName)
|
||||
this.isLocating = false
|
||||
this.getPageData()
|
||||
}).catch(() => {
|
||||
this.getPageData()
|
||||
})
|
||||
} else {
|
||||
this.isLocating = false
|
||||
|
||||
@@ -901,17 +901,18 @@ export default {
|
||||
})
|
||||
},
|
||||
async getMapData() {
|
||||
let location = uni.getStorageSync('location')
|
||||
const location = uni.getStorageSync('location')
|
||||
if (location.length === 0) {
|
||||
const map = await getLocation()
|
||||
if (map.length > 1) {
|
||||
const {latitude, longitude} = map[1]
|
||||
let address = await getCurAddress(latitude, longitude)
|
||||
address = address[1].data.result.ad_info
|
||||
location = address.province + address.city + address.district
|
||||
getCurAddress(latitude, longitude, address => {
|
||||
this.postAddress = address.formattedAddress
|
||||
})
|
||||
}
|
||||
} else {
|
||||
this.postAddress = location
|
||||
}
|
||||
this.postAddress = location
|
||||
},
|
||||
// 获取当前位置经纬度
|
||||
handleLoacation(toast) {
|
||||
@@ -923,9 +924,9 @@ export default {
|
||||
const map = await getLocation();
|
||||
if (map.length > 1) {
|
||||
const {latitude, longitude} = map[1]
|
||||
let address = await getCurAddress(latitude, longitude)
|
||||
address = address[1].data.result.ad_info
|
||||
that.postAddress = address.province + address.city + address.district
|
||||
getCurAddress(latitude, longitude, address => {
|
||||
that.postAddress = address.formattedAddress
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: err => {
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
:items="district"
|
||||
></CitySelect>
|
||||
</view>
|
||||
<view class="iconfont icon-dizhi font-color-red" @click="getCurAddress()"></view>
|
||||
<view class="iconfont icon-dizhi font-color-red" @click="getCurAddressFn()"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item acea-row row-between-wrapper" style="flex-wrap: nowrap;">
|
||||
@@ -75,7 +75,7 @@
|
||||
|
||||
<script type="text/babel">
|
||||
import CitySelect from '@/components/CitySelect'
|
||||
import config from '@/utils/mapConfig'
|
||||
import {getCurAddress, getLocation} from "@/utils/common"
|
||||
import { getAddress, getCity, postAddress, analysisAddress } from '@/api/user'
|
||||
import attrs, { chs_extphone, required } from '@/utils/validate'
|
||||
import { validatorDefaultCatch } from '@/utils/dialog'
|
||||
@@ -192,113 +192,33 @@ export default {
|
||||
})
|
||||
},
|
||||
//获取当前定位地址
|
||||
getCurAddress() {
|
||||
|
||||
var that = this;
|
||||
//定位
|
||||
async getCurAddressFn() {
|
||||
const that = this
|
||||
uni.showLoading({
|
||||
title: '定位中...'
|
||||
});
|
||||
|
||||
//this.getLocation();
|
||||
|
||||
uni.getLocation({
|
||||
type: 'wgs84',
|
||||
success: function (res) {
|
||||
let latitude = res.latitude;
|
||||
let longitude = res.longitude;
|
||||
|
||||
console.log('latitude:' + latitude + 'longitude:' + longitude)
|
||||
|
||||
// #ifdef H5
|
||||
Vue.jsonp(
|
||||
'https://apis.map.qq.com/ws/geocoder/v1/?location=' + latitude + ',' + longitude + '&key=' + config.key,
|
||||
{
|
||||
//callbackName: 'QQmap',
|
||||
output: 'jsonp',
|
||||
}).then(json => {
|
||||
// Success.
|
||||
uni.hideLoading();
|
||||
|
||||
that.addressText =
|
||||
json.result.ad_info.province + " " + json.result.ad_info.city + " " + json.result.ad_info.district;
|
||||
that.address.province = json.result.ad_info.province;
|
||||
that.address.city = json.result.ad_info.city;
|
||||
that.address.district = json.result.ad_info.district;
|
||||
that.$set(that.userAddress, 'detail', json.result.formatted_addresses.recommend);
|
||||
//that.userAddress.detail = json.result.formatted_addresses.recommend;
|
||||
// that.$refs.cityselect.adjustDefaultValue();
|
||||
|
||||
//设置city_id
|
||||
var pIdx = that.getIndex(that.address.province, that.district);
|
||||
if (pIdx > -1) {
|
||||
var citys = that.district[pIdx].c;
|
||||
var cIdx = that.getIndex(that.address.city, citys);
|
||||
if (cIdx > -1) {
|
||||
var city = citys[cIdx];
|
||||
that.address.city_id = city.v;
|
||||
console.log('city_id:' + city.v);
|
||||
}
|
||||
})
|
||||
const map = await getLocation()
|
||||
if (map.length > 1) {
|
||||
const {latitude, longitude} = map[1]
|
||||
getCurAddress(latitude, longitude, address => {
|
||||
that.addressText = address.province + " " + address.city + " " + address.county
|
||||
that.address.province = address.province
|
||||
that.address.city = address.city
|
||||
that.address.district = address.county
|
||||
that.$set(that.userAddress, 'detail', address.formattedAddress)
|
||||
// 设置city_id
|
||||
const pIdx = that.getIndex(that.address.province, that.district)
|
||||
if (pIdx > -1) {
|
||||
const citys = that.district[pIdx].c
|
||||
const cIdx = that.getIndex(that.address.city, citys)
|
||||
if (cIdx > -1) {
|
||||
const city = citys[cIdx]
|
||||
that.address.city_id = city.v
|
||||
console.log('city_id:' + city.v)
|
||||
}
|
||||
|
||||
|
||||
}).catch(err => {
|
||||
// Failed.
|
||||
console.log('地址解析失败:' + JSON.stringify(err));
|
||||
uni.hideLoading();
|
||||
})
|
||||
// #endif
|
||||
|
||||
// #ifndef H5
|
||||
uni.request({
|
||||
url: 'https://apis.map.qq.com/ws/geocoder/v1/?location=' + latitude + ',' + longitude + '&key=' + config.key,
|
||||
success: function (res) {
|
||||
// console.log('res:'+JSON.stringify(res.data));
|
||||
uni.hideLoading();
|
||||
that.addressText =
|
||||
res.data.result.ad_info.province + " " + res.data.result.ad_info.city + " " + res.data.result.ad_info.district;
|
||||
that.address.province = res.data.result.ad_info.province;
|
||||
that.address.city = res.data.result.ad_info.city;
|
||||
that.address.district = res.data.result.ad_info.district;
|
||||
//that.userAddress.detail = res.data.result.formatted_addresses.recommend;
|
||||
that.$set(that.userAddress, 'detail', res.data.result.formatted_addresses.recommend);
|
||||
// that.$refs.cityselect.adjustDefaultValue();
|
||||
//设置city_id
|
||||
var pIdx = that.getIndex(that.address.province, that.district);
|
||||
if (pIdx > -1) {
|
||||
var citys = that.district[pIdx].c;
|
||||
var cIdx = that.getIndex(that.address.city, citys);
|
||||
if (cIdx > -1) {
|
||||
var city = citys[cIdx];
|
||||
that.address.city_id = city.v;
|
||||
console.log('city_id:' + city.v);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
fail: function (res) {
|
||||
console.log('地址解析失败');
|
||||
uni.hideLoading();
|
||||
},
|
||||
complete: function () {
|
||||
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
},
|
||||
fail: function (res) {
|
||||
uni.hideLoading();
|
||||
|
||||
// uni.showToast({
|
||||
// title:'城市定位失败:'+JSON.stringify(res),
|
||||
// icon:'none',
|
||||
// duration:2000
|
||||
// })
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
getCityList: function () {
|
||||
let that = this;
|
||||
|
||||
@@ -77,11 +77,15 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
async getMapData() {
|
||||
const map = await getLocation();
|
||||
uni.showLoading({
|
||||
title: '定位中...'
|
||||
})
|
||||
const map = await getLocation()
|
||||
if (map.length > 1) {
|
||||
const {latitude, longitude} = map[1];
|
||||
const address = await getCurAddress(latitude, longitude);
|
||||
this.cityName = address[1].data.result['ad_info']['city']
|
||||
const {latitude, longitude} = map[1]
|
||||
getCurAddress(latitude, longitude, address => {
|
||||
this.cityName = address.city
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -140,14 +140,17 @@ export default {
|
||||
},
|
||||
|
||||
async getMapData() {
|
||||
const map = await getLocation();
|
||||
uni.showLoading({
|
||||
title: '定位中...'
|
||||
})
|
||||
const map = await getLocation()
|
||||
if (map.length > 1) {
|
||||
const {latitude, longitude} = map[1];
|
||||
const address = await getCurAddress(latitude, longitude);
|
||||
this.cityName = address[1].data.result['ad_info']['city']
|
||||
const {latitude, longitude} = map[1]
|
||||
getCurAddress(latitude, longitude, address => {
|
||||
this.cityName = address.city
|
||||
this.fetchList()
|
||||
})
|
||||
}
|
||||
|
||||
await this.fetchList()
|
||||
},
|
||||
|
||||
async fetchList() {
|
||||
|
||||
@@ -557,7 +557,7 @@
|
||||
v-for="(shop, shopIndex) in shopList"
|
||||
:key="shopIndex"
|
||||
class="village-item v12-white"
|
||||
@click="villageItemClick(shop)"
|
||||
@click="hotelItemClick(shop)"
|
||||
>
|
||||
<view class="img-wrap">
|
||||
<image
|
||||
@@ -1685,6 +1685,14 @@ export default {
|
||||
gotoInvestment(title = '', type = 'investment', id = '') {
|
||||
uni.navigateTo({ url: `/pkg_product/views/famousQianxianInvestment?id=${id || this.id}&title=${title}&type=${type}` })
|
||||
},
|
||||
hotelItemClick(item) {
|
||||
this.$yrouter.push({
|
||||
path: '/pagesInn/inn/innHome',
|
||||
query: {
|
||||
id: item.id
|
||||
}
|
||||
})
|
||||
},
|
||||
villageItemClick(item) {
|
||||
uni.navigateTo({ url: `/pkg_product/views/famousQianxianVillageShop?id=${item.id}` })
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ export default {
|
||||
onLoad(query) {
|
||||
this.id = (query && query.id) || ''
|
||||
this.getDetail()
|
||||
this.getCalendar()
|
||||
// this.getCalendar()
|
||||
getJiaLouBookingRules(this.id).then(res => {
|
||||
if (res.status === 200) {
|
||||
this.rules = res.data || ''
|
||||
@@ -256,22 +256,22 @@ export default {
|
||||
handleDate() {
|
||||
this.showDatePicker = true
|
||||
},
|
||||
/**
|
||||
* 获取产品可预约日期
|
||||
*/
|
||||
getCalendar() {
|
||||
const currentMonth = new Date().toISOString().slice(0, 7)
|
||||
getJiaLouCalendar({
|
||||
travelGroupProductId: this.id,
|
||||
month: currentMonth
|
||||
}).then(res => {
|
||||
if (res.status === 200) {
|
||||
this.calendar = res.data || []
|
||||
// 计算当前日及后面4天
|
||||
this.currentWeek = this.computeCurrentWeekFromCalendar()
|
||||
}
|
||||
})
|
||||
},
|
||||
// /**
|
||||
// * 获取产品可预约日期
|
||||
// */
|
||||
// getCalendar() {
|
||||
// const currentMonth = new Date().toISOString().slice(0, 7)
|
||||
// getJiaLouCalendar({
|
||||
// travelGroupProductId: this.id,
|
||||
// month: currentMonth
|
||||
// }).then(res => {
|
||||
// if (res.status === 200) {
|
||||
// this.calendar = res.data || []
|
||||
// // 计算当前日及后面4天
|
||||
// this.currentWeek = this.computeCurrentWeekFromCalendar()
|
||||
// }
|
||||
// })
|
||||
// },
|
||||
|
||||
/**
|
||||
* 根据 calendar 数据计算:今天 + 接下来4天(共5天)
|
||||
@@ -322,6 +322,19 @@ export default {
|
||||
if (res.status === 200) {
|
||||
this.detail = res.data
|
||||
this.detail.packageDetails = this.detail.packageDetails.filter(e => e.title !== '')
|
||||
const inventoryList = Array.isArray(res.data.inventoryStatus) ? res.data.inventoryStatus : []
|
||||
const todayStr = this.formatYMD(new Date())
|
||||
const futureList = inventoryList.filter(item => item.date >= todayStr)
|
||||
const limitedList = (futureList.length ? futureList : inventoryList).slice(0, 5)
|
||||
this.currentWeek = limitedList.map((item, index) => {
|
||||
const dateStr = item.date
|
||||
return {
|
||||
date: dateStr,
|
||||
week: this.getWeekLabel(dateStr),
|
||||
status: this.mapInventoryStatus(item.inventoryStatus),
|
||||
monthDay: index === 0 ? '今日' : this.getMonthDay(dateStr)
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
@@ -362,26 +375,23 @@ export default {
|
||||
* @returns {string} 预约状态文本:可约、已约、不可约
|
||||
*/
|
||||
findDateStatus(dateStr) {
|
||||
// 在calendar数组中查找匹配的日期
|
||||
const matchedDate = this.calendar.find(item => item.date === dateStr)
|
||||
console.log('未找到匹配日期:', matchedDate)
|
||||
// 如果找到匹配的日期,根据inventoryStatus返回对应文本
|
||||
if (matchedDate) {
|
||||
switch (matchedDate.inventoryStatus) {
|
||||
case 0:
|
||||
return '可订'
|
||||
case 1:
|
||||
return '不可订'
|
||||
case 2:
|
||||
return '不可订'
|
||||
default:
|
||||
return '不可订'
|
||||
}
|
||||
return this.mapInventoryStatus(matchedDate.inventoryStatus)
|
||||
}
|
||||
|
||||
// 如果没有找到匹配的日期,返回不可约
|
||||
return '不可订'
|
||||
},
|
||||
mapInventoryStatus(status) {
|
||||
switch (status) {
|
||||
case 0:
|
||||
return '可订'
|
||||
case 1:
|
||||
case 2:
|
||||
default:
|
||||
return '不可订'
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 处理日期点击事件
|
||||
|
||||
@@ -19,8 +19,16 @@
|
||||
<swiper-item v-for="(item, index) in traveItems" :key="index" >
|
||||
<view class="trave-item v12-mr-3 v12-mt-3" @click="toStore(item)">
|
||||
<view class="trave-item">
|
||||
<image class="trave-item" :src="item.cover"></image>
|
||||
<!-- <video class="trave-item" :src="item.cover" :show-fullscreen-btn="false" :show-center-play-btn="flase" :show-play-btn="false" v-if="item.coverType === 2"></video> -->
|
||||
<image class="trave-item" :src="item.cover" v-if="item.coverType === 1"></image>
|
||||
<video
|
||||
class="trave-item"
|
||||
:src="item.cover"
|
||||
:show-fullscreen-btn="false"
|
||||
:show-center-play-btn="false"
|
||||
:show-play-btn="false"
|
||||
:poster="item.cover + '?vframe/jpg/offset/1'"
|
||||
v-if="item.coverType === 2"
|
||||
></video>
|
||||
</view>
|
||||
<view class="trave-btn">
|
||||
<text>旅居预约</text>
|
||||
@@ -267,4 +275,4 @@ export default {
|
||||
border-radius: 6rpx;
|
||||
bottom: 5rpx;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -52,7 +52,10 @@ export default {
|
||||
this.isOpen = !this.isOpen
|
||||
},
|
||||
goGoods() {
|
||||
uni.navigateTo({url: '/pages/home/landMark'})
|
||||
this.$yrouter.switchTab({
|
||||
path: '/pages/home/index',
|
||||
query: {},
|
||||
})
|
||||
// this.$global.navToGoods(this.data.productId)
|
||||
},
|
||||
selectCoupon() {
|
||||
|
||||
@@ -234,111 +234,6 @@ export default {
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
},
|
||||
//获取当前定位地址
|
||||
getCurAddress() {
|
||||
var that = this;
|
||||
//定位
|
||||
uni.showLoading({
|
||||
title: '定位中...'
|
||||
});
|
||||
//this.getLocation();
|
||||
uni.getLocation({
|
||||
type: 'wgs84',
|
||||
success: function (res) {
|
||||
let latitude = res.latitude;
|
||||
let longitude = res.longitude;
|
||||
|
||||
console.log('latitude:' + latitude + 'longitude:' + longitude)
|
||||
|
||||
// #ifdef H5
|
||||
Vue.jsonp(
|
||||
'https://apis.map.qq.com/ws/geocoder/v1/?location=' + latitude + ',' + longitude + '&key=' + config.key,
|
||||
{
|
||||
//callbackName: 'QQmap',
|
||||
output: 'jsonp',
|
||||
}).then(json => {
|
||||
// Success.
|
||||
uni.hideLoading();
|
||||
|
||||
that.addressText =
|
||||
json.result.ad_info.province + " " + json.result.ad_info.city + " " + json.result.ad_info.district;
|
||||
that.address.province = json.result.ad_info.province;
|
||||
that.address.city = json.result.ad_info.city;
|
||||
that.address.district = json.result.ad_info.district;
|
||||
that.$set(that.userAddress, 'detail', json.result.formatted_addresses.recommend);
|
||||
//that.userAddress.detail = json.result.formatted_addresses.recommend;
|
||||
// that.$refs.cityselect.adjustDefaultValue();
|
||||
|
||||
//设置city_id
|
||||
var pIdx = that.getIndex(that.address.province, that.district);
|
||||
if (pIdx > -1) {
|
||||
var citys = that.district[pIdx].c;
|
||||
var cIdx = that.getIndex(that.address.city, citys);
|
||||
if (cIdx > -1) {
|
||||
var city = citys[cIdx];
|
||||
that.address.city_id = city.v;
|
||||
console.log('city_id:' + city.v);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}).catch(err => {
|
||||
// Failed.
|
||||
console.log('地址解析失败:' + JSON.stringify(err));
|
||||
uni.hideLoading();
|
||||
})
|
||||
// #endif
|
||||
|
||||
// #ifndef H5
|
||||
uni.request({
|
||||
url: 'https://apis.map.qq.com/ws/geocoder/v1/?location=' + latitude + ',' + longitude + '&key=' + config.key,
|
||||
success: function (res) {
|
||||
// console.log('res:'+JSON.stringify(res.data));
|
||||
uni.hideLoading();
|
||||
that.addressText =
|
||||
res.data.result.ad_info.province + " " + res.data.result.ad_info.city + " " + res.data.result.ad_info.district;
|
||||
that.address.province = res.data.result.ad_info.province;
|
||||
that.address.city = res.data.result.ad_info.city;
|
||||
that.address.district = res.data.result.ad_info.district;
|
||||
//that.userAddress.detail = res.data.result.formatted_addresses.recommend;
|
||||
that.$set(that.userAddress, 'detail', res.data.result.formatted_addresses.recommend);
|
||||
// that.$refs.cityselect.adjustDefaultValue();
|
||||
//设置city_id
|
||||
var pIdx = that.getIndex(that.address.province, that.district);
|
||||
if (pIdx > -1) {
|
||||
var citys = that.district[pIdx].c;
|
||||
var cIdx = that.getIndex(that.address.city, citys);
|
||||
if (cIdx > -1) {
|
||||
var city = citys[cIdx];
|
||||
that.address.city_id = city.v;
|
||||
console.log('city_id:' + city.v);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
fail: function (res) {
|
||||
console.log('地址解析失败');
|
||||
uni.hideLoading();
|
||||
},
|
||||
complete: function () {
|
||||
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
},
|
||||
fail: function (res) {
|
||||
uni.hideLoading();
|
||||
|
||||
// uni.showToast({
|
||||
// title:'城市定位失败:'+JSON.stringify(res),
|
||||
// icon:'none',
|
||||
// duration:2000
|
||||
// })
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
getCityList: function () {
|
||||
let that = this;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
class="cover-swiper"
|
||||
>
|
||||
<swiper-item v-for="(item, i) in list" :key="i" class="cover-swiper-item" :class="{'n-actived' : currentIndex !== i}">
|
||||
<view class="cover-item" >
|
||||
<view class="cover-item" :class="{'ios-cover': isIOS}">
|
||||
<view class="img-wrap">
|
||||
<view class="pro-img-wrap " :style="{
|
||||
left: (item.productImageX*2 || 0) + 'rpx',
|
||||
@@ -26,6 +26,16 @@
|
||||
}">
|
||||
<image :src="product.image" class="pro-cover-image" mode="widthFix|heightFix" />
|
||||
</view>
|
||||
<view class="good-story"
|
||||
|
||||
v-if="product.productStory && item.isShowProductStory"
|
||||
:style="{
|
||||
right: (item.productStoryX*2 || 0) + 'rpx',
|
||||
top: (item.productStoryY*2 || 0) + 'rpx'
|
||||
}"
|
||||
>
|
||||
<view v-for="(line, j) in product.productStory.split('/n')" :key="j">{{ line }}</view>
|
||||
</view>
|
||||
<image :src="item.cover" class="cover-image" mode="widthFix" />
|
||||
<!-- <view class="message-text" :style="{top: currentIndex !== index ? '260rpx' : '220rpx'}">{{ message }}</view> -->
|
||||
</view>
|
||||
@@ -69,9 +79,15 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
productStory: '源自云南的宣威火腿月饼,/n以匠心手作,外皮酥香,/n内馅甜咸交融。/n每一口,都是月圆情浓的/n团圆滋味,载着滇地独特的/n饮食文化记忆。',
|
||||
currentIndex: this.index
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
isIOS() {
|
||||
return uni.getSystemInfoSync().osName === 'ios'
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
index(val) {
|
||||
this.currentIndex = val
|
||||
@@ -186,4 +202,16 @@ export default {
|
||||
line-height: 80rpx;
|
||||
}
|
||||
}
|
||||
.good-story{
|
||||
position: absolute;
|
||||
color: #fff;
|
||||
height: 320rpx;
|
||||
writing-mode: vertical-rl;
|
||||
color: #ffefd2;
|
||||
font-size: 24rpx;
|
||||
line-height: 36rpx;
|
||||
}
|
||||
.ios-cover{
|
||||
zoom: 1.01
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<view class="dialog-conent" v-show="isLogin">
|
||||
<view class="gift-card-modal" >
|
||||
<view class="gift-card-modal" :class="{'ios-cover': isIOS}">
|
||||
<image class="bg-image" :src="!card.isBlind ? card.cover : card.blindBoxImage" mode="widthFix" lazy-load="false"></image>
|
||||
<view v-if="card.isBlind !== 1" class="image-wrap" :style="{
|
||||
top: card.productImageY*2 + 'rpx',
|
||||
@@ -13,6 +13,16 @@
|
||||
|
||||
</image>
|
||||
</view>
|
||||
<view
|
||||
class="good-story"
|
||||
v-if="card.isBlind !== 1 && card.giftProducts[0].productStory && card.isShowProductStory"
|
||||
:style="{
|
||||
right: (card.productStoryX*2 || 0) + 'rpx',
|
||||
top: (card.productStoryY*2 || 0) + 'rpx'
|
||||
}"
|
||||
>
|
||||
<view v-for="(line, j) in card.giftProducts[0].productStory.split('/n')" :key="j">{{ line }}</view>
|
||||
</view>
|
||||
<view class="wrap-box">
|
||||
|
||||
</view>
|
||||
@@ -21,33 +31,33 @@
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view v-if="!isTravelGroup">
|
||||
<view v-if="!isTravelGroup" style="margin-top: 200rpx;">
|
||||
<view class="blind-box" v-if="card.isBlind">
|
||||
<u-icon :name="webUrl + '/orderIcon/礼物.png'" size="30" ></u-icon>
|
||||
<text class="v12-font-30 v12-dark-text v12-font-bold v12-ml-2">您收到一份来自朋友的神秘礼物</text>
|
||||
</view>
|
||||
<view class="btn-wrap">
|
||||
<view class="btn-wrap" style="margin-top: 0rpx;">
|
||||
<button v-if="!isReceive && myGift.isCurrentUser !== 1" class="share-btn v12-white-text v12-primary" @click="setAddress(0)">
|
||||
填写地址并收下
|
||||
</button>
|
||||
<button v-if="card.canTransfer !== 0 && !isReceive && myGift.isCurrentUser !== 1" open-type="share" class="share-btn v12-white v12-primary-text v12-d-flex" >
|
||||
<button v-if="card.canTransfer !== 0 && !isReceive && myGift.isCurrentUser !== 1" open-type="share" class="share-btn share-btn-second v12-white v12-primary-text v12-d-flex" >
|
||||
点击转赠给好友
|
||||
<u-icon :name="webUrl + '/icon/share.png'" ></u-icon>
|
||||
</button>
|
||||
</view>
|
||||
<view v-if="myGift.isCurrentUser === 1 && !card.isBlind" @click="toOrder" style="z-index: 10; display: flex;flex-direction: column;align-items: center;margin-top:200rpx;">
|
||||
<view class="address-btn v12-white-text v12-primary">
|
||||
您已领取礼包
|
||||
</view>
|
||||
<view class="info-btn v12-text-center v12-font-32 v12-mt-3">查看礼包详情>></view>
|
||||
</view>
|
||||
<view v-if="myGift.isCurrentUser === 1 && card.isBlind" style="z-index: 10; display: flex;flex-direction: column;align-items: center;margin-top:200rpx;">
|
||||
<view style="width: fit-content;" class="address-btn v12-white-text v12-primary" @click="toOrder">
|
||||
<!-- <view v-if="myGift.isCurrentUser === 1 && !card.isBlind" style="z-index: 10; display: flex;flex-direction: column;align-items: center;margin-top:200rpx;">
|
||||
<view style="width: fit-content;" class="address-btn v12-white-text v12-primary" @click="toOrder">
|
||||
您已领取礼包,去看看>>
|
||||
</view>
|
||||
<view class="info-btn v12-text-center v12-font-32 v12-mt-3" @click.stop="searchGift">我也要送礼</view>
|
||||
</view> -->
|
||||
<view v-if="myGift.isCurrentUser === 1" style="z-index: 10; display: flex;flex-direction: column;align-items: center;margin-top:60rpx;">
|
||||
<view style="width: 380rpx" class="address-btn v12-white-text v12-primary" @click="toOrder">
|
||||
您已领取礼包,去看看>>
|
||||
</view>
|
||||
<view style="width: 380rpx" class="info-btn v12-text-center v12-font-32 v12-mt-3" @click.stop="searchGift">我也要送礼</view>
|
||||
</view>
|
||||
<view v-if="isReceive && myGift.isCurrentUser !== 1" @click="toHome" style="z-index: 10; display: flex;flex-direction: column;align-items: center;margin-top:200rpx;">
|
||||
<view v-if="isReceive && myGift.isCurrentUser !== 1" @click="toHome" style="z-index: 10; display: flex;flex-direction: column;align-items: center;margin-top:60rpx;">
|
||||
<view class="address-btn v12-white-text v12-primary">
|
||||
礼包已被领取
|
||||
</view>
|
||||
@@ -59,7 +69,7 @@
|
||||
<button class="share-btn v12-white-text v12-primary" @click="setShowAddressForm(true)">
|
||||
填写信息并收下
|
||||
</button>
|
||||
<button v-if="card.canTransfer !== 0" open-type="share" class="share-btn v12-white v12-primary-text v12-d-flex" >
|
||||
<button v-if="card.canTransfer !== 0" open-type="share" class="share-btn share-btn-second v12-white v12-primary-text v12-d-flex" >
|
||||
点击转赠给好友
|
||||
<u-icon :name="webUrl + '/icon/share.png'" ></u-icon>
|
||||
</button>
|
||||
@@ -131,6 +141,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
productStory: '源自云南的宣威火腿月饼,/n以匠心手作,外皮酥香,/n内馅甜咸交融。/n每一口,都是月圆情浓的/n团圆滋味,载着滇地独特的/n饮食文化记忆。',
|
||||
webUrl: this.$VUE_APP_RESOURCES_URL,
|
||||
// 组件数据
|
||||
giftNotice: '',
|
||||
@@ -146,6 +157,9 @@ export default {
|
||||
const isReceiveNum = this.card.giftProducts && this.card.giftProducts.filter(e => e.isReceive === 1).length
|
||||
return gitfNum === isReceiveNum
|
||||
},
|
||||
isIOS() {
|
||||
return uni.getSystemInfoSync().osName === 'ios'
|
||||
},
|
||||
isLogin() {
|
||||
return !!cookie.get('login_status');
|
||||
},
|
||||
@@ -393,11 +407,13 @@ export default {
|
||||
z-index: 999;
|
||||
align-items: center;
|
||||
border: 1rpx solid #C52733 ;
|
||||
margin-left: 10rpx;
|
||||
font-weight: bold;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
}
|
||||
.share-btn-second{
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
.share-btn::before{
|
||||
border: none;
|
||||
}
|
||||
@@ -439,4 +455,16 @@ export default {
|
||||
width: 80%;
|
||||
max-width: 300px;
|
||||
}
|
||||
.good-story{
|
||||
position: absolute;
|
||||
color: #fff;
|
||||
height: 320rpx;
|
||||
writing-mode: vertical-rl;
|
||||
color: #ffefd2;
|
||||
font-size: 24rpx;
|
||||
line-height: 36rpx;
|
||||
}
|
||||
.ios-cover{
|
||||
zoom: 1.01
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -290,6 +290,34 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
adjustCoverListForProductStory(coverList, productInfo, defaultTemplate) {
|
||||
if (!productInfo || !productInfo.productStory) {
|
||||
return {
|
||||
coverList,
|
||||
template: defaultTemplate
|
||||
}
|
||||
}
|
||||
const list = coverList && coverList.length ? [...coverList] : []
|
||||
if (!list.length) {
|
||||
return {
|
||||
coverList: list,
|
||||
template: defaultTemplate
|
||||
}
|
||||
}
|
||||
const storyIndex = list.findIndex(item => item && item.isShowProductStory)
|
||||
if (storyIndex === -1) {
|
||||
return {
|
||||
coverList: list,
|
||||
template: defaultTemplate
|
||||
}
|
||||
}
|
||||
const storyCover = list.splice(storyIndex, 1)[0]
|
||||
list.unshift(storyCover)
|
||||
return {
|
||||
coverList: list,
|
||||
template: storyCover
|
||||
}
|
||||
},
|
||||
// 团购价计算
|
||||
computedTravelGroupPrice(useDefaultCouponId) {
|
||||
const params = {
|
||||
@@ -345,16 +373,21 @@ export default {
|
||||
}
|
||||
getGiftCardResend(params).then(res => {
|
||||
this.isPayOk = false
|
||||
this.coverList = [...res.data.giftCardTemplates, res.data.specialGiftCardTemplate]
|
||||
this.cartId = res.data.cartInfo[0].id
|
||||
const temp = res.data.giftCardTemplates.filter(e => e.isTravelGroup === 0)
|
||||
const hasSpecial = res.data.giftCardTemplates.map(e => e.id).includes(res.data.specialGiftCardTemplate.id)
|
||||
const initialCoverList = hasSpecial ? [...temp] : [...temp, res.data.specialGiftCardTemplate]
|
||||
const goodsInfo = res.data.cartInfo[0]
|
||||
const { coverList, template } = this.adjustCoverListForProductStory(initialCoverList, goodsInfo && goodsInfo.productInfo, res.data.specialGiftCardTemplate)
|
||||
this.coverList = coverList
|
||||
this.cartId = goodsInfo.id
|
||||
this.giftNotice = res.data.giftCardGiftNotice
|
||||
this.orderKey = res.data.orderKey
|
||||
this.goodsInfo = res.data.cartInfo[0]
|
||||
this.templateId = res.data.specialGiftCardTemplate.id
|
||||
this.goodsInfo = goodsInfo
|
||||
this.templateId = template.id
|
||||
this.defaultIndex = this.coverList.findIndex(item => item.id === this.templateId)
|
||||
console.log(this.defaultIndex, 'defaultIndex');
|
||||
this.selectedCover = res.data.specialGiftCardTemplate.cover
|
||||
this.giftImage = res.data.specialGiftCardTemplate.image
|
||||
this.selectedCover = template.cover
|
||||
this.giftImage = template.image
|
||||
this.couponId = ''
|
||||
this.computedPrice(this.goodsInfo.cartNum)
|
||||
})
|
||||
@@ -423,13 +456,17 @@ export default {
|
||||
this.loading = true
|
||||
getGiftCardSendOrderConfirm(params).then(res => {
|
||||
const temp = this.isGroupBuy ? res.data.giftCardTemplates : res.data.giftCardTemplates.filter(e => e.isTravelGroup === 0)
|
||||
this.coverList = res.data.giftCardTemplates.map(e => e.id).includes(res.data.specialGiftCardTemplate.id) ? [...temp] : [...temp, res.data.specialGiftCardTemplate]
|
||||
const hasSpecial = res.data.giftCardTemplates.map(e => e.id).includes(res.data.specialGiftCardTemplate.id)
|
||||
const initialCoverList = hasSpecial ? [...temp] : [...temp, res.data.specialGiftCardTemplate]
|
||||
const goodsInfo = res.data.cartInfo[0]
|
||||
const { coverList, template } = this.adjustCoverListForProductStory(initialCoverList, goodsInfo && goodsInfo.productInfo, res.data.specialGiftCardTemplate)
|
||||
this.coverList = coverList
|
||||
this.giftNotice = res.data.giftCardGiftNotice
|
||||
this.orderKey = res.data.orderKey
|
||||
this.goodsInfo = res.data.cartInfo[0]
|
||||
this.templateId = res.data.specialGiftCardTemplate.id
|
||||
this.selectedCover = res.data.specialGiftCardTemplate.cover
|
||||
this.giftImage = res.data.specialGiftCardTemplate.image
|
||||
this.goodsInfo = goodsInfo
|
||||
this.templateId = template.id
|
||||
this.selectedCover = template.cover
|
||||
this.giftImage = template.image
|
||||
this.blindImage = res.data.giftCardBlindBoxShareImage
|
||||
this.defaultIndex = this.coverList.findIndex(item => item.id === this.templateId)
|
||||
// if(!this.couponId) {
|
||||
@@ -752,4 +789,4 @@ export default {
|
||||
width: 100%;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
+33
-5
@@ -20,11 +20,39 @@ module.exports = {
|
||||
})
|
||||
},
|
||||
|
||||
getCurAddress(latitude, longitude) {
|
||||
return uni.request({
|
||||
url: 'https://apis.map.qq.com/ws/geocoder/v1/?location=' + latitude + ',' + longitude +
|
||||
'&key=' + config.key
|
||||
});
|
||||
getCurAddress(latitude, longitude, cb) {
|
||||
const postStr = {
|
||||
lon: longitude,
|
||||
lat: latitude,
|
||||
ver: 1 // 接口版本号
|
||||
}
|
||||
const encodedPostStr = encodeURIComponent(JSON.stringify(postStr))
|
||||
|
||||
uni.request({
|
||||
url: `https://api.tianditu.gov.cn/geocoder?postStr=${encodedPostStr}&type=geocode&tk=${config.key}`,
|
||||
method: 'GET',
|
||||
success: (res) => {
|
||||
if (res.data.status === '0') { // 请求成功[6](@ref)
|
||||
const result = res.data.result;
|
||||
// 从返回数据中提取省市区信息[1,6](@ref)
|
||||
const addressComponent = result.addressComponent;
|
||||
const province = addressComponent.province; // 省份
|
||||
const city = addressComponent.city; // 城市
|
||||
const county = addressComponent.county; // 区县
|
||||
const formattedAddress = result.formatted_address; // 完整地址
|
||||
cb && cb({
|
||||
province,
|
||||
city,
|
||||
county,
|
||||
formattedAddress
|
||||
})
|
||||
}
|
||||
uni.hideLoading()
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading()
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
getLocationSetting(cb) {
|
||||
|
||||
+1
-1
@@ -2,6 +2,6 @@
|
||||
module.exports = {
|
||||
|
||||
//key: 'LBZBZ-XAJRO-HKYWF-SOACS-HSTYQ-ZUF44'
|
||||
key: 'J2WBZ-WS366-SL2SI-M35IG-IU7OH-4YFKF'
|
||||
key: '653f4f2f787ee9d156ab24c663868938'
|
||||
|
||||
};
|
||||
|
||||
@@ -40,8 +40,7 @@
|
||||
<script>
|
||||
import {
|
||||
fetchSpecialty
|
||||
} from "@/api/shop";
|
||||
import config from '@/utils/mapConfig';
|
||||
} from "@/api/shop"
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@@ -53,12 +52,12 @@ export default {
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
let memCityName = uni.getStorageSync("cityName")
|
||||
const memCityName = uni.getStorageSync("cityName")
|
||||
if (memCityName.length) {
|
||||
this.cityName = memCityName;
|
||||
this.page = 1;
|
||||
this.list = [];
|
||||
this.fetchList(this.cityName);
|
||||
this.cityName = memCityName
|
||||
this.page = 1
|
||||
this.list = []
|
||||
this.fetchList(this.cityName)
|
||||
uni.removeStorageSync("cityName")
|
||||
}
|
||||
},
|
||||
@@ -89,67 +88,7 @@ export default {
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
//获取当前定位地址
|
||||
getCurAddress() {
|
||||
var that = this;
|
||||
//定位
|
||||
uni.showLoading({
|
||||
title: '定位中...'
|
||||
});
|
||||
|
||||
uni.getLocation({
|
||||
type: 'wgs84',
|
||||
success: function (res) {
|
||||
let latitude = res.latitude;
|
||||
let longitude = res.longitude;
|
||||
|
||||
console.log('latitude:' + latitude + 'longitude:' + longitude)
|
||||
|
||||
// #ifdef H5
|
||||
Vue.jsonp(
|
||||
'https://apis.map.qq.com/ws/geocoder/v1/?location=' + latitude + ',' + longitude + '&key=' +
|
||||
config.key, {
|
||||
output: 'jsonp',
|
||||
}).then(json => {
|
||||
// Success.
|
||||
uni.hideLoading();
|
||||
that.cityName = json.result.ad_info.city;
|
||||
//定位成功刷新数据
|
||||
that.fetchList()
|
||||
}).catch(err => {
|
||||
// Failed.
|
||||
console.log('地址解析失败:' + JSON.stringify(err));
|
||||
uni.hideLoading();
|
||||
})
|
||||
// #endif
|
||||
|
||||
// #ifndef H5
|
||||
uni.request({
|
||||
url: 'https://apis.map.qq.com/ws/geocoder/v1/?location=' + latitude + ',' + longitude +
|
||||
'&key=' + config.key,
|
||||
success: function (res) {
|
||||
uni.hideLoading();
|
||||
|
||||
that.cityName = res.data.result.ad_info.city;
|
||||
|
||||
//定位成功刷新数据
|
||||
that.fetchList()
|
||||
},
|
||||
fail: function (res) {
|
||||
console.log('地址解析失败');
|
||||
uni.hideLoading();
|
||||
},
|
||||
complete: function () {
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
},
|
||||
fail: function (res) {
|
||||
uni.hideLoading();
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user