Browse Source

修改 bug

master
王泽彦 8 months ago
parent
commit
c172d3b634
  1. 241
      uniapp/pages/market/clue/add_clues.vue
  2. 89
      uniapp/pages/market/clue/clue_info.vue
  3. 321
      uniapp/pages/market/clue/edit_clues.vue
  4. 186
      uniapp/pages/student/knowledge/index.vue
  5. 211
      uniapp/pages/student/orders/index.vue

241
uniapp/pages/market/clue/add_clues.vue

@ -509,12 +509,10 @@
class="img"
:src="$util.img('/uniapp_src/static/images/index/myk.png')"></image>
<view class="name">{{v.name}}</view>
<!-- <view class="tag">{{ v.is_status == 1 ? '试听' : '成交' }}</view>-->
</view>
<view class="box_2">
<view class="left">
<view class="name">首选联系人{{v.decision_maker}}</view>
<!-- <view class="call">妈妈</view>-->
</view>
</view>
<view class="box_2">
@ -550,8 +548,6 @@
</view>
</view>
<view class="right_box">
<!-- <image v-if="v.member_id" class="img" :src="$util.img('/uniapp_src/static/images/index/message.png')" @click="openViewMyMessage(v)"></image>-->
<!-- <image v-if="v.phone_number" class="img" :src="$util.img('/uniapp_src/static/images/index/phone.png')" @click="dialTel(v)"></image>-->
</view>
</view>
</view>
@ -602,78 +598,10 @@ import dictUtil from '@/common/dictUtil.js';
import dictUtilSimple from '@/common/dictUtilSimple.js';
const rules = [
{
name: "student_name",
rule: ["required"],
msg: ["请输入学员姓名"]
},
{
name: "title",
rule: ["required"],
msg: ["请输入线索标题"]
},
{
name: "student_phone",
rule: ["required", "isMobile"],
msg: ["请输入电话", "请输入正确的手机号"]
},
{
name: "age",
rule: ["required", "isNumber"],
msg: ["请输入年龄", "请输入正确的数字"]
},
{
name: "school_name",
rule: ["required"],
msg: ["请输入学校"]
},
{
name: "grade",
rule: ["required"],
msg: ["请输入年级"]
},
{
name: "class_name",
rule: ["required"],
msg: ["请输入班级"]
},
{
name: "customer_source",
rule: ["required"],
msg: ["请选择客户来源"]
},
{
name: "add_staff_id",
rule: ["required"],
msg: ["请选择顾问"]
},
{
name: "contact_name",
rule: ["required"],
msg: ["请输入联系人"]
},
{
name: "full_address",
rule: ["required"],
msg: ["请选择所在地区"]
},
{
name: "community_name",
rule: ["required"],
msg: ["请输入小区"]
},
{
name: "customer_tags_name",
rule: ["required"],
msg: ["请选择客户标签"]
}
];
export default {
data() {
return {
switchChange_type: 1,
rules,
is_submit: true,//()|true=,false=
@ -787,9 +715,6 @@ export default {
maxDate: new Date().toISOString().split('T')[0], //
//
show_area: false,
options_area: [],
//
userInfo:{},
@ -1190,93 +1115,10 @@ export default {
await this.get_campus_list()//
},
//-id
async getDict_courses_id(){
let res = await marketApi.selectCourseList({})
if(res.code != 1){
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
let dictionary = res.data
let arr = []
dictionary.forEach((v,k)=>{
arr.push({
text: v.name,
value: v.id,
})
})
this.options_courses_id = arr
},
//
async getStaffList() {
let res = await memberApi.staffList({type: 2})
if (res.code != 1) {
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
let arr = []
res.data.forEach((v,k)=>{
arr.push({
text: v.name,
value: v.id,
})
})
this.options_add_staff_id = arr
},
// role_id|5=,6=
async getRoleStaffList(role_id) {
let res = await memberApi.staffList({
type: 2,
role_id:role_id
})
if (res.code != 1) {
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
let arr = []
res.data.forEach((v,k)=>{
arr.push({
text: v.name,
value: v.id,
})
})
if(role_id == 5){
this.options_staff_id_5 = arr
console.log('市场',arr)
}else{
this.options_staff_id_6 = arr
console.log('销售',arr)
}
},
//
async getAreaTree() {
let res = await commonApi.getAreaTree()
if (res.code != 1) {
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
this.options_area = res.data
},
//
async getDict(inputName){
@ -1513,68 +1355,10 @@ export default {
//-
onConfirmCustomerTags(e) {
console.log('多选客户标签', e)
this.show_customer_tags = false
let customer_tags_name_arr = []
let customer_tags_arr = []
e.options.forEach((v, k) => {
customer_tags_arr.push(v.value)
customer_tags_name_arr.push(v.text)
//v.value this.options_customer_tagscheckedtrue
this.options_customer_tags.forEach((v, k) => {
if (v.value == v.value) {
v.checked = true
}
})
})
this.formData.customer_tags_name = customer_tags_name_arr.join(',')//
this.formData.customer_tags = customer_tags_arr//
},
//
changeArea(e) {
this.show_area = false
console.log('地区选择', e)
this.formData.province_id = e.value[0]
this.formData.city_id = e.value[1]
this.formData.district_id = e.value[2]
this.formData.full_address = `${e.text[0]}-${e.text[1]}-${e.text[2]}`
},
//
switchChange(e) {
if (e.detail.value) {
this.switchChange_type = 1
} else {
this.switchChange_type = 2
}
},
//
changeSex(e){
this.formData.gender = e.detail.value
},
//-
changeIsFollow(e) {
console.log(111, e.detail.value)
this.is_follow = e.detail.value
// 1
if (this.is_follow) {
this.formData.is_follow = '1'
} else {
//2
this.formData.is_follow = '2'
this.formData.entry_type = ''//
this.formData.staff_id = ''//
this.formData.follow_up_time = ''//
this.formData.follow_up_content = ''//
}
},
//tag
@ -1992,14 +1776,6 @@ export default {
.form-style {
width: 100%;
// background: #434544;
}
.form-style-vid {
display: flex;
align-items: center;
justify-content: space-between;
padding: 12rpx 0;
}
.input-style {
@ -2072,23 +1848,11 @@ export default {
.img {
width: 48rpx;
height: 48rpx;
border-right: 50%;
border-radius: 50%;
}
.name{
margin-left: 20rpx;
}
.tag{
margin-left: 20rpx;
width: 84rpx;
height: 32rpx;
line-height: 28rpx;
border-radius: 0rpx 20rpx 20rpx 20rpx;
background-color: rgba(236,128,141,0.3);
color: rgba(240,90,90,1);
font-size: 20rpx;
text-align: center;
border: 0rpx solid rgba(121,121,121,1);
}
}
.box_2{
display: flex;
@ -2110,7 +1874,6 @@ export default {
.box_3{
display: flex;
gap: 30rpx;
.left{}
.right{
display: flex;
align-items: center;
@ -2118,7 +1881,7 @@ export default {
.img{
width: 16rpx;
height: 16rpx;
border-right: 50%;
border-radius: 50%;
}
}
}

89
uniapp/pages/market/clue/clue_info.vue

@ -224,7 +224,6 @@
</uni-popup>
<FitnessRecordPopup ref="fitnessRecordPopup" :resource-id="clientInfo.resource_id" :student-id="currentStudent && currentStudent.id" @confirm="handleFitnessRecordConfirm" />
<CourseEditPopup ref="courseEditPopup" @confirm="handleCourseEditConfirm" />
<StudentEditPopup ref="studentEditPopup" :resource-id="clientInfo.resource_id" @confirm="handleStudentEditConfirm" />
<StudyPlanPopup ref="studyPlanPopup" :student-id="currentStudent && currentStudent.id" @confirm="handleStudyPlanConfirm" />
@ -300,7 +299,6 @@ import OrderListCard from '@/components/order-list-card/index.vue'
import ServiceListCard from '@/components/service-list-card/index.vue'
import OrderFormPopup from '@/components/order-form-popup/index.vue'
//
import CourseEditPopup from '@/components/course-edit-popup/course-edit-popup.vue'
import StudentEditPopup from '@/components/student-edit-popup/student-edit-popup.vue'
import FitnessRecordPopup from '@/components/fitness-record-popup/fitness-record-popup.vue'
import StudyPlanPopup from '@/components/study-plan-popup/study-plan-popup.vue'
@ -318,7 +316,6 @@ export default {
OrderListCard,
ServiceListCard,
OrderFormPopup,
CourseEditPopup,
StudentEditPopup,
FitnessRecordPopup,
StudyPlanPopup
@ -328,8 +325,6 @@ export default {
switch_tags_type: 1,
resource_sharing_id: '',
// 使
screenHeight: 0,
//
clientInfo: { id: '', resource_id: '', customerResource: {} },
@ -360,10 +355,7 @@ export default {
//
tabs: [
{ id: 1, name: '基本资料' },
// { id: 2, name: '' },
{ id: 3, name: '通话记录' },
// { id: 4, name: '' },
// { id: 5, name: '' }
{ id: 7, name: '修改资料' },
{ id: 6, name: '修改记录' }
],
@ -418,45 +410,6 @@ export default {
return ['fitness_record', 'study_plan'].includes(this.currentPopup)
},
// xx
calculateAge(birthday) {
if (!birthday) return ''
const birthDate = new Date(birthday)
const now = new Date()
let years = now.getFullYear() - birthDate.getFullYear()
let months = now.getMonth() - birthDate.getMonth()
if (months < 0) {
years--
months += 12
}
// 1
if (now.getDate() < birthDate.getDate()) {
months--
if (months < 0) {
years--
months += 12
}
}
if (years > 0 && months > 0) {
return `${years}${months}`
} else if (years > 0) {
return `${years}`
} else if (months > 0) {
return `${months}`
} else {
return '新生儿'
}
},
//
formatGender(gender) {
return gender === 1 ? '男' : gender === 2 ? '女' : ''
}
},
onLoad(options) {
if (!options?.resource_sharing_id) {
@ -599,37 +552,6 @@ export default {
}
},
//
async handleActionClick(action) {
switch (action.key) {
case 'course_arrangement':
this.$navigateToPage(`/pages/market/clue/class_arrangement`, {
resource_id: this.clientInfo.resource_id,
student_id: this.currentStudent?.id
})
break
case 'course_info':
await this.getCourseInfo()
this.currentPopup = 'course_info'
break
case 'fitness_record':
await this.getFitnessRecords()
this.currentPopup = 'fitness_record'
break
case 'study_plan':
await this.getStudyPlanList()
this.currentPopup = 'study_plan'
break
case 'order_list':
await this.getOrderList()
this.currentPopup = 'order_list'
break
case 'service_list':
await this.getServiceList()
this.currentPopup = 'service_list'
break
}
},
// -
async handleStudentActionClick(action, student) {
@ -686,9 +608,6 @@ export default {
},
handleCourseEditConfirm(result) {
uni.showToast({ title: '保存成功', icon: 'success' })
},
viewCourseDetail(course) {
@ -702,7 +621,6 @@ export default {
})
},
async handleTabChange({ tabId }) {
this.switch_tags_type = tabId
@ -732,9 +650,6 @@ export default {
case 'study_plan':
this.switch_tags_type = 5
break
default:
this.handleActionClick(action)
break
}
},
@ -1228,9 +1143,9 @@ export default {
},
//
async handleOrderFormConfirm(orderData) {
async handleOrderFormConfirm() {
try {
//
//
this.closeOrderForm()
//

321
uniapp/pages/market/clue/edit_clues.vue

@ -74,14 +74,6 @@
</fui-radio-group>
</view>
</fui-form-item>
<!-- 生日 -->
<!-- <fui-form-item label="生日" labelSize='26' prop="birthday" background='#434544' labelColor='#fff' :bottomBorder='false'>-->
<!-- <view class="input-title" style="margin-right:14rpx;">-->
<!-- <view class="input-title" style="margin-right:14rpx;" @click="openDate('birthday')">-->
<!-- {{ formData.birthday || '请选择生日' }}-->
<!-- </view>-->
<!-- </view>-->
<!-- </fui-form-item>-->
<!-- 电话 -->
<fui-form-item label="电话" labelSize='26' prop="phone_number" background='#434544' labelColor='#fff' :bottomBorder='false'>
<view class="input-title" style="margin-right:14rpx;">
@ -182,20 +174,6 @@
</view>
</view>
</fui-form-item>
<!-- 客户分类 -->
<!-- <fui-form-item label="客户分类" labelSize='26' prop="customer_type" background='#434544' labelColor='#fff' :bottomBorder='false'>
<view class="input-title" style="margin-right:14rpx;">
<view class="input-title" style="margin-right:14rpx;" @click="openCicker('customer_type')">
{{ formData.customer_type ? picker_config.customer_type.text : '点击选择' }}
</view>
</view>
</fui-form-item> -->
<!-- 预约体验课 -->
<!-- <fui-form-item label="预约体验课" labelSize='26' prop="trial_lesson" background='#434544' labelColor='#fff' :bottomBorder='false'>
<view class="input-title" style="margin-right:14rpx;">
<fui-button background="#434544" color="#24BA9F" borderColor="#24BA9F" @click="goTrialLesson">预约体验课</fui-button>
</view>
</fui-form-item> -->
<!-- 是否加微信 -->
<fui-form-item label="是否加微信" labelSize='26' prop="call_intent" background='#434544' labelColor='#fff' :bottomBorder='false'>
<view class="input-title" style="margin-right:14rpx;">
@ -224,12 +202,6 @@
<fui-textarea v-model="formData.remark" placeholder="点击填写" backgroundColor="#434544" size="26" color="#fff" :borderTop="false" :isCounter="true" :maxlength="500" :minHeight="250" :isAutoHeight="true"></fui-textarea>
</view>
</fui-form-item>
<!-- 面咨记录 -->
<!-- <fui-form-item label="面咨记录" labelSize='26' prop="consultation_record" background='#434544' labelColor='#fff' :bottomBorder='false'>
<view class="input-title" style="margin-right:14rpx;">
<fui-input :borderBottom="false" :padding="[0]" placeholder="点击填写" v-model="formData.consultation_record" backgroundColor="#434544" size="26" color="#fff"></fui-input>
</view>
</fui-form-item> -->
</view>
<!-- 添加底部安全区 -->
<view class="safe-area-bottom"></view>
@ -357,78 +329,9 @@
import memberApi from '@/api/member.js';
const rules = [{
name: "student_name",
rule: ["required"],
msg: ["请输入学员姓名"]
},
{
name: "title",
rule: ["required"],
msg: ["请输入线索标题"]
},
{
name: "student_phone",
rule: ["required", "isMobile"],
msg: ["请输入电话", "请输入正确的手机号"]
},
{
name: "age",
rule: ["required", "isNumber"],
msg: ["请输入年龄", "请输入正确的数字"]
},
{
name: "school_name",
rule: ["required"],
msg: ["请输入学校"]
},
{
name: "grade",
rule: ["required"],
msg: ["请输入年级"]
},
{
name: "class_name",
rule: ["required"],
msg: ["请输入班级"]
},
{
name: "customer_source",
rule: ["required"],
msg: ["请选择客户来源"]
},
{
name: "add_staff_id",
rule: ["required"],
msg: ["请选择顾问"]
},
{
name: "contact_name",
rule: ["required"],
msg: ["请输入联系人"]
},
{
name: "full_address",
rule: ["required"],
msg: ["请选择所在地区"]
},
{
name: "community_name",
rule: ["required"],
msg: ["请输入小区"]
},
{
name: "customer_tags_name",
rule: ["required"],
msg: ["请选择客户标签"]
}
];
export default {
data() {
return {
switchChange_type: 1,
rules,
is_submit: true, //()|true=,false=
resource_sharing_id: '', //resource_sharing_id(id)
@ -555,15 +458,8 @@
default_date_value: '', //
//
show_area: false,
options_area: [],
//
userInfo: {},
//
student_name: '', //
//
clientUserList: [], //
showDuplicateCheck: false, //
@ -1025,95 +921,10 @@
return null
},
//-id
async getDict_courses_id() {
let res = await marketApi.selectCourseList({})
if (res.code != 1) {
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
let dictionary = res.data
let arr = []
dictionary.forEach((v, k) => {
arr.push({
text: v.name,
value: v.id,
})
})
this.options_courses_id = arr
},
//
async getStaffList() {
let res = await memberApi.staffList({
type: 2
})
if (res.code != 1) {
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
let arr = []
res.data.forEach((v, k) => {
arr.push({
text: v.name,
value: v.id,
})
})
this.options_add_staff_id = arr
},
// role_id|5=,6=
async getRoleStaffList(role_id) {
let res = await memberApi.staffList({
type: 2,
role_id: role_id
})
if (res.code != 1) {
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
let arr = []
res.data.forEach((v, k) => {
arr.push({
text: v.name,
value: v.id,
})
})
if (role_id == 5) {
this.options_staff_id_5 = arr
console.log('市场', arr)
} else {
this.options_staff_id_6 = arr
console.log('销售', arr)
}
},
//
async getAreaTree() {
let res = await commonApi.getAreaTree()
if (res.code != 1) {
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
this.options_area = res.data
},
//
async getDict(inputName) {
@ -1208,35 +1019,6 @@
}
},
//##### #####
//--
async clientList() {
if (!this.student_name) {
uni.showToast({
title: '请输入检索关键字',
icon: 'none'
})
return
}
this.clientUserList = []
let param = {
student_name: this.student_name
}
let res = await marketApi.clientList(param)
if (res.code != 1) {
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
console.log('查重', res)
this.clientUserList = res.data
this.openDuplicateCheck()
},
//
openDuplicateCheck() {
this.showDuplicateCheck = true
@ -1247,50 +1029,7 @@
},
//-
openViewClueInfo(item) {
let id = item.id
this.$navigateTo({
url: `/pages/market/clue/clue_info?id=${id}`
})
},
//-
openViewMyMessage(item) {
let hair_staff_id = item.hair_staff_id
this.$navigateTo({
url: `/pages/common/im_chat_info?hair_staff_id=${hair_staff_id}`
})
},
//
async dialTel(item) {
let tel = item.student_phone
if (!tel) {
uni.showToast({
title: '电话号码为空',
icon: 'none'
});
return;
}
let param = {
sales_id: item.id //线id
}
let res = await marketApi.setCallUp(param) //
if (res.code != 1) {
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
uni.makePhoneCall({
phoneNumber: tel
})
},
//
@ -1334,71 +1073,13 @@
//-
onConfirmCustomerTags(e) {
console.log('多选客户标签', e)
this.show_customer_tags = false
let customer_tags_name_arr = []
let customer_tags_arr = []
e.options.forEach((v, k) => {
customer_tags_arr.push(v.value)
customer_tags_name_arr.push(v.text)
//v.value this.options_customer_tagscheckedtrue
this.options_customer_tags.forEach((v, k) => {
if (v.value == v.value) {
v.checked = true
}
})
})
this.formData.customer_tags_name = customer_tags_name_arr.join(',') //
this.formData.customer_tags = customer_tags_arr //
},
//
changeArea(e) {
this.show_area = false
console.log('地区选择', e)
this.formData.province_id = e.value[0]
this.formData.city_id = e.value[1]
this.formData.district_id = e.value[2]
this.formData.full_address = `${e.text[0]}-${e.text[1]}-${e.text[2]}`
},
//
switchChange(e) {
if (e.detail.value) {
this.switchChange_type = 1
} else {
this.switchChange_type = 2
}
},
changeEfficacious(e) {
this.formData.efficacious = e.detail.value
},
//
changeSex(e) {
this.formData.gender = e.detail.value
},
//-
changeIsFollow(e) {
console.log(111, e.detail.value)
this.is_follow = e.detail.value
// 1
if (this.is_follow) {
this.formData.is_follow = '1'
} else {
//2
this.formData.is_follow = '2'
this.formData.entry_type = '' //
this.formData.staff_id = '' //
this.formData.follow_up_time = '' //
this.formData.follow_up_content = '' //
}
},
//tag

186
uniapp/pages/student/knowledge/index.vue

@ -210,6 +210,7 @@
showSearchPopup: false,
searchKeyword: '',
searchHistory: [],
//
categoryTabs: [
{ value: 'all', text: '全部', icon: '📖', count: 0 },
{ value: 'training', text: '训练技巧', icon: '💪', count: 0 },
@ -217,7 +218,19 @@
{ value: 'recovery', text: '恢复康复', icon: '🧘', count: 0 },
{ value: 'psychology', text: '运动心理', icon: '🧠', count: 0 },
{ value: 'equipment', text: '装备指南', icon: '🏃', count: 0 }
]
],
categoryMap: {
'training': '训练技巧',
'nutrition': '营养健康',
'recovery': '恢复康复',
'psychology': '运动心理',
'equipment': '装备指南'
},
mockConfig: {
maxSearchHistory: 10,
pageSize: 10,
searchDelay: 300
}
}
},
@ -238,6 +251,109 @@
uni.navigateBack()
},
// Mock
getMockArticlesData() {
return {
code: 1,
data: {
list: [
{
id: 1,
title: '少儿体适能训练的核心要素',
summary: '了解少儿体适能训练的基本原理和核心要素,帮助孩子建立正确的运动基础。',
category: 'training',
tags: ['体适能', '少儿训练', '基础运动'],
cover_image: '/static/knowledge/training1.jpg',
author: '张教练',
publish_time: '2024-01-15 10:00:00',
read_count: 1250,
like_count: 88,
is_read: false,
is_favorite: false
},
{
id: 2,
title: '儿童运动营养指南',
summary: '科学的营养搭配是儿童运动能力提升的重要保障。',
category: 'nutrition',
tags: ['运动营养', '儿童健康', '饮食搭配'],
cover_image: '/static/knowledge/nutrition1.jpg',
author: '李营养师',
publish_time: '2024-01-14 15:30:00',
read_count: 980,
like_count: 65,
is_read: true,
is_favorite: true
},
{
id: 3,
title: '运动后的恢复与拉伸',
summary: '正确的恢复和拉伸能够有效防止运动损伤。',
category: 'recovery',
tags: ['运动恢复', '拉伸运动', '损伤预防'],
cover_image: '/static/knowledge/recovery1.jpg',
author: '王康复师',
publish_time: '2024-01-13 09:20:00',
read_count: 756,
like_count: 42,
is_read: false,
is_favorite: false
}
],
total: 25,
has_more: true,
stats: {
total_articles: 25,
favorites: 8,
read_articles: 12
}
}
}
},
getMockRecommendData() {
return [
{
id: 101,
title: '新手家长必看:如何陪伴孩子开始运动',
summary: '专为运动新手家长准备的指导文章。',
cover_image: '/static/knowledge/recommend1.jpg',
read_count: 2580,
publish_time: '2024-01-10 16:00:00'
},
{
id: 102,
title: '冬季儿童运动注意事项',
summary: '冬季天气寒冷,儿童运动需要特别注意保暖和安全。',
cover_image: '/static/knowledge/recommend2.jpg',
read_count: 1890,
publish_time: '2024-01-09 10:30:00'
}
]
},
//
validateArticleData(article) {
if (!article || typeof article !== 'object') {
return false
}
const requiredFields = ['id', 'title', 'category']
return requiredFields.every(field => article.hasOwnProperty(field) && article[field])
},
validateResponseData(response) {
if (!response || response.code !== 1) {
return false
}
if (!response.data || !Array.isArray(response.data.list)) {
return false
}
return response.data.list.every(item => this.validateArticleData(item))
},
async initPage() {
await this.loadStudentInfo()
await this.loadArticles()
@ -395,28 +511,10 @@
async loadRecommendArticles() {
try {
//
const mockRecommend = [
{
id: 101,
title: '新手家长必看:如何陪伴孩子开始运动',
summary: '专为运动新手家长准备的指导文章,教你如何正确引导孩子爱上运动。',
cover_image: '/static/knowledge/recommend1.jpg',
read_count: 2580,
publish_time: '2024-01-10 16:00:00'
},
{
id: 102,
title: '冬季儿童运动注意事项',
summary: '冬季天气寒冷,儿童运动需要特别注意保暖和安全问题。',
cover_image: '/static/knowledge/recommend2.jpg',
read_count: 1890,
publish_time: '2024-01-09 10:30:00'
}
]
this.recommendArticles = mockRecommend
this.recommendArticles = this.getMockRecommendData()
} catch (error) {
console.error('获取推荐文章失败:', error)
this.recommendArticles = []
}
},
@ -458,14 +556,7 @@
},
getCategoryText(category) {
const categoryMap = {
'training': '训练技巧',
'nutrition': '营养健康',
'recovery': '恢复康复',
'psychology': '运动心理',
'equipment': '装备指南'
}
return categoryMap[category] || category
return this.categoryMap[category] || category
},
formatDate(dateString) {
@ -658,6 +749,40 @@
</script>
<style lang="less" scoped>
//
.image-container {
width: 120rpx;
height: 90rpx;
margin-right: 20rpx;
border-radius: 8rpx;
overflow: hidden;
flex-shrink: 0;
.cover_image {
width: 100%;
height: 100%;
}
}
.article-title {
font-weight: 600;
color: #333;
margin-bottom: 8rpx;
line-height: 1.4;
}
.text-summary {
font-size: 22rpx;
color: #666;
line-height: 1.4;
margin-bottom: 8rpx;
}
.text-meta {
font-size: 20rpx;
color: #999;
}
.main_box {
background: #f8f9fa;
min-height: 100vh;
@ -836,6 +961,7 @@
margin-right: 20rpx;
border-radius: 8rpx;
overflow: hidden;
flex-shrink: 0;
.cover_image {
width: 100%;
@ -847,11 +973,11 @@
flex: 1;
.recommend_title {
font-size: 26rpx;
font-weight: 600;
color: #333;
margin-bottom: 8rpx;
line-height: 1.4;
font-size: 26rpx;
}
.recommend_summary {

211
uniapp/pages/student/orders/index.vue

@ -240,7 +240,16 @@
desc: '快捷安全',
icon: '/static/payment/alipay.png'
}
]
],
//
STATUS_TEXT_MAP: {
'pending_payment': '待付款',
'paid': '已付款',
'completed': '已完成',
'cancelled': '已取消',
'refunding': '退款中',
'refunded': '已退款'
}
}
},
@ -279,7 +288,7 @@
async initPage() {
await this.loadStudentInfo()
await this.loadOrders()
this.updateStatusCounts()
this.calculateOrderStats()
},
async loadStudentInfo() {
@ -312,7 +321,6 @@
async loadOrders() {
this.loading = true
try {
console.log('加载订单列表:', this.studentId)
//
const response = await apiRoute.xy_orderTableList({
@ -332,10 +340,8 @@
//
this.hasMore = response.data?.current_page < response.data?.last_page
//
this.calculateOrderStats()
this.applyStatusFilter()
console.log('订单数据加载成功:', this.ordersList)
//
this.updateOrderDisplay()
} else {
uni.showToast({
title: response.msg || '获取订单列表失败',
@ -417,42 +423,31 @@
changeStatus(status) {
this.activeStatus = status
this.applyStatusFilter()
this.updateOrderDisplay()
},
applyStatusFilter() {
updateOrderDisplay() {
//
if (this.activeStatus === 'all') {
this.filteredOrders = [...this.ordersList]
} else {
this.filteredOrders = this.ordersList.filter(order => order.status === this.activeStatus)
}
},
calculateOrderStats() {
//
const counts = {}
this.ordersList.forEach(order => {
counts[order.status] = (counts[order.status] || 0) + 1
})
this.statusTabs.forEach(tab => {
if (tab.value === 'all') {
tab.count = this.ordersList.length
} else {
tab.count = counts[tab.value] || 0
}
tab.count = tab.value === 'all' ? this.ordersList.length : (counts[tab.value] || 0)
})
},
getStatusText(status) {
const statusMap = {
'pending_payment': '待付款',
'paid': '已付款',
'completed': '已完成',
'cancelled': '已取消',
'refunding': '退款中',
'refunded': '已退款'
}
return statusMap[status] || status
return this.STATUS_TEXT_MAP[status] || status
},
formatDate(dateString) {
@ -464,8 +459,67 @@
return `${month}-${day} ${hours}:${minutes}`
},
//
updateOrderStatus(orderId, statusUpdates) {
const orderIndex = this.ordersList.findIndex(o => o.id === orderId)
if (orderIndex !== -1) {
Object.assign(this.ordersList[orderIndex], statusUpdates)
}
this.updateOrderDisplay()
},
showOperationSuccess(message, callback) {
uni.showToast({
title: message,
icon: 'success'
})
if (callback) callback()
},
handleError(error, message) {
console.error(`${message}:`, error)
uni.showToast({
title: message,
icon: 'none'
})
},
simulateDelay(ms = 1000) {
return new Promise(resolve => setTimeout(resolve, ms))
},
getCurrentTimestamp() {
return new Date().toISOString().slice(0, 19).replace('T', ' ')
},
//
async executeOrderOperation(operation, config) {
const { order, statusKey, statusValue, delay = 1000, successMessage, errorMessage, callback } = config
try {
if (operation.loadingKey) {
this[operation.loadingKey] = true
}
await this.simulateDelay(delay)
const updates = { [statusKey]: statusValue }
if (operation.additionalUpdates) {
Object.assign(updates, operation.additionalUpdates)
}
this.updateOrderStatus(order.id, updates)
this.showOperationSuccess(successMessage, callback)
} catch (error) {
this.handleError(error, errorMessage)
} finally {
if (operation.loadingKey) {
this[operation.loadingKey] = false
}
}
},
async viewOrderDetail(order) {
console.log('查看订单详情:', order)
try {
uni.showLoading({ title: '加载中...' })
@ -521,49 +575,24 @@
async confirmPayment() {
if (!this.selectedOrder || this.paying) return
this.paying = true
try {
console.log('确认支付:', {
order_id: this.selectedOrder.id,
payment_method: this.selectedPaymentMethod
})
//
await new Promise(resolve => setTimeout(resolve, 2000))
const mockResponse = { code: 1, message: '支付成功' }
if (mockResponse.code === 1) {
uni.showToast({
title: '支付成功',
icon: 'success'
})
//
const orderIndex = this.ordersList.findIndex(o => o.id === this.selectedOrder.id)
if (orderIndex !== -1) {
this.ordersList[orderIndex].status = 'paid'
this.ordersList[orderIndex].payment_method = this.selectedPaymentMethod
this.ordersList[orderIndex].payment_time = new Date().toISOString().slice(0, 19).replace('T', ' ')
await this.executeOrderOperation(
{
loadingKey: 'paying',
additionalUpdates: {
payment_method: this.selectedPaymentMethod,
payment_time: this.getCurrentTimestamp()
}
this.closePaymentPopup()
this.applyStatusFilter()
this.updateStatusCounts()
} else {
uni.showToast({
title: mockResponse.message || '支付失败',
icon: 'none'
})
},
{
order: this.selectedOrder,
statusKey: 'status',
statusValue: 'paid',
delay: 2000,
successMessage: '支付成功',
errorMessage: '支付失败',
callback: () => this.closePaymentPopup()
}
} catch (error) {
console.error('支付失败:', error)
uni.showToast({
title: '支付失败',
icon: 'none'
})
} finally {
this.paying = false
}
)
},
async cancelOrder(order) {
@ -572,48 +601,24 @@
content: '确定要取消此订单吗?',
success: async (res) => {
if (res.confirm) {
try {
console.log('取消订单:', order.id)
//
await new Promise(resolve => setTimeout(resolve, 500))
const mockResponse = { code: 1, message: '取消成功' }
if (mockResponse.code === 1) {
uni.showToast({
title: '取消成功',
icon: 'success'
})
//
const orderIndex = this.ordersList.findIndex(o => o.id === order.id)
if (orderIndex !== -1) {
this.ordersList[orderIndex].status = 'cancelled'
}
this.applyStatusFilter()
this.updateStatusCounts()
} else {
uni.showToast({
title: mockResponse.message || '取消失败',
icon: 'none'
})
await this.executeOrderOperation(
{},
{
order,
statusKey: 'status',
statusValue: 'cancelled',
delay: 500,
successMessage: '取消成功',
errorMessage: '取消失败'
}
} catch (error) {
console.error('取消订单失败:', error)
uni.showToast({
title: '取消失败',
icon: 'none'
})
}
)
}
}
})
},
viewRefundDetail(order) {
console.log('查看退款详情:', order)
const refundInfo = `订单号:${order.order_no}\n退款金额:¥${order.refund_amount || order.total_amount}\n退款时间:${order.refund_time || '处理中'}`
const refundInfo = `订单号:${order.order_no}\n退款金额:¥${order.refund_amount || order.total_amount}\n退款时间:${order.refund_time || '处理中'}`
uni.showModal({
title: '退款详情',
content: refundInfo,

Loading…
Cancel
Save