main
lion 1 year ago
parent 072caa24c8
commit c1a65a733c

@ -1,6 +1,7 @@
const mode = 'production'; //devLocal本地测试、devOnline线上测试、production生产环境
let ROOTPATH = ''; //域名
let base = "https://agent.xfgshop.com"
// let base = "https://agenttest.xfgshop.com"
switch (mode) {
// https://agenttest.xfgshop.com
// https://agent.xfgshop.com

@ -37,17 +37,21 @@ const install = (Vue, vm) => {
console.log('res-http', res)
if (res.statusCode === 200) {
if (res.data.hasOwnProperty("errcode")) {
if (res.data?.errcode === 40001) {
if (res.data?.errcode === 40001) {
console.log("调用用户信息失效")
uni.showModal({
title: '用户信息已失效',
confirmText: '重新获取',
success: function(res) {
if (res.confirm) {
if (res.confirm) {
console.log("调用用户信息失效code",res)
uni.removeStorageSync()
uni.login({
provider: 'weixin',
success: (res) => {
let url = baseUrl + '/api/mobile/user/login'
success: (res) => {
console.log("调用用户信息失效code12",res)
let url = `${baseUrl}/api/mobile/user/login`
console.log("调用用户信息失效url",url)
uni.request({
url: url,
data:{
@ -59,34 +63,15 @@ const install = (Vue, vm) => {
uni.setStorageSync("xtt_lifeData3",{'vuex_token':result.data.token})
uni.reLaunch({
url: '/pages/home/home'
});
// const currentPage =
// getCurrentPages()[
// getCurrentPages()
// .length - 1];
// const currentPagePath =
// "/" + currentPage.route;
// const currentPageOptions =
// currentPage.options;
// const queryString = Object
// .keys(
// currentPageOptions)
// .map(key =>
// `${key}=${currentPageOptions[key]}`
// )
// .join('&');
// // 使用uni.reLaunch方法刷新当前页面
// uni.reLaunch({
// url: `${currentPagePath}?${queryString}`
// });
// console.log("reLaunch",
// `${currentPagePath}?${queryString}`
// )
}
});
},
fail:function(err2){
console.log("err2",err2)
},
});
},
fail:function(err){
console.log("err",err)
}
});
// login end

@ -28,7 +28,8 @@
<view class="date-list-right">
<view class="lunarData" v-if="dateObj.lunarData">
{{dateObj.lunarData?dateObj.lunarData:''}}
<view>今日剩余可提货量{{dateObj.canUse.quantity - dateObj.canUse.booked}}</view>
<!-- <view>今日剩余可提货量{{dateObj.canUse.quantity - dateObj.canUse.booked}}</view> -->
<view>余量充足</view>
</view>
<!-- <view class="hh">
<view @click="chooseHh(index,item)"

@ -383,9 +383,9 @@
} else {
toast("未查询到卡券信息")
uni.removeStorageSync("vuex_card")
uni.redirectTo({
url: '/packages/change/change'
})
// uni.redirectTo({
// url: '/packages/change/change'
// })
}
},
methods: {
@ -421,6 +421,18 @@
_this.form.city_id = res1.city_id ? res1.city_id.id : ''
_this.form.district_id = res1.district_id ? res1
.district_id.id : ''
if (isNull(_this.form.province_id) || isNull(_this.form
.city_id) ||
isNull(_this.form.district_id)) {
uni.showToast({
title: '未能匹配到所在地区,请手动选择',
icon: 'none'
})
_this.form.area = ""
_this.form.province_id = ''
_this.form.city_id = ''
_this.form.district_id = ''
}
})
console.log("_this", _this.form)
},
@ -480,15 +492,15 @@
..._k
})
}
} else {
// 1212
let _k = this.momentDay(k)
this.listDates.push({
canUse: data.open_dates[k],
..._k
})
// if(this.isBeforeNoon(k)){
} else {
// 1212
let _k = this.momentDay(k)
this.listDates.push({
canUse: data.open_dates[k],
..._k
})
// if(this.isBeforeNoon(k)){
// }
}
@ -520,17 +532,17 @@
const twoDaysAfterToday = today.add(2, 'days');
return dateToCheck >= twoDaysAfterToday;
},
},
// 12
isBeforeNoon(a) {
// Moment
console.log("a",a)
// Moment
console.log("a", a)
const dateA = this.$moment(a, 'YYYY-MM-DD');
//
const today = this.$moment();
if(dateA.isAfter(today)){
return true
if (dateA.isAfter(today)) {
return true
}
//
if (dateA.isSame(today, 'day')) {
@ -613,14 +625,14 @@
scope: 'scope.userLocation',
success: (res) => {
console.log("authorize", res)
uni.chooseLocation({
success(res) {
console.log("res", res)
// _this.form.area = res.address
// _this.form.area = res.address
_this.form.address = res.name
//
let pca = parseAddress(res.address)
let pca = parseAddress(res.address)
console.log("pca",pca)
if (pca.length > 0) {
_this.form.area = pca.join('')
_this.$u.api.matchRegion({
@ -633,16 +645,30 @@
_this.form.city_id = res.city_id ? res.city_id.id : ''
_this.form.district_id = res.district_id ? res
.district_id.id : ''
if (isNull(_this.form.province_id) || isNull(_this.form
.city_id) ||
isNull(_this.form.district_id)) {
uni.showToast({
title: '未能匹配到所在省市区,请手动选择',
icon: 'none'
})
_this.form.area = ""
_this.form.province_id = ''
_this.form.city_id = ''
_this.form.district_id = ''
}
})
} else {
uni.showToast({
title: '未获取到地址,重新获取',
title: '未能匹配到所在省市区,请手动选择',
icon: 'none'
})
})
_this.form.area = ""
_this.form.province_id = ''
_this.form.city_id = ''
_this.form.district_id = ''
}
},
fail(res) {
console.log("fail", res)
@ -789,6 +815,8 @@
})
} else {
console.log("this.form", this.form)
// return
this.$u.api.addUserOrder(this.form).then(res => {
console.log("res", res)
uni.removeStorageSync('vuex_card')

@ -7,7 +7,7 @@
<view>
<view class="myswiper">
<u-swiper mode="none" border-radius="0" :list="list" height="440"></u-swiper>
<u-swiper mode="none" @click="clickTop" border-radius="0" :list="list" height="440"></u-swiper>
</view>
<view class="tags">
<view v-for="item in tags">
@ -62,12 +62,12 @@
</view>
</view>
</view>
<view class="contact" @click="toUrl(5)">
<view class="contact" @click="toUrl(5)">
<image src="../../static/index_icon8.png"></image>
<view>
<view>蟹太太官方旗舰店</view>
<view>
<view>提货答疑 物流追踪</view>
<view>提货答疑 物流追踪</view>
<image src="../../static/index_icon9.png" mode=""></image>
</view>
<view class="contact-btn">
@ -97,12 +97,12 @@
<script>
import PrivacyPopup from '@/components/privacy-popup/privacy-popup.vue';
import tabbar from '@/components/tabbar/tabbar.vue';
import {
ROOTPATH as baseUrl
import tabbar from '@/components/tabbar/tabbar.vue';
import {
ROOTPATH as baseUrl
} from "@/common/config.js"
import {
isNull,
isNull,
toast
} from '@/common/util.js'
export default {
@ -113,8 +113,8 @@
data() {
return {
list: [],
tags: ['品牌自营', '品质保障', '顺丰包邮', '售后无忧'],
banner2:[]
tags: ['品牌自营', '品质保障', '顺丰包邮', '售后无忧'],
banner2: []
}
},
@ -124,15 +124,15 @@
onShareTimeline() {
// return shareInfo
},
onLoad(option) {
this.getBanner()
let token = uni.getStorageSync('xtt_lifeData3')?uni.getStorageSync('xtt_lifeData3').vuex_token:''
onLoad(option) {
this.getBanner()
let token = uni.getStorageSync('xtt_lifeData3') ? uni.getStorageSync('xtt_lifeData3').vuex_token : ''
if (isNull(token)) {
this.getToken()
}
},
onShow() {
},
onHide() {
@ -146,147 +146,153 @@
},
onRejectPrivacy() {
//
//
//
// wx.exitMiniProgram();
console.log('User rejected the privacy policy');
},
async getBanner(){
const res = await this.$u.api.getConfig()
// banner1
let arr = []
if(res.banner1.length>0){
res.banner1.map(item=>{
arr.push({
image:item.upfile_url
})
})
this.list = arr
}
// banner2
if(res.banner2.length>0){
this.banner2 = res.banner2
}
// banner3
let _arr = []
if(res.banner3.length>0){
res.banner3.map(item=>{
_arr.push({
image:item.upfile_url
})
})
uni.setStorageSync('banner3',_arr)
}
//
let _arr1 = []
if(res.banner4.length>0){
res.banner4.map(item=>{
_arr1.push({
image:item.upfile_url,
type:item.url
})
})
uni.setStorageSync('banner4',_arr1)
}
//
uni.setStorageSync('configs',res.config)
},
//
clickTop(e) {
console.log("e", e, this.list[e])
const appid = this.list[e].appid
const path = this.list[e].url
if (!isNull(appid)) {
uni.navigateToMiniProgram({
appId: appid, // appid
path: path?path:'', //
extraData: {
//
},
success(res) {
//
},
fail(err) {
//
}
})
return
}
},
async getBanner() {
const res = await this.$u.api.getConfig()
// banner1
let arr = []
if (res.banner1.length > 0) {
res.banner1.map(item => {
arr.push({
image: item.upfile_url,
...item
})
})
this.list = arr
}
// banner2
if (res.banner2.length > 0) {
this.banner2 = res.banner2
}
// banner3
let _arr = []
if (res.banner3.length > 0) {
res.banner3.map(item => {
_arr.push({
image: item.upfile_url
})
})
uni.setStorageSync('banner3', _arr)
}
//
let _arr1 = []
if (res.banner4.length > 0) {
res.banner4.map(item => {
_arr1.push({
image: item.upfile_url,
type: item.url
})
})
uni.setStorageSync('banner4', _arr1)
}
//
uni.setStorageSync('configs', res.config)
},
async getToken() {
await uni.login({
provider: 'weixin',
success: (res) => {
success: (res) => {
this.$u.api.login({
code: res.code
}).then(res1 => {
}).then(res1 => {
uni.removeStorageSync("xtt_lifeData3")
uni.setStorageSync("xtt_lifeData3", {
'vuex_token': res1.token
})
// uni.request({
// url: baseUrl + '/api/mobile/user/show',
// header: {
// Authorization: `Bearer ${res1.token}`
// },
// method: "GET",
// success(res2) {
// uni.setStorageSync("xtt_lifeData3", {
// 'vuex_token': res1.token,
// "vuex_user": res2.user
// })
// },
// fail(err) {
// console.log("err", err)
// }
// })
}).catch(err => {
uni.setStorageSync("xtt_lifeData3", {
'vuex_token': res1.token
})
}).catch(err => {
toast(JSON.stringify(err))
console.log('login-error:', JSON.stringify(err))
})
},
fail: (res) => {
console.log("errtoken", JSON.stringify(res))
console.log("errtoken", JSON.stringify(res))
toast(JSON.stringify(err))
}
});
},
toUrl(index) {
var url = ''
if (index == 1) {
var url = ''
if (index == 1) {
url = '/packages/change/change'
}else if(index == 2){
uni.navigateToMiniProgram({
appId: 'wx28874f0da33453ab', // appid
path: '', //
extraData: {
//
},
success(res) {
//
},
fail(err) {
//
}
})
return
} else if (index == 2) {
uni.navigateToMiniProgram({
appId: 'wx28874f0da33453ab', // appid
path: '', //
extraData: {
//
},
success(res) {
//
},
fail(err) {
//
}
})
return
} else if (index == 3) {
url = '/packages/myorder/myorder'
} else if (index == 4) {
url = '/packages/myorder/myorder'
} else if (index == 5) {
uni.navigateTo({
url:'/packages/product/talkwx'
uni.navigateTo({
url: '/packages/product/talkwx'
})
} else if (index == 6) {
url = '/packages/product/fresh'
}
console.log("index",index,url)
}
console.log("index", index, url)
if (!isNull(url)) {
uni.navigateTo({
url: url
})
}
},
toAd(index){
let item = this.banner2[index]
if(item.upfile_url){
uni.navigateToMiniProgram({
appId: item.appid?item.appid:'wx28874f0da33453ab', // appid
path: item.url?item.url:'', //
extraData: {
//
},
success(res) {
//
},
fail(err) {
//
}
})
}
},
toAd(index) {
let item = this.banner2[index]
if (item.upfile_url) {
uni.navigateToMiniProgram({
appId: item.appid ? item.appid : 'wx28874f0da33453ab', // appid
path: item.url ? item.url : '', //
extraData: {
//
},
success(res) {
//
},
fail(err) {
//
}
})
}
},
}
@ -299,7 +305,8 @@
height: 100vh;
width: 100vw;
overflow: scroll;
padding-bottom:160rpx;
padding-bottom: 160rpx;
.myswiper {
// padding: 40rpx;
}
@ -531,7 +538,7 @@
text-align: center;
/* justify-content: space-around; */
padding: 10rpx;
justify-content: center;
justify-content: center;
margin: 0 auto;
}

@ -163,7 +163,7 @@
onLoad() {
const MenuButton = uni.getMenuButtonBoundingClientRect()
this.navBarTop = MenuButton.top //
this.myToken = uni.getStorageSync('xtt_lifeData3').vuex_token
this.myToken = uni.getStorageSync('xtt_lifeData3')?uni.getStorageSync('xtt_lifeData3').vuex_token:''
},
onShow() {
this.getInitUser()

Loading…
Cancel
Save