Browse Source

'开始联调'

hfll
hflllll 1 month ago
parent
commit
dc40bb34a1
24 changed files with 356 additions and 270 deletions
  1. +1
    -1
      App.vue
  2. +8
    -3
      api/index.js
  3. +5
    -0
      api/modules/book.js
  4. +1
    -1
      api/modules/config.js
  5. +0
    -95
      api/modules/exhibit.js
  6. +6
    -3
      api/modules/home.js
  7. +27
    -6
      api/modules/login.js
  8. +32
    -0
      api/modules/member.js
  9. +5
    -0
      api/modules/promotion.js
  10. +32
    -20
      api/request.js
  11. +1
    -1
      config/index.js
  12. +2
    -2
      manifest.json
  13. +8
    -11
      mixins/config.js
  14. +19
    -18
      pages/index/home.vue
  15. +3
    -1
      pages/index/member.vue
  16. +24
    -10
      pages/index/user.vue
  17. +7
    -7
      stores/index.js
  18. +23
    -4
      subPages/home/plan.vue
  19. +36
    -7
      subPages/home/submit.vue
  20. +3
    -3
      subPages/login/login.vue
  21. +29
    -35
      subPages/login/userInfo.vue
  22. +59
    -31
      subPages/member/recharge.vue
  23. +3
    -0
      subPages/user/discount.vue
  24. +22
    -11
      subPages/user/profile.vue

+ 1
- 1
App.vue View File

@ -15,7 +15,7 @@
console.log(uni.getStorageSync('token'));
console.log('App Show')
// await this.$store.dispatch('initData')
await this.$store.dispatch('initData')
// console.log('')
},
onHide: function() {


+ 8
- 3
api/index.js View File

@ -1,13 +1,18 @@
import user from '@/api/modules/user'
import config from '@/api/modules/config'
import exhibit from '@/api/modules/exhibit'
import login from '@/api/modules/login'
import home from '@/api/modules/home'
import member from '@/api/modules/member'
import book from '@/api/modules/book'
import promotion from '@/api/modules/promotion'
export {
user,
config,
exhibit,
login,
home
home,
member,
book,
promotion
}

+ 5
- 0
api/modules/book.js View File

@ -0,0 +1,5 @@
import request from "@/api/request";
export default {
}

+ 1
- 1
api/modules/config.js View File

@ -4,7 +4,7 @@ import http from "@/api/http";
export default {
async queryConfigList() {
return http({
url: '/config/queryConfigList',
url: '/config/list',
method: 'GET'
})
},


+ 0
- 95
api/modules/exhibit.js View File

@ -1,95 +0,0 @@
import http from "@/api/http";
export default {
// 查看展品信息列表
async queryShowpieceList(data) {
return http({
url: '/showpiece/queryShowpieceList',
method: 'GET',
data
})
},
// 查看维修记录列表
async queryRepairList(data) {
return http({
url: '/showpiece/queryRepairList',
method: 'GET',
data
})
},
// 查看保养记录
async queryMaintenanceList(data) {
return http({
url: '/showpiece/queryMaintenanceList',
method: 'GET',
data
})
},
// 保养-新增保养记录
async addMaintenance(data) {
return http({
url: '/showpiece/addMaintenance',
method: 'POST',
data,
showLoading: true,
needToken: true
})
},
// 报修- 查看报修单列表
async queryMalfunctionList(data) {
return http({
url: '/showpiece/queryMalfunctionList',
method: 'GET',
data
})
},
// 报修- 新增报修单
async addMalfunction(data) {
return http({
url: '/showpiece/addMalfunction',
method: 'POST',
data,
showLoading: true,
needToken: true
})
},
// 查看保修单详情
async queryMalfunctionById(data) {
return http({
url: '/showpiece/queryMalfunctionById',
method: 'GET',
data
})
},
// 修改保修单
async updateMalfunction(data) {
return http({
url: '/showpiece/updateMalfunction',
method: 'POST',
data,
showLoading: true,
needToken: true
})
},
// 新增维修记录
async addRepair(data) {
return http({
url: '/showpiece/addRepair',
method: 'POST',
data,
showLoading: true,
needToken: true
})
},
}

+ 6
- 3
api/modules/home.js View File

@ -2,11 +2,13 @@ import http from "@/api/http";
export default{
async getSignup() {
async getSignup(data) {
// 首页底部内容添加报名
return http({
url: '/index/linkSignup',
method: 'GET',
method: 'POST',
data,
needToken: true
})
},
@ -19,10 +21,11 @@ export default{
},
// 首页底部内容链接详情
async getLinkDetails() {
async getLinkDetails(data) {
return http({
url: '/index/linkDetails',
method: 'GET',
data
})
},


+ 27
- 6
api/modules/login.js View File

@ -1,24 +1,45 @@
// import request from "@/api/request";
import http from "@/api/http";
export default {
// 程序-绑定手机号码
// 绑定手机号码
async bindPhone(data) {
return http({
url: '/login/bindPhone',
method: 'GET',
data
url: '/login/getPhoneNumber',
method: 'POST',
data,
needToken: true
})
},
// 登录
async login(data) {
return http({
url: '/login/login',
method: 'GET',
url: '/login/wxLogin',
method: 'POST',
data,
// header: {
// 'Content-Type': 'application/x-www-form-urlencoded'
// },
showLoading: true
})
},
// 获取用户信息
async getUserInfo() {
return http({
url: '/login/getUserInfo',
method: 'GET',
needToken: true
})
},
// 更新用户信息
async updateUserInfo(data) {
return http({
url: '/login/updateUserInfo',
method: 'POST',
data,
needToken: true
})
}
}

+ 32
- 0
api/modules/member.js View File

@ -0,0 +1,32 @@
import request from "@/api/request";
export default {
// 开通会员
async openMember(data) {
return request({
url: '/member/open',
method: 'POST',
data,
needToken: true,
showLoading: true
})
},
// 取会员列表
async getMemberList() {
return request({
url: '/member/list',
method: 'GET'
})
},
// 获取优惠卷
async getCouponList(data) {
return request({
url: '/member/coupon',
method: 'GET',
needToken: true,
data
})
}
}

+ 5
- 0
api/modules/promotion.js View File

@ -0,0 +1,5 @@
import request from "@/api/request";
export default {
}

+ 32
- 20
api/request.js View File

@ -1,21 +1,24 @@
import config from "@/config";
export default function request ( {
url = '',
method = 'GET',
data = {},
showLoading = false,
header = {} ,
export default function request({
url = '',
method = 'GET',
data = {},
showLoading = false,
header = {},
needToken = false, // 需要token
showToast = true // 默认显示失败的提示
} ) {
if (showLoading) uni.showLoading({title: '加载中'})
if(needToken) {
}) {
if (showLoading) uni.showLoading({ title: '加载中' })
if (needToken) {
const token = uni.getStorageSync('token')
if (token) {
header['X-Access-Token'] = token
}else {
} else {
if (showLoading) {
uni.hideLoading()
}
uni.showToast({
title: '请先登录',
icon: 'none'
@ -39,18 +42,25 @@ export default function request ( {
// 优先处理业务逻辑响应
if (res.statusCode === 200 && res.data) {
// 业务成功
if (res.data.code === 200 ) {
if (res.data.code === 200) {
if (showLoading) {
uni.hideLoading()
}
resolve(res.data)
return
}
// 业务失败但有具体错误信息
const errorMsg = res.data.message || '请求失败'
if (showToast) {
if (showLoading) {
uni.hideLoading()
}
uni.showToast({
title: errorMsg,
icon: 'none'
icon: 'none',
duration: 3000
})
}
reject({
@ -77,11 +87,14 @@ export default function request ( {
case 404:
error.message = '资源不存在'
break;
case 500:
case 500:
error.message = '服务器错误'
break;
}
if (showToast) {
if (showLoading) {
uni.hideLoading()
}
uni.showToast({
title: error.message,
icon: 'none'
@ -93,6 +106,9 @@ export default function request ( {
console.log(`Fail ${method} ${url}`, err);
const errorMsg = err.errMsg || '请求失败'
if (showToast) {
if (showLoading) {
uni.hideLoading()
}
uni.showToast({
title: errorMsg,
icon: 'none'
@ -105,11 +121,7 @@ export default function request ( {
data: err
})
},
complete: () => {
if (showLoading) {
uni.hideLoading()
}
}
})
})
}

+ 1
- 1
config/index.js View File

@ -19,7 +19,7 @@ const config = {
// 网络全局配置
netConfig: {
development: {
baseURL: 'http://augcl.natapp1.cc/exhibit-admin/exhibit',
baseURL: 'http://h5.xzaiyp.top/englishread-admin/doc.html',
},
testing: {
baseURL: 'https://www.multipleculture.com/englishread-admin/appletApi',


+ 2
- 2
manifest.json View File

@ -1,7 +1,7 @@
{
"name" : "展品维保",
"name" : "四零语境",
"appid" : "__UNI__B264FE1",
"description" : "展品维保",
"description" : "四零语境",
"versionName" : "1.0.0",
"versionCode" : "100",
"transformPx" : false,


+ 8
- 11
mixins/config.js View File

@ -21,23 +21,20 @@ export default {
},
computed: {
// 获取全局配置的文本
configParamText() {
return key => this.$store.state.configList[key]?.paramText || '默认文本'
configParamInfo() {
return key => this.$store.state.configList[key]?.info || '默认资料'
},
// 获取全局配置的图片
configParamImage() {
return key => this.$store.state.configList[key]?.paramImage || '/static/默认图片.png'
},
// 获取全局配置的富文本
configParamTextarea() {
return key => this.$store.state.configList[key]?.paramTextarea || '默认富文本'
configParamContent() {
return key => this.$store.state.configList[key]?.content || '默认内容'
},
// 默认的全局分享参数
GShare() {
return {
title: this.configParamText('app_name'),
desc: this.configParamText('share_desc'),
imageUrl: this.configParamImage('app_logo'),
title: this.configParamContent('app_name'),
desc: this.configParamContent('share_desc'),
imageUrl: this.configParamContent('app_logo'),
path: '/pages/index/index'
}
}


+ 19
- 18
pages/index/home.vue View File

@ -152,12 +152,12 @@
<view class="section">
<view class="recommend-list">
<view
@click="goPlan()"
@click="goPlan(item.id, item.type)"
v-for="(item, index) in recommendList"
:key="index"
class="recommend-item"
>
<image :src="item.image" mode="aspectFill" class="recommend-image"></image>
<image :src="item.img" mode="aspectFill" class="recommend-image"></image>
</view>
</view>
</view>
@ -174,8 +174,10 @@ export default {
//
bannerList: [
],
//
todayUpdates: [
@ -269,18 +271,7 @@ export default {
//
recommendList: [
{
image: '/static/默认图片.png'
},
{
image: '/static/默认图片.png'
},
{
image: '/static/默认图片.png'
},
{
image: '/static/默认图片.png'
}
]
}
},
@ -297,9 +288,9 @@ export default {
//
},
//
goPlan() {
goPlan(id, type) {
uni.navigateTo({
url: '/subPages/home/plan'
url: '/subPages/home/plan?id=' + id + '&type=' + type
})
},
goSearch() {
@ -321,10 +312,20 @@ export default {
}))
}
},
async getSignup() {
const signupRes = await this.$api.home.getLink()
if (signupRes.code === 200){
this.recommendList = signupRes.result.map(item => ({
img: item.img,
id: item.id,
type: item.type
}))
}
}
},
async onShow() {
await this.getBanner()
Promise.all([this.getBanner(), this.getSignup()])
}
}
</script>


+ 3
- 1
pages/index/member.vue View File

@ -238,8 +238,10 @@ export default{
uni.navigateTo({
url: '/subPages/member/recharge'
})
}
},
},
}
</script>


+ 24
- 10
pages/index/user.vue View File

@ -6,11 +6,11 @@
<view class="page-title">我的</view>
<view class="user-info">
<view class="user-avatar" @click="goLogin">
<image :src="isLogin ? userInfo.headImage : displayInfo.avatar" mode="aspectFill"></image>
<image :src="isLogin ? userInfo.avatar === 'undefined' ? displayInfo.avatar : userInfo.avatar : displayInfo.avatar" mode="aspectFill"></image>
</view>
<view class="user-details">
<view class="user-details" @click="clickInfo">
<view class="user-name">{{ isLogin ? userInfo.nickName : displayInfo.name }}</view>
<view class="user-name">{{ isLogin ? userInfo.name : displayInfo.name }}</view>
<view class="user-phone">手机号{{ isLogin ? userInfo.phone || displayInfo.phone : displayInfo.phone }}</view>
<view class="user-desc">{{ displayInfo.description }}</view>
</view>
@ -142,15 +142,15 @@ export default {
data() {
return {
userInfo: {
headImage: '/static/默认头像.png',
nickName: '请先登录',
avatar: '/static/默认头像.png',
name: '请先登录',
id: 'XXXXX'
},
isLogin: uni.getStorageSync('token'),
//
displayInfo: {
name: '战斗世界',
phone: '19989674531',
name: '点击登录',
phone: 'xxxxxxxxx',
avatar: '/static/默认头像.png',
description: '世界这么美,我想去看看~'
}
@ -197,7 +197,7 @@ export default {
//
async getUserInfo() {
const res = await this.$api.user.queryUser();
const res = await this.$api.login.getUserInfo();
if (res.code === 200) {
this.userInfo = res.result;
}
@ -246,6 +246,20 @@ export default {
})
},
//
clickInfo() {
if (!this.isLogin){
uni.navigateTo({
url: '/subPages/login/login'
})
}else {
uni.navigateTo({
url: '/subPages/user/profile'
})
}
},
// 退
logout() {
uni.showModal({
@ -259,8 +273,8 @@ export default {
//
this.userInfo = {
headImage: '/static/默认头像.png',
nickName: '请先登录',
avatar: '/static/默认头像.png',
name: '请先登录',
id: 'XXXXX'
}


+ 7
- 7
stores/index.js View File

@ -63,12 +63,12 @@ const store = new Vuex.Store({
async getConfig({ commit }) {
const res = await api.config.queryConfigList()
// 要求变成键值对的样子
const config = res.result.records.reduce((acc, item) => {
if (!item.paramCode) {
console.log('paramCode为空', item);
const config = res.result.reduce((acc, item) => {
if (!item.code) {
console.log('code为空', item);
return acc
}
acc[item.paramCode] = item
acc[item.code] = item
return acc
}, {})
commit('setConfigList', config)
@ -86,7 +86,7 @@ const store = new Vuex.Store({
// 初始化数据
async initData({ dispatch, state }) {
// 检查是否已初始化
if (state.configList.length > 0 && state.departmentList.length > 0 && state.categoryList.length > 0) {
if (state.configList.length > 0) {
console.log('配置数据已初始化,无需重复初始化')
return
@ -95,8 +95,8 @@ const store = new Vuex.Store({
try {
await Promise.all([
dispatch('getConfig'),
dispatch('getDepartment'),
dispatch('getCategory'),
// dispatch('getDepartment'),
// dispatch('getCategory'),
])
console.log('所有配置数据初始化完成')
} catch (error) {


+ 23
- 4
subPages/home/plan.vue View File

@ -15,7 +15,7 @@
</view>
<!-- 底部固定报名栏 -->
<view class="bottom-bar">
<view class="bottom-bar" v-if="type === 1 || '-1'">
<uv-button
type="primary"
text="报名"
@ -61,7 +61,9 @@ export default {
`,
style: {
img: 'borderRadius: 24rpx'
}
},
id: '',
type: ''
}
},
methods: {
@ -69,10 +71,27 @@ export default {
console.log('点击报名')
//
uni.navigateTo({
url: '/subPages/home/submit'
url: '/subPages/home/submit?id=' + this.id
})
},
},
async onShow() {
try{
const askRes = await this.$api.home.getLinkDetails({
id: this.id
})
if (askRes.code === 200){
this.richTextContent = askRes.result.content
}
} catch (error) {
console.log('error', error)
}
}
},
onLoad(options) {
this.id = options.id
this.type = options.type
},
}
</script>


+ 36
- 7
subPages/home/submit.vue View File

@ -44,7 +44,7 @@
<view class="form-item">
<text class="form-label">个人期待</text>
<uv-textarea
v-model="formData.expectation"
v-model="formData.looking"
placeholder="请输入"
border="bottom"
:auto-height="true"
@ -102,13 +102,13 @@ export default {
formData: {
name: '',
phone: '',
expectation: '',
looking: '',
background: ''
}
}
},
methods: {
handleSubmit() {
async handleSubmit() {
console.log('提交表单', this.formData)
//
if (!this.formData.name) {
@ -126,10 +126,39 @@ export default {
return
}
uni.showToast({
title: '提交成功',
icon: 'success'
})
try{
const subRes = await this.$api.home.getSignup({
...this.formData,
id: this.id
})
if (subRes.code === 200) {
uni.showToast({
title: '提交成功',
icon: 'success'
})
setTimeout(() => {
uni.navigateBack({
delta: 2
})
}, 1000)
} else {
uni.showToast({
title: subRes.msg,
icon: 'none'
})
}
} catch (error) {
uni.showToast({
title: error.msg,
icon: 'none'
})
}
// uni.showToast({
// title: '',
// icon: 'success'
// })
}
}
}


+ 3
- 3
subPages/login/login.vue View File

@ -71,8 +71,8 @@ export default {
//
handleLogin() {
uni.redirectTo({ url: '/subPages/login/userInfo' })
return
// uni.redirectTo({ url: '/subPages/login/userInfo' })
// return
if (!this.isAgreed) {
this.$refs.serviceModal.open();
@ -89,7 +89,7 @@ export default {
uni.setStorageSync('token', loginRes.token)
const userInfo = loginRes.userInfo
if ( !userInfo.department || !userInfo.headImage || !userInfo.nickName || !userInfo.phone ){
if ( !userInfo.avatar || !userInfo.name || !userInfo.phone ){
uni.navigateTo({
url: '/subPages/login/userInfo'
})


+ 29
- 35
subPages/login/userInfo.vue View File

@ -19,7 +19,7 @@
<button class="avatar-button" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
<image
class="avatar-image"
:src="userInfo.headImage || '/static/默认图片.png'"
:src="userInfo.avatar || '/static/默认头像.png'"
mode="aspectFill"
></image>
</button>
@ -30,15 +30,15 @@
<text class="form-label">昵称</text>
<input
class="form-input"
type="nickname"
v-model="userInfo.nickName"
type="name"
v-model="userInfo.name"
placeholder="请输入昵称"
@blur="onNicknameBlur"
@blur="nameBlur"
/>
</view>
<!-- 手机号 -->
<!-- <view class="form-item">
<view class="form-item">
<text class="form-label">手机号</text>
<view class="phone-container" v-if="!userInfo.phone">
<button
@ -51,7 +51,7 @@
</view>
<text class="form-label" v-else>{{ userInfo.phone }}</text>
</view>
-->
<!-- 所在部门 -->
<!-- <view class="form-item">
<text class="form-label">所在部门</text>
@ -98,8 +98,8 @@ export default {
data() {
return {
userInfo: {
headImage: '',
nickName: '',
avatar: '',
name: '',
phone: '',
department: {
title: '',
@ -113,7 +113,8 @@ export default {
},
async onLoad() {
this.calculateContainerHeight();
// await this.getUserInfo();
await this.getUserInfo();
},
computed: {
//
@ -135,16 +136,16 @@ export default {
//
async getWechatUserInfo() {
const { result } = await this.$api.user.queryUser()
this.userInfo.nickName = result.nickName
this.userInfo.headImage = result.headImage
this.userInfo.name = result.name
this.userInfo.avatar = result.avatar
this.userInfo.phone = result.phone
},
//
async getUserInfo(){
const { result:info } = await this.$api.user.queryUser()
this.userInfo.nickName = info.nickName
this.userInfo.headImage = info.headImage
const { result:info } = await this.$api.login.getUserInfo()
this.userInfo.name = info.name
this.userInfo.avatar = info.headImage
this.userInfo.phone = info.phone
},
@ -169,7 +170,7 @@ export default {
if (uploadResult.success) {
// URL
this.userInfo.headImage = uploadResult.url;
this.userInfo.avatar = uploadResult.url;
console.log('头像上传成功', uploadResult.url);
uni.showToast({
title: '头像上传成功',
@ -182,7 +183,7 @@ export default {
uni.hideLoading();
console.error('头像上传异常:', error);
// 使
this.userInfo.headImage = e.detail.avatarUrl;
this.userInfo.avatar = e.detail.avatarUrl;
uni.showToast({
title: '头像处理异常,使用本地头像',
icon: 'none'
@ -198,8 +199,8 @@ export default {
//
onNicknameBlur() {
if (!this.userInfo.nickName.trim()) {
nameBlur() {
if (!this.userInfo.name.trim()) {
uni.showToast({
title: '请输入昵称',
icon: 'none'
@ -234,11 +235,11 @@ export default {
if (e.detail.errMsg === 'getPhoneNumber:ok') {
// e.detail.code
console.log('获取手机号成功', e.detail);
const res = await this.$api.login.bindPhone({
phoneCode: e.detail.code
const { result:phoneRes } = await this.$api.login.bindPhone({
code: e.detail.code
})
const str = JSON.parse(res.result);
this.userInfo.phone = str.phone_info.phoneNumber
this.userInfo.phone = phoneRes
uni.showToast({
title: '手机号获取成功',
icon: 'success'
@ -254,7 +255,7 @@ export default {
//
async submitUserInfo() {
if (!this.userInfo.nickName.trim()) {
if (!this.userInfo.name.trim()) {
uni.showToast({
title: '请输入昵称',
icon: 'none'
@ -270,24 +271,17 @@ export default {
return;
}
if (!this.userInfo.department.title.trim()) {
uni.showToast({
title: '请选择所在部门',
icon: 'none'
});
return;
}
console.log('提交用户信息', this.userInfo);
try {
//
await this.$api.user.updateUser({
nickName: this.userInfo.nickName,
await this.$api.login.updateUserInfo({
name: this.userInfo.name,
phone: this.userInfo.phone,
headImage: this.userInfo.headImage,
department: this.userInfo.department.id,
remark: this.userInfo.remark
avatar: this.userInfo.avatar,
});
uni.showToast({


+ 59
- 31
subPages/member/recharge.vue View File

@ -9,7 +9,7 @@
/>
<text class="header-title">会员开通</text>
<!-- 加一个推出箭头 -->
<view class="header-icon" >
<view class="header-icon" @click="goBack">
<uv-icon name="arrow-left" color="#000" size="20" />
</view>
<!-- 轮播容器 -->
@ -17,6 +17,9 @@
<uv-swiper
bgColor="transparent"
:list="list"
:loading="!list.length"
@change="changeSwiper"
keyName="img"
previousMargin="70"
nextMargin="70"
acceleration
@ -51,17 +54,17 @@
>
<view class="info">
<!-- 赠送标识 -->
<view class="gift-tag" v-if="item.gift">
赠送{{ item.gift }}
<view class="gift-tag" v-if="item.content">
{{ item.content }}
</view>
<view class="package-title">{{ item.title }}</view>
<view class="package-price">¥{{ getInt(item.price) }}.<text class="package-decimal">{{ getDecimal(item.price) }}</text></view>
<view class="package-original">¥{{ item.originalPrice }}</view>
<view class="package-price">¥{{ getInt(item.discountedprice) }}.<text class="package-decimal">{{ getDecimal(item.discountedprice) }}</text></view>
<view class="package-original">¥{{ item.originalprice }}</view>
</view>
<view class="package-btn" :class="{ 'active': selectedPackage === index }">
<view class="package-btn" :class="{ 'active': selectedPackage === index }">
{{ selectedPackage === index ? '已选择' : '点击选择' }}
</view>
</view>
@ -126,36 +129,47 @@
data() {
return {
list: [
'/static/会员1.png',
'/static/会员2.png',
'/static/会员3.png'
],
selectedPackage: 0, //
packageList: [
selectedMember: 0, //
defaultPackageList: [
{
title: '30天会员',
price: '36.00',
originalPrice: '128',
gift: null
title: '当前会员没有返回套餐',
discountedprice: '36.00',
originalprice: '128',
gift: null,
content: '赠送66天'
},
{
title: '90天会员',
price: '88.00',
originalPrice: '384',
gift: '180'
title: '当前会员没有返回套餐',
discountedprice: '88.00',
originalprice: '384',
gift: '180',
content: '赠送666天'
},
{
title: '180天会员',
price: '128.00',
originalPrice: '384',
gift: null
title: '当前会员没有返回套餐',
discountedprice: '128.00',
originalprice: '384',
gift: null,
content: '赠送9999天'
}
]
}
},
computed:{
packageList(){
return this.list[this.selectedMember].setmeals.length ? this.list[this.selectedMember].setmeals : this.defaultPackageList
}
},
methods: {
goBack(){
uni.navigateBack()
},
//
getInt(price){
getInt(pri){
const price = String(pri)
if (price.indexOf('.') === -1) {
return price
}
@ -164,10 +178,11 @@
}
return String(price).split('.')[0]
},
getDecimal(price){
getDecimal(pri){
const price = String(pri)
if (price === null) return '00'
const parts = String(price).split('.')
return parts[1] ? parts[1].padEnd(2, '0') : '00'
const parts = price.split('.')
return parts[1] ? parts[1].padEnd(2, '0') : '00'
},
selectPackage(index) {
this.selectedPackage = index
@ -177,8 +192,21 @@
title: '功能开发中',
icon: 'none'
})
}
}
},
async getMemberList(){
const memberRes = await this.$api.member.getMemberList()
if (memberRes.code === 200){
this.list = memberRes.result
}
},
changeSwiper(e){
this.selectedMember = e.current
this.selectedPackage = 0
}
},
onShow(){
this.getMemberList()
}
}
</script>
@ -271,13 +299,13 @@
.gift-tag {
position: absolute;
top: -10rpx;
left: 50%;
transform: translateX(-50%);
left: 0%;
// transform: translateX(-50%);
background: #FF6B6B;
color: #fff;
font-size: 20rpx;
padding: 8rpx 16rpx;
border-radius: 20rpx;
border-radius: 20rpx 20rpx 20rpx 0;
white-space: nowrap;
}


+ 3
- 0
subPages/user/discount.vue View File

@ -80,9 +80,12 @@
</template>
<script>
import ListMixins from '@/mixins/list'
export default {
mixins: [ListMixins],
data() {
return {
mixinListApi: 'member.getCouponList',
currentTab: 0,
tabList: [
{ name: '待使用' },


+ 22
- 11
subPages/user/profile.vue View File

@ -11,7 +11,7 @@
<text>昵称</text>
</view>
<uv-input
v-model="userInfo.nickName"
v-model="userInfo.name"
placeholder="请输入昵称"
:customStyle="inputStyle"
border="bottom"
@ -40,8 +40,15 @@
<text>头像</text>
</view>
<view class="avatar-container" @click="uploadAvatar">
<view
v-if="userInfo.avatar === 'undefined'"
class="avatar-image"
>
<uv-icon name="camera" size="40" color="white"></uv-icon>
</view>
<image
:src="userInfo.headImage || '/static/默认头像.png'"
v-else
:src="userInfo.avatar || '/static/默认头像.png'"
class="avatar-image"
mode="aspectFill"
></image>
@ -71,8 +78,8 @@ export default {
data() {
return {
userInfo: {
headImage: '',
nickName: '',
avatar: 'undefined',
name: '',
phone: ''
},
showMask: true,
@ -104,7 +111,7 @@ export default {
if (result && result.success) {
console.log(result);
this.userInfo.headImage = result.url
this.userInfo.avatar = result.url
}
} catch (error) {
console.error('头像上传失败:', error)
@ -118,7 +125,7 @@ export default {
//
async saveProfile() {
if (!this.userInfo.nickName.trim()) {
if (!this.userInfo.name.trim()) {
uni.showToast({
title: '请输入昵称',
icon: 'none'
@ -145,9 +152,9 @@ export default {
}
// TODO: API
const res = await this.$api.user.updateUser({
headImage: this.userInfo.headImage,
nickName: this.userInfo.nickName,
const res = await this.$api.login.updateUserInfo({
avatar: this.userInfo.avatar,
name: this.userInfo.name,
phone: this.userInfo.phone
})
if (res.code === 200) {
@ -165,14 +172,14 @@ export default {
//
async getProfile() {
const res = await this.$api.user.queryUser()
const res = await this.$api.login.getUserInfo()
if (res.code === 200) {
this.userInfo = res.result
}
}
},
onLoad() {
// this.getProfile()
this.getProfile()
// 3
setTimeout(() => {
this.showMask = false
@ -230,6 +237,10 @@ export default {
.avatar-image {
width: 100%;
height: 100%;
background: #00000080;
display: flex;
align-items: center;
justify-content: center;
}
.avatar-mask {


Loading…
Cancel
Save