「我的卡券加会员卡类型」

This commit is contained in:
2022-08-12 09:47:56 +08:00
parent c0fc64054d
commit f2cb612887
5 changed files with 959 additions and 926 deletions

View File

@@ -1,4 +1,3 @@
/** /**
* Web唐明明 * Web唐明明
* 匆匆数载恍如梦,岁月迢迢华发增。 * 匆匆数载恍如梦,岁月迢迢华发增。
@@ -10,160 +9,161 @@ import router from '../router'
// 基础配置 // 基础配置
const config = { const config = {
// apiUrl : 'https://api.gongli.vip/api/', // 正式环境 // apiUrl : 'https://api.gongli.vip/api/', // 正式环境
apiUrl : 'http://api.gl.shangkelian.cn/api/', // 测试 apiUrl: 'http://api.gl.shangkelian.cn/api/', // 测试
timeout : 60000 timeout: 60000
} }
let loginHintState = false let loginHintState = false
// 网络请求 // 网络请求
const request = (parameter, hideLoding = true) => { const request = (parameter, hideLoding = true) => {
// 检查url配置 // 检查url配置
if(parameter.url === 'undefined' || parameter.url === ''){ if (parameter.url === 'undefined' || parameter.url === '') {
uni.showToast({ uni.showToast({
title: '请求地址不能为空', title: '请求地址不能为空',
icon : 'none' icon: 'none'
}) })
return return
} }
// 注入header // 注入header
config.header = { config.header = {
'Accept': 'application/json', 'Accept': 'application/json',
'Authorization': store.getters.getToken || uni.getStorageSync('token') 'Authorization': store.getters.getToken || uni.getStorageSync('token')
} }
// 加载提示 // 加载提示
if(!hideLoding) uni.showLoading({ if (!hideLoding) uni.showLoading({
title: '加载中', title: '加载中',
mask : true mask: true
}); });
// 请求实例 // 请求实例
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.request({ uni.request({
url : config.apiUrl + parameter.url, url: config.apiUrl + parameter.url,
timeout : config.timeout, timeout: config.timeout,
header : config.header || {}, header: config.header || {},
data : parameter.data || {}, data: parameter.data || {},
method : parameter.method || 'GET', method: parameter.method || 'GET',
success : res => { success: res => {
if (res.header.Authorization){ console.log(res)
updateToken('token', res.header.Authorization) if (res.header.Authorization) {
} updateToken('token', res.header.Authorization)
if(res.statusCode === 200){ }
uni.hideLoading() if (res.statusCode === 200) {
const resolveData = res.data uni.hideLoading()
if(resolveData.status_code === 200) { const resolveData = res.data
resolve(resolveData.data) if (resolveData.status_code === 200) {
return resolve(resolveData.data)
} return
if(resolveData.status_code === 401) { }
loginHint() if (resolveData.status_code === 401) {
return loginHint()
} return
reject(resolveData) }
return reject(resolveData)
} return
errToast(res.statusCode) }
}, errToast(res.statusCode)
fail(err) { },
uni.showToast({ fail(err) {
title: '网络错误,请检查您设备网络状态', uni.showToast({
icon : 'none' title: '网络错误,请检查您设备网络状态',
}) icon: 'none'
} })
}) }
}) })
})
} }
// 文件上传 // 文件上传
const uploading = (paths) => { const uploading = (paths) => {
uni.showLoading({ uni.showLoading({
title: '上传中', title: '上传中',
mask : true mask: true
}); });
// 注入header // 注入header
config.header = { config.header = {
'Accept': 'application/json', 'Accept': 'application/json',
'Authorization': store.getters.getToken || '' 'Authorization': store.getters.getToken || ''
} }
// 上传图片 // 上传图片
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.uploadFile({ uni.uploadFile({
url : config.apiUrl + 'storage/uploads', url: config.apiUrl + 'storage/uploads',
files : paths, files: paths,
header : config.header || {}, header: config.header || {},
success : res=>{ success: res => {
if(res.statusCode === 200){ if (res.statusCode === 200) {
uni.hideLoading() uni.hideLoading()
let updData = JSON.parse(res.data) let updData = JSON.parse(res.data)
if(updData.status_code === 200){ if (updData.status_code === 200) {
resolve(updData.data) resolve(updData.data)
return return
} }
reject(updData) reject(updData)
return return
} }
errToast(res.statusCode) errToast(res.statusCode)
} }
}) })
}) })
} }
// 处理一些http请求错误提示 // 处理一些http请求错误提示
const errToast = (code) => { const errToast = (code) => {
switch (code){ switch (code) {
case 404: case 404:
uni.showToast({ uni.showToast({
title: code + '接口不存在,请联系系统管理员', title: code + '接口不存在,请联系系统管理员',
icon : 'none' icon: 'none'
}) })
break; break;
case 405: case 405:
uni.showToast({ uni.showToast({
title: code + '请检查接口请求方式错误', title: code + '请检查接口请求方式错误',
icon : 'none' icon: 'none'
}) })
break; break;
case 500: case 500:
uni.showToast({ uni.showToast({
title: code + '服务端错误,请检查服务器信息', title: code + '服务端错误,请检查服务器信息',
icon : 'none' icon: 'none'
}) })
break; break;
} }
} }
// 更新token // 更新token
const updateToken = (token) => { const updateToken = (token) => {
store.commit('setToken', token) store.commit('setToken', token)
// 清除退出登录标识 // 清除退出登录标识
uni.removeStorageSync('isnew') uni.removeStorageSync('isnew')
} }
// 处理登录提示 // 处理登录提示
const loginHint = () => { const loginHint = () => {
if( loginHintState ) return if (loginHintState) return
if(!loginHintState) loginHintState = true if (!loginHintState) loginHintState = true
updateToken('') updateToken('')
uni.showModal({ uni.showModal({
title: '登录提示', title: '登录提示',
content: '您的登录信息已过期,请重新登录', content: '您的登录信息已过期,请重新登录',
confirmColor: '#8b64fd', confirmColor: '#8b64fd',
showCancel:false, showCancel: false,
success: res=> { success: res => {
loginHintState = false loginHintState = false
if (res.confirm) { if (res.confirm) {
uni.reLaunch({ uni.reLaunch({
url:'/pages/auth/auth' url: '/pages/auth/auth'
}) })
} }
} }
}) })
} }
export { export {
request, request,
uploading, uploading,
config config
} }

View File

@@ -34,7 +34,6 @@ const shops = (categoryId,page) => {
// 店铺详情 // 店铺详情
const shopsDetail = (shopId) => { const shopsDetail = (shopId) => {
console.log(shopId,'shopId.....')
return request({ return request({
url: 'mall/shops/' + shopId, url: 'mall/shops/' + shopId,
}) })
@@ -42,7 +41,6 @@ const shopsDetail = (shopId) => {
// 店铺商品 // 店铺商品
const shopsGoods = (data) => { const shopsGoods = (data) => {
console.log(data,'shopsGoods.....')
return request({ return request({
url: 'mall/goods', url: 'mall/goods',
data: data data: data

View File

@@ -10,9 +10,10 @@
<image class="avatar" :src="item.message.cover" mode="aspectFill" /> <image class="avatar" :src="item.message.cover" mode="aspectFill" />
<view class="info"> <view class="info">
<view class="title"> {{item.shop.name}}</view> <view class="title"> {{item.shop.name}}</view>
<view class="des"> NO.{{item.number}} | {{item.ended_at}} 到期 </view> <view class="des"> NO.{{item.number}} | {{item.ended_at}} 到期</view>
</view> </view>
</view> </view>
<view class="tags">{{item.message.title}}</view>
</view> </view>
</block> </block>
<block v-else> <block v-else>
@@ -113,6 +114,20 @@
box-sizing: border-box; box-sizing: border-box;
margin: 0 $margin; margin: 0 $margin;
margin-bottom: $margin - 10; margin-bottom: $margin - 10;
.tags {
position: absolute;
top: 22rpx;
color: #fff;
right: -46rpx;
background: rgba($color: #d81e06, $alpha: 0.5);
font-size: 30rpx;
padding: 2rpx 50rpx;
text-align: center;
transform: rotate(45deg);
font-weight: bold;
letter-spacing:4rpx;
z-index: 10;
}
.card-item-bg { .card-item-bg {
position: absolute; position: absolute;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long