Merge branch 'master' of https://git.dayouqiantu.cn/uniapp/yshop-uniapp into dev
This commit is contained in:
@@ -12,7 +12,8 @@
|
|||||||
<view class="num">x {{ cart.cartNum }}</view>
|
<view class="num">x {{ cart.cartNum }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="attr line1" v-if="cart.productInfo.attrInfo">{{ cart.productInfo.attrInfo.sku }}</view>
|
<view class="attr line1" v-if="cart.productInfo.attrInfo">{{ cart.productInfo.attrInfo.sku }}</view>
|
||||||
<view class="money font-color-red">¥{{ cart.truePrice }}</view>
|
<view class="money font-color-red" v-if="isIntegral">{{ cart.costPrice }}积分</view>
|
||||||
|
<view class="money font-color-red" v-else>¥{{ cart.truePrice }}</view>
|
||||||
<view class="evaluate" v-if="evaluate == 3 && cart.isReply == 0" @click="routerGo(cart)">评价</view>
|
<view class="evaluate" v-if="evaluate == 3 && cart.isReply == 0" @click="routerGo(cart)">评价</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -28,6 +29,7 @@ export default {
|
|||||||
type: Array,
|
type: Array,
|
||||||
default: () => [],
|
default: () => [],
|
||||||
},
|
},
|
||||||
|
isIntegral: Boolean,
|
||||||
},
|
},
|
||||||
data: function() {
|
data: function() {
|
||||||
return {}
|
return {}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="tui-goods__item" :class="{ 'tui-full__item': isList }" @tap="detail">
|
<view class="tui-goods__item" :class="{ 'tui-full__item': isList }">
|
||||||
<view class="tui-image__box" :class="{ 'tui-full__imgbox': isList }">
|
<view class="tui-image__box" :class="{ 'tui-full__imgbox': isList }">
|
||||||
<image class="tui-goods__img" :class="{ 'tui-full__img': isList }" :src="item.image" mode="widthFix"></image>
|
<image class="tui-goods__img" :class="{ 'tui-full__img': isList }" :src="item.image" mode="widthFix"></image>
|
||||||
</view>
|
</view>
|
||||||
@@ -23,10 +23,10 @@
|
|||||||
<!-- <tui-button :width="status == 3 ? '146rpx' : '144rpx'" :height="status == 3 ? '60rpx' : '50rpx'" :size="status == 3 ? 26 : 24" :type="status == 1 ? 'gray' : 'danger'" :disabled="status == 1" :plain="status == 3">
|
<!-- <tui-button :width="status == 3 ? '146rpx' : '144rpx'" :height="status == 3 ? '60rpx' : '50rpx'" :size="status == 3 ? 26 : 24" :type="status == 1 ? 'gray' : 'danger'" :disabled="status == 1" :plain="status == 3">
|
||||||
{{ status | getBtnText(item.subscribe) }}
|
{{ status | getBtnText(item.subscribe) }}
|
||||||
</tui-button> -->
|
</tui-button> -->
|
||||||
<view class="grab bg-color-red" v-if="item.status === 0 && item.stock > 0" @click="goDetail()">马上抢</view>
|
<view class="grab bg-color-red" v-if="timeList[active].status === 1 && item.stock > 0" @click="goDetail">马上抢</view>
|
||||||
<view class="grab" v-if="item.status === 1 && item.stock <= 0">已售磬</view>
|
<view class="grab" v-if="timeList[active].status === 1 && item.stock <= 0">已售磬</view>
|
||||||
<view class="grab bg-color-red" v-if="item.status === 2">即将开始</view>
|
<view class="grab bg-color-red" v-if="timeList[active].status === 2">即将开始</view>
|
||||||
<view class="grab bg-color-red" v-if="item.status === 1">已结束</view>
|
<view class="grab bg-color-red" v-if="timeList[active].status === 0">已结束</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -53,6 +53,14 @@ export default {
|
|||||||
type: Number,
|
type: Number,
|
||||||
default: 2,
|
default: 2,
|
||||||
},
|
},
|
||||||
|
timeList: {
|
||||||
|
type: Array,
|
||||||
|
default: [],
|
||||||
|
},
|
||||||
|
active: {
|
||||||
|
type: Number,
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
filters: {
|
filters: {
|
||||||
getBtnText(status, subscribe) {
|
getBtnText(status, subscribe) {
|
||||||
@@ -84,12 +92,8 @@ export default {
|
|||||||
return {}
|
return {}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// detail() {
|
|
||||||
// //项目中应该传id
|
|
||||||
// this.tui.href(`../seckillDetail/seckillDetail?status=${this.status}`)
|
|
||||||
// },
|
|
||||||
goDetail: function() {
|
goDetail: function() {
|
||||||
this.$emit('goDetail', item)
|
this.$emit('goDetail', this.item)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-3
@@ -1,8 +1,9 @@
|
|||||||
// export const VUE_APP_API_URL = 'http://natapp.xinxintuan.co/api';
|
// export const VUE_APP_API_URL = 'http://natapp.xinxintuan.co/api';
|
||||||
export const VUE_APP_API_URL = 'https://wxapi.yixiang.co/api';
|
export const VUE_APP_API_URL = 'https://wxapi.yixiang.co/api'
|
||||||
// export const VUE_APP_API_URL = 'http://192.168.31.223:8008/api';
|
// export const VUE_APP_API_URL = 'http://139.186.134.205:9006/api'
|
||||||
|
// export const VUE_APP_API_URL = 'http://192.168.31.223:8008/api'
|
||||||
// export const VUE_APP_API_URL = 'http://natapp.xinxintuan.co/api';
|
// export const VUE_APP_API_URL = 'http://natapp.xinxintuan.co/api';
|
||||||
// export const VUE_APP_API_URL = 'https://tapi.xinxintuan.co/api'
|
// export const VUE_APP_API_URL = 'https://thapi.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_API_URL = 'https://h5api.xinxintuan.co/api';
|
||||||
export const VUE_APP_RESOURCES_URL = 'https://h5.yixiang.co/static'
|
export const VUE_APP_RESOURCES_URL = 'https://h5.yixiang.co/static'
|
||||||
|
|||||||
+160
-159
@@ -1,36 +1,39 @@
|
|||||||
import { subscribeMessage } from "@/libs/order";
|
import { subscribeMessage } from '@/libs/order'
|
||||||
import { getProvider } from "@/utils";
|
import { getProvider } from '@/utils'
|
||||||
import WechatJSSDK from "wechat-jssdk/dist/client.umd";
|
import WechatJSSDK from 'wechat-jssdk/dist/client.umd'
|
||||||
import { getWechatConfig, wechatAuth } from "@/api/public";
|
import { getWechatConfig, wechatAuth } from '@/api/public'
|
||||||
import { parseQuery } from "@/utils";
|
import { parseQuery } from '@/utils'
|
||||||
import cookie from "@/utils/store/cookie";
|
import cookie from '@/utils/store/cookie'
|
||||||
import store from "@/store";
|
import store from '@/store'
|
||||||
import dayjs from "dayjs";
|
import dayjs from 'dayjs'
|
||||||
|
|
||||||
// 支付模块
|
// 支付模块
|
||||||
export const weappPay = (option) => {
|
export const weappPay = option => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (store.state.$deviceType == 'weixinh5') {
|
if (store.state.$deviceType == 'weixinh5') {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
location.href = option.mweb_url;
|
location.href = option.mweb_url
|
||||||
}, 100);
|
}, 100)
|
||||||
resolve()
|
resolve()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (store.state.$deviceType == 'weixin') {
|
if (store.state.$deviceType == 'weixin') {
|
||||||
pay(option).then(() => {
|
pay(option)
|
||||||
|
.then(() => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '支付成功', icon: 'success', duration: 5000,
|
title: '支付成功',
|
||||||
});
|
icon: 'success',
|
||||||
|
duration: 5000,
|
||||||
|
})
|
||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
.finally(res => {
|
.finally(res => {
|
||||||
//if(typeof(res) == "undefined") return
|
//if(typeof(res) == "undefined") return
|
||||||
})
|
})
|
||||||
.catch(function() {
|
.catch(function() {
|
||||||
uni.showToast({ title: '支付失败', icon: 'none', duration: 5000 });
|
uni.showToast({ title: '支付失败', icon: 'none', duration: 5000 })
|
||||||
reject()
|
reject()
|
||||||
});
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 吊起微信支付
|
// 吊起微信支付
|
||||||
@@ -50,11 +53,13 @@ export const weappPay = (option) => {
|
|||||||
...option,
|
...option,
|
||||||
timestamp: orderInfo.timestamp,
|
timestamp: orderInfo.timestamp,
|
||||||
orderInfo,
|
orderInfo,
|
||||||
success: (success) => {
|
success: success => {
|
||||||
console.log(success)
|
console.log(success)
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '支付成功', icon: 'success', duration: 5000,
|
title: '支付成功',
|
||||||
});
|
icon: 'success',
|
||||||
|
duration: 5000,
|
||||||
|
})
|
||||||
let time = setTimeout(() => {
|
let time = setTimeout(() => {
|
||||||
clearTimeout(time)
|
clearTimeout(time)
|
||||||
resolve(success)
|
resolve(success)
|
||||||
@@ -63,28 +68,26 @@ export const weappPay = (option) => {
|
|||||||
subscribeMessage()
|
subscribeMessage()
|
||||||
// #endif
|
// #endif
|
||||||
},
|
},
|
||||||
fail: (error) => {
|
fail: error => {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
if (error.errMsg == 'requestPayment:fail cancel') {
|
if (error.errMsg == 'requestPayment:fail cancel') {
|
||||||
uni.showToast({ title: '已取消支付', icon: 'none', duration: 5000 });
|
uni.showToast({ title: '已取消支付', icon: 'none', duration: 5000 })
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({ title: error || error.msg, icon: 'none', duration: 5000 });
|
uni.showToast({ title: error || error.msg, icon: 'none', duration: 5000 })
|
||||||
}
|
}
|
||||||
reject(error)
|
reject(error)
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
// })
|
// })
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const STATE_KEY = 'wx_authorize_state'
|
||||||
|
const WX_AUTH = 'wx_auth'
|
||||||
const STATE_KEY = "wx_authorize_state";
|
const BACK_URL = 'login_back_url'
|
||||||
const WX_AUTH = "wx_auth";
|
const LOGINTYPE = 'loginType'
|
||||||
const BACK_URL = "login_back_url";
|
let instance
|
||||||
const LOGINTYPE = "loginType";
|
let wechatObj
|
||||||
let instance;
|
|
||||||
let wechatObj;
|
|
||||||
let appId
|
let appId
|
||||||
let wechatLoading = false
|
let wechatLoading = false
|
||||||
|
|
||||||
@@ -92,41 +95,41 @@ export function wechat() {
|
|||||||
console.log('初始化微信配置')
|
console.log('初始化微信配置')
|
||||||
wechatLoading = false
|
wechatLoading = false
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (instance) return resolve(instance);
|
if (instance) return resolve(instance)
|
||||||
getWechatConfig()
|
getWechatConfig()
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log(res.data)
|
console.log(res.data)
|
||||||
const _wx = WechatJSSDK(res.data);
|
const _wx = WechatJSSDK(res.data)
|
||||||
console.log(_wx)
|
console.log(_wx)
|
||||||
appId = res.data.appId
|
appId = res.data.appId
|
||||||
wechatObj = _wx;
|
wechatObj = _wx
|
||||||
_wx
|
_wx
|
||||||
.initialize()
|
.initialize()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
instance = _wx.wx;
|
instance = _wx.wx
|
||||||
instance.initConfig = res.data;
|
instance.initConfig = res.data
|
||||||
resolve(instance);
|
resolve(instance)
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: error,
|
title: error,
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
duration: 2000
|
duration: 2000,
|
||||||
});
|
})
|
||||||
reject()
|
reject()
|
||||||
});
|
})
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.log(err);
|
console.log(err)
|
||||||
reject();
|
reject()
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function clearAuthStatus() {
|
export function clearAuthStatus() {
|
||||||
cookie.remove(WX_AUTH);
|
cookie.remove(WX_AUTH)
|
||||||
cookie.remove(STATE_KEY);
|
cookie.remove(STATE_KEY)
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function oAuth() {
|
export async function oAuth() {
|
||||||
@@ -137,11 +140,11 @@ export async function oAuth() {
|
|||||||
// if (cookie.has(WX_AUTH)) {
|
// if (cookie.has(WX_AUTH)) {
|
||||||
if (cookie.has(WX_AUTH) && store.state.token) {
|
if (cookie.has(WX_AUTH) && store.state.token) {
|
||||||
reject()
|
reject()
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
const { code } = parseQuery();
|
const { code } = parseQuery()
|
||||||
if (!code) {
|
if (!code) {
|
||||||
toAuth();
|
toAuth()
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
auth(code)
|
auth(code)
|
||||||
@@ -155,24 +158,24 @@ export async function oAuth() {
|
|||||||
export async 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)
|
console.log('微信授权登录前获取spread', spread)
|
||||||
wechatAuth(code, spread, loginType)
|
wechatAuth(code, spread, loginType)
|
||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
console.log(data)
|
console.log(data)
|
||||||
const expires_time = dayjs(data.expires_time);
|
const expires_time = dayjs(data.expires_time)
|
||||||
const newTime = Math.round(new Date() / 1000);
|
const newTime = Math.round(new Date() / 1000)
|
||||||
store.commit("login", data.token, expires_time - newTime);
|
store.commit('login', data.token, expires_time - newTime)
|
||||||
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)
|
||||||
console.log('微信公众号授权登录,获取用户信息')
|
console.log('微信公众号授权登录,获取用户信息')
|
||||||
store.dispatch('getUser').finally(() => {
|
store.dispatch('getUser').finally(() => {
|
||||||
resolve();
|
resolve()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.catch(reject);
|
.catch(reject)
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
})
|
})
|
||||||
@@ -184,27 +187,26 @@ export async function toAuth() {
|
|||||||
}
|
}
|
||||||
wechatLoading = true
|
wechatLoading = true
|
||||||
wechat().then(wx => {
|
wechat().then(wx => {
|
||||||
location.href = getAuthUrl(appId);
|
location.href = getAuthUrl(appId)
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAuthUrl(appId) {
|
function getAuthUrl(appId) {
|
||||||
|
|
||||||
// const redirect_uri = encodeURIComponent(window.location.href);
|
// const redirect_uri = encodeURIComponent(window.location.href);
|
||||||
// const redirect_uri = encodeURIComponent(`${location.origin}/pages/Loading/index`);
|
// const redirect_uri = encodeURIComponent(`${location.origin}/pages/Loading/index`);
|
||||||
|
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
// #endif
|
// #endif
|
||||||
cookie.set('redirect', window.location.href)
|
cookie.set('redirect', window.location.href)
|
||||||
const redirect_uri = encodeURIComponent(`${location.origin}/pages/Loading/index`);
|
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)
|
||||||
const state = 'STATE'
|
const state = 'STATE'
|
||||||
// const state = encodeURIComponent(("" + Math.random()).split(".")[1] + "authorizestate");
|
// const state = encodeURIComponent(("" + Math.random()).split(".")[1] + "authorizestate");
|
||||||
cookie.set(STATE_KEY, state);
|
cookie.set(STATE_KEY, state)
|
||||||
return `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`;
|
return `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
|
||||||
}
|
}
|
||||||
|
|
||||||
function toPromise(fn, config = {}) {
|
function toPromise(fn, config = {}) {
|
||||||
@@ -212,185 +214,184 @@ function toPromise(fn, config = {}) {
|
|||||||
fn({
|
fn({
|
||||||
...config,
|
...config,
|
||||||
success(res) {
|
success(res) {
|
||||||
resolve(res);
|
resolve(res)
|
||||||
},
|
},
|
||||||
fail(err) {
|
fail(err) {
|
||||||
reject(err);
|
reject(err)
|
||||||
},
|
},
|
||||||
complete(err) {
|
complete(err) {
|
||||||
reject(err);
|
reject(err)
|
||||||
},
|
},
|
||||||
cancel(err) {
|
cancel(err) {
|
||||||
reject(err);
|
reject(err)
|
||||||
}
|
},
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function pay(config) {
|
export function pay(config) {
|
||||||
console.log(instance)
|
console.log(instance)
|
||||||
return toPromise(instance.chooseWXPay, config);
|
return toPromise(instance.chooseWXPay, config)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function openAddress() {
|
export function openAddress() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
wechatEvevt("openAddress", {})
|
wechatEvevt('openAddress', {})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
resolve(res);
|
resolve(res)
|
||||||
})
|
})
|
||||||
.catch(res => {
|
.catch(res => {
|
||||||
if (res.is_ready) {
|
if (res.is_ready) {
|
||||||
res.wx.openAddress({
|
res.wx.openAddress({
|
||||||
fail(res) {
|
fail(res) {
|
||||||
reject(res);
|
reject(res)
|
||||||
},
|
},
|
||||||
success(res) {
|
success(res) {
|
||||||
resolve(res);
|
resolve(res)
|
||||||
}
|
},
|
||||||
});
|
})
|
||||||
} else {
|
} else {
|
||||||
reject(res);
|
reject(res)
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function openShareAll(config) {
|
export function openShareAll(config) {
|
||||||
config || {};
|
config || {}
|
||||||
config.type = config.type == undefined ? "link" : config.type;
|
config.type = config.type == undefined ? 'link' : config.type
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
getWechatConfig().then(res => {
|
getWechatConfig().then(res => {
|
||||||
wechatObj.signSignature({
|
wechatObj.signSignature({
|
||||||
nonceStr: res.data.nonceStr,
|
nonceStr: res.data.nonceStr,
|
||||||
signature: res.data.signature,
|
signature: res.data.signature,
|
||||||
timestamp: res.data.timestamp
|
timestamp: res.data.timestamp,
|
||||||
});
|
})
|
||||||
instance = wechatObj.getOriginalWx();
|
instance = wechatObj.getOriginalWx()
|
||||||
instance.ready(() => {
|
instance.ready(() => {
|
||||||
instance.updateAppMessageShareData(config);
|
instance.updateAppMessageShareData(config)
|
||||||
instance.updateTimelineShareData(config);
|
instance.updateTimelineShareData(config)
|
||||||
resolve();
|
resolve()
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function openShareAppMessage(config) {
|
export function openShareAppMessage(config) {
|
||||||
instance.updateAppMessageShareData(config);
|
instance.updateAppMessageShareData(config)
|
||||||
instance.onMenuShareAppMessage && instance.onMenuShareAppMessage(config);
|
instance.onMenuShareAppMessage && instance.onMenuShareAppMessage(config)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function openShareTimeline(config) {
|
export function openShareTimeline(config) {
|
||||||
instance.updateTimelineShareData(config);
|
instance.updateTimelineShareData(config)
|
||||||
instance.onMenuShareTimeline && instance.onMenuShareTimeline(config);
|
instance.onMenuShareTimeline && instance.onMenuShareTimeline(config)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function wechatEvevt(name, config) {
|
export function wechatEvevt(name, config) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let wx;
|
let wx
|
||||||
let configDefault = {
|
let configDefault = {
|
||||||
fail(res) {
|
fail(res) {
|
||||||
if (wx) return reject({ is_ready: true, wx: wx });
|
if (wx) return reject({ is_ready: true, wx: wx })
|
||||||
getWechatConfig().then(res => {
|
getWechatConfig().then(res => {
|
||||||
wechatObj.signSignature({
|
wechatObj.signSignature({
|
||||||
nonceStr: res.data.nonceStr,
|
nonceStr: res.data.nonceStr,
|
||||||
signature: res.data.signature,
|
signature: res.data.signature,
|
||||||
timestamp: res.data.timestamp
|
timestamp: res.data.timestamp,
|
||||||
});
|
})
|
||||||
wx = wechatObj.getOriginalWx();
|
wx = wechatObj.getOriginalWx()
|
||||||
reject({ is_ready: true, wx: wx });
|
reject({ is_ready: true, wx: wx })
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
success(res) {
|
success(res) {
|
||||||
resolve(res);
|
resolve(res)
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
Object.assign(configDefault, config)
|
||||||
Object.assign(configDefault, config);
|
if (typeof instance !== 'undefined') {
|
||||||
if (typeof instance !== "undefined") {
|
|
||||||
instance.ready(() => {
|
instance.ready(() => {
|
||||||
if (typeof name === "object") {
|
if (typeof name === 'object') {
|
||||||
name.forEach(item => {
|
name.forEach(item => {
|
||||||
instance[item] && instance[item](configDefault);
|
instance[item] && instance[item](configDefault)
|
||||||
});
|
})
|
||||||
} else instance[name] && instance[name](configDefault);
|
} else instance[name] && instance[name](configDefault)
|
||||||
});
|
})
|
||||||
} else {
|
} else {
|
||||||
getWechatConfig().then(res => {
|
getWechatConfig().then(res => {
|
||||||
const _wx = WechatJSSDK(res.data);
|
const _wx = WechatJSSDK(res.data)
|
||||||
_wx.initialize().then(() => {
|
_wx.initialize().then(() => {
|
||||||
instance = _wx.getOriginalWx();
|
instance = _wx.getOriginalWx()
|
||||||
instance.ready(() => {
|
instance.ready(() => {
|
||||||
if (typeof name === "object") {
|
if (typeof name === 'object') {
|
||||||
name.forEach(item => {
|
name.forEach(item => {
|
||||||
instance[item] && instance[item](configDefault);
|
instance[item] && instance[item](configDefault)
|
||||||
});
|
})
|
||||||
} else instance[name] && instance[name](configDefault);
|
} else instance[name] && instance[name](configDefault)
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ready() {
|
export function ready() {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
if (typeof instance !== "undefined") {
|
if (typeof instance !== 'undefined') {
|
||||||
instance.ready(() => {
|
instance.ready(() => {
|
||||||
resolve(instance);
|
resolve(instance)
|
||||||
});
|
})
|
||||||
} else {
|
} else {
|
||||||
getWechatConfig().then(res => {
|
getWechatConfig().then(res => {
|
||||||
const _wx = WechatJSSDK(res.data);
|
const _wx = WechatJSSDK(res.data)
|
||||||
_wx.initialize().then(() => {
|
_wx.initialize().then(() => {
|
||||||
instance = _wx.wx;
|
instance = _wx.wx
|
||||||
instance.ready(() => {
|
instance.ready(() => {
|
||||||
resolve(instance);
|
resolve(instance)
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function wxShowLocation() {
|
export function wxShowLocation() {
|
||||||
return new Promise(() => {
|
return new Promise(() => {
|
||||||
wechatEvevt("getLocation", { type: "wgs84" })
|
wechatEvevt('getLocation', { type: 'wgs84' })
|
||||||
.then(res => {
|
.then(res => {
|
||||||
let latitude = res.latitude; // 纬度
|
let latitude = res.latitude // 纬度
|
||||||
let longitude = res.longitude; // 经度
|
let longitude = res.longitude // 经度
|
||||||
cookie.set(LATITUDE, latitude);
|
cookie.set(LATITUDE, latitude)
|
||||||
cookie.set(LONGITUDE, longitude);
|
cookie.set(LONGITUDE, longitude)
|
||||||
})
|
})
|
||||||
.catch(res => {
|
.catch(res => {
|
||||||
if (res.is_ready) {
|
if (res.is_ready) {
|
||||||
res.wx.getLocation({
|
res.wx.getLocation({
|
||||||
success(res) {
|
success(res) {
|
||||||
let latitude = res.latitude; // 纬度
|
let latitude = res.latitude // 纬度
|
||||||
let longitude = res.longitude; // 经度
|
let longitude = res.longitude // 经度
|
||||||
cookie.set(LATITUDE, latitude);
|
cookie.set(LATITUDE, latitude)
|
||||||
cookie.set(LONGITUDE, longitude);
|
cookie.set(LONGITUDE, longitude)
|
||||||
},
|
},
|
||||||
cancel() {
|
cancel() {
|
||||||
cookie.remove(LATITUDE);
|
cookie.remove(LATITUDE)
|
||||||
cookie.remove(LONGITUDE);
|
cookie.remove(LONGITUDE)
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "取消获取位置",
|
title: '取消获取位置',
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
fail() {
|
fail() {
|
||||||
cookie.remove(LATITUDE);
|
cookie.remove(LATITUDE)
|
||||||
cookie.remove(LONGITUDE);
|
cookie.remove(LONGITUDE)
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "授权失败",
|
title: '授权失败',
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
});
|
})
|
||||||
|
},
|
||||||
|
})
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@@ -27,23 +27,6 @@ const app = new Vue({
|
|||||||
store,
|
store,
|
||||||
})
|
})
|
||||||
|
|
||||||
Vue.mixin({
|
|
||||||
onLoad() {
|
|
||||||
const { $mp } = this.$root
|
|
||||||
this._route = parseRoute($mp)
|
|
||||||
},
|
|
||||||
onShow() {
|
|
||||||
_router.app = this
|
|
||||||
_router.currentRoute = this._route
|
|
||||||
},
|
|
||||||
// 这里为了解决 .vue文件中 template 无法获取 VUE.prototype 绑定的变量
|
|
||||||
computed: {
|
|
||||||
$VUE_APP_RESOURCES_URL() {
|
|
||||||
return VUE_APP_RESOURCES_URL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
Object.defineProperty(Vue.prototype, '$yrouter', {
|
Object.defineProperty(Vue.prototype, '$yrouter', {
|
||||||
get() {
|
get() {
|
||||||
return _router
|
return _router
|
||||||
@@ -59,17 +42,16 @@ Object.defineProperty(Vue.prototype, '$yroute', {
|
|||||||
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)
|
||||||
|
|
||||||
|
let deviceType = ''
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
// App平台编译的代码
|
// App平台编译的代码
|
||||||
Vue.prototype.$deviceType = 'app'
|
deviceType = 'app'
|
||||||
store.commit('updateDevicetype', 'app')
|
|
||||||
Vue.prototype.$platform = uni.getSystemInfoSync().platform
|
Vue.prototype.$platform = uni.getSystemInfoSync().platform
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
// 微信小程序编译的代码
|
// 微信小程序编译的代码
|
||||||
Vue.prototype.$deviceType = 'routine'
|
deviceType = 'routine'
|
||||||
store.commit('updateDevicetype', 'routine')
|
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// !!! ps 不建议在 template 中使用 $deviceType 去判断当前环境,很有可能出现 $deviceType 为 undefined 导致判断出错的问题,可以在 script 模块中正常使用
|
// !!! ps 不建议在 template 中使用 $deviceType 去判断当前环境,很有可能出现 $deviceType 为 undefined 导致判断出错的问题,可以在 script 模块中正常使用
|
||||||
@@ -99,29 +81,42 @@ if (urlSpread) {
|
|||||||
|
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
async function init() {
|
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
// H5编译的代码
|
// H5编译的代码
|
||||||
// 判断是否是微信浏览器
|
// 判断是否是微信浏览器
|
||||||
|
async function init() {
|
||||||
if (isWeixin()) {
|
if (isWeixin()) {
|
||||||
Vue.prototype.$deviceType = 'weixin'
|
deviceType = 'weixin'
|
||||||
store.commit('updateDevicetype', 'weixin')
|
let wechatInit = wechat()
|
||||||
let wechatInit = await wechat()
|
|
||||||
console.log(wechatInit)
|
|
||||||
if (wechatInit) {
|
if (wechatInit) {
|
||||||
await oAuth()
|
await oAuth()
|
||||||
app.$mount()
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Vue.prototype.$deviceType = 'weixinh5'
|
deviceType = 'weixinh5'
|
||||||
store.commit('updateDevicetype', 'weixinh5')
|
|
||||||
app.$mount()
|
|
||||||
}
|
}
|
||||||
// #endif
|
|
||||||
|
|
||||||
// #ifndef H5
|
|
||||||
app.$mount()
|
|
||||||
// #endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
init()
|
init()
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
Vue.prototype.$deviceType = deviceType
|
||||||
|
|
||||||
|
Vue.mixin({
|
||||||
|
onLoad() {
|
||||||
|
const { $mp } = this.$root
|
||||||
|
this._route = parseRoute($mp)
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
_router.app = this
|
||||||
|
_router.currentRoute = this._route
|
||||||
|
},
|
||||||
|
// 这里为了解决 .vue文件中 template 无法获取 VUE.prototype 绑定的变量
|
||||||
|
computed: {
|
||||||
|
$VUE_APP_RESOURCES_URL() {
|
||||||
|
return VUE_APP_RESOURCES_URL
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
store.commit('updateDevicetype', deviceType)
|
||||||
|
|
||||||
|
app.$mount()
|
||||||
|
|||||||
@@ -45,12 +45,12 @@
|
|||||||
<view class="tui-list__goods">
|
<view class="tui-list__goods">
|
||||||
<view class="tui-goods__left">
|
<view class="tui-goods__left">
|
||||||
<block v-for="(item, index) in seckillList" :key="index">
|
<block v-for="(item, index) in seckillList" :key="index">
|
||||||
<t-goods-item v-if="index % 2 == 0" :item="item" :isList="false" @goDetail="goDetail"></t-goods-item>
|
<t-goods-item v-if="index % 2 == 0" :item="item" :timeList="timeList" :active="active" :isList="false" @goDetail="goDetail"></t-goods-item>
|
||||||
</block>
|
</block>
|
||||||
</view>
|
</view>
|
||||||
<view class="tui-goods__right">
|
<view class="tui-goods__right">
|
||||||
<block v-for="(item, index) in seckillList" :key="index">
|
<block v-for="(item, index) in seckillList" :key="index">
|
||||||
<t-goods-item v-if="index % 2 !== 0" :item="item" :isList="false" @goDetail="goDetail"></t-goods-item>
|
<t-goods-item v-if="index % 2 !== 0" :item="item" :timeList="timeList" :active="active" :isList="false" @goDetail="goDetail"></t-goods-item>
|
||||||
</block>
|
</block>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -189,7 +189,7 @@ export default {
|
|||||||
query: {
|
query: {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
time,
|
time,
|
||||||
status: item.status,
|
status: that.timeList[that.active].status,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
+100
-110
@@ -13,13 +13,14 @@
|
|||||||
<text class="iconfont icon-xiazai5"></text>
|
<text class="iconfont icon-xiazai5"></text>
|
||||||
搜索商品
|
搜索商品
|
||||||
</view>
|
</view>
|
||||||
<view class="qr" @click="startQr()">
|
<!-- #ifndef H5 -->
|
||||||
|
<view class="qr" @click="startQr()" v-if="$deviceType !== 'weixin'">
|
||||||
<image :src="`${$VUE_APP_RESOURCES_URL}/images/qr.png`" />
|
<image :src="`${$VUE_APP_RESOURCES_URL}/images/qr.png`" />
|
||||||
</view>
|
</view>
|
||||||
|
<!-- #endif -->
|
||||||
</view>
|
</view>
|
||||||
<Banner v-if="item.type == 'banner'" :detail="item.componentContent.bannerData" @getbgcolor="getbgcolor"></Banner>
|
<Banner v-if="item.type == 'banner'" :detail="item.componentContent.bannerData" @getbgcolor="getbgcolor"></Banner>
|
||||||
<uni-notice-bar v-if="item.type=='noticeBar'" scrollable="true" @click="goRoll(item.componentContent.roll[0])"
|
<uni-notice-bar v-if="item.type == 'noticeBar'" scrollable="true" @click="goRoll(item.componentContent.roll[0])" single="true" :speed="10" showIcon="true" :text="item.componentContent.roll[0].info"></uni-notice-bar>
|
||||||
single="true" :speed="10" showIcon="true" :text="item.componentContent.roll[0].info"></uni-notice-bar>
|
|
||||||
<view class="content_box home_content_box" v-if="item.type == 'menu' && item.componentContent.menus">
|
<view class="content_box home_content_box" v-if="item.type == 'menu' && item.componentContent.menus">
|
||||||
<!-- 菜单 -->
|
<!-- 菜单 -->
|
||||||
<Menu :list="item.componentContent.menus"></Menu>
|
<Menu :list="item.componentContent.menus"></Menu>
|
||||||
@@ -43,50 +44,36 @@
|
|||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
<!-- 为您推荐 -->
|
<!-- 为您推荐 -->
|
||||||
<PromotionGood v-if="item.type == 'promotionGood'" :benefit="benefit"></PromotionGood>
|
<PromotionGood v-if="item.type == 'promotionGood'" :benefit="benefit"></PromotionGood>
|
||||||
<Coupon-window :coupon-list="couponList" v-if="showCoupon" @checked="couponClose" @close="couponClose">
|
<Coupon-window :coupon-list="couponList" v-if="showCoupon" @checked="couponClose" @close="couponClose"> </Coupon-window>
|
||||||
</Coupon-window>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import {
|
import { mapState, mapMutations, mapActions } from 'vuex'
|
||||||
mapState,
|
import GoodList from '@/components/GoodList'
|
||||||
mapMutations,
|
import PromotionGood from '@/components/PromotionGood'
|
||||||
mapActions
|
import CouponWindow from '@/components/CouponWindow'
|
||||||
} from "vuex";
|
import Menu from '@/components/Menu'
|
||||||
import GoodList from "@/components/GoodList";
|
import UniNoticeBar from '@/components/uni-notice-bar/uni-notice-bar'
|
||||||
import PromotionGood from "@/components/PromotionGood";
|
import Adv from '@/components/sh-adv'
|
||||||
import CouponWindow from "@/components/CouponWindow";
|
import Groupon from '@/components/sh-groupon.vue'
|
||||||
import Menu from "@/components/Menu";
|
|
||||||
import UniNoticeBar from "@/components/uni-notice-bar/uni-notice-bar";
|
|
||||||
import Adv from "@/components/sh-adv";
|
|
||||||
import Groupon from "@/components/sh-groupon.vue";
|
|
||||||
|
|
||||||
import Banner from "./components/Banner";
|
import Banner from './components/Banner'
|
||||||
import HotCommodity from "./components/HotCommodity";
|
import HotCommodity from './components/HotCommodity'
|
||||||
import FirstNewProduct from "./components/FirstNewProduct";
|
import FirstNewProduct from './components/FirstNewProduct'
|
||||||
import ProductsRecommended from "./components/ProductsRecommended";
|
import ProductsRecommended from './components/ProductsRecommended'
|
||||||
import Live from "./components/Live";
|
import Live from './components/Live'
|
||||||
|
|
||||||
import {
|
import { getHomeData, getShare, getCanvas } from '@/api/public'
|
||||||
getHomeData,
|
import cookie from '@/utils/store/cookie'
|
||||||
getShare,
|
import { isWeixin, handleUrlParam } from '@/utils/index'
|
||||||
getCanvas
|
|
||||||
} from "@/api/public";
|
|
||||||
import cookie from "@/utils/store/cookie";
|
|
||||||
import {
|
|
||||||
isWeixin,
|
|
||||||
handleUrlParam
|
|
||||||
} from "@/utils/index";
|
|
||||||
|
|
||||||
import {
|
import { openShareAll } from '@/libs/wechat'
|
||||||
openShareAll,
|
|
||||||
} from '@/libs/wechat'
|
|
||||||
|
|
||||||
const HAS_COUPON_WINDOW = "has_coupon_window";
|
const HAS_COUPON_WINDOW = 'has_coupon_window'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Index",
|
name: 'Index',
|
||||||
components: {
|
components: {
|
||||||
// swiper,
|
// swiper,
|
||||||
// swiperSlide,
|
// swiperSlide,
|
||||||
@@ -112,12 +99,12 @@
|
|||||||
formatMenus: [],
|
formatMenus: [],
|
||||||
categoryCurrent: 0,
|
categoryCurrent: 0,
|
||||||
menuNum: 4,
|
menuNum: 4,
|
||||||
bgcolor: "",
|
bgcolor: '',
|
||||||
bgColor: "",
|
bgColor: '',
|
||||||
swiperCurrent: 0, //轮播下标
|
swiperCurrent: 0, //轮播下标
|
||||||
webviewId: 0,
|
webviewId: 0,
|
||||||
showCoupon: false,
|
showCoupon: false,
|
||||||
logoUrl: "",
|
logoUrl: '',
|
||||||
banner: [],
|
banner: [],
|
||||||
menus: [],
|
menus: [],
|
||||||
combinationList: [],
|
combinationList: [],
|
||||||
@@ -139,7 +126,7 @@
|
|||||||
couponList: [],
|
couponList: [],
|
||||||
swiperOption: {
|
swiperOption: {
|
||||||
pagination: {
|
pagination: {
|
||||||
el: ".swiper-pagination",
|
el: '.swiper-pagination',
|
||||||
clickable: true,
|
clickable: true,
|
||||||
},
|
},
|
||||||
autoplay: {
|
autoplay: {
|
||||||
@@ -152,7 +139,7 @@
|
|||||||
observeParents: true,
|
observeParents: true,
|
||||||
},
|
},
|
||||||
swiperRoll: {
|
swiperRoll: {
|
||||||
direction: "vertical",
|
direction: 'vertical',
|
||||||
autoplay: {
|
autoplay: {
|
||||||
disableOnInteraction: false,
|
disableOnInteraction: false,
|
||||||
delay: 2000,
|
delay: 2000,
|
||||||
@@ -165,13 +152,13 @@
|
|||||||
swiperScroll: {
|
swiperScroll: {
|
||||||
freeMode: true,
|
freeMode: true,
|
||||||
freeModeMomentum: false,
|
freeModeMomentum: false,
|
||||||
slidesPerView: "auto",
|
slidesPerView: 'auto',
|
||||||
observer: true,
|
observer: true,
|
||||||
observeParents: true,
|
observeParents: true,
|
||||||
},
|
},
|
||||||
swiperBoutique: {
|
swiperBoutique: {
|
||||||
pagination: {
|
pagination: {
|
||||||
el: ".swiper-pagination",
|
el: '.swiper-pagination',
|
||||||
clickable: true,
|
clickable: true,
|
||||||
},
|
},
|
||||||
autoplay: {
|
autoplay: {
|
||||||
@@ -186,167 +173,169 @@
|
|||||||
swiperProducts: {
|
swiperProducts: {
|
||||||
freeMode: true,
|
freeMode: true,
|
||||||
freeModeMomentum: false,
|
freeModeMomentum: false,
|
||||||
slidesPerView: "auto",
|
slidesPerView: 'auto',
|
||||||
observer: true,
|
observer: true,
|
||||||
observeParents: true,
|
observeParents: true,
|
||||||
},
|
},
|
||||||
bgImage: "",
|
bgImage: '',
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
singNew() {
|
singNew() {
|
||||||
return this.roll.length > 0 ? this.roll[0] : "你还没添加通知哦!";
|
return this.roll.length > 0 ? this.roll[0] : '你还没添加通知哦!'
|
||||||
},
|
},
|
||||||
customStyle() {
|
customStyle() {
|
||||||
var bgImage = this.bgImage;
|
var bgImage = this.bgImage
|
||||||
// var style = `height:${this.CustomBar}px;padding-top:${0}px;background: ${this.bgcolor}`;
|
// var style = `height:${this.CustomBar}px;padding-top:${0}px;background: ${this.bgcolor}`;
|
||||||
var style = `height:${this.CustomBar}px;padding-top:${this.StatusBar}px;background: ${this.bgcolor}`;
|
var style = `height:${this.CustomBar}px;padding-top:${this.StatusBar}px;background: ${this.bgcolor}`
|
||||||
if (this.bgImage) {
|
if (this.bgImage) {
|
||||||
style = `${style}background-image:url(${bgImage});`;
|
style = `${style}background-image:url(${bgImage});`
|
||||||
}
|
}
|
||||||
return style;
|
return style
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
onLoad: function() {
|
onLoad: function() {
|
||||||
this.getLocation();
|
this.getLocation()
|
||||||
let that = this;
|
let that = this
|
||||||
// uni.showLoading({
|
// uni.showLoading({
|
||||||
// title: "加载中",
|
// title: "加载中",
|
||||||
// });
|
// });
|
||||||
getCanvas().then(res => {}).catch(error => {
|
getCanvas()
|
||||||
|
.then(res => {})
|
||||||
|
.catch(error => {
|
||||||
this.homeData = JSON.parse(error.data.json)
|
this.homeData = JSON.parse(error.data.json)
|
||||||
console.log(this.homeData)
|
console.log(this.homeData)
|
||||||
console.log(222)
|
console.log(222)
|
||||||
})
|
})
|
||||||
getHomeData().then((res) => {
|
getHomeData().then(res => {
|
||||||
that.logoUrl = res.data.logoUrl;
|
that.logoUrl = res.data.logoUrl
|
||||||
res.data.banner.map((item) => (item.bgcolor = item.color || ""));
|
res.data.banner.map(item => (item.bgcolor = item.color || ''))
|
||||||
that.$set(that, "info", res.data.info);
|
that.$set(that, 'info', res.data.info)
|
||||||
that.$set(that, "firstList", res.data.firstList);
|
that.$set(that, 'firstList', res.data.firstList)
|
||||||
that.$set(that, "bastList", res.data.bastList);
|
that.$set(that, 'bastList', res.data.bastList)
|
||||||
that.$set(that, "likeInfo", res.data.likeInfo);
|
that.$set(that, 'likeInfo', res.data.likeInfo)
|
||||||
that.$set(that, "live", res.data.liveList);
|
that.$set(that, 'live', res.data.liveList)
|
||||||
that.$set(that, "lovely", res.data.lovely);
|
that.$set(that, 'lovely', res.data.lovely)
|
||||||
that.$set(that, "benefit", res.data.benefit);
|
that.$set(that, 'benefit', res.data.benefit)
|
||||||
that.$set(that, "couponList", res.data.couponList);
|
that.$set(that, 'couponList', res.data.couponList)
|
||||||
that.$set(that, "combinationList", res.data.combinationList);
|
that.$set(that, 'combinationList', res.data.combinationList)
|
||||||
uni.hideLoading();
|
uni.hideLoading()
|
||||||
that.setOpenShare();
|
that.setOpenShare()
|
||||||
// that.doColorThief()
|
// that.doColorThief()
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(["getLocation"]),
|
...mapActions(['getLocation']),
|
||||||
onShareTimeline: function() {
|
onShareTimeline: function() {
|
||||||
return {
|
return {
|
||||||
title: this.miniHomeRemark,
|
title: this.miniHomeRemark,
|
||||||
imageUrl: this.miniHomeImg,
|
imageUrl: this.miniHomeImg,
|
||||||
path: "pages/home/index?spread=" + uni.getStorageSync("uid"),
|
path: 'pages/home/index?spread=' + uni.getStorageSync('uid'),
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
onShareAppMessage: function() {
|
onShareAppMessage: function() {
|
||||||
return {
|
return {
|
||||||
title: this.miniHomeRemark,
|
title: this.miniHomeRemark,
|
||||||
imageUrl: this.miniHomeImg,
|
imageUrl: this.miniHomeImg,
|
||||||
path: "pages/home/index?spread=" + uni.getStorageSync("uid"),
|
path: 'pages/home/index?spread=' + uni.getStorageSync('uid'),
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
goRoll(item) {
|
goRoll(item) {
|
||||||
if (item.uniapp_url) {
|
if (item.uniapp_url) {
|
||||||
this.$yrouter.push(item.uniapp_url);
|
this.$yrouter.push(item.uniapp_url)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
goGoodSearch() {
|
goGoodSearch() {
|
||||||
// this.$yrouter.push('/pages/shop/GoodsEvaluate/index');
|
// this.$yrouter.push('/pages/shop/GoodsEvaluate/index');
|
||||||
this.$yrouter.push("/pages/shop/GoodSearch/index");
|
this.$yrouter.push('/pages/shop/GoodSearch/index')
|
||||||
},
|
},
|
||||||
goWxappUrl(item) {
|
goWxappUrl(item) {
|
||||||
this.$yrouter.push(item.uniapp_url);
|
this.$yrouter.push(item.uniapp_url)
|
||||||
},
|
},
|
||||||
goHotNewGoods(type) {
|
goHotNewGoods(type) {
|
||||||
this.$yrouter.push({
|
this.$yrouter.push({
|
||||||
path: "/pages/shop/HotNewGoods/index",
|
path: '/pages/shop/HotNewGoods/index',
|
||||||
query: {
|
query: {
|
||||||
type,
|
type,
|
||||||
},
|
},
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
goGoodsCon(item) {
|
goGoodsCon(item) {
|
||||||
this.$yrouter.push({
|
this.$yrouter.push({
|
||||||
path: "/pages/shop/GoodsCon/index",
|
path: '/pages/shop/GoodsCon/index',
|
||||||
query: {
|
query: {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
},
|
},
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
goGoodsPromotion() {
|
goGoodsPromotion() {
|
||||||
this.$yrouter.push("/pages/shop/GoodsPromotion/index");
|
this.$yrouter.push('/pages/shop/GoodsPromotion/index')
|
||||||
},
|
},
|
||||||
setOpenShare: function() {
|
setOpenShare: function() {
|
||||||
if (this.$deviceType == "weixin") {
|
if (this.$deviceType == 'weixin') {
|
||||||
getShare().then((res) => {
|
getShare().then(res => {
|
||||||
var data = res.data.data;
|
var data = res.data.data
|
||||||
var configAppMessage = {
|
var configAppMessage = {
|
||||||
desc: data.synopsis,
|
desc: data.synopsis,
|
||||||
title: data.title,
|
title: data.title,
|
||||||
link: location.href,
|
link: location.href,
|
||||||
imgUrl: data.img,
|
imgUrl: data.img,
|
||||||
};
|
}
|
||||||
openShareAll(configAppMessage);
|
openShareAll(configAppMessage)
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
startQr: function() {
|
startQr: function() {
|
||||||
uni.scanCode({
|
uni.scanCode({
|
||||||
success: (res) => {
|
success: res => {
|
||||||
let option = handleUrlParam(res.result);
|
let option = handleUrlParam(res.result)
|
||||||
switch (option.pageType) {
|
switch (option.pageType) {
|
||||||
case "good":
|
case 'good':
|
||||||
// 跳转商品详情
|
// 跳转商品详情
|
||||||
this.$yrouter.push({
|
this.$yrouter.push({
|
||||||
path: "/pages/shop/GoodsCon/index",
|
path: '/pages/shop/GoodsCon/index',
|
||||||
query: {
|
query: {
|
||||||
q: res.result,
|
q: res.result,
|
||||||
},
|
},
|
||||||
});
|
})
|
||||||
break;
|
break
|
||||||
case "group":
|
case 'group':
|
||||||
// 跳转团购
|
// 跳转团购
|
||||||
this.$yrouter.push({
|
this.$yrouter.push({
|
||||||
path: "/pages/activity/GroupRule/index",
|
path: '/pages/activity/GroupRule/index',
|
||||||
query: {
|
query: {
|
||||||
q: res.result,
|
q: res.result,
|
||||||
},
|
},
|
||||||
});
|
})
|
||||||
break;
|
break
|
||||||
case "dargain":
|
case 'dargain':
|
||||||
// 跳转砍价
|
// 跳转砍价
|
||||||
this.$yrouter.push({
|
this.$yrouter.push({
|
||||||
path: "/pages/activity/DargainDetails/index",
|
path: '/pages/activity/DargainDetails/index',
|
||||||
query: {
|
query: {
|
||||||
q: res.result,
|
q: res.result,
|
||||||
},
|
},
|
||||||
});
|
})
|
||||||
break;
|
break
|
||||||
default:
|
default:
|
||||||
// 跳转分销
|
// 跳转分销
|
||||||
this.$yrouter.push({
|
this.$yrouter.push({
|
||||||
path: "/pages/Loading/index",
|
path: '/pages/Loading/index',
|
||||||
query: {},
|
query: {},
|
||||||
});
|
})
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
getbgcolor(e) {
|
getbgcolor(e) {
|
||||||
this.bgcolor = e;
|
this.bgcolor = e
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
created: async function() {
|
created: async function() {
|
||||||
// await this.doColorThief();
|
// await this.doColorThief();
|
||||||
},
|
},
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
.content_box {
|
.content_box {
|
||||||
@@ -439,7 +428,8 @@
|
|||||||
margin-top: -20rpx;
|
margin-top: -20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.head_box {}
|
.head_box {
|
||||||
|
}
|
||||||
|
|
||||||
.nav-title {
|
.nav-title {
|
||||||
margin-left: 20rpx;
|
margin-left: 20rpx;
|
||||||
|
|||||||
+87
-122
@@ -34,10 +34,7 @@
|
|||||||
<view class="item" v-for="(order, orderListIndex) in orderList" :key="orderListIndex">
|
<view class="item" v-for="(order, orderListIndex) in orderList" :key="orderListIndex">
|
||||||
<view class="title acea-row row-between-wrapper">
|
<view class="title acea-row row-between-wrapper">
|
||||||
<view class="acea-row row-middle">
|
<view class="acea-row row-middle">
|
||||||
<span
|
<span class="sign cart-color acea-row row-center-wrapper" v-if="order.combinationId > 0">拼团</span>
|
||||||
class="sign cart-color acea-row row-center-wrapper"
|
|
||||||
v-if="order.combinationId > 0"
|
|
||||||
>拼团</span>
|
|
||||||
<span class="sign cart-color acea-row row-center-wrapper" v-if="order.seckillId > 0">秒杀</span>
|
<span class="sign cart-color acea-row row-center-wrapper" v-if="order.seckillId > 0">秒杀</span>
|
||||||
<span class="sign cart-color acea-row row-center-wrapper" v-if="order.bargainId > 0">砍价</span>
|
<span class="sign cart-color acea-row row-center-wrapper" v-if="order.bargainId > 0">砍价</span>
|
||||||
<span class="sign cart-color acea-row row-center-wrapper" v-if="order.storeId > 0">门店</span>
|
<span class="sign cart-color acea-row row-center-wrapper" v-if="order.storeId > 0">门店</span>
|
||||||
@@ -46,24 +43,15 @@
|
|||||||
<view class="font-color-red">{{ getStatus(order) }}</view>
|
<view class="font-color-red">{{ getStatus(order) }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view @click="goOrderDetails(order)">
|
<view @click="goOrderDetails(order)">
|
||||||
<view
|
<view class="item-info acea-row row-between row-top" v-for="(cart, cartInfoIndex) in order.cartInfo" :key="cartInfoIndex">
|
||||||
class="item-info acea-row row-between row-top"
|
|
||||||
v-for="(cart,cartInfoIndex) in order.cartInfo"
|
|
||||||
:key="cartInfoIndex"
|
|
||||||
>
|
|
||||||
<view class="pictrue">
|
<view class="pictrue">
|
||||||
<image
|
<image :src="cart.productInfo.image" @click.stop="$yrouter.push({ path: '/pages/shop/GoodsCon/index', query: { id: cart.productInfo.id } })" v-if="cart.combinationId === 0 && cart.bargainId === 0 && cart.seckillId === 0" />
|
||||||
:src="cart.productInfo.image"
|
|
||||||
@click.stop="
|
|
||||||
$yrouter.push({ path: '/pages/shop/GoodsCon/index',query:{id:cart.productInfo.id} })
|
|
||||||
"
|
|
||||||
v-if="cart.combinationId === 0 && cart.bargainId === 0 &&cart.seckillId === 0"
|
|
||||||
/>
|
|
||||||
<image
|
<image
|
||||||
:src="cart.productInfo.image"
|
:src="cart.productInfo.image"
|
||||||
@click.stop="
|
@click.stop="
|
||||||
$yrouter.push({
|
$yrouter.push({
|
||||||
path: '/pages/activity/GroupDetails/index',query:{id:cart.combinationId}
|
path: '/pages/activity/GroupDetails/index',
|
||||||
|
query: { id: cart.combinationId },
|
||||||
})
|
})
|
||||||
"
|
"
|
||||||
v-else-if="cart.combinationId > 0"
|
v-else-if="cart.combinationId > 0"
|
||||||
@@ -72,7 +60,8 @@
|
|||||||
:src="cart.productInfo.image"
|
:src="cart.productInfo.image"
|
||||||
@click.stop="
|
@click.stop="
|
||||||
$yrouter.push({
|
$yrouter.push({
|
||||||
path: '/pages/activity/DargainDetails/index',query:{id:cart.bargainId}
|
path: '/pages/activity/DargainDetails/index',
|
||||||
|
query: { id: cart.bargainId },
|
||||||
})
|
})
|
||||||
"
|
"
|
||||||
v-else-if="cart.bargainId > 0"
|
v-else-if="cart.bargainId > 0"
|
||||||
@@ -81,7 +70,8 @@
|
|||||||
:src="cart.productInfo.image"
|
:src="cart.productInfo.image"
|
||||||
@click.stop="
|
@click.stop="
|
||||||
$yrouter.push({
|
$yrouter.push({
|
||||||
path: '/pages/activity/SeckillDetails/index',query:{id:cart.seckillId}
|
path: '/pages/activity/SeckillDetails/index',
|
||||||
|
query: { id: cart.seckillId },
|
||||||
})
|
})
|
||||||
"
|
"
|
||||||
v-else-if="cart.seckillId > 0"
|
v-else-if="cart.seckillId > 0"
|
||||||
@@ -90,16 +80,8 @@
|
|||||||
<view class="text acea-row row-between">
|
<view class="text acea-row row-between">
|
||||||
<view class="name line2">{{ cart.productInfo.storeName }}</view>
|
<view class="name line2">{{ cart.productInfo.storeName }}</view>
|
||||||
<view class="money">
|
<view class="money">
|
||||||
<view v-if="order.payType!='integral'">
|
<view v-if="order.payType != 'integral'"> ¥{{ cart.productInfo.attrInfo ? cart.productInfo.attrInfo.price : cart.productInfo.price }} </view>
|
||||||
¥{{
|
<view v-if="order.payType == 'integral'"> {{ order.payIntegral }}积分 </view>
|
||||||
cart.productInfo.attrInfo
|
|
||||||
? cart.productInfo.attrInfo.price
|
|
||||||
: cart.productInfo.price
|
|
||||||
}}
|
|
||||||
</view>
|
|
||||||
<view v-if="order.payType=='integral'">
|
|
||||||
{{order.payIntegral}}积分
|
|
||||||
</view>
|
|
||||||
<view>x{{ cart.cartNum }}</view>
|
<view>x{{ cart.cartNum }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -150,32 +132,17 @@
|
|||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getOrderData, getOrderList } from "@/api/order";
|
import { getOrderData, getOrderList } from '@/api/order'
|
||||||
import {
|
import { cancelOrderHandle, payOrderHandle, takeOrderHandle } from '@/libs/order'
|
||||||
cancelOrderHandle,
|
import Loading from '@/components/Loading'
|
||||||
payOrderHandle,
|
import Payment from '@/components/Payment'
|
||||||
takeOrderHandle
|
import DataFormat from '@/components/DataFormat'
|
||||||
} from "@/libs/order";
|
import { mapGetters } from 'vuex'
|
||||||
import Loading from "@/components/Loading";
|
import { isWeixin, dataFormat } from '@/utils'
|
||||||
import Payment from "@/components/Payment";
|
|
||||||
import DataFormat from "@/components/DataFormat";
|
|
||||||
import { mapGetters } from "vuex";
|
|
||||||
import { isWeixin, dataFormat } from "@/utils";
|
|
||||||
|
|
||||||
const STATUS = [
|
const STATUS = ['待付款', '待发货', '待收货', '待评价', '已完成', '', '', '', '', '待付款']
|
||||||
"待付款",
|
|
||||||
"待发货",
|
|
||||||
"待收货",
|
|
||||||
"待评价",
|
|
||||||
"已完成",
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
"待付款"
|
|
||||||
];
|
|
||||||
|
|
||||||
const NAME = "MyOrder";
|
const NAME = 'MyOrder'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: NAME,
|
name: NAME,
|
||||||
@@ -183,139 +150,137 @@ export default {
|
|||||||
return {
|
return {
|
||||||
offlinePayStatus: 2,
|
offlinePayStatus: 2,
|
||||||
orderData: {},
|
orderData: {},
|
||||||
type: "",
|
type: '',
|
||||||
page: 1,
|
page: 1,
|
||||||
limit: 20,
|
limit: 20,
|
||||||
loaded: false,
|
loaded: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
orderList: [],
|
orderList: [],
|
||||||
pay: false,
|
pay: false,
|
||||||
payType: ["yue", "weixin"],
|
payType: ['yue', 'weixin'],
|
||||||
from: this.$deviceType
|
from: this.$deviceType,
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
Loading,
|
Loading,
|
||||||
Payment,
|
Payment,
|
||||||
DataFormat
|
DataFormat,
|
||||||
},
|
},
|
||||||
computed: mapGetters(["userInfo"]),
|
computed: mapGetters(['userInfo']),
|
||||||
onShow: function() {
|
onShow: function() {
|
||||||
console.log(this);
|
console.log(this)
|
||||||
this.type = parseInt(this.$yroute.query.type) || 0;
|
this.type = parseInt(this.$yroute.query.type) || 0
|
||||||
this.changeType(this.type);
|
this.changeType(this.type)
|
||||||
this.getOrderData();
|
this.getOrderData()
|
||||||
this.getOrderList();
|
this.getOrderList()
|
||||||
},
|
},
|
||||||
onHide: function() {
|
onHide: function() {
|
||||||
this.orderList = [];
|
this.orderList = []
|
||||||
this.page = 1;
|
this.page = 1
|
||||||
this.limit = 20;
|
this.limit = 20
|
||||||
this.loaded = false;
|
this.loaded = false
|
||||||
this.loading = false;
|
this.loading = false
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
goLogistics(order) {
|
goLogistics(order) {
|
||||||
this.$yrouter.push({
|
this.$yrouter.push({
|
||||||
path: "/pages/order/Logistics/index",
|
path: '/pages/order/Logistics/index',
|
||||||
query: { id: order.orderId }
|
query: { id: order.orderId },
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
goOrderDetails(order) {
|
goOrderDetails(order) {
|
||||||
this.$yrouter.push({
|
this.$yrouter.push({
|
||||||
path: "/pages/order/OrderDetails/index",
|
path: '/pages/order/OrderDetails/index',
|
||||||
query: { id: order.orderId }
|
query: { id: order.orderId },
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
dataFormat,
|
dataFormat,
|
||||||
setOfflinePayStatus: function(status) {
|
setOfflinePayStatus: function(status) {
|
||||||
var that = this;
|
var that = this
|
||||||
that.offlinePayStatus = status;
|
that.offlinePayStatus = status
|
||||||
if (status === 1) {
|
if (status === 1) {
|
||||||
if (that.payType.indexOf("offline") < 0) {
|
if (that.payType.indexOf('offline') < 0) {
|
||||||
that.payType.push("offline");
|
that.payType.push('offline')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getOrderData() {
|
getOrderData() {
|
||||||
getOrderData().then(res => {
|
getOrderData().then(res => {
|
||||||
this.orderData = res.data;
|
this.orderData = res.data
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
takeOrder(order) {
|
takeOrder(order) {
|
||||||
takeOrderHandle(order.orderId).finally(() => {
|
takeOrderHandle(order.orderId).finally(() => {
|
||||||
this.reload();
|
this.reload()
|
||||||
this.getOrderData();
|
this.getOrderData()
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
reload() {
|
reload() {
|
||||||
this.changeType(this.type);
|
this.changeType(this.type)
|
||||||
},
|
},
|
||||||
changeType(type) {
|
changeType(type) {
|
||||||
this.type = type;
|
this.type = type
|
||||||
this.orderList = [];
|
this.orderList = []
|
||||||
this.page = 1;
|
this.page = 1
|
||||||
this.loaded = false;
|
this.loaded = false
|
||||||
this.loading = false;
|
this.loading = false
|
||||||
this.getOrderList();
|
this.getOrderList()
|
||||||
},
|
},
|
||||||
getOrderList() {
|
getOrderList() {
|
||||||
if (this.loading || this.loaded) return;
|
if (this.loading || this.loaded) return
|
||||||
this.loading = true;
|
this.loading = true
|
||||||
const { page, limit, type } = this;
|
const { page, limit, type } = this
|
||||||
getOrderList({
|
getOrderList({
|
||||||
page,
|
page,
|
||||||
limit,
|
limit,
|
||||||
type
|
type,
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
this.orderList = this.orderList.concat(res.data);
|
this.orderList = this.orderList.concat(res.data)
|
||||||
this.page++;
|
this.page++
|
||||||
this.loaded = res.data.length < this.limit;
|
this.loaded = res.data.length < this.limit
|
||||||
this.loading = false;
|
this.loading = false
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
getStatus(order) {
|
getStatus(order) {
|
||||||
return STATUS[order._status._type];
|
return STATUS[order._status._type]
|
||||||
},
|
},
|
||||||
cancelOrder(order) {
|
cancelOrder(order) {
|
||||||
cancelOrderHandle(order.orderId)
|
cancelOrderHandle(order.orderId)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.getOrderData();
|
this.getOrderData()
|
||||||
this.orderList.splice(this.orderList.indexOf(order), 1);
|
this.orderList.splice(this.orderList.indexOf(order), 1)
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.reload();
|
this.reload()
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
paymentTap: function(order) {
|
paymentTap: function(order) {
|
||||||
var that = this;
|
var that = this
|
||||||
if (
|
if (!(order.combinationId > 0 || order.bargainId > 0 || order.seckillId > 0)) {
|
||||||
!(order.combinationId > 0 || order.bargainId > 0 || order.seckillId > 0)
|
that.setOfflinePayStatus(order.offlinePayStatus)
|
||||||
) {
|
|
||||||
that.setOfflinePayStatus(order.offlinePayStatus);
|
|
||||||
}
|
}
|
||||||
this.pay = true;
|
this.pay = true
|
||||||
this.toPay = type => {
|
this.toPay = type => {
|
||||||
payOrderHandle(order.orderId, type, that.from)
|
payOrderHandle(order.orderId, type, that.from)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const type = parseInt(this.$yroute.query.type) || 0;
|
const type = parseInt(this.$yroute.query.type) || 0
|
||||||
that.changeType(type);
|
that.changeType(type)
|
||||||
that.getOrderData();
|
that.getOrderData()
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
const type = parseInt(that.$yroute.query.type) || 0;
|
const type = parseInt(that.$yroute.query.type) || 0
|
||||||
that.changeType(type);
|
that.changeType(type)
|
||||||
that.getOrderData();
|
that.getOrderData()
|
||||||
});
|
})
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
toPay() {}
|
toPay() {},
|
||||||
},
|
},
|
||||||
mounted() {},
|
mounted() {},
|
||||||
onReachBottom() {
|
onReachBottom() {
|
||||||
!this.loading && this.getOrderList();
|
!this.loading && this.getOrderList()
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
|
|||||||
@@ -508,6 +508,7 @@ export default {
|
|||||||
if (this.$deviceType == 'app') {
|
if (this.$deviceType == 'app') {
|
||||||
from.from = 'app'
|
from.from = 'app'
|
||||||
}
|
}
|
||||||
|
console.log(this.$deviceType)
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
subscribeMessage()
|
subscribeMessage()
|
||||||
// #endif
|
// #endif
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<input type="number" placeholder="0" v-model="verify_code" />
|
<input type="number" placeholder="0" v-model="verify_code" />
|
||||||
</view>
|
</view>
|
||||||
<view class="bnt" @click="storeCancellation">立即核销</view>
|
<view class="bnt" @click="storeCancellation">立即核销</view>
|
||||||
<view class="bnt" @click="openQRCode">扫码核销</view>
|
<view class="bnt" v-if="$deviceType !== 'weixin'" @click="openQRCode">扫码核销</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- #ifndef H5 -->
|
<!-- #ifndef H5 -->
|
||||||
<!-- <view class="scan" v-if="iswechat">
|
<!-- <view class="scan" v-if="iswechat">
|
||||||
@@ -20,118 +20,111 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import WriteOff from "@/components/WriteOff";
|
import WriteOff from '@/components/WriteOff'
|
||||||
import {
|
import { isWeixin } from '@/utils'
|
||||||
isWeixin
|
|
||||||
} from "@/utils";
|
|
||||||
// import { wechatEvevt } from "@/libs/wechat";
|
// import { wechatEvevt } from "@/libs/wechat";
|
||||||
import {
|
import { orderVerific } from '@/api/order'
|
||||||
orderVerific
|
const NAME = 'OrderCancellation'
|
||||||
} from "@/api/order";
|
|
||||||
const NAME = "OrderCancellation";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: NAME,
|
name: NAME,
|
||||||
components: {
|
components: {
|
||||||
WriteOff
|
WriteOff,
|
||||||
},
|
},
|
||||||
props: {},
|
props: {},
|
||||||
data: function() {
|
data: function() {
|
||||||
return {
|
return {
|
||||||
iShidden: true,
|
iShidden: true,
|
||||||
orderInfo: {},
|
orderInfo: {},
|
||||||
verify_code: ""
|
verify_code: '',
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
mounted: function() {},
|
mounted: function() {},
|
||||||
methods: {
|
methods: {
|
||||||
cancel: function(res) {
|
cancel: function(res) {
|
||||||
this.iShidden = res;
|
this.iShidden = res
|
||||||
},
|
},
|
||||||
confirm: function() {
|
confirm: function() {
|
||||||
orderVerific(this.verify_code, 1)
|
orderVerific(this.verify_code, 1)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
this.iShidden = true;
|
this.iShidden = true
|
||||||
this.verify_code = "";
|
this.verify_code = ''
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.msg,
|
title: res.msg,
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
duration: 2000
|
duration: 2000,
|
||||||
});
|
})
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: err.msg || err.response.data.msg || err.response.data.message,
|
title: err.msg || err.response.data.msg || err.response.data.message,
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
duration: 2000
|
duration: 2000,
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
storeCancellation: function() {
|
storeCancellation: function() {
|
||||||
let ref = /[0-9]{12}/;
|
let ref = /[0-9]{12}/
|
||||||
if (!this.verify_code) {
|
if (!this.verify_code) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "请输入核销码",
|
title: '请输入核销码',
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
duration: 2000
|
duration: 2000,
|
||||||
});
|
})
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
if (!ref.test(this.verify_code)) {
|
if (!ref.test(this.verify_code)) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "请输入正确的核销码",
|
title: '请输入正确的核销码',
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
duration: 2000
|
duration: 2000,
|
||||||
});
|
})
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: "查询中"
|
title: '查询中',
|
||||||
});
|
})
|
||||||
orderVerific(this.verify_code, 0)
|
orderVerific(this.verify_code, 0)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
uni.hideLoading();
|
uni.hideLoading()
|
||||||
this.orderInfo = res.data;
|
this.orderInfo = res.data
|
||||||
this.iShidden = false;
|
this.iShidden = false
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.msg,
|
title: res.msg,
|
||||||
icon: "success",
|
icon: 'success',
|
||||||
duration: 2000
|
duration: 2000,
|
||||||
});
|
})
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
uni.hideLoading();
|
uni.hideLoading()
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: error.msg ||
|
title: error.msg || error.response.data.msg || error.response.data.message,
|
||||||
error.response.data.msg ||
|
icon: 'none',
|
||||||
error.response.data.message,
|
duration: 2000,
|
||||||
icon: "none",
|
})
|
||||||
duration: 2000
|
})
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
openQRCode: function() {
|
openQRCode: function() {
|
||||||
let that = this;
|
let that = this
|
||||||
// 这里需要调用扫码功能
|
// 这里需要调用扫码功能
|
||||||
uni.scanCode({
|
uni.scanCode({
|
||||||
success: (res) => {
|
success: res => {
|
||||||
var result = res.result;
|
var result = res.result
|
||||||
if (result) {
|
if (result) {
|
||||||
that.verify_code = res.result;
|
that.verify_code = res.result
|
||||||
that.storeCancellation();
|
that.storeCancellation()
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '没有扫描到什么!',
|
title: '没有扫描到什么!',
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
duration: 2000
|
duration: 2000,
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
|
|||||||
@@ -1,30 +1,22 @@
|
|||||||
<template>
|
<template>
|
||||||
<view ref="container">
|
<view ref="container">
|
||||||
<view class="collectionGoods" v-if="collectProductList.length > 0">
|
<view class="collectionGoods" v-if="collectProductList.length > 0">
|
||||||
<view
|
<view class="item acea-row row-between-wrapper" v-for="(item, collectProductListIndex) in collectProductList" :key="collectProductListIndex" @click="goGoodsCon(item)">
|
||||||
class="item acea-row row-between-wrapper"
|
|
||||||
v-for="(item, collectProductListIndex) in collectProductList"
|
|
||||||
:key="collectProductListIndex"
|
|
||||||
@click="goGoodsCon(item)"
|
|
||||||
>
|
|
||||||
<view class="pictrue">
|
<view class="pictrue">
|
||||||
<image :src="item.image" />
|
<image :src="item.image" />
|
||||||
</view>
|
</view>
|
||||||
<view class="text acea-row row-column-between">
|
<view class="text acea-row row-column-between">
|
||||||
<view class="infor line1">{{ item.storeName }}</view>
|
<view class="infor line1">{{ item.storeName }}</view>
|
||||||
<view class="acea-row row-between-wrapper">
|
<view class="acea-row row-between-wrapper">
|
||||||
<view class="money font-color-red">¥{{ item.price }}</view>
|
<view class="money font-color-red" v-if="isIntegral == 1">{{ item.costPrice }}积分</view>
|
||||||
|
<view class="money font-color-red" v-else>¥{{ item.price }}</view>
|
||||||
<view class="delete" @tap.stop="delCollection(collectProductListIndex)">删除</view>
|
<view class="delete" @tap.stop="delCollection(collectProductListIndex)">删除</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<Loading :loaded="loadend" :loading="loading"></Loading>
|
<Loading :loaded="loadend" :loading="loading"></Loading>
|
||||||
<view
|
<view class="noCommodity" style="background-color:#fff;" v-if="collectProductList.length < 1 && page > 1">
|
||||||
class="noCommodity"
|
|
||||||
style="background-color:#fff;"
|
|
||||||
v-if="collectProductList.length < 1 && page > 1"
|
|
||||||
>
|
|
||||||
<view class="noPictrue">
|
<view class="noPictrue">
|
||||||
<image :src="`${$VUE_APP_RESOURCES_URL}/images/noCollection.png`" class="image" />
|
<image :src="`${$VUE_APP_RESOURCES_URL}/images/noCollection.png`" class="image" />
|
||||||
</view>
|
</view>
|
||||||
@@ -33,14 +25,14 @@
|
|||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import Recommend from "@/components/Recommend";
|
import Recommend from '@/components/Recommend'
|
||||||
import { getCollectUser, getCollectDel } from "@/api/user";
|
import { getCollectUser, getCollectDel } from '@/api/user'
|
||||||
import Loading from "@/components/Loading";
|
import Loading from '@/components/Loading'
|
||||||
export default {
|
export default {
|
||||||
name: "GoodsCollection",
|
name: 'GoodsCollection',
|
||||||
components: {
|
components: {
|
||||||
Recommend,
|
Recommend,
|
||||||
Loading
|
Loading,
|
||||||
},
|
},
|
||||||
props: {},
|
props: {},
|
||||||
data: function() {
|
data: function() {
|
||||||
@@ -49,54 +41,61 @@ export default {
|
|||||||
limit: 20,
|
limit: 20,
|
||||||
type: 'collect',
|
type: 'collect',
|
||||||
collectProductList: [],
|
collectProductList: [],
|
||||||
loadTitle: "",
|
loadTitle: '',
|
||||||
loading: false,
|
loading: false,
|
||||||
loadend: false
|
loadend: false,
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
mounted: function() {
|
mounted: function() {
|
||||||
this.get_user_collect_product();
|
this.get_user_collect_product()
|
||||||
},
|
},
|
||||||
onReachBottom() {
|
onReachBottom() {
|
||||||
!this.loading && this.get_user_collect_product();
|
!this.loading && this.get_user_collect_product()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
goGoodsCon(item) {
|
goGoodsCon(item) {
|
||||||
|
if (item.isIntegral == 1) {
|
||||||
this.$yrouter.push({
|
this.$yrouter.push({
|
||||||
path: "/pages/shop/GoodsCon/index",
|
path: '/pages/shop/GoodsCon/index',
|
||||||
query: { id: item.pid }
|
query: { id: item.pid },
|
||||||
});
|
})
|
||||||
|
} else {
|
||||||
|
this.$yrouter.push({
|
||||||
|
path: '/pages/shop/GoodsCon/index',
|
||||||
|
query: { id: item.pid },
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
get_user_collect_product: function() {
|
get_user_collect_product: function() {
|
||||||
let that = this;
|
let that = this
|
||||||
if (that.loading) return; //阻止下次请求(false可以进行请求);
|
if (that.loading) return //阻止下次请求(false可以进行请求);
|
||||||
if (that.loadend) return; //阻止结束当前请求(false可以进行请求);
|
if (that.loadend) return //阻止结束当前请求(false可以进行请求);
|
||||||
that.loading = true;
|
that.loading = true
|
||||||
getCollectUser(that.page, that.limit, that.type).then(res => {
|
getCollectUser(that.page, that.limit, that.type).then(res => {
|
||||||
that.loading = false;
|
that.loading = false
|
||||||
//apply();js将一个数组插入另一个数组;
|
//apply();js将一个数组插入另一个数组;
|
||||||
that.collectProductList.push.apply(that.collectProductList, res.data);
|
that.collectProductList.push.apply(that.collectProductList, res.data)
|
||||||
that.loadend = res.data.length < that.limit; //判断所有数据是否加载完成;
|
that.loadend = res.data.length < that.limit //判断所有数据是否加载完成;
|
||||||
that.page = that.page + 1;
|
that.page = that.page + 1
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
//删除收藏;
|
//删除收藏;
|
||||||
delCollection: function(index) {
|
delCollection: function(index) {
|
||||||
let that = this,
|
let that = this,
|
||||||
id = that.collectProductList[index].pid,
|
id = that.collectProductList[index].pid,
|
||||||
category = that.collectProductList[index].category;
|
category = that.collectProductList[index].category
|
||||||
getCollectDel(id, category).then(function() {
|
getCollectDel(id, category).then(function() {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "删除成功",
|
title: '删除成功',
|
||||||
icon: "success",
|
icon: 'success',
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
complete: () => {
|
complete: () => {
|
||||||
that.collectProductList.splice(index, 1);
|
that.collectProductList.splice(index, 1)
|
||||||
that.$set(that, "collectProductList", that.collectProductList);
|
that.$set(that, 'collectProductList', that.collectProductList)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -293,7 +293,8 @@ export default {
|
|||||||
if (!url) {
|
if (!url) {
|
||||||
url = handleUrlParam(getCurrentPageUrlWithArgs())
|
url = handleUrlParam(getCurrentPageUrlWithArgs())
|
||||||
}
|
}
|
||||||
this.coupons()
|
|
||||||
|
const token = cookie.get('login_status')
|
||||||
if (url && url.id) {
|
if (url && url.id) {
|
||||||
this.id = url.id
|
this.id = url.id
|
||||||
let urlSpread = parseInt(url.spread)
|
let urlSpread = parseInt(url.spread)
|
||||||
@@ -303,7 +304,15 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.id = this._route.query.id
|
this.id = this._route.query.id
|
||||||
}
|
}
|
||||||
|
|
||||||
this.isIntegral = url.isIntegral == 'true'
|
this.isIntegral = url.isIntegral == 'true'
|
||||||
|
|
||||||
|
if (!token) {
|
||||||
|
this.productCon()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.coupons()
|
||||||
|
|
||||||
this.productCon()
|
this.productCon()
|
||||||
this.setOpenShare()
|
this.setOpenShare()
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,30 +1,22 @@
|
|||||||
<template>
|
<template>
|
||||||
<view ref="container">
|
<view ref="container">
|
||||||
<view class="collectionGoods" v-if="collectProductList.length > 0">
|
<view class="collectionGoods" v-if="collectProductList.length > 0">
|
||||||
<view
|
<view class="item acea-row row-between-wrapper" v-for="(item, collectProductListIndex) in collectProductList" :key="collectProductListIndex" @click="goGoodsCon(item)">
|
||||||
class="item acea-row row-between-wrapper"
|
|
||||||
v-for="(item, collectProductListIndex) in collectProductList"
|
|
||||||
:key="collectProductListIndex"
|
|
||||||
@click="goGoodsCon(item)"
|
|
||||||
>
|
|
||||||
<view class="pictrue">
|
<view class="pictrue">
|
||||||
<image :src="item.image" />
|
<image :src="item.image" />
|
||||||
</view>
|
</view>
|
||||||
<view class="text acea-row row-column-between">
|
<view class="text acea-row row-column-between">
|
||||||
<view class="infor line1">{{ item.storeName }}</view>
|
<view class="infor line1">{{ item.storeName }}</view>
|
||||||
<view class="acea-row row-between-wrapper">
|
<view class="acea-row row-between-wrapper">
|
||||||
<view class="money font-color-red">¥{{ item.price }}</view>
|
<view class="money font-color-red" v-if="isIntegral == 1">{{ item.costPrice }}积分</view>
|
||||||
|
<view class="money font-color-red" v-else>¥{{ item.price }}</view>
|
||||||
<view class="delete" @tap.stop="delCollection(collectProductListIndex)">删除</view>
|
<view class="delete" @tap.stop="delCollection(collectProductListIndex)">删除</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<Loading :loaded="loadend" :loading="loading"></Loading>
|
<Loading :loaded="loadend" :loading="loading"></Loading>
|
||||||
<view
|
<view class="noCommodity" style="background-color:#fff;" v-if="collectProductList.length < 1 && page > 1">
|
||||||
class="noCommodity"
|
|
||||||
style="background-color:#fff;"
|
|
||||||
v-if="collectProductList.length < 1 && page > 1"
|
|
||||||
>
|
|
||||||
<view class="noPictrue">
|
<view class="noPictrue">
|
||||||
<image :src="`${$VUE_APP_RESOURCES_URL}/images/noCollection.png`" class="image" />
|
<image :src="`${$VUE_APP_RESOURCES_URL}/images/noCollection.png`" class="image" />
|
||||||
</view>
|
</view>
|
||||||
@@ -33,14 +25,14 @@
|
|||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import Recommend from "@/components/Recommend";
|
import Recommend from '@/components/Recommend'
|
||||||
import { getCollectUser, getCollectDel } from "@/api/user";
|
import { getCollectUser, getCollectDel } from '@/api/user'
|
||||||
import Loading from "@/components/Loading";
|
import Loading from '@/components/Loading'
|
||||||
export default {
|
export default {
|
||||||
name: "GoodsFoot",
|
name: 'GoodsFoot',
|
||||||
components: {
|
components: {
|
||||||
Recommend,
|
Recommend,
|
||||||
Loading
|
Loading,
|
||||||
},
|
},
|
||||||
props: {},
|
props: {},
|
||||||
data: function() {
|
data: function() {
|
||||||
@@ -49,54 +41,61 @@ export default {
|
|||||||
limit: 20,
|
limit: 20,
|
||||||
type: 'foot',
|
type: 'foot',
|
||||||
collectProductList: [],
|
collectProductList: [],
|
||||||
loadTitle: "",
|
loadTitle: '',
|
||||||
loading: false,
|
loading: false,
|
||||||
loadend: false
|
loadend: false,
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
mounted: function() {
|
mounted: function() {
|
||||||
this.get_user_collect_product();
|
this.get_user_collect_product()
|
||||||
},
|
},
|
||||||
onReachBottom() {
|
onReachBottom() {
|
||||||
!this.loading && this.get_user_collect_product();
|
!this.loading && this.get_user_collect_product()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
goGoodsCon(item) {
|
goGoodsCon(item) {
|
||||||
|
if (item.isIntegral == 1) {
|
||||||
this.$yrouter.push({
|
this.$yrouter.push({
|
||||||
path: "/pages/shop/GoodsCon/index",
|
path: '/pages/shop/GoodsCon/index',
|
||||||
query: { id: item.pid }
|
query: { id: item.pid },
|
||||||
});
|
})
|
||||||
|
} else {
|
||||||
|
this.$yrouter.push({
|
||||||
|
path: '/pages/shop/GoodsCon/index',
|
||||||
|
query: { id: item.pid },
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
get_user_collect_product: function() {
|
get_user_collect_product: function() {
|
||||||
let that = this;
|
let that = this
|
||||||
if (that.loading) return; //阻止下次请求(false可以进行请求);
|
if (that.loading) return //阻止下次请求(false可以进行请求);
|
||||||
if (that.loadend) return; //阻止结束当前请求(false可以进行请求);
|
if (that.loadend) return //阻止结束当前请求(false可以进行请求);
|
||||||
that.loading = true;
|
that.loading = true
|
||||||
getCollectUser(that.page, that.limit, that.type).then(res => {
|
getCollectUser(that.page, that.limit, that.type).then(res => {
|
||||||
that.loading = false;
|
that.loading = false
|
||||||
//apply();js将一个数组插入另一个数组;
|
//apply();js将一个数组插入另一个数组;
|
||||||
that.collectProductList.push.apply(that.collectProductList, res.data);
|
that.collectProductList.push.apply(that.collectProductList, res.data)
|
||||||
that.loadend = res.data.length < that.limit; //判断所有数据是否加载完成;
|
that.loadend = res.data.length < that.limit //判断所有数据是否加载完成;
|
||||||
that.page = that.page + 1;
|
that.page = that.page + 1
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
//删除收藏;
|
//删除收藏;
|
||||||
delCollection: function(index) {
|
delCollection: function(index) {
|
||||||
let that = this,
|
let that = this,
|
||||||
id = that.collectProductList[index].pid,
|
id = that.collectProductList[index].pid,
|
||||||
category = that.collectProductList[index].category;
|
category = that.collectProductList[index].category
|
||||||
getCollectDel(id, category).then(function() {
|
getCollectDel(id, category).then(function() {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "删除成功",
|
title: '删除成功',
|
||||||
icon: "success",
|
icon: 'success',
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
complete: () => {
|
complete: () => {
|
||||||
that.collectProductList.splice(index, 1);
|
that.collectProductList.splice(index, 1)
|
||||||
that.$set(that, "collectProductList", that.collectProductList);
|
that.$set(that, 'collectProductList', that.collectProductList)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -44,59 +44,58 @@
|
|||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import Recommend from "@/components/Recommend";
|
import Recommend from '@/components/Recommend'
|
||||||
import { getActivityStatus, getBalance } from "@/api/user";
|
import { getActivityStatus, getBalance } from '@/api/user'
|
||||||
export default {
|
export default {
|
||||||
name: "UserAccount",
|
name: 'UserAccount',
|
||||||
components: {
|
components: {
|
||||||
Recommend
|
Recommend,
|
||||||
},
|
},
|
||||||
props: {},
|
props: {},
|
||||||
data: function() {
|
data: function() {
|
||||||
return {
|
return {
|
||||||
is_hide: "1",
|
is_hide: '1',
|
||||||
now_money: 0,
|
now_money: 0,
|
||||||
orderStatusSum: 0,
|
orderStatusSum: 0,
|
||||||
recharge: 0,
|
recharge: 0,
|
||||||
activity: {
|
activity: {
|
||||||
is_bargin: false,
|
is_bargin: false,
|
||||||
is_pink: false,
|
is_pink: false,
|
||||||
is_seckill: false
|
is_seckill: false,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
|
||||||
},
|
},
|
||||||
onShow: function() {
|
onShow: function() {
|
||||||
this.getIndex();
|
this.getIndex()
|
||||||
this.getActivity();
|
this.getActivity()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
goUserBill(types) {
|
goUserBill(types) {
|
||||||
this.$yrouter.push({
|
this.$yrouter.push({
|
||||||
path: "/pages/user/UserBill/index",
|
path: '/pages/user/UserBill/index',
|
||||||
query: { types }
|
query: { types },
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
getIndex: function() {
|
getIndex: function() {
|
||||||
let that = this;
|
let that = this
|
||||||
getBalance().then(
|
getBalance().then(
|
||||||
res => {
|
res => {
|
||||||
that.now_money = res.data.now_money;
|
that.now_money = res.data.now_money
|
||||||
that.orderStatusSum = res.data.orderStatusSum;
|
that.orderStatusSum = res.data.orderStatusSum
|
||||||
that.recharge = res.data.recharge;
|
that.recharge = res.data.recharge
|
||||||
this.is_hide = res.data.is_hide;
|
this.is_hide = res.data.is_hide
|
||||||
},
|
},
|
||||||
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
|
})
|
||||||
});
|
|
||||||
}
|
}
|
||||||
);
|
)
|
||||||
},
|
},
|
||||||
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;
|
||||||
@@ -112,7 +111,7 @@ export default {
|
|||||||
// });
|
// });
|
||||||
// }
|
// }
|
||||||
// );
|
// );
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
+38
-16
@@ -499,6 +499,22 @@ export const handleLoginStatus = (location, complete, fail, success) => {
|
|||||||
path: '/pages/home/index',
|
path: '/pages/home/index',
|
||||||
name: '首页',
|
name: '首页',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/pages/shop/HotNewGoods/index',
|
||||||
|
name: '热门榜单',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/pages/activity/GoodsGroup/index',
|
||||||
|
name: '超值拼团',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/pages/shop/Live/LiveList/index',
|
||||||
|
name: '热门直播',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/pages/shop/GoodsClass/index',
|
||||||
|
name: '商品分类',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/pages/user/Login/index',
|
path: '/pages/user/Login/index',
|
||||||
name: '登录页面',
|
name: '登录页面',
|
||||||
@@ -520,7 +536,7 @@ export const handleLoginStatus = (location, complete, fail, success) => {
|
|||||||
} else {
|
} else {
|
||||||
path = location.path
|
path = location.path
|
||||||
}
|
}
|
||||||
|
console.log(path)
|
||||||
// 判断用户是否有token
|
// 判断用户是否有token
|
||||||
if (!handleAuth()) {
|
if (!handleAuth()) {
|
||||||
page.map(item => {
|
page.map(item => {
|
||||||
@@ -531,28 +547,34 @@ export const handleLoginStatus = (location, complete, fail, success) => {
|
|||||||
} else {
|
} else {
|
||||||
isAuth = true
|
isAuth = true
|
||||||
}
|
}
|
||||||
|
console.log(isAuth)
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (isAuth) {
|
|
||||||
// 有token
|
|
||||||
if (path == '/pages/home/index' || path == '/pages/shop/GoodsClass/index' || path == '/pages/shop/ShoppingCart/index' || path == '/pages/user/User/index') {
|
|
||||||
// switchTab({
|
|
||||||
// path: parseUrl(location),
|
|
||||||
// })
|
|
||||||
// return
|
|
||||||
}
|
|
||||||
|
|
||||||
resolve({
|
resolve({
|
||||||
url: parseUrl(location),
|
url: parseUrl(location),
|
||||||
complete,
|
complete,
|
||||||
fail,
|
fail,
|
||||||
success,
|
success,
|
||||||
})
|
})
|
||||||
} else {
|
// if (isAuth) {
|
||||||
// 没有token,先校验用户是否授权,如果授权了,进行自动登录
|
// // 有token
|
||||||
routerPermissions(parseUrl(location))
|
// if (path == '/pages/home/index' || path == '/pages/shop/GoodsClass/index' || path == '/pages/shop/ShoppingCart/index' || path == '/pages/user/User/index') {
|
||||||
reject()
|
// // switchTab({
|
||||||
}
|
// // path: parseUrl(location),
|
||||||
|
// // })
|
||||||
|
// // return
|
||||||
|
// }
|
||||||
|
|
||||||
|
// resolve({
|
||||||
|
// url: parseUrl(location),
|
||||||
|
// complete,
|
||||||
|
// fail,
|
||||||
|
// success,
|
||||||
|
// })
|
||||||
|
// } else {
|
||||||
|
// // 没有token,先校验用户是否授权,如果授权了,进行自动登录
|
||||||
|
// routerPermissions(parseUrl(location))
|
||||||
|
// reject()
|
||||||
|
// }
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
})
|
})
|
||||||
|
|||||||
+7
-7
@@ -72,13 +72,13 @@ function baseRequest(options) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果需要登录才可访问的接口没有拿到 token 视为登录失效
|
// // 如果需要登录才可访问的接口没有拿到 token 视为登录失效
|
||||||
if (options.login === true && !token) {
|
// if (options.login === true && !token) {
|
||||||
// 跳转到登录或授权页面
|
// // 跳转到登录或授权页面
|
||||||
handleLoginFailure()
|
// handleLoginFailure()
|
||||||
// 提示错误信息
|
// // 提示错误信息
|
||||||
return Promise.reject({ msg: '未登录', toLogin: true })
|
// return Promise.reject({ msg: '未登录', toLogin: true })
|
||||||
}
|
// }
|
||||||
// 结构请求需要的参数
|
// 结构请求需要的参数
|
||||||
const { url, params, data, login, ...option } = options
|
const { url, params, data, login, ...option } = options
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user