Merge branch 'master' of https://git.dayouqiantu.cn/uniapp/yshop-uniapp
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
- uni会自动打开微信开发者工具并且打开uni的项目
|
- uni会自动打开微信开发者工具并且打开uni的项目
|
||||||
|
|
||||||
## 注意事项
|
## 注意事项
|
||||||
- 目前并不支持H5运行,需要运行H5模式的,请自行调整兼容
|
- uniapp v3.1版本已经兼容h5,另外yshop有自己的H5,uniappv3.1以下版本未对H5端进行处理,如果需要请自行兼容。
|
||||||
- manifest.json 中可以配置uni项目的一些信息
|
- manifest.json 中可以配置uni项目的一些信息
|
||||||
- 打开manifest.json可配置小程序的 appid
|
- 打开manifest.json可配置小程序的 appid
|
||||||
- 由于需要兼容app,公共样式由 main.js 迁移到了 App.vue,公共样式请在App.vue中进行编辑
|
- 由于需要兼容app,公共样式由 main.js 迁移到了 App.vue,公共样式请在App.vue中进行编辑
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -2467,7 +2467,7 @@ page {
|
|||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
border-bottom: 1rpx solid #f5f5f5;
|
border-bottom: 1rpx solid #f5f5f5;
|
||||||
z-index: 999;
|
z-index: 99;
|
||||||
height: 1rpx;
|
height: 1rpx;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+91
-86
@@ -1,99 +1,104 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="time">
|
<view class="time">
|
||||||
<text v-if="rtipText">{{ rtipText }}</text>
|
{{ tipText }}
|
||||||
<text class="styleAll" v-if="risDay === true">{{ rday }}</text>
|
<text class="styleAll" v-if="isDay === true">{{ day }}</text>
|
||||||
<text class="timeTxt" v-if="rdayText">{{ rdayText }}</text>
|
<text class="timeTxt">{{ dayText }}</text>
|
||||||
<text class="styleAll">{{ hour }}</text>
|
<text class="styleAll">{{ hour }}</text>
|
||||||
<text class="timeTxt" v-if="rhourText">{{ rhourText }}</text>
|
<text class="timeTxt">{{ hourText }}</text>
|
||||||
<text class="styleAll">{{ minute }}</text>
|
<text class="styleAll">{{ minute }}</text>
|
||||||
<text class="timeTxt" v-if="rminuteText">{{ rminuteText }}</text>
|
<text class="timeTxt">{{ minuteText }}</text>
|
||||||
<text class="styleAll">{{ second }}</text>
|
<text class="styleAll">{{ second }}</text>
|
||||||
<text class="timeTxt" v-if="rsecondText">{{ rsecondText }}</text>
|
<text class="timeTxt">{{ secondText }}</text>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: "CountDown",
|
name: "CountDown",
|
||||||
props: [
|
props: {
|
||||||
//距离开始提示文字
|
//距离开始提示文字
|
||||||
'tipText',
|
tipText: {
|
||||||
'dayText',
|
type: String,
|
||||||
'hourText',
|
default: "倒计时"
|
||||||
'minuteText',
|
},
|
||||||
'secondText',
|
dayText: {
|
||||||
'datatime',
|
type: String,
|
||||||
'isDay'
|
default: "天"
|
||||||
],
|
},
|
||||||
data: function() {
|
hourText: {
|
||||||
return {
|
type: String,
|
||||||
day: "00",
|
default: "时"
|
||||||
hour: "00",
|
},
|
||||||
minute: "00",
|
minuteText: {
|
||||||
second: "00",
|
type: String,
|
||||||
rtipText: "倒计时",
|
default: "分"
|
||||||
rdayText: "天",
|
},
|
||||||
rhourText: "时",
|
secondText: {
|
||||||
rminuteText: "分",
|
type: String,
|
||||||
rsecondText: "秒",
|
default: "秒"
|
||||||
rdatatime: 0,
|
},
|
||||||
risDay: true
|
datatime: {
|
||||||
};
|
type: Number,
|
||||||
},
|
default: 0
|
||||||
created: function() {
|
},
|
||||||
// this.show_time();
|
isDay: {
|
||||||
},
|
type: Boolean,
|
||||||
mounted: function() {
|
default: true
|
||||||
this.rtipText = this.$props.tipText;
|
}
|
||||||
this.rdayText = this.$props.dayText;
|
|
||||||
this.rhourText = this.$props.hourText;
|
|
||||||
this.rminuteText = this.$props.minuteText;
|
|
||||||
this.rsecondText = this.$props.secondText;
|
|
||||||
this.rdatatime = this.$props.datatime;
|
|
||||||
this.risDay = this.$props.isDay;
|
|
||||||
this.show_time();
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
show_time: function() {
|
|
||||||
let that = this;
|
|
||||||
this.runTime();
|
|
||||||
setInterval(this.runTime, 1000);
|
|
||||||
},
|
},
|
||||||
runTime() {
|
data: function () {
|
||||||
let that = this;
|
return {
|
||||||
//时间函数
|
day: "00",
|
||||||
let intDiff = that.datatime - Date.parse(new Date()) / 1000; //获取数据中的时间戳的时间差;
|
hour: "00",
|
||||||
let day = 0,
|
minute: "00",
|
||||||
hour = 0,
|
second: "00"
|
||||||
minute = 0,
|
};
|
||||||
second = 0;
|
},
|
||||||
if (intDiff > 0) {
|
created: function () {
|
||||||
//转换时间
|
this.show_time();
|
||||||
if (that.isDay === true) {
|
},
|
||||||
day = Math.floor(intDiff / (60 * 60 * 24));
|
mounted: function () {},
|
||||||
} else {
|
methods: {
|
||||||
day = 0;
|
show_time: function () {
|
||||||
|
let that = this;
|
||||||
|
|
||||||
|
function runTime() {
|
||||||
|
//时间函数
|
||||||
|
let intDiff = that.datatime - Date.parse(new Date()) / 1000; //获取数据中的时间戳的时间差;
|
||||||
|
let day = 0,
|
||||||
|
hour = 0,
|
||||||
|
minute = 0,
|
||||||
|
second = 0;
|
||||||
|
if (intDiff > 0) {
|
||||||
|
//转换时间
|
||||||
|
if (that.isDay === true) {
|
||||||
|
day = Math.floor(intDiff / (60 * 60 * 24));
|
||||||
|
} else {
|
||||||
|
day = 0;
|
||||||
|
}
|
||||||
|
hour = Math.floor(intDiff / (60 * 60)) - day * 24;
|
||||||
|
minute = Math.floor(intDiff / 60) - day * 24 * 60 - hour * 60;
|
||||||
|
second =
|
||||||
|
Math.floor(intDiff) -
|
||||||
|
day * 24 * 60 * 60 -
|
||||||
|
hour * 60 * 60 -
|
||||||
|
minute * 60;
|
||||||
|
if (hour <= 9) hour = "0" + hour;
|
||||||
|
if (minute <= 9) minute = "0" + minute;
|
||||||
|
if (second <= 9) second = "0" + second;
|
||||||
|
that.day = day;
|
||||||
|
that.hour = hour;
|
||||||
|
that.minute = minute;
|
||||||
|
that.second = second;
|
||||||
|
} else {
|
||||||
|
that.day = "00";
|
||||||
|
that.hour = "00";
|
||||||
|
that.minute = "00";
|
||||||
|
that.second = "00";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
hour = Math.floor(intDiff / (60 * 60)) - day * 24;
|
runTime();
|
||||||
minute = Math.floor(intDiff / 60) - day * 24 * 60 - hour * 60;
|
setInterval(runTime, 1000);
|
||||||
second =
|
|
||||||
Math.floor(intDiff) -
|
|
||||||
day * 24 * 60 * 60 -
|
|
||||||
hour * 60 * 60 -
|
|
||||||
minute * 60;
|
|
||||||
if (hour <= 9) hour = "0" + hour;
|
|
||||||
if (minute <= 9) minute = "0" + minute;
|
|
||||||
if (second <= 9) second = "0" + second;
|
|
||||||
that.day = day;
|
|
||||||
that.hour = hour;
|
|
||||||
that.minute = minute;
|
|
||||||
that.second = second;
|
|
||||||
} else {
|
|
||||||
that.day = "00";
|
|
||||||
that.hour = "00";
|
|
||||||
that.minute = "00";
|
|
||||||
that.second = "00";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -5,4 +5,3 @@
|
|||||||
export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api';
|
export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api';
|
||||||
// export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api';
|
// export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api';
|
||||||
export const VUE_APP_RESOURCES_URL = 'https://wx.yixiang.co/static';
|
export const VUE_APP_RESOURCES_URL = 'https://wx.yixiang.co/static';
|
||||||
|
|
||||||
|
|||||||
+27
-11
@@ -86,9 +86,11 @@ const LOGINTYPE = "loginType";
|
|||||||
let instance;
|
let instance;
|
||||||
let wechatObj;
|
let wechatObj;
|
||||||
let appId
|
let appId
|
||||||
|
let wechatLoading = false
|
||||||
|
|
||||||
export function wechat() {
|
export function wechat() {
|
||||||
console.log('初始化微信配置')
|
console.log('初始化微信配置')
|
||||||
|
wechatLoading = false
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (instance) return resolve(instance);
|
if (instance) return resolve(instance);
|
||||||
getWechatConfig()
|
getWechatConfig()
|
||||||
@@ -107,12 +109,17 @@ export function wechat() {
|
|||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
reject(error)
|
uni.showToast({
|
||||||
|
title: error,
|
||||||
|
icon: "none",
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
reject()
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
reject(err);
|
reject();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -122,9 +129,8 @@ export function clearAuthStatus() {
|
|||||||
cookie.remove(STATE_KEY);
|
cookie.remove(STATE_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function oAuth() {
|
export async function oAuth() {
|
||||||
console.log('处理微信授权')
|
console.log('处理微信授权')
|
||||||
console.log('处理微信授权cookie', cookie.get("spread"))
|
|
||||||
console.log(store)
|
console.log(store)
|
||||||
console.log(store.state)
|
console.log(store.state)
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
@@ -137,6 +143,8 @@ export function oAuth() {
|
|||||||
if (!code) {
|
if (!code) {
|
||||||
toAuth();
|
toAuth();
|
||||||
return
|
return
|
||||||
|
} else {
|
||||||
|
auth(code)
|
||||||
}
|
}
|
||||||
resolve()
|
resolve()
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
@@ -144,11 +152,12 @@ export function oAuth() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function auth(code) {
|
export async function auth(code) {
|
||||||
console.log('获取微信授权')
|
console.log('获取微信授权')
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let loginType = cookie.get(LOGINTYPE);
|
let loginType = cookie.get(LOGINTYPE);
|
||||||
let spread = cookie.get(spread);
|
let spread = cookie.get('spread');
|
||||||
|
console.log('微信授权登录前获取spread', spread)
|
||||||
wechatAuth(code, spread, loginType)
|
wechatAuth(code, spread, loginType)
|
||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
console.log(data)
|
console.log(data)
|
||||||
@@ -158,7 +167,10 @@ export function auth(code) {
|
|||||||
cookie.set(WX_AUTH, code, expires_time);
|
cookie.set(WX_AUTH, code, expires_time);
|
||||||
cookie.remove(STATE_KEY);
|
cookie.remove(STATE_KEY);
|
||||||
loginType && cookie.remove(LOGINTYPE);
|
loginType && cookie.remove(LOGINTYPE);
|
||||||
resolve();
|
console.log('微信公众号授权登录,获取用户信息')
|
||||||
|
store.dispatch('getUser').finally(() => {
|
||||||
|
resolve();
|
||||||
|
})
|
||||||
})
|
})
|
||||||
.catch(reject);
|
.catch(reject);
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
@@ -166,7 +178,11 @@ export function auth(code) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function toAuth() {
|
export async function toAuth() {
|
||||||
|
if (wechatLoading) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
wechatLoading = true
|
||||||
wechat().then(wx => {
|
wechat().then(wx => {
|
||||||
location.href = getAuthUrl(appId);
|
location.href = getAuthUrl(appId);
|
||||||
});
|
});
|
||||||
@@ -179,9 +195,9 @@ function getAuthUrl(appId) {
|
|||||||
|
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
// #endif
|
// #endif
|
||||||
|
cookie.set('redirect', window.location.href)
|
||||||
|
const redirect_uri = encodeURIComponent(`${location.origin}/pages/Loading/index`);
|
||||||
const redirect_uri = encodeURIComponent(`${location.origin}/pages/Loading/index?path=${encodeURIComponent(window.location.href)}`);
|
// const redirect_uri = encodeURIComponent(`${location.origin}/pages/Loading/index?path=${encodeURIComponent(window.location.href)}`);
|
||||||
// const redirect_uri = encodeURIComponent(`${window.location.origin}${window.location.pathname}`)
|
// const redirect_uri = encodeURIComponent(`${window.location.origin}${window.location.pathname}`)
|
||||||
// const redirect_uri = encodeURIComponent(`${location.origin}`)
|
// const redirect_uri = encodeURIComponent(`${location.origin}`)
|
||||||
cookie.remove(BACK_URL);
|
cookie.remove(BACK_URL);
|
||||||
|
|||||||
@@ -38,14 +38,6 @@ Vue.prototype.$validator = function (rule) {
|
|||||||
return new schema(rule);
|
return new schema(rule);
|
||||||
};
|
};
|
||||||
|
|
||||||
// const CACHE_KEY = "clear_0.0.1";
|
|
||||||
|
|
||||||
// if (!cookie.has(CACHE_KEY)) {
|
|
||||||
// cookie.clearAll();
|
|
||||||
// cookie.set(CACHE_KEY, 1);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
Vue.config.productionTip = false
|
Vue.config.productionTip = false
|
||||||
App.mpType = 'app'
|
App.mpType = 'app'
|
||||||
Vue.prototype.$store = store
|
Vue.prototype.$store = store
|
||||||
@@ -82,73 +74,7 @@ Object.defineProperty(Vue.prototype, '$yroute', {
|
|||||||
Vue.prototype.$VUE_APP_RESOURCES_URL = VUE_APP_RESOURCES_URL
|
Vue.prototype.$VUE_APP_RESOURCES_URL = VUE_APP_RESOURCES_URL
|
||||||
Vue.prototype.$VUE_APP_API_URL = VUE_APP_API_URL
|
Vue.prototype.$VUE_APP_API_URL = VUE_APP_API_URL
|
||||||
Vue.component('cu-custom', cuCustom);
|
Vue.component('cu-custom', cuCustom);
|
||||||
// #ifdef H5
|
|
||||||
// H5编译的代码
|
|
||||||
|
|
||||||
import {
|
|
||||||
wechat,
|
|
||||||
clearAuthStatus,
|
|
||||||
oAuth,
|
|
||||||
auth,
|
|
||||||
toAuth,
|
|
||||||
pay,
|
|
||||||
openAddress,
|
|
||||||
openShareAll,
|
|
||||||
openShareAppMessage,
|
|
||||||
openShareTimeline,
|
|
||||||
wechatEvevt,
|
|
||||||
ready,
|
|
||||||
wxShowLocation,
|
|
||||||
} from '@/libs/wechat'
|
|
||||||
|
|
||||||
import { isWeixin } from '@/utils'
|
|
||||||
|
|
||||||
|
|
||||||
const CACHE_KEY = "clear_0.0.1";
|
|
||||||
|
|
||||||
if (!cookie.has(CACHE_KEY)) {
|
|
||||||
cookie.clearAll();
|
|
||||||
cookie.set(CACHE_KEY, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
var urlSpread = parseQuery()["spread"];
|
|
||||||
|
|
||||||
if (urlSpread !== undefined) {
|
|
||||||
var spread = cookie.get("spread");
|
|
||||||
urlSpread = parseInt(urlSpread);
|
|
||||||
if (!Number.isNaN(urlSpread) && spread !== urlSpread) {
|
|
||||||
cookie.set("spread", urlSpread || 0);
|
|
||||||
} else if (spread === 0 || typeof spread !== "number") {
|
|
||||||
cookie.set("spread", urlSpread || 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 判断是否是微信浏览器
|
|
||||||
if (isWeixin()) {
|
|
||||||
Vue.prototype.$deviceType = 'weixin'
|
|
||||||
store.commit('updateDevicetype', 'weixin')
|
|
||||||
wechat().then(() => oAuth());
|
|
||||||
} else {
|
|
||||||
Vue.prototype.$deviceType = 'weixinh5'
|
|
||||||
store.commit('updateDevicetype', 'weixinh5')
|
|
||||||
}
|
|
||||||
|
|
||||||
Vue.prototype.wechat = wechat
|
|
||||||
Vue.prototype.clearAuthStatus = clearAuthStatus
|
|
||||||
Vue.prototype.oAuth = oAuth
|
|
||||||
Vue.prototype.auth = auth
|
|
||||||
Vue.prototype.toAuth = toAuth
|
|
||||||
Vue.prototype.pay = pay
|
|
||||||
Vue.prototype.openAddress = openAddress
|
|
||||||
Vue.prototype.openShareAll = openShareAll
|
|
||||||
Vue.prototype.openShareAppMessage = openShareAppMessage
|
|
||||||
Vue.prototype.openShareTimeline = openShareTimeline
|
|
||||||
Vue.prototype.wechatEvevt = wechatEvevt
|
|
||||||
Vue.prototype.ready = ready
|
|
||||||
Vue.prototype.wxShowLocation = wxShowLocation
|
|
||||||
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
// App平台编译的代码
|
// App平台编译的代码
|
||||||
@@ -170,4 +96,69 @@ store.commit('updateDevicetype', 'routine')
|
|||||||
// ...mapState(['$deviceType'])
|
// ...mapState(['$deviceType'])
|
||||||
// },
|
// },
|
||||||
|
|
||||||
app.$mount()
|
|
||||||
|
// #ifdef H5
|
||||||
|
// H5编译的代码
|
||||||
|
|
||||||
|
import {
|
||||||
|
wechat,
|
||||||
|
clearAuthStatus,
|
||||||
|
oAuth,
|
||||||
|
auth,
|
||||||
|
toAuth,
|
||||||
|
pay,
|
||||||
|
openAddress,
|
||||||
|
openShareAll,
|
||||||
|
openShareAppMessage,
|
||||||
|
openShareTimeline,
|
||||||
|
wechatEvevt,
|
||||||
|
ready,
|
||||||
|
wxShowLocation,
|
||||||
|
} from '@/libs/wechat'
|
||||||
|
|
||||||
|
import { isWeixin } from '@/utils'
|
||||||
|
const CACHE_KEY = "clear_0.0.1";
|
||||||
|
|
||||||
|
if (!cookie.has(CACHE_KEY)) {
|
||||||
|
cookie.clearAll()
|
||||||
|
cookie.set(CACHE_KEY, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
var urlSpread = parseQuery()["spread"];
|
||||||
|
if (urlSpread) {
|
||||||
|
cookie.set("spread", urlSpread);
|
||||||
|
}
|
||||||
|
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
async function init() {
|
||||||
|
|
||||||
|
// #ifdef H5
|
||||||
|
// H5编译的代码
|
||||||
|
// 判断是否是微信浏览器
|
||||||
|
if (isWeixin()) {
|
||||||
|
Vue.prototype.$deviceType = 'weixin'
|
||||||
|
store.commit('updateDevicetype', 'weixin')
|
||||||
|
let wechatInit = await wechat()
|
||||||
|
console.log(wechatInit)
|
||||||
|
if (wechatInit) {
|
||||||
|
await oAuth()
|
||||||
|
app.$mount()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Vue.prototype.$deviceType = 'weixinh5'
|
||||||
|
store.commit('updateDevicetype', 'weixinh5')
|
||||||
|
app.$mount()
|
||||||
|
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifndef H5
|
||||||
|
app.$mount()
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
init()
|
||||||
|
|||||||
+2
-2
@@ -141,12 +141,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"plugins" : {
|
"plugins" : {
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
"live-player-plugin" : {
|
"live-player-plugin" : {
|
||||||
// 注意填写该直播组件最新版本号,微信开发者工具调试时可获取最新版本号(复制时请去掉注释)
|
|
||||||
"version" : "1.1.10",
|
"version" : "1.1.10",
|
||||||
// 必须填该直播组件appid,该示例值即为直播组件appid(复制时请去掉注释)
|
|
||||||
"provider" : "wx2b03c6e691cd7370"
|
"provider" : "wx2b03c6e691cd7370"
|
||||||
}
|
}
|
||||||
|
// #endif
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"mp-alipay" : {
|
"mp-alipay" : {
|
||||||
|
|||||||
@@ -424,6 +424,7 @@
|
|||||||
"navigationBarBackgroundColor": "#F8F8F8",
|
"navigationBarBackgroundColor": "#F8F8F8",
|
||||||
"backgroundColor": "#F8F8F8",
|
"backgroundColor": "#F8F8F8",
|
||||||
"navigationStyle": "default"
|
"navigationStyle": "default"
|
||||||
|
|
||||||
},
|
},
|
||||||
"tabBar": {
|
"tabBar": {
|
||||||
"color": "#282828",
|
"color": "#282828",
|
||||||
|
|||||||
+39
-49
@@ -16,16 +16,17 @@
|
|||||||
// import request from "@//api/request";
|
// import request from "@//api/request";
|
||||||
import {
|
import {
|
||||||
wxappAuth,
|
wxappAuth,
|
||||||
getUser
|
|
||||||
} from "@/api/user";
|
} from "@/api/user";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
|
import store from "@/store";
|
||||||
import cookie from "@/utils/store/cookie";
|
import cookie from "@/utils/store/cookie";
|
||||||
import {
|
import {
|
||||||
parseQuery,
|
parseQuery,
|
||||||
login,
|
login,
|
||||||
handleQrCode,
|
handleQrCode,
|
||||||
getCurrentPageUrl,
|
getCurrentPageUrl,
|
||||||
handleUrlParam
|
handleUrlParam,
|
||||||
|
getCurrentPageUrlWithArgs
|
||||||
} from "@/utils";
|
} from "@/utils";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -34,64 +35,53 @@
|
|||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
|
console.log('getUser')
|
||||||
var url = handleQrCode();
|
var url = handleQrCode();
|
||||||
if (!url) {
|
if (!url) {
|
||||||
url = handleUrlParam(getCurrentPageUrl())
|
url = handleUrlParam(getCurrentPageUrlWithArgs())
|
||||||
}
|
}
|
||||||
// 判断是否是分销
|
// 判断是否是分销
|
||||||
if (url) {
|
if (url) {
|
||||||
var spread = cookie.get("spread");
|
|
||||||
let urlSpread = parseInt(url.spread);
|
let urlSpread = parseInt(url.spread);
|
||||||
if (!Number.isNaN(urlSpread) && spread !== urlSpread) {
|
if (urlSpread) {
|
||||||
cookie.set("spread", urlSpread || 0);
|
cookie.set("spread", urlSpread);
|
||||||
} else if (spread === 0 || typeof spread !== "number") {
|
|
||||||
cookie.set("spread", urlSpread || 0);
|
|
||||||
}
|
}
|
||||||
if (this.$store.getters.token) {
|
|
||||||
this.toLaunch();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// cookie.get("spread");
|
|
||||||
// if (this.$deviceType == "weixin") {
|
|
||||||
// let path = parseQuery().path
|
|
||||||
// console.log(this)
|
|
||||||
// if (path) {
|
|
||||||
// this.$yrouter.push({
|
|
||||||
// path
|
|
||||||
// });
|
|
||||||
// } else {
|
|
||||||
// this.$yrouter.switchTab({
|
|
||||||
// path: "/pages/home/index"
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// this.toLaunch();
|
|
||||||
if (this.$deviceType == "app" || this.$deviceType == "h5") {
|
|
||||||
// this.toLaunch();
|
|
||||||
|
|
||||||
this.$yrouter.switchTab({
|
|
||||||
path: "/pages/home/index"
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
login().finally(() => {
|
|
||||||
this.$yrouter.switchTab({
|
|
||||||
path: "/pages/home/index"
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
// if (this.$deviceType == "app" || this.$deviceType == "weixinh5") {
|
||||||
methods: {
|
// this.$yrouter.switchTab({
|
||||||
...mapActions(["changeAuthorization", "setUserInfo"]),
|
// path: "/pages/home/index"
|
||||||
toLaunch() {
|
// });
|
||||||
console.log("loading home");
|
// return;
|
||||||
this.changeAuthorization(false);
|
// }
|
||||||
|
if (this.$store.getters.token) {
|
||||||
|
// 如果token存在,直接进行进页面
|
||||||
|
console.log('登录状态存在,直接进页面')
|
||||||
|
this.toLaunch();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log('进行登录操作')
|
||||||
|
login().finally(() => {
|
||||||
this.$yrouter.switchTab({
|
this.$yrouter.switchTab({
|
||||||
path: "/pages/home/index"
|
path: "/pages/home/index"
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
...mapActions(["changeAuthorization", "setUserInfo", "getUser"]),
|
||||||
|
toLaunch() {
|
||||||
|
console.log("loading home");
|
||||||
|
this.changeAuthorization(false);
|
||||||
|
let redirect = cookie.get('redirect')
|
||||||
|
if (redirect && redirect.indexOf('/pages') != -1) {
|
||||||
|
this.$yrouter.replace({
|
||||||
|
path: '/pages' + redirect.split('/pages')[1],
|
||||||
|
});
|
||||||
|
cookie.remove('redirect');
|
||||||
|
} else {
|
||||||
|
this.$yrouter.switchTab({
|
||||||
|
path: "/pages/home/index"
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="bargain on">
|
<view class="bargain on">
|
||||||
<!-- 在header上加 on 为请求支援 -->
|
<!-- 在header上加 on 为请求支援 -->
|
||||||
<view :class="[bargainPartake != userInfo.uid ? 'wrapper bargain-box on user' : 'wrapper bargain-box user']" v-if="bargainPartake != userInfo.uid">
|
<!-- 当前登录的用户和url上携带的用户id不一致视为被邀请砍价 -->
|
||||||
<!-- <view class="people">{{ lookCount }}人查看 丨 {{ shareCount }}人分享 丨 {{ userCount }}人参与</view> -->
|
<view class="wrapper bargain-box on user" v-if="bargainUserInfo && bargainUid != userInfo.uid">
|
||||||
|
<!-- <view class="people">
|
||||||
|
{{ bargainShare.lookCount }}人查看 丨 {{ bargainShare.shareCount }}人分享 丨 {{ bargainShare.userCount }}人参与
|
||||||
|
</view> -->
|
||||||
<!-- 帮助砍价、帮砍成功:-->
|
<!-- 帮助砍价、帮砍成功:-->
|
||||||
<view class="pictxt acea-row row-center-wrapper " >
|
<view class="pictxt acea-row row-center-wrapper ">
|
||||||
<div class="bargain-header">
|
<div class="bargain-header">
|
||||||
<view class="pictrue">
|
<view class="pictrue">
|
||||||
<image :src="bargainUserInfo.avatar" />
|
<image :src="bargainUserInfo.avatar" />
|
||||||
@@ -19,79 +22,70 @@
|
|||||||
<view class="wrapper bargain-box time on">
|
<view class="wrapper bargain-box time on">
|
||||||
<div class="pictxt ">
|
<div class="pictxt ">
|
||||||
<count-down :isDay="true" :tipText="'倒计时 '" :dayText="' 天 '" :hourText="' 时 '" :minuteText="' 分 '"
|
<count-down :isDay="true" :tipText="'倒计时 '" :dayText="' 天 '" :hourText="' 时 '" :minuteText="' 分 '"
|
||||||
:secondText="' 秒'" :datatime="datatime"></count-down>
|
:secondText="' 秒'" :datatime="goodsDetail.stopTime"></count-down>
|
||||||
</div>
|
</div>
|
||||||
</view>
|
</view>
|
||||||
<view class="wrapper bargain-box bargain-product">
|
<view class="wrapper bargain-box bargain-product">
|
||||||
<view class="pictxt acea-row row-between-wrapper" @click="openAlone">
|
<view class="pictxt acea-row row-between-wrapper" @click="openAlone">
|
||||||
<view class="pictrue">
|
<view class="pictrue">
|
||||||
<image :src="bargain.image" />
|
<image :src="goodsDetail.image" />
|
||||||
<view class="bargain_view">
|
<view class="bargain_view">
|
||||||
查看商品
|
查看商品
|
||||||
<view class="iconfont icon-jiantou iconfonts"></view>
|
<view class="iconfont icon-jiantou iconfonts"></view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="text acea-row row-column-around">
|
<view class="text acea-row row-column-around">
|
||||||
<view class="line2" v-text="bargain.title"></view>
|
<view class="line2" v-text="goodsDetail.title"></view>
|
||||||
<view class="money font-color-red">
|
<view class="money font-color-red">
|
||||||
已砍至: ¥
|
已砍至: ¥
|
||||||
<text class="num" v-text="price"></text>
|
<text class="num" v-text="bargainHelpCount.remainingPrice"></text>
|
||||||
</view>
|
</view>
|
||||||
<view class="acea-row row-middle">
|
<view class="acea-row row-middle">
|
||||||
<view class="successNum" v-text="'原价' + bargain.price"></view>
|
<view class="successNum" v-text="'原价' + goodsDetail.price"></view>
|
||||||
<view class="successNum" v-text="'已有' + bargainSumCount + '人砍价成功'"></view>
|
<view class="successNum" v-text="'已有' + bargainSumCount + '人砍价成功'"></view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- 砍价进度条 -->
|
||||||
<view class="cu-progress acea-row row-middle round margin-top">
|
<view class="cu-progress acea-row row-middle round margin-top">
|
||||||
<view class="acea-row row-middle bg-red" :style="{ width: loading ? pricePercent + '%' : '' }"></view>
|
<view class="acea-row row-middle bg-red" :style="{ width: bargainHelpCount.pricePercent + '%' }"></view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- 砍价进度条下的金额 -->
|
||||||
<view class="balance acea-row row-between-wrapper">
|
<view class="balance acea-row row-between-wrapper">
|
||||||
<view v-text="'已砍' + alreadyPrice + '元'"></view>
|
<view v-text="'已砍' + bargainHelpCount.alreadyPrice + '元'"></view>
|
||||||
<view v-if="surplusPrice === 0">砍价成功</view>
|
<view v-if="bargainHelpCount.remainingPrice === 0">砍价成功</view>
|
||||||
<view v-else v-text="'还剩' + surplusPrice + '元'"></view>
|
<view v-else v-text="'还剩' + bargainHelpCount.remainingPrice + '元'"></view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 帮助砍价、帮砍成功:-->
|
|
||||||
<!-- <view class="bargainSuccess" v-if="bargainPartake != userInfo.uid && !statusUser && !helpListLoading">
|
|
||||||
<span class="iconfont icon-xiaolian"></span>已成功帮助好友砍价
|
|
||||||
</view> -->
|
|
||||||
<!-- 砍价成功:-->
|
<!-- 砍价成功:-->
|
||||||
<view class="bargainSuccess" v-if="
|
<!--
|
||||||
surplusPrice === 0 &&
|
surplusPrice 砍价剩余金额为0
|
||||||
bargainPartake === userInfo.uid &&
|
bargainUid 砍价人为发起砍价用户
|
||||||
userBargainStatus === 1 &&
|
userBargainStatus 砍价状态为
|
||||||
!helpListLoading
|
-->
|
||||||
">
|
<view class="bargainSuccess" v-if="pay">
|
||||||
<span class="iconfont icon-xiaolian"></span>恭喜您砍价成功,快去支付吧~
|
<span class="iconfont icon-xiaolian"></span>恭喜您砍价成功,快去支付吧~
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view v-if="userBargainStatus == 0 && bargainPartake === userInfo.uid" class="bargainBnt" @click="goParticipate">
|
<!-- 参与砍价按钮 同一人-->
|
||||||
立即参与砍价</view>
|
<view v-if="participate" class="bargainBnt" @click="goParticipate">立即发起砍价</view>
|
||||||
<view class="bargainBnt" @click="goPoster" v-if="
|
|
||||||
surplusPrice > 0 &&
|
<!-- 邀请好友按钮 -->
|
||||||
bargainPartake === userInfo.uid &&
|
<view v-if="inviteFriends" class="bargainBnt" @click="goPoster">邀请好友帮砍价</view>
|
||||||
userBargainStatus === 1 &&
|
|
||||||
!helpListLoading
|
<!-- 帮砍好友砍按钮 -->
|
||||||
">邀请好友帮砍价</view>
|
<view v-if="helpFriendsBargain" class="bargainBnt" @click="getBargainHelp">帮好友砍一刀</view>
|
||||||
<view class="bargainBnt" @click="getBargainHelp" v-else-if="
|
|
||||||
bargainPartake != userInfo.uid &&
|
<!-- 发起砍价按钮 非同一人-->
|
||||||
userBargainStatus == 1 &&
|
<view v-if="bargain" class="bargainBnt" @click="getBargainStart">我也要砍价</view>
|
||||||
statusUser &&
|
|
||||||
!helpListLoading
|
<!-- 支付按钮 -->
|
||||||
">帮好友砍一刀</view>
|
<view class="bargainBnt" @click="goPay" v-if="pay">立即支付</view>
|
||||||
<view class="bargainBnt" @click="getBargainStart"
|
|
||||||
v-if="bargainPartake != userInfo.uid && !statusUser && !helpListLoading">我也要参与</view>
|
|
||||||
<view class="bargainBnt" @click="goPay" v-if="
|
|
||||||
surplusPrice === 0 &&
|
|
||||||
bargainPartake === userInfo.uid &&
|
|
||||||
userBargainStatus === 1
|
|
||||||
">立即支付</view>
|
|
||||||
<view class="bargainBnt on" @click="goList">抢更多商品</view>
|
<view class="bargainBnt on" @click="goList">抢更多商品</view>
|
||||||
<view class="tip">
|
<view class="tip">已有<span class="font-color-red" v-text="bargainHelpCount.count"></span>位好友成功帮您砍价</view>
|
||||||
已有
|
|
||||||
<span class="font-color-red" v-text="helpCount"></span>
|
|
||||||
位好友成功帮您砍价
|
|
||||||
</view>
|
|
||||||
<view class="lock"></view>
|
<view class="lock"></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="bargainGang bargain-box">
|
<view class="bargainGang bargain-box">
|
||||||
@@ -122,7 +116,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="load font-color-red" v-if="!helpListStatus && !helpListLoading" @click="getBargainHelpList">点击加载更多
|
<view class="load font-color-red" v-if="!helpListStatus " @click="getBargainHelpList">点击加载更多
|
||||||
</view>
|
</view>
|
||||||
<view class="lock"></view>
|
<view class="lock"></view>
|
||||||
</view>
|
</view>
|
||||||
@@ -136,7 +130,7 @@
|
|||||||
<image src="@/static/images/left.png" />
|
<image src="@/static/images/left.png" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="conter" v-html="bargain.description"></view>
|
<view class="conter" v-html="goodsDetail.description"></view>
|
||||||
<view class="lock"></view>
|
<view class="lock"></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="goodsDetails bargain-box">
|
<view class="goodsDetails bargain-box">
|
||||||
@@ -149,21 +143,17 @@
|
|||||||
<image src="@/static/images/left.png" />
|
<image src="@/static/images/left.png" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="conter" v-html="bargain.rule"></view>
|
<view class="conter" v-html="goodsDetail.rule"></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="bargainTip" :class="active === true ? 'on' : ''">
|
<view class="bargainTip" :class="active === true ? 'on' : ''">
|
||||||
<!-- <view class="pictrue">
|
<view class="cutOff" v-if="bargainUid === userInfo.uid">
|
||||||
<image src="@/static/images/bargainBg.jpg" />
|
|
||||||
<view class="iconfont icon-guanbi" @click="close"></view>
|
|
||||||
</view>-->
|
|
||||||
<view class="cutOff" v-if="bargainPartake === userInfo.uid">
|
|
||||||
您已砍掉
|
您已砍掉
|
||||||
<text class="font-color-red" v-text="bargainHelpPrice"></text>元,听说分享次数越多砍价成功的机会越大哦!
|
<text class="font-color-red" v-text="bargainHelpPrice"></text>元,听说分享次数越多砍价成功的机会越大哦!
|
||||||
</view>
|
</view>
|
||||||
<view class="cutOff on" v-else>
|
<view class="cutOff on" v-else>
|
||||||
<view class="help font-color-red" v-text="'成功帮砍' + bargainHelpPrice + '元'"></view>,您也可以砍价低价拿哦,快去挑选心仪的商品吧~
|
<view class="help font-color-red" v-text="'成功帮砍' + bargainHelpPrice + '元'"></view>,您也可以砍价低价拿哦,快去挑选心仪的商品吧~
|
||||||
</view>
|
</view>
|
||||||
<view class="tipBnt" @click="goPoster" v-if="bargainPartake === userInfo.uid">邀请好友帮砍价</view>
|
<view class="tipBnt" @click="goPoster" v-if="bargainUid === userInfo.uid">邀请好友帮砍价</view>
|
||||||
<view class="tipBnt" @click="getBargainStart" v-else>我也要参与</view>
|
<view class="tipBnt" @click="getBargainStart" v-else>我也要参与</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="mask" @touchmove.prevent :hidden="active === false" @click="close"></view>
|
<view class="mask" @touchmove.prevent :hidden="active === false" @click="close"></view>
|
||||||
@@ -204,118 +194,83 @@
|
|||||||
props: {},
|
props: {},
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
price: 0,
|
|
||||||
bargainId: 0, //砍价编号
|
bargainId: 0, //砍价编号
|
||||||
bargainPartake: 0, //参与砍价
|
|
||||||
bargain: [], //砍价产品信息
|
|
||||||
partake: null,
|
|
||||||
bargainSumCount: 0, //砍价成功人数
|
bargainSumCount: 0, //砍价成功人数
|
||||||
activeMsg: "",
|
activeMsg: "",
|
||||||
// ssssss
|
|
||||||
active: false,
|
active: false,
|
||||||
loading: false,
|
|
||||||
datatime: 0,
|
|
||||||
lookCount: 0, //查看人数
|
|
||||||
shareCount: 0, //分享人数
|
|
||||||
userCount: 0, //参与人数
|
|
||||||
bargainHelpPrice: 0, //砍掉金额
|
bargainHelpPrice: 0, //砍掉金额
|
||||||
bargainHelpList: [],
|
bargainHelpList: [],
|
||||||
helpListStatus: false, //砍价列表是否获取完成 false 未完成 true 完成
|
helpListStatus: false, //砍价列表是否获取完成 false 未完成 true 完成
|
||||||
helpListLoading: false, //当前接口是否请求完成 false 完成 true 未完成
|
|
||||||
page: 1, //页码
|
page: 1, //页码
|
||||||
limit: 2, //数量
|
limit: 2, //数量
|
||||||
helpCount: 0, //砍价帮总人数
|
|
||||||
surplusPrice: 0, //剩余金额
|
|
||||||
alreadyPrice: 0, //已砍掉价格
|
|
||||||
pricePercent: 0, //砍价进度条
|
pricePercent: 0, //砍价进度条
|
||||||
bargainUserInfo: [], //砍价 开启砍价用户信息
|
bargainShare: {}, // 砍价分享的消息
|
||||||
userBargainStatus: 2, //砍价状态
|
bargainHelpCount: {}, // 砍价的信息数据
|
||||||
statusUser: false // 是否帮别人砍,没砍是true,砍了false
|
goodsDetail: {}, // 商品的详情
|
||||||
|
bargainUserInfo: [], // 开启砍价用户信息
|
||||||
|
bargainUid: 0, // 参与砍价的用户
|
||||||
|
pay: false, // 支付
|
||||||
|
bargain: false, // 发起砍价
|
||||||
|
participate: false, // 参与砍价
|
||||||
|
inviteFriends: false, // 邀请好友
|
||||||
|
helpFriendsBargain: false, // 帮好友砍
|
||||||
|
bargainSuccess: false, // 帮好友砍价成功
|
||||||
|
mainBargainSuccess: false, // 砍价成功
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: mapGetters(["userInfo", "isLogin"]),
|
computed: mapGetters(["userInfo", "isLogin"]),
|
||||||
// watch: {
|
|
||||||
// $yroute: function(n) {
|
|
||||||
// var that = this;
|
|
||||||
// if (n.name === NAME) {
|
|
||||||
// that.mountedStart();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
var that = this;
|
this.mountedStart();
|
||||||
that.mountedStart();
|
|
||||||
setTimeout(function () {
|
|
||||||
that.loading = true;
|
|
||||||
}, 500);
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onShareAppMessage: function () {
|
// 开始处理砍价逻辑
|
||||||
return {
|
mountedStart: function () {
|
||||||
title: this.storeInfo.title,
|
var that = this;
|
||||||
imageUrl: this.storeInfo.image,
|
let url = handleQrCode();
|
||||||
path: "pages/activity/DargainDetails/index?id=" + this.storeInfo.id + "&spread=" + uni.getStorageSync(
|
// bargainId 砍价商品id
|
||||||
"uid"),
|
// bargainUid 发起砍价人
|
||||||
success(res) {
|
if (url) {
|
||||||
uni.showToast({
|
// 通过二维码进来
|
||||||
title: '分享成功'
|
that.bargainId = url.bargainId;
|
||||||
})
|
that.bargainUid = url.partake;
|
||||||
},
|
} else {
|
||||||
fail(res) {
|
// 正常途径进来
|
||||||
uni.showToast({
|
that.bargainId = that.$yroute.query.id;
|
||||||
title: '分享失败',
|
that.bargainUid = that.$yroute.query.partake
|
||||||
icon: 'none'
|
}
|
||||||
})
|
if (this.bargainUid == 0 || !this.bargainUid) {
|
||||||
}
|
// url未携带用户uid,填上登录用户uid,跳转
|
||||||
|
that.bargainUid = that.userInfo.uid;
|
||||||
|
}
|
||||||
|
console.log(this)
|
||||||
|
|
||||||
|
// 获取商品详情
|
||||||
|
that.getBargainDetail();
|
||||||
|
// 砍价数据统计
|
||||||
|
that.getBargainShare(0);
|
||||||
|
if (that.bargainUid !== that.userInfo.uid) {
|
||||||
|
that.getBargainStartUser();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//参与砍价
|
// 发起砍价
|
||||||
goParticipate() {
|
goParticipate() {
|
||||||
if (this.bargainPartake === this.userInfo.uid) this.getBargainStart();
|
//发起人和当前用户为同一人
|
||||||
else this.getBargainStartUser();
|
if (this.bargainUid === this.userInfo.uid) {
|
||||||
|
// 变更为当前用户砍价页面
|
||||||
|
this.getBargainStart();
|
||||||
|
} else {
|
||||||
|
// 发起人与当前用户非同一人,变更为发起人的砍价页面
|
||||||
|
this.getBargainStartUser();
|
||||||
|
}
|
||||||
this.getBargainHelpCount();
|
this.getBargainHelpCount();
|
||||||
},
|
},
|
||||||
|
// 查看商品
|
||||||
openAlone: function () {
|
openAlone: function () {
|
||||||
this.$yrouter.push({
|
this.$yrouter.push({
|
||||||
path: "/detail/" + this.bargain.productId
|
path: "/detail/" + this.bargain.productId
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
mountedStart: function () {
|
// 砍价完成,去支付
|
||||||
var that = this;
|
|
||||||
console.log(this)
|
|
||||||
let url = handleQrCode();
|
|
||||||
console.log(url)
|
|
||||||
if (url) {
|
|
||||||
that.bargainId = url.bargainId;
|
|
||||||
that.partake = url.uid;
|
|
||||||
} else {
|
|
||||||
that.bargainId = that.$yroute.query.id;
|
|
||||||
that.partake = parseInt(that.$yroute.query.partake);
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
this.partake === undefined ||
|
|
||||||
this.partake <= 0 ||
|
|
||||||
isNaN(this.partake)
|
|
||||||
) {
|
|
||||||
that.bargainPartake = that.userInfo.uid;
|
|
||||||
// that.$yrouter.push({
|
|
||||||
// path: "/pages/activity/DargainDetails/index",
|
|
||||||
// query: { id: that.bargainId, partake: that.bargainPartake }
|
|
||||||
// });
|
|
||||||
} else {
|
|
||||||
that.bargainPartake = parseInt(this.partake);
|
|
||||||
}
|
|
||||||
|
|
||||||
that.getBargainHelpCountStart();
|
|
||||||
that.getBargainDetail();
|
|
||||||
that.getBargainShare(0);
|
|
||||||
// if (that.bargainPartake !== that.userInfo.uid) that.getBargainStartUser();
|
|
||||||
if (that.bargainPartake === that.userInfo.uid) {
|
|
||||||
// that.getBargainStart();
|
|
||||||
} else {
|
|
||||||
that.getBargainStartUser();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
goPay: function () {
|
goPay: function () {
|
||||||
var data = {};
|
var data = {};
|
||||||
var that = this;
|
var that = this;
|
||||||
@@ -341,6 +296,7 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
// 生成海报
|
||||||
goPoster: function () {
|
goPoster: function () {
|
||||||
var that = this;
|
var that = this;
|
||||||
that.getBargainShare(that.bargainId);
|
that.getBargainShare(that.bargainId);
|
||||||
@@ -352,6 +308,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
// 跳转砍价商品列表
|
||||||
goList: function () {
|
goList: function () {
|
||||||
this.$yrouter.push({
|
this.$yrouter.push({
|
||||||
path: "/pages/activity/GoodsBargain/index"
|
path: "/pages/activity/GoodsBargain/index"
|
||||||
@@ -365,31 +322,33 @@
|
|||||||
getBargainShare({
|
getBargainShare({
|
||||||
bargainId: bargainId
|
bargainId: bargainId
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
that.lookCount = res.data.lookCount;
|
that.bargainShare = res.data
|
||||||
that.shareCount = res.data.shareCount;
|
|
||||||
that.userCount = res.data.userCount;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 获取产品详情
|
// 获取产品详情
|
||||||
getBargainDetail: function () {
|
getBargainDetail: function () {
|
||||||
var that = this;
|
var that = this;
|
||||||
|
uni.showLoading({
|
||||||
|
title: "加载中",
|
||||||
|
mask: true
|
||||||
|
});
|
||||||
getBargainDetail(that.bargainId)
|
getBargainDetail(that.bargainId)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
that.bargain = res.data.bargain;
|
uni.hideLoading()
|
||||||
that.bargain.description = that.bargain.description.replace(
|
that.goodsDetail = res.data.bargain;
|
||||||
|
that.goodsDetail.description = that.goodsDetail.description.replace(
|
||||||
/\<img/gi,
|
/\<img/gi,
|
||||||
'<img style="max-width:100%;height:auto;"'
|
'<img style="max-width:100%;height:auto;"'
|
||||||
);
|
);
|
||||||
that.bargain.rule = that.bargain.rule.replace(
|
that.goodsDetail.rule = that.goodsDetail.rule.replace(
|
||||||
/\<img/gi,
|
/\<img/gi,
|
||||||
'<img style="max-width:100%;height:auto;"'
|
'<img style="max-width:100%;height:auto;"'
|
||||||
);
|
);
|
||||||
that.datatime = that.bargain.stopTime / 1000;
|
that.goodsDetail.stopTime = that.goodsDetail.stopTime / 1000
|
||||||
that.getBargainHelpCount();
|
that.getBargainHelpCount();
|
||||||
// that.setOpenShare();
|
|
||||||
that.getBargainHelpList();
|
|
||||||
})
|
})
|
||||||
.catch(res => {
|
.catch(res => {
|
||||||
|
uni.hideLoading()
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.msg,
|
title: res.msg,
|
||||||
icon: "none",
|
icon: "none",
|
||||||
@@ -397,15 +356,16 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
//开启砍价
|
// 开启砍价-发起人与当前用户非同一人
|
||||||
getBargainStart: function () {
|
getBargainStart: function () {
|
||||||
var that = this;
|
var that = this;
|
||||||
getBargainStart({
|
getBargainStart({
|
||||||
bargainId: that.bargainId
|
bargainId: that.bargainId
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
that.bargainPartake = that.userInfo.uid;
|
that.bargainUid = that.userInfo.uid;
|
||||||
that.getBargainHelp();
|
that.getBargainHelp();
|
||||||
|
that.getBargainHelpCount();
|
||||||
})
|
})
|
||||||
.catch(res => {
|
.catch(res => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@@ -415,12 +375,12 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
//参与砍价
|
// 参与砍价
|
||||||
getBargainHelp: function () {
|
getBargainHelp: function () {
|
||||||
var that = this;
|
var that = this;
|
||||||
if (
|
if (
|
||||||
that.surplusPrice === 0 &&
|
this.bargainHelpCount.remainingPrice === 0 &&
|
||||||
that.bargainPartake !== that.userInfo.uid
|
that.bargainUid !== that.userInfo.uid
|
||||||
) {
|
) {
|
||||||
return uni.showToast({
|
return uni.showToast({
|
||||||
title: "好友已经砍价成功",
|
title: "好友已经砍价成功",
|
||||||
@@ -430,15 +390,12 @@
|
|||||||
}
|
}
|
||||||
var data = {
|
var data = {
|
||||||
bargainId: that.bargainId,
|
bargainId: that.bargainId,
|
||||||
bargainUserUid: that.bargainPartake
|
bargainUserUid: that.bargainUid
|
||||||
};
|
};
|
||||||
getBargainHelp(data)
|
getBargainHelp(data)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
that.activeMsg = res.data.status;
|
that.activeMsg = res.data.status;
|
||||||
if (
|
if (res.data.status === "SUCCESSFUL" && that.bargainUid !== that.userInfo.uid) {
|
||||||
res.data.status === "SUCCESSFUL" &&
|
|
||||||
that.bargainPartake !== that.userInfo.uid
|
|
||||||
) {
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "您已经砍过了",
|
title: "您已经砍过了",
|
||||||
icon: "none",
|
icon: "none",
|
||||||
@@ -462,15 +419,12 @@
|
|||||||
//获取砍掉的金额
|
//获取砍掉的金额
|
||||||
getBargainHelpPrice: function () {
|
getBargainHelpPrice: function () {
|
||||||
var that = this;
|
var that = this;
|
||||||
that.helpListLoading = true;
|
|
||||||
|
|
||||||
getBargainHelpPrice({
|
getBargainHelpPrice({
|
||||||
bargainId: that.bargainId,
|
bargainId: that.bargainId,
|
||||||
bargainUserUid: that.bargainPartake
|
bargainUserUid: that.bargainUid
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
that.bargainHelpPrice = res.data.price;
|
that.bargainHelpPrice = res.data.price;
|
||||||
that.helpListLoading = false;
|
|
||||||
that.getBargainHelpCount();
|
that.getBargainHelpCount();
|
||||||
that.getBargainHelpList();
|
that.getBargainHelpList();
|
||||||
switch (that.activeMsg) {
|
switch (that.activeMsg) {
|
||||||
@@ -489,79 +443,129 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
//砍价帮
|
// 砍价帮助列表
|
||||||
getBargainHelpList: function () {
|
getBargainHelpList: function () {
|
||||||
var that = this;
|
var that = this;
|
||||||
if (that.helpListLoading === true) return;
|
|
||||||
if (that.helpListStatus === true) return;
|
if (that.helpListStatus === true) return;
|
||||||
that.helpListLoading = true;
|
|
||||||
getBargainHelpList({
|
getBargainHelpList({
|
||||||
bargainId: that.bargainId,
|
bargainId: that.bargainId,
|
||||||
bargainUserUid: that.bargainPartake,
|
bargainUserUid: that.bargainUid,
|
||||||
page: that.page,
|
page: that.page,
|
||||||
limit: that.limit
|
limit: that.limit
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
that.helpListStatus = res.data.length < that.limit;
|
that.helpListStatus = res.data.length < that.limit;
|
||||||
that.helpListLoading = false;
|
|
||||||
that.page++;
|
that.page++;
|
||||||
that.bargainHelpList.push.apply(that.bargainHelpList, res.data);
|
if (res.data) {
|
||||||
|
that.bargainHelpList.push.apply(that.bargainHelpList, res.data);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch(res => {
|
.catch(err => {
|
||||||
|
if (!err.msg) {
|
||||||
|
return
|
||||||
|
}
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.msg,
|
title: err.msg || err.response.data.msg || err.response.data.message,
|
||||||
icon: "none",
|
icon: "none",
|
||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getBargainHelpCountStart: function () {
|
// 砍价 砍价帮总人数、剩余金额、进度条、已经砍掉的价格
|
||||||
var that = this;
|
|
||||||
getBargainHelpCount({
|
|
||||||
bargainId: that.bargainId,
|
|
||||||
bargainUserUid: that.bargainPartake
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
// this.$yrouter.push({
|
|
||||||
// path: "/pages/activity/DargainDetails/index",
|
|
||||||
// query: {
|
|
||||||
// id: that.bargainId,
|
|
||||||
// partake: that.userInfo.uid
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
});
|
|
||||||
},
|
|
||||||
getBargainHelpCount: function () {
|
getBargainHelpCount: function () {
|
||||||
var that = this;
|
|
||||||
getBargainHelpCount({
|
getBargainHelpCount({
|
||||||
bargainId: that.bargainId,
|
bargainId: this.bargainId,
|
||||||
bargainUserUid: that.bargainPartake
|
bargainUserUid: this.bargainUid
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
that.userBargainStatus = res.data.status;
|
// 剩余砍价金额 = 商品价格 - 已经砍掉的金额
|
||||||
that.helpCount = res.data.count;
|
let remainingPrice = (this.goodsDetail.price - res.data.alreadyPrice).toFixed(2)
|
||||||
that.surplusPrice = res.data.price;
|
this.bargainHelpCount = {
|
||||||
that.alreadyPrice = res.data.alreadyPrice;
|
...res.data,
|
||||||
that.pricePercent = res.data.pricePercent;
|
remainingPrice
|
||||||
that.price = (that.bargain.price - that.alreadyPrice).toFixed(2);
|
}
|
||||||
console.log(that);
|
this.handleButtonStatus()
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(err => {
|
||||||
that.bargainPartake = that.userInfo.uid;
|
if (!err.msg) {
|
||||||
// that.$yrouter.push({
|
return
|
||||||
// path: "/pages/activity/DargainDetails/index",
|
}
|
||||||
// query: { id: that.bargainId, partake: that.userInfo.uid }
|
uni.showToast({
|
||||||
// });
|
title: err.msg || err.response.data.msg || err.response.data.message,
|
||||||
|
icon: "none",
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
// 判断是否可以支付
|
||||||
|
handleButtonStatus() {
|
||||||
|
// 砍价按钮分为
|
||||||
|
// 1.参与砍价 ==> 发起人与当前用户为同一人 && 未参与
|
||||||
|
if (
|
||||||
|
this.bargainUid === this.userInfo.uid &&
|
||||||
|
this.bargainHelpCount.status == 0
|
||||||
|
) {
|
||||||
|
this.participate = true
|
||||||
|
} else {
|
||||||
|
this.participate = false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2.邀请好友 ==> 发起人与当前用户同一人 && 已参与未过期 && 剩余金额>0
|
||||||
|
if (
|
||||||
|
this.bargainUid === this.userInfo.uid &&
|
||||||
|
this.bargainHelpCount.status == 1 &&
|
||||||
|
this.bargainHelpCount.remainingPrice > 0
|
||||||
|
) {
|
||||||
|
this.inviteFriends = true
|
||||||
|
} else {
|
||||||
|
this.inviteFriends = false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3.帮好友砍价 ==> 发起人与当前用户非一人 && 未参与未过期 && 剩余金额>0 && 为砍价
|
||||||
|
if (
|
||||||
|
this.bargainUid != this.userInfo.uid &&
|
||||||
|
this.bargainHelpCount.status == 1 &&
|
||||||
|
// this.bargainHelpCount.userBargainStatus &&
|
||||||
|
this.bargainHelpCount.remainingPrice > 0
|
||||||
|
) {
|
||||||
|
this.helpFriendsBargain = true
|
||||||
|
} else {
|
||||||
|
this.helpFriendsBargain = false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4.支付 ==> 发起人与当前用户同一人 && 已参与未过期 && 剩余金额<=0
|
||||||
|
if (
|
||||||
|
this.bargainUid === this.userInfo.uid &&
|
||||||
|
this.bargainHelpCount.status == 1 &&
|
||||||
|
this.bargainHelpCount.remainingPrice <= 0
|
||||||
|
) {
|
||||||
|
this.pay = true
|
||||||
|
} else {
|
||||||
|
this.pay = false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5.砍价人发起新的砍价 ==> 发起人与当前用户非一人 && 未参与
|
||||||
|
if (
|
||||||
|
this.bargainUid != this.userInfo.uid
|
||||||
|
) {
|
||||||
|
this.bargain = true
|
||||||
|
} else {
|
||||||
|
this.bargain = false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 砍价弹窗
|
||||||
|
// 1.发起人砍价成功 ==> 发起人与当前用户同一人 && 已参与未过期
|
||||||
|
// 2.砍价人砍价成功 ==> 发起人与当前用户非一人 && 已参与未过期
|
||||||
|
// 3.已砍价 ==> 已参与 && 砍价状态为 true
|
||||||
|
|
||||||
|
},
|
||||||
|
// 获取开启砍价用户信息
|
||||||
|
// 参与砍价,为同一人发起砍价后
|
||||||
getBargainStartUser: function () {
|
getBargainStartUser: function () {
|
||||||
var that = this;
|
var that = this;
|
||||||
getBargainStartUser({
|
getBargainStartUser({
|
||||||
bargainId: that.bargainId,
|
bargainId: that.bargainId,
|
||||||
bargainUserUid: that.bargainPartake
|
bargainUserUid: that.bargainUid
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
that.bargainUserInfo = res.data;
|
that.bargainUserInfo = res.data;
|
||||||
@@ -575,9 +579,30 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
// 关闭弹窗
|
||||||
close: function () {
|
close: function () {
|
||||||
this.active = false;
|
this.active = false;
|
||||||
}
|
},
|
||||||
|
// 设置微信分享
|
||||||
|
onShareAppMessage: function () {
|
||||||
|
return {
|
||||||
|
title: this.storeInfo.title,
|
||||||
|
imageUrl: this.storeInfo.image,
|
||||||
|
path: "pages/activity/DargainDetails/index?id=" + this.storeInfo.id + "&spread=" + uni.getStorageSync(
|
||||||
|
"uid"),
|
||||||
|
success(res) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '分享成功'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
fail(res) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '分享失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
onShareAppMessage() {
|
onShareAppMessage() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -135,7 +135,10 @@
|
|||||||
</button>
|
</button>
|
||||||
</view>
|
</view>
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
|
<view class="item" @click="goHome" >
|
||||||
|
<view class="iconfont icon-shouye-xianxing"></view>
|
||||||
|
<text>首页</text>
|
||||||
|
</view>
|
||||||
<view class="item" @click="setCollect" v-if="storeInfo.userCollect">
|
<view class="item" @click="setCollect" v-if="storeInfo.userCollect">
|
||||||
<view class="iconfont icon-shoucang1"></view>
|
<view class="iconfont icon-shoucang1"></view>
|
||||||
<text>收藏</text>
|
<text>收藏</text>
|
||||||
@@ -217,10 +220,13 @@
|
|||||||
getCollectDel,
|
getCollectDel,
|
||||||
getUserInfo,
|
getUserInfo,
|
||||||
} from "@/api/user";
|
} from "@/api/user";
|
||||||
|
import cookie from "@/utils/store/cookie";
|
||||||
import {
|
import {
|
||||||
isWeixin,
|
isWeixin,
|
||||||
PosterCanvas,
|
PosterCanvas,
|
||||||
handleQrCode
|
handleQrCode,
|
||||||
|
handleUrlParam,
|
||||||
|
getCurrentPageUrlWithArgs
|
||||||
} from "@/utils";
|
} from "@/utils";
|
||||||
import {
|
import {
|
||||||
wechatEvevt
|
wechatEvevt
|
||||||
@@ -303,8 +309,15 @@
|
|||||||
computed: mapGetters(["isLogin", "location"]),
|
computed: mapGetters(["isLogin", "location"]),
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
let url = handleQrCode();
|
let url = handleQrCode();
|
||||||
if (url && url.productId) {
|
if (!url) {
|
||||||
this.id = url.productId;
|
url = handleUrlParam(getCurrentPageUrlWithArgs())
|
||||||
|
}
|
||||||
|
if (url && url.id) {
|
||||||
|
this.id = url.id;
|
||||||
|
let urlSpread = parseInt(url.spread);
|
||||||
|
if (urlSpread) {
|
||||||
|
cookie.set("spread", urlSpread);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.id = this._route.query.id;
|
this.id = this._route.query.id;
|
||||||
}
|
}
|
||||||
@@ -326,7 +339,8 @@
|
|||||||
return {
|
return {
|
||||||
title: this.storeInfo.storeName,
|
title: this.storeInfo.storeName,
|
||||||
imageUrl: this.storeInfo.image,
|
imageUrl: this.storeInfo.image,
|
||||||
path: "pages/shop/GoodsCon/index?id=" + this.storeInfo.id + "&spread=" + uni.getStorageSync("uid")+"&pageType=good&codeType=routine",
|
path: "pages/shop/GoodsCon/index?id=" + this.storeInfo.id + "&spread=" + uni.getStorageSync("uid") +
|
||||||
|
"&pageType=good&codeType=routine",
|
||||||
success(res) {
|
success(res) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '分享成功'
|
title: '分享成功'
|
||||||
@@ -340,6 +354,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
goHome() {
|
||||||
|
this.$yrouter.switchTab("/pages/home/index");
|
||||||
|
},
|
||||||
goShoppingCart() {
|
goShoppingCart() {
|
||||||
this.$yrouter.switchTab("/pages/shop/ShoppingCart/index");
|
this.$yrouter.switchTab("/pages/shop/ShoppingCart/index");
|
||||||
},
|
},
|
||||||
@@ -593,7 +610,7 @@
|
|||||||
//选择属性;
|
//选择属性;
|
||||||
ChangeAttr: function (res) {
|
ChangeAttr: function (res) {
|
||||||
// 修改了规格
|
// 修改了规格
|
||||||
|
|
||||||
let productSelect = this.productValue[res.value];
|
let productSelect = this.productValue[res.value];
|
||||||
if (productSelect) {
|
if (productSelect) {
|
||||||
this.attr.productAttr[res.indexw].index = res.indexn;
|
this.attr.productAttr[res.indexw].index = res.indexn;
|
||||||
@@ -754,10 +771,10 @@
|
|||||||
configAppMessage
|
configAppMessage
|
||||||
)
|
)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
|
||||||
})
|
})
|
||||||
.catch((res) => {
|
.catch((res) => {
|
||||||
|
|
||||||
if (res.is_ready) {
|
if (res.is_ready) {
|
||||||
res.wx.updateAppMessageShareData(configAppMessage);
|
res.wx.updateAppMessageShareData(configAppMessage);
|
||||||
res.wx.updateTimelineShareData(configAppMessage);
|
res.wx.updateTimelineShareData(configAppMessage);
|
||||||
@@ -776,10 +793,10 @@
|
|||||||
configAppMessage
|
configAppMessage
|
||||||
)
|
)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
|
||||||
})
|
})
|
||||||
.catch((res) => {
|
.catch((res) => {
|
||||||
|
|
||||||
if (res.is_ready) {
|
if (res.is_ready) {
|
||||||
res.wx.updateAppMessageShareData(configAppMessage);
|
res.wx.updateAppMessageShareData(configAppMessage);
|
||||||
res.wx.updateTimelineShareData(configAppMessage);
|
res.wx.updateTimelineShareData(configAppMessage);
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
<view class="checkbox-wrapper">
|
<view class="checkbox-wrapper">
|
||||||
<checkbox-group @change="switchSelect(cartListValidIndex)">
|
<checkbox-group @change="switchSelect(cartListValidIndex)">
|
||||||
<label class="well-check">
|
<label class="well-check">
|
||||||
<checkbox value :checked="item.checked+''"></checkbox>
|
<checkbox color="#eb3729" value :checked="item.checked"></checkbox>
|
||||||
</label>
|
</label>
|
||||||
</checkbox-group>
|
</checkbox-group>
|
||||||
</view>
|
</view>
|
||||||
@@ -113,7 +113,7 @@
|
|||||||
|
|
||||||
<checkbox-group @change="allChecked">
|
<checkbox-group @change="allChecked">
|
||||||
<label class="well-check">
|
<label class="well-check">
|
||||||
<checkbox value="allSelect" :checked="isAllSelect && cartCount > 0"></checkbox>
|
<checkbox color="#eb3729" value="allSelect" :checked="isAllSelect && cartCount > 0"></checkbox>
|
||||||
<text class="checkAll">全选 ({{ cartCount }})</text>
|
<text class="checkAll">全选 ({{ cartCount }})</text>
|
||||||
</label>
|
</label>
|
||||||
</checkbox-group>
|
</checkbox-group>
|
||||||
|
|||||||
@@ -62,7 +62,7 @@
|
|||||||
<!-- <svg class="icon" aria-hidden="true">
|
<!-- <svg class="icon" aria-hidden="true">
|
||||||
<use xlink:href="#icon-phone_" />
|
<use xlink:href="#icon-phone_" />
|
||||||
</svg>-->
|
</svg>-->
|
||||||
<input type="text" placeholder="输入手机号码" v-model="account" />
|
<input name="account" type="text" placeholder="输入手机号码" v-model="account" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
<!-- <svg class="icon" aria-hidden="true">
|
<!-- <svg class="icon" aria-hidden="true">
|
||||||
<use xlink:href="#icon-code_1" />
|
<use xlink:href="#icon-code_1" />
|
||||||
</svg>-->
|
</svg>-->
|
||||||
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
|
<input name="verifyCode" type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
|
||||||
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''"
|
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''"
|
||||||
@click="code">{{ text }}</button>
|
@click="code">{{ text }}</button>
|
||||||
</view>
|
</view>
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
<!-- <svg class="icon" aria-hidden="true">
|
<!-- <svg class="icon" aria-hidden="true">
|
||||||
<use xlink:href="#icon-code_" />
|
<use xlink:href="#icon-code_" />
|
||||||
</svg>-->
|
</svg>-->
|
||||||
<input type="password" placeholder="填写您的登录密码" v-model="password" />
|
<input name="password" type="password" placeholder="填写您的登录密码" v-model="password" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- #ifndef H5 -->
|
<!-- #ifndef H5 -->
|
||||||
@@ -89,7 +89,7 @@
|
|||||||
<!-- <svg class="icon" aria-hidden="true">
|
<!-- <svg class="icon" aria-hidden="true">
|
||||||
<use xlink:href="#icon-phone_" />
|
<use xlink:href="#icon-phone_" />
|
||||||
</svg>-->
|
</svg>-->
|
||||||
<input type="text" placeholder="输入邀请码" v-model="inviteCode" />
|
<input name="inviteCode" type="text" placeholder="输入邀请码" v-model="inviteCode" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<!-- <svg class="icon" aria-hidden="true">
|
<!-- <svg class="icon" aria-hidden="true">
|
||||||
<use xlink:href="#icon-phone_" />
|
<use xlink:href="#icon-phone_" />
|
||||||
</svg> -->
|
</svg> -->
|
||||||
<input type="text" placeholder="输入手机号码" />
|
<input name="phone" type="text" placeholder="输入手机号码" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
@@ -21,13 +21,9 @@
|
|||||||
<!-- <svg class="icon" aria-hidden="true">
|
<!-- <svg class="icon" aria-hidden="true">
|
||||||
<use xlink:href="#icon-code_1" />
|
<use xlink:href="#icon-code_1" />
|
||||||
</svg> -->
|
</svg> -->
|
||||||
<input type="text" placeholder="填写验证码" class="codeIput" />
|
<input name="" type="text" placeholder="填写验证码" class="codeIput" />
|
||||||
<button
|
<button class="verifyCode" :disabled="disabled" :class="disabled === true ? 'on' : ''"
|
||||||
class="code"
|
@click="code">{{ text }}</button>
|
||||||
:disabled="disabled"
|
|
||||||
:class="disabled === true ? 'on' : ''"
|
|
||||||
@click="code"
|
|
||||||
>{{ text }}</button>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
@@ -50,18 +46,20 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import sendVerifyCode from "@/mixins/SendVerifyCode";
|
import sendVerifyCode from "@/mixins/SendVerifyCode";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Register",
|
name: "Register",
|
||||||
mixins: [sendVerifyCode],
|
mixins: [sendVerifyCode],
|
||||||
methods: {
|
methods: {
|
||||||
code: function() {
|
code: function () {
|
||||||
this.sendCode();
|
this.sendCode();
|
||||||
},
|
},
|
||||||
goLogin() {
|
goLogin() {
|
||||||
this.$yrouter.push({ path: "/pages/user/Login/index" });
|
this.$yrouter.push({
|
||||||
|
path: "/pages/user/Login/index"
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -97,21 +97,21 @@ export default {
|
|||||||
},
|
},
|
||||||
getActivity: function() {
|
getActivity: function() {
|
||||||
let that = this;
|
let that = this;
|
||||||
getActivityStatus().then(
|
// getActivityStatus().then(
|
||||||
res => {
|
// res => {
|
||||||
that.activity.is_bargin = res.data.is_bargin;
|
// that.activity.is_bargin = res.data.is_bargin;
|
||||||
that.activity.is_pink = res.data.is_pink;
|
// that.activity.is_pink = res.data.is_pink;
|
||||||
that.activity.is_seckill = res.data.is_seckill;
|
// that.activity.is_seckill = res.data.is_seckill;
|
||||||
},
|
// },
|
||||||
err => {
|
// err => {
|
||||||
uni.showToast({
|
// uni.showToast({
|
||||||
title:
|
// title:
|
||||||
err.msg || err.response.data.msg || err.response.data.message,
|
// err.msg || err.response.data.msg || err.response.data.message,
|
||||||
icon: "none",
|
// icon: "none",
|
||||||
duration: 2000
|
// duration: 2000
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
);
|
// );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ export default {
|
|||||||
res => {
|
res => {
|
||||||
that.vipRequire = res.data.list;
|
that.vipRequire = res.data.list;
|
||||||
that.vipComplete = res.data.task;
|
that.vipComplete = res.data.task;
|
||||||
that.taskCount = res.data.reach_count;
|
that.taskCount = res.data.reachCount;
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
|||||||
@@ -13,22 +13,14 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="nav acea-row row-around">
|
<view class="nav acea-row row-around">
|
||||||
<view
|
<view class="item" :class="screen.grade == 0 ? 'on' : ''" @click="checkGrade(0)">一级({{ first||'0' }})</view>
|
||||||
class="item"
|
<view class="item" :class="screen.grade == 1 ? 'on' : ''" @click="checkGrade(1)">二级({{ second||'0' }})</view>
|
||||||
:class="screen.grade == 0 ? 'on' : ''"
|
|
||||||
@click="checkGrade(0)"
|
|
||||||
>一级({{ first||'0' }})</view>
|
|
||||||
<view
|
|
||||||
class="item"
|
|
||||||
:class="screen.grade == 1 ? 'on' : ''"
|
|
||||||
@click="checkGrade(1)"
|
|
||||||
>二级({{ second||'0' }})</view>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="search acea-row row-between-wrapper">
|
<view class="search acea-row row-between-wrapper">
|
||||||
<form @submit.prevent="submitForm">
|
<form @submit.prevent="submitForm">
|
||||||
<view class="input">
|
<view class="input">
|
||||||
<input placeholder="点击搜索会员名称" v-model="screen.keyword" />
|
<input placeholder="点击搜索会员名称" v-model="screen.keyword" />
|
||||||
<text class="iconfont icon-guanbi"></text>
|
<text class="iconfont icon-guanbi" @click="screen.keyword=''"></text>
|
||||||
</view>
|
</view>
|
||||||
</form>
|
</form>
|
||||||
<view class="iconfont icon-sousuo2"></view>
|
<view class="iconfont icon-sousuo2"></view>
|
||||||
@@ -56,11 +48,8 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view :class="fixedState === true ? 'sortList' : ''">
|
<view :class="fixedState === true ? 'sortList' : ''">
|
||||||
<view
|
<view class="item acea-row row-between-wrapper" v-for="(val, spreadListIndex) in spreadList"
|
||||||
class="item acea-row row-between-wrapper"
|
:key="spreadListIndex">
|
||||||
v-for="(val, spreadListIndex) in spreadList"
|
|
||||||
:key="spreadListIndex"
|
|
||||||
>
|
|
||||||
<view class="picTxt acea-row row-between-wrapper">
|
<view class="picTxt acea-row row-between-wrapper">
|
||||||
<view class="pictrue">
|
<view class="pictrue">
|
||||||
<image :src="val.avatar" />
|
<image :src="val.avatar" />
|
||||||
@@ -84,166 +73,167 @@
|
|||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getSpreadUser } from "@/api/user";
|
import {
|
||||||
import Loading from "@/components/Loading";
|
getSpreadUser
|
||||||
export default {
|
} from "@/api/user";
|
||||||
name: "PromoterList",
|
import Loading from "@/components/Loading";
|
||||||
components: {
|
export default {
|
||||||
Loading
|
name: "PromoterList",
|
||||||
},
|
components: {
|
||||||
props: {},
|
Loading
|
||||||
data: function() {
|
|
||||||
return {
|
|
||||||
fixedState: false,
|
|
||||||
screen: {
|
|
||||||
page: 1,
|
|
||||||
limit: 15,
|
|
||||||
grade: 0,
|
|
||||||
keyword: "",
|
|
||||||
sort: ""
|
|
||||||
},
|
|
||||||
childCount: 2,
|
|
||||||
numberCount: 2,
|
|
||||||
orderCount: 2,
|
|
||||||
loaded: false,
|
|
||||||
loading: false,
|
|
||||||
spreadList: [],
|
|
||||||
loadTitle: "",
|
|
||||||
first: "",
|
|
||||||
second: ""
|
|
||||||
};
|
|
||||||
},
|
|
||||||
mounted: function() {
|
|
||||||
this.getSpreadUsers();
|
|
||||||
},
|
|
||||||
onReachBottom() {
|
|
||||||
!this.loading && this.getSpreadUsers();
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
"screen.sort": function() {
|
|
||||||
this.screen.page = 0;
|
|
||||||
this.loaded = false;
|
|
||||||
this.loading = false;
|
|
||||||
this.spreadList = [];
|
|
||||||
this.getSpreadUsers();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
handleScroll: function() {
|
|
||||||
// var scrollTop =
|
|
||||||
// document.documentElement.scrollTop || document.body.scrollTop;
|
|
||||||
// var offsetTop = document.querySelector(".header").clientHeight;
|
|
||||||
// if (scrollTop >= offsetTop) {
|
|
||||||
// this.fixedState = true;
|
|
||||||
// } else {
|
|
||||||
// this.fixedState = false;
|
|
||||||
// }
|
|
||||||
},
|
},
|
||||||
submitForm: function() {
|
props: {},
|
||||||
this.screen.page = 0;
|
data: function () {
|
||||||
this.loaded = false;
|
return {
|
||||||
this.loading = false;
|
fixedState: false,
|
||||||
this.spreadList = [];
|
screen: {
|
||||||
|
page: 1,
|
||||||
|
limit: 15,
|
||||||
|
grade: 0,
|
||||||
|
keyword: "",
|
||||||
|
sort: ""
|
||||||
|
},
|
||||||
|
childCount: 2,
|
||||||
|
numberCount: 2,
|
||||||
|
orderCount: 2,
|
||||||
|
loaded: false,
|
||||||
|
loading: false,
|
||||||
|
spreadList: [],
|
||||||
|
loadTitle: "",
|
||||||
|
first: "",
|
||||||
|
second: ""
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted: function () {
|
||||||
this.getSpreadUsers();
|
this.getSpreadUsers();
|
||||||
},
|
},
|
||||||
getSpreadUsers: function() {
|
onReachBottom() {
|
||||||
let that = this,
|
!this.loading && this.getSpreadUsers();
|
||||||
screen = that.screen;
|
|
||||||
if (that.loaded || that.loading) return;
|
|
||||||
that.loading = true;
|
|
||||||
getSpreadUser(screen).then(
|
|
||||||
res => {
|
|
||||||
that.loading = false;
|
|
||||||
that.spreadList.push.apply(that.spreadList, res.data.list);
|
|
||||||
that.loaded = res.data.list.length < that.screen.limit; //判断所有数据是否加载完成;
|
|
||||||
that.loadTitle = that.loaded ? "人家是有底线的" : "上拉加载更多";
|
|
||||||
that.screen.page = that.screen.page + 1;
|
|
||||||
that.first = res.data.total;
|
|
||||||
that.second = res.data.totalLevel;
|
|
||||||
},
|
|
||||||
err => {
|
|
||||||
uni.showToast({
|
|
||||||
title:
|
|
||||||
err.msg || err.response.data.msg || err.response.data.message,
|
|
||||||
icon: "none",
|
|
||||||
duration: 2000
|
|
||||||
});
|
|
||||||
},
|
|
||||||
300
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
checkGrade: function(val) {
|
watch: {
|
||||||
if (val == this.screen.grade) return;
|
"screen.sort": function () {
|
||||||
else {
|
this.screen.page = 0;
|
||||||
this.screen.page = 1;
|
|
||||||
this.screen.grade = val;
|
|
||||||
this.loading = false;
|
|
||||||
this.loaded = false;
|
this.loaded = false;
|
||||||
|
this.loading = false;
|
||||||
this.spreadList = [];
|
this.spreadList = [];
|
||||||
this.getSpreadUsers();
|
this.getSpreadUsers();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
sort: function(types) {
|
methods: {
|
||||||
let that = this;
|
handleScroll: function () {
|
||||||
switch (types) {
|
// var scrollTop =
|
||||||
case "childCount":
|
// document.documentElement.scrollTop || document.body.scrollTop;
|
||||||
if (that.childCount == 2) {
|
// var offsetTop = document.querySelector(".header").clientHeight;
|
||||||
that.childCount = 1;
|
// if (scrollTop >= offsetTop) {
|
||||||
that.orderCount = 2;
|
// this.fixedState = true;
|
||||||
that.numberCount = 2;
|
// } else {
|
||||||
that.screen.sort = "childCount DESC";
|
// this.fixedState = false;
|
||||||
} else if (that.childCount == 1) {
|
// }
|
||||||
that.childCount = 3;
|
},
|
||||||
that.orderCount = 2;
|
submitForm: function () {
|
||||||
that.numberCount = 2;
|
this.screen.page = 0;
|
||||||
that.screen.sort = "childCount ASC";
|
this.loaded = false;
|
||||||
} else if (that.childCount == 3) {
|
this.loading = false;
|
||||||
that.childCount = 2;
|
this.spreadList = [];
|
||||||
that.orderCount = 2;
|
this.getSpreadUsers();
|
||||||
that.numberCount = 2;
|
},
|
||||||
|
getSpreadUsers: function () {
|
||||||
|
let that = this,
|
||||||
|
screen = that.screen;
|
||||||
|
if (that.loaded || that.loading) return;
|
||||||
|
that.loading = true;
|
||||||
|
getSpreadUser(screen).then(
|
||||||
|
res => {
|
||||||
|
that.loading = false;
|
||||||
|
that.spreadList.push.apply(that.spreadList, res.data.list);
|
||||||
|
that.loaded = res.data.list.length < that.screen.limit; //判断所有数据是否加载完成;
|
||||||
|
that.loadTitle = that.loaded ? "人家是有底线的" : "上拉加载更多";
|
||||||
|
that.screen.page = that.screen.page + 1;
|
||||||
|
that.first = res.data.total;
|
||||||
|
that.second = res.data.totalLevel;
|
||||||
|
},
|
||||||
|
err => {
|
||||||
|
uni.showToast({
|
||||||
|
title: err.msg || err.response.data.msg || err.response.data.message,
|
||||||
|
icon: "none",
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
},
|
||||||
|
300
|
||||||
|
);
|
||||||
|
},
|
||||||
|
checkGrade: function (val) {
|
||||||
|
if (val == this.screen.grade) return;
|
||||||
|
else {
|
||||||
|
this.screen.page = 1;
|
||||||
|
this.screen.grade = val;
|
||||||
|
this.loading = false;
|
||||||
|
this.loaded = false;
|
||||||
|
this.spreadList = [];
|
||||||
|
this.getSpreadUsers();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
sort: function (types) {
|
||||||
|
let that = this;
|
||||||
|
switch (types) {
|
||||||
|
case "childCount":
|
||||||
|
if (that.childCount == 2) {
|
||||||
|
that.childCount = 1;
|
||||||
|
that.orderCount = 2;
|
||||||
|
that.numberCount = 2;
|
||||||
|
that.screen.sort = "childCount DESC";
|
||||||
|
} else if (that.childCount == 1) {
|
||||||
|
that.childCount = 3;
|
||||||
|
that.orderCount = 2;
|
||||||
|
that.numberCount = 2;
|
||||||
|
that.screen.sort = "childCount ASC";
|
||||||
|
} else if (that.childCount == 3) {
|
||||||
|
that.childCount = 2;
|
||||||
|
that.orderCount = 2;
|
||||||
|
that.numberCount = 2;
|
||||||
|
that.screen.sort = "";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "numberCount":
|
||||||
|
if (that.numberCount == 2) {
|
||||||
|
that.numberCount = 1;
|
||||||
|
that.orderCount = 2;
|
||||||
|
that.childCount = 2;
|
||||||
|
that.screen.sort = "numberCount DESC";
|
||||||
|
} else if (that.numberCount == 1) {
|
||||||
|
that.numberCount = 3;
|
||||||
|
that.orderCount = 2;
|
||||||
|
that.childCount = 2;
|
||||||
|
that.screen.sort = "numberCount ASC";
|
||||||
|
} else if (that.numberCount == 3) {
|
||||||
|
that.numberCount = 2;
|
||||||
|
that.orderCount = 2;
|
||||||
|
that.childCount = 2;
|
||||||
|
that.screen.sort = "";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "orderCount":
|
||||||
|
if (that.orderCount == 2) {
|
||||||
|
that.orderCount = 1;
|
||||||
|
that.numberCount = 2;
|
||||||
|
that.childCount = 2;
|
||||||
|
that.screen.sort = "orderCount DESC";
|
||||||
|
} else if (that.orderCount == 1) {
|
||||||
|
that.orderCount = 3;
|
||||||
|
that.numberCount = 2;
|
||||||
|
that.childCount = 2;
|
||||||
|
that.screen.sort = "orderCount ASC";
|
||||||
|
} else if (that.orderCount == 3) {
|
||||||
|
that.orderCount = 2;
|
||||||
|
that.numberCount = 2;
|
||||||
|
that.childCount = 2;
|
||||||
|
that.screen.sort = "";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
that.screen.sort = "";
|
that.screen.sort = "";
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
case "numberCount":
|
|
||||||
if (that.numberCount == 2) {
|
|
||||||
that.numberCount = 1;
|
|
||||||
that.orderCount = 2;
|
|
||||||
that.childCount = 2;
|
|
||||||
that.screen.sort = "numberCount DESC";
|
|
||||||
} else if (that.numberCount == 1) {
|
|
||||||
that.numberCount = 3;
|
|
||||||
that.orderCount = 2;
|
|
||||||
that.childCount = 2;
|
|
||||||
that.screen.sort = "numberCount ASC";
|
|
||||||
} else if (that.numberCount == 3) {
|
|
||||||
that.numberCount = 2;
|
|
||||||
that.orderCount = 2;
|
|
||||||
that.childCount = 2;
|
|
||||||
that.screen.sort = "";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "orderCount":
|
|
||||||
if (that.orderCount == 2) {
|
|
||||||
that.orderCount = 1;
|
|
||||||
that.numberCount = 2;
|
|
||||||
that.childCount = 2;
|
|
||||||
that.screen.sort = "orderCount DESC";
|
|
||||||
} else if (that.orderCount == 1) {
|
|
||||||
that.orderCount = 3;
|
|
||||||
that.numberCount = 2;
|
|
||||||
that.childCount = 2;
|
|
||||||
that.screen.sort = "orderCount ASC";
|
|
||||||
} else if (that.orderCount == 3) {
|
|
||||||
that.orderCount = 2;
|
|
||||||
that.numberCount = 2;
|
|
||||||
that.childCount = 2;
|
|
||||||
that.screen.sort = "";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
that.screen.sort = "";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
+18
-22
@@ -39,14 +39,7 @@ const vuexStore = new Vuex.Store({
|
|||||||
console.log('清除数据')
|
console.log('清除数据')
|
||||||
state.token = null;
|
state.token = null;
|
||||||
state.userInfo = null
|
state.userInfo = null
|
||||||
let spread = cookie.get('spread')
|
cookie.clearAll()
|
||||||
let redirect = cookie.get('redirect')
|
|
||||||
let outTime = setTimeout(() => {
|
|
||||||
clearTimeout(outTime)
|
|
||||||
cookie.clearAll()
|
|
||||||
cookie.set('redirect', redirect)
|
|
||||||
cookie.set('spread', spread)
|
|
||||||
}, 100)
|
|
||||||
},
|
},
|
||||||
backgroundColor(state, color) {
|
backgroundColor(state, color) {
|
||||||
state.color = color;
|
state.color = color;
|
||||||
@@ -97,22 +90,24 @@ const vuexStore = new Vuex.Store({
|
|||||||
userInfo({ state, commit }, force) {
|
userInfo({ state, commit }, force) {
|
||||||
if (state.userInfo !== null && !force) {
|
if (state.userInfo !== null && !force) {
|
||||||
return Promise.resolve(state.userInfo);
|
return Promise.resolve(state.userInfo);
|
||||||
} else {
|
|
||||||
return new Promise(reslove => {
|
|
||||||
getUserInfo().then(res => {
|
|
||||||
commit("updateUserInfo", res.data);
|
|
||||||
reslove(res.data);
|
|
||||||
});
|
|
||||||
}).catch(() => {
|
|
||||||
uni.showToast({
|
|
||||||
title: "获取信息失败!",
|
|
||||||
icon: "none",
|
|
||||||
duration: 2000,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
return new Promise(reslove => {
|
||||||
|
getUserInfo().then(res => {
|
||||||
|
commit("updateUserInfo", res.data);
|
||||||
|
reslove(res.data);
|
||||||
|
});
|
||||||
|
}).catch(() => {
|
||||||
|
uni.showToast({
|
||||||
|
title: "获取信息失败!",
|
||||||
|
icon: "none",
|
||||||
|
duration: 2000,
|
||||||
|
});
|
||||||
|
});
|
||||||
},
|
},
|
||||||
getUser({ state, commit }) {
|
getUser({ state, commit }) {
|
||||||
|
if (!state.token) {
|
||||||
|
return Promise.reject('未获取到token');
|
||||||
|
}
|
||||||
return new Promise(reslove => {
|
return new Promise(reslove => {
|
||||||
getUserInfo().then(res => {
|
getUserInfo().then(res => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
@@ -138,7 +133,7 @@ const vuexStore = new Vuex.Store({
|
|||||||
state,
|
state,
|
||||||
commit
|
commit
|
||||||
}, user) {
|
}, user) {
|
||||||
|
|
||||||
commit("updateUserInfo", user);
|
commit("updateUserInfo", user);
|
||||||
},
|
},
|
||||||
changeAuthorizationPage({
|
changeAuthorizationPage({
|
||||||
@@ -163,6 +158,7 @@ const vuexStore = new Vuex.Store({
|
|||||||
location: state => state.location,
|
location: state => state.location,
|
||||||
storeItems: state => state.storeItems,
|
storeItems: state => state.storeItems,
|
||||||
goName: state => state.goName,
|
goName: state => state.goName,
|
||||||
|
$deviceType: state => state.$deviceType,
|
||||||
},
|
},
|
||||||
strict: debug
|
strict: debug
|
||||||
});
|
});
|
||||||
|
|||||||
+39
-44
@@ -204,7 +204,6 @@ export const authorize = (authorizeStr) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const login = () => {
|
export const login = () => {
|
||||||
console.log(Vue.prototype)
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (Vue.prototype.$deviceType == 'weixin') {
|
if (Vue.prototype.$deviceType == 'weixin') {
|
||||||
// 微信授权登录
|
// 微信授权登录
|
||||||
@@ -212,47 +211,32 @@ export const login = () => {
|
|||||||
if (code) {
|
if (code) {
|
||||||
auth(code)
|
auth(code)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// location.replace(
|
let redirect = cookie.get('redirect')
|
||||||
// decodeURIComponent(decodeURIComponent(this.$route.params.url))
|
console.log(redirect)
|
||||||
// );
|
if (redirect) {
|
||||||
location.href = decodeURIComponent(
|
redirect = redirect.split('/pages')[1]
|
||||||
decodeURIComponent(this.$route.params.url)
|
reLaunch({
|
||||||
);
|
path: '/pages' + redirect,
|
||||||
|
});
|
||||||
|
cookie.remove('redirect');
|
||||||
|
} else {
|
||||||
|
reLaunch({
|
||||||
|
path: '/pages/home/index',
|
||||||
|
});
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
reject('当前运行环境为微信浏览器')
|
reject('当前运行环境为微信浏览器')
|
||||||
location.replace("/pages/home/index");
|
reLaunch({
|
||||||
|
path: '/pages/home/index',
|
||||||
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// wechat().then(() => oAuth());
|
|
||||||
}
|
}
|
||||||
// if (!code) {
|
|
||||||
// toAuth("wxc061dee8806ff712")
|
|
||||||
// } else {
|
|
||||||
// // wechat().then(() => oAuth().then((code) => {
|
|
||||||
// // // const { code } = parseQuery()
|
|
||||||
// // auth(code)
|
|
||||||
// // .then(() => {
|
|
||||||
// // // location.replace(
|
|
||||||
// // // decodeURIComponent(decodeURIComponent(this.$route.params.url))
|
|
||||||
// // // );
|
|
||||||
// // location.href = decodeURIComponent(
|
|
||||||
// // decodeURIComponent(this.$route.params.url)
|
|
||||||
// // );
|
|
||||||
// // })
|
|
||||||
// // .catch(() => {
|
|
||||||
// // reject('当前运行环境为微信浏览器')
|
|
||||||
// // location.replace("/pages/home/index");
|
|
||||||
// // });
|
|
||||||
// // })).catch(error => {
|
|
||||||
// // console.log(error)
|
|
||||||
// // reject('自动登录失败')
|
|
||||||
// // });
|
|
||||||
// }
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (Vue.prototype.$deviceType == 'weixinh5') {
|
if (Vue.prototype.$deviceType == 'weixinh5') {
|
||||||
|
console.log('当前运行环境为H5')
|
||||||
reject('当前运行环境为H5')
|
reject('当前运行环境为H5')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -275,7 +259,7 @@ export const login = () => {
|
|||||||
console.log('登录接口调用成功')
|
console.log('登录接口调用成功')
|
||||||
console.log('开始检查用户信息授权')
|
console.log('开始检查用户信息授权')
|
||||||
let code = loginRes.code;
|
let code = loginRes.code;
|
||||||
cookie.set('wxLoginCode',loginRes.code)
|
cookie.set('wxLoginCode', loginRes.code)
|
||||||
// 检查授权, 检查用户信息授权
|
// 检查授权, 检查用户信息授权
|
||||||
authorize('userInfo').then(() => {
|
authorize('userInfo').then(() => {
|
||||||
console.log('授权通过')
|
console.log('授权通过')
|
||||||
@@ -705,7 +689,8 @@ export const _router = {
|
|||||||
push,
|
push,
|
||||||
replace,
|
replace,
|
||||||
go,
|
go,
|
||||||
back
|
back,
|
||||||
|
reLaunch
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -857,14 +842,18 @@ export const handleLoginFailure = () => {
|
|||||||
console.log('————————')
|
console.log('————————')
|
||||||
|
|
||||||
store.commit("logout");
|
store.commit("logout");
|
||||||
|
// 改为授权取消
|
||||||
store.commit("updateAuthorization", false);
|
store.commit("updateAuthorization", false);
|
||||||
|
|
||||||
let currentPageUrl = getCurrentPageUrl()
|
let currentPageUrl = getCurrentPageUrl()
|
||||||
|
|
||||||
if (store.state.$deviceType == 'weixin') {
|
if (store.state.$deviceType == 'weixin') {
|
||||||
if (store.getters.isAuthorizationPage){
|
// 如果不是授权页面,
|
||||||
|
if (!store.getters.isAuthorizationPage) {
|
||||||
|
// 标识当前为授权页面
|
||||||
|
store.commit("updateAuthorizationPage", true);
|
||||||
toAuth()
|
toAuth()
|
||||||
}
|
}
|
||||||
|
return
|
||||||
} else {
|
} else {
|
||||||
// token 失效
|
// token 失效
|
||||||
// 判断当前是不是已经在登录页面或者授权页,防止二次跳转
|
// 判断当前是不是已经在登录页面或者授权页,防止二次跳转
|
||||||
@@ -895,12 +884,14 @@ export const handleLoginFailure = () => {
|
|||||||
console.log('————————')
|
console.log('————————')
|
||||||
if (qrCode.pinkId) {
|
if (qrCode.pinkId) {
|
||||||
path = parseUrl({
|
path = parseUrl({
|
||||||
path: `/${currentPageUrl}`,
|
path: `/ ${currentPageUrl} `,
|
||||||
query: {
|
query: {
|
||||||
id: qrCode.pinkId,
|
id: qrCode.pinkId,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
cookie.set("spread", qrCode.spread || 0);
|
if (qrCode.spread) {
|
||||||
|
cookie.set("spread", qrCode.spread || 0);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log('————————')
|
console.log('————————')
|
||||||
console.log('是拼团进来的,但是没有获取到参数')
|
console.log('是拼团进来的,但是没有获取到参数')
|
||||||
@@ -917,13 +908,15 @@ export const handleLoginFailure = () => {
|
|||||||
|
|
||||||
if (qrCode.bargainId) {
|
if (qrCode.bargainId) {
|
||||||
path = parseUrl({
|
path = parseUrl({
|
||||||
path: `/${currentPageUrl}`,
|
path: `/ ${currentPageUrl} `,
|
||||||
query: {
|
query: {
|
||||||
id: qrCode.bargainId,
|
id: qrCode.bargainId,
|
||||||
partake: qrCode.uid
|
partake: qrCode.uid
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
cookie.set("spread", qrCode.spread || 0);
|
if (qrCode.spread) {
|
||||||
|
cookie.set("spread", qrCode.spread || 0);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
handleNoParameters()
|
handleNoParameters()
|
||||||
console.log('————————')
|
console.log('————————')
|
||||||
@@ -939,12 +932,14 @@ export const handleLoginFailure = () => {
|
|||||||
|
|
||||||
if (qrCode.productId) {
|
if (qrCode.productId) {
|
||||||
path = parseUrl({
|
path = parseUrl({
|
||||||
path: `/${currentPageUrl}`,
|
path: `/ ${currentPageUrl} `,
|
||||||
query: {
|
query: {
|
||||||
id: qrCode.productId,
|
id: qrCode.productId,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
cookie.set("spread", qrCode.spread || 0);
|
if (qrCode.spread) {
|
||||||
|
cookie.set("spread", qrCode.spread || 0);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
handleNoParameters()
|
handleNoParameters()
|
||||||
console.log('————————')
|
console.log('————————')
|
||||||
@@ -988,7 +983,7 @@ export function chooseImage(callback) {
|
|||||||
console.log(image);
|
console.log(image);
|
||||||
uni.showLoading({ title: "图片上传中", mask: true });
|
uni.showLoading({ title: "图片上传中", mask: true });
|
||||||
uni.uploadFile({
|
uni.uploadFile({
|
||||||
url: `${VUE_APP_API_URL}/api/upload`,
|
url: `${VUE_APP_API_URL} /api/upload`,
|
||||||
file: image,
|
file: image,
|
||||||
filePath: image.path,
|
filePath: image.path,
|
||||||
header: {
|
header: {
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@ import Fly from "flyio/dist/npm/wx";
|
|||||||
import Fly from "flyio/dist/npm/wx";
|
import Fly from "flyio/dist/npm/wx";
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
import $store from "../store";
|
import store from "../store";
|
||||||
import { handleLoginFailure } from "@/utils";
|
import { handleLoginFailure } from "@/utils";
|
||||||
import { VUE_APP_API_URL } from "@/config";
|
import { VUE_APP_API_URL } from "@/config";
|
||||||
import cookie from "@/utils/store/cookie";
|
import cookie from "@/utils/store/cookie";
|
||||||
|
|||||||
+10
-1
@@ -29,7 +29,16 @@ function remove(key) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function clearAll() {
|
function clearAll() {
|
||||||
uni.clearStorage()
|
const res = uni.getStorageInfoSync();
|
||||||
|
res.keys.map((item) => {
|
||||||
|
if (item == 'redirect' || item == 'spread') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
remove(item)
|
||||||
|
})
|
||||||
|
console.log(res)
|
||||||
|
// debugger
|
||||||
|
// uni.clearStorageSync()
|
||||||
}
|
}
|
||||||
|
|
||||||
function _has(key) {
|
function _has(key) {
|
||||||
|
|||||||
Reference in New Issue
Block a user