Browse Source

'初次对接完成'

main
hflllll 1 week ago
parent
commit
b9dd1c2d2e
5 changed files with 141 additions and 63 deletions
  1. +50
    -15
      pages/index/maintain.vue
  2. +39
    -0
      pages/index/user.vue
  3. +50
    -46
      subPages/home/maintainanceSubmit.vue
  4. +1
    -1
      subPages/home/repairSubmit.vue
  5. +1
    -1
      subPages/repair/maintainSubmit.vue

+ 50
- 15
pages/index/maintain.vue View File

@ -4,14 +4,14 @@
<view class="selector-section">
<!-- 紧急程度选择器 -->
<view class="selector-item" @click="openUrgencyPicker">
<text class="selector-label" :class="{ active: selectedUrgency !== '紧急程度' }">{{ selectedUrgency }}</text>
<uv-icon name="arrow-down-fill" size="14" :color="selectedUrgency !== '紧急程度' ? '#C70019' : '#000'"></uv-icon>
<text class="selector-label" :class="{ active: urgency }">{{ urgency.label || '紧急状态' }}</text>
<uv-icon name="arrow-down-fill" size="14" :color="urgency ? '#C70019' : '#000'"></uv-icon>
</view>
<!-- 维修状态选择器 -->
<view class="selector-item" @click="openStatusPicker">
<text class="selector-label" :class="{ active: selectedStatus !== '维修状态' }">{{ selectedStatus }}</text>
<uv-icon name="arrow-down-fill" size="14" :color="selectedStatus !== '维修状态' ? '#C70019' : '#000'"></uv-icon>
<text class="selector-label" :class="{ active: status }">{{ status.label || '维修状态' }}</text>
<uv-icon name="arrow-down-fill" size="14" :color="status ? '#C70019' : '#000'"></uv-icon>
</view>
</view>
@ -78,13 +78,16 @@
<button class="item-actions-button">立即维修</button>
</view>
</view>
<!-- 空状态 -->
</view>
<uv-empty v-if="!list.length" icon="/static/暂无搜索结果.png" />
<!-- 紧急程度选择器 -->
<uv-picker
ref="urgencyPicker"
v-model="urgencyShow"
:columns="urgencyColumns"
keyName="label"
mode="selector"
@confirm="onUrgencyConfirm"
confirmColor="#C70019"
@ -95,6 +98,7 @@
ref="statusPicker"
v-model="statusShow"
:columns="statusColumns"
keyName="label"
mode="selector"
@confirm="onStatusConfirm"
confirmColor="#C70019"
@ -109,29 +113,56 @@ export default {
mixins: [ListMixin],
data() {
return {
selectedUrgency: '紧急程度',
selectedStatus: '维修状态',
urgency: null,
status: null,
urgencyShow: false,
statusShow: false,
mixinListApi: 'exhibit.queryMalfunctionList',
urgencyColumns: [
[
'一般',
'紧急',
'非常紧急'
{
label: '全部',
value: ''
},
{
label: '一般',
value: '0'
},
{
label: '紧急',
value: '1'
},
]
],
statusColumns: [
[
'维护中',
'故障中',
'已解决'
{
label: '全部',
value: ''
},
{
label: '故障中',
value: '0'
},
{
label: '维修中',
value: '1'
},
{
label: '已解决',
value: '2'
}
]
],
}
},
methods: {
mixinSetParams(){
return {
urgency: this.urgency?.value || '',
status: this.status?.value || ''
}
},
navigateToDetail(item) {
uni.navigateTo({
url: '/subPages/repair/maintainSubmit?id=' + item.id
@ -144,13 +175,17 @@ export default {
this.$refs.statusPicker.open()
},
onUrgencyConfirm(e) {
this.selectedUrgency = e.value[0]
this.urgency = e.value[0]
console.log('选择紧急程度:', e)
this.initPage()
this.getList(true)
// TODO:
},
onStatusConfirm(e) {
this.selectedStatus = e.value[0]
this.status = e.value[0]
console.log('选择维修状态:', e)
this.initPage()
this.getList(true)
// TODO:
},
getStatusClass(status) {


+ 39
- 0
pages/index/user.vue View File

@ -38,6 +38,15 @@
</view>
<uv-icon name="arrow-right" size="24" color="#000"></uv-icon>
</view>
<!-- 退出登录 -->
<view class="function-item" @click="logout">
<view class="item-left">
<uv-icon name="minus-circle" size="24" color="#C70019"></uv-icon>
<text class="item-text">退出登录</text>
</view>
<uv-icon name="arrow-right" size="24" color="#000"></uv-icon>
</view>
</view>
</view>
@ -53,6 +62,7 @@
</template>
<script>
export default {
data() {
return {
@ -95,6 +105,35 @@ export default {
//
showPrivacyPolicy() {
this.$refs.privacyModal.open()
},
// 退
logout() {
uni.showModal({
title: '提示',
content: '确定要退出登录吗?',
confirmColor: '#C70019',
success: (res) => {
if (res.confirm) {
//
uni.removeStorageSync('token')
// uni.removeStorageSync('userInfo')
//
this.userInfo = {
headImage: '/static/默认头像.png',
nickName: '请先登录',
id: 'XXXXX'
}
// 退
uni.showToast({
title: '退出成功',
icon: 'success'
})
}
}
})
}
}
}


+ 50
- 46
subPages/home/maintainanceSubmit.vue View File

@ -93,25 +93,25 @@
<view class="radio-options">
<view
class="radio-item"
:class="{ active: isExpend === true }"
@click="selectCost(true)"
:class="{ active: isExpend === '1' }"
@click="selectCost('1')"
>
<view class="radio-dot" :class="{ active: isExpend === true }"></view>
<text :class="{ active: isExpend === true }"></text>
<view class="radio-dot" :class="{ active: isExpend === '1' }"></view>
<text :class="{ active: isExpend === '1' }"></text>
</view>
<view
class="radio-item"
:class="{ active: isExpend === false }"
@click="selectCost(false)"
:class="{ active: isExpend === '0' }"
@click="selectCost('0')"
>
<view class="radio-dot" :class="{ active: isExpend === false }"></view>
<text :class="{ active: isExpend === false }"></text>
<view class="radio-dot" :class="{ active: isExpend === '0' }"></view>
<text :class="{ active: isExpend === '0' }"></text>
</view>
</view>
</view>
<!-- 产生费用 -->
<view v-if="isExpend" class="cost-section">
<view v-if="isExpend === '1'" class="cost-section">
<view class="form-item form-item-header">
<text class="label active">产生费用</text>
</view>
@ -244,21 +244,19 @@
</view>
<!-- 日期选择器 -->
<uv-picker
<uv-datetime-picker
confirm-color="#C70019"
ref="datePicker"
mode="date"
@confirm="confirmDate"
@cancel="cancelDate"
></uv-picker>
></uv-datetime-picker>
<uv-picker
<uv-datetime-picker
confirm-color="#C70019"
ref="nextDatePicker"
mode="date"
@confirm="confirmNextDate"
@cancel="cancelNextDate"
></uv-picker>
></uv-datetime-picker>
</view>
</template>
@ -273,7 +271,7 @@ export default {
stateFrontImage: [],
stateBackText: '',
stateBackImage: [],
isExpend: false,
isExpend: '0',
newCostName: '',
costList: [],
remarkText: '',
@ -287,7 +285,7 @@ export default {
computed: {
//
amount() {
return this.costList.reduce((sum, item) => sum + (parseFloat(item.amount) || 0), 0)
return this.costList.reduce((sum, item) => sum + (parseFloat(item.amount) * Number(item.quantity) || 0), 0)
}
},
methods: {
@ -298,12 +296,11 @@ export default {
//
confirmDate(e) {
this.maintenanceDate = e.value
},
//
cancelDate() {
//
// uv-datetime-picker
const date = new Date(e.value)
this.maintenanceDate = date.getFullYear() + '-' +
String(date.getMonth() + 1).padStart(2, '0') + '-' +
String(date.getDate()).padStart(2, '0')
},
//
@ -313,12 +310,11 @@ export default {
//
confirmNextDate(e) {
this.nextMaintenanceDate = e.value
},
//
cancelNextDate() {
//
// uv-datetime-picker
const date = new Date(e.value)
this.nextMaintenanceDate = date.getFullYear() + '-' +
String(date.getMonth() + 1).padStart(2, '0') + '-' +
String(date.getDate()).padStart(2, '0')
},
//
@ -452,11 +448,7 @@ export default {
uni.showToast({ title: '请填写保养人', icon: 'none' })
return
}
//
// if (!this.maintenanceDate) {
// uni.showToast({ title: '', icon: 'none' })
// return
// }
if (!this.stateFrontText.trim()) {
uni.showToast({ title: '请填写保养前状态', icon: 'none' })
return
@ -466,15 +458,22 @@ export default {
return
}
if (this.isExpend === '1' && !this.amount){
uni.showToast({ title: '请填写消费', icon: 'none' })
return
}
// costList,,;
//
const formData = {
maintenanceName: this.maintenanceName,
maintenanceDate: this.maintenanceDate,
maintenanceDate: this.maintenanceDate,
stateFrontText: this.stateFrontText,
stateFrontImage: this.stateFrontImage?.join(',') || '',
stateBackText: this.stateBackText,
stateBackImage: this.stateBackImage?.join(',') || '',
expenseList: this.costList.map(item => {
return `${item.name},${item.quantity},${item.amount}`
}).join(';'),
isExpend: this.isExpend,
amount: this.amount,
remarkText: this.remarkText,
@ -486,17 +485,22 @@ export default {
this.submiting = true
const subRes = await this.$api.exhibit.addMaintenance(formData)
if(subRes.code == 200){
uni.showToast({ title: subRes.message, icon: 'success' })
//
setTimeout(() => {
uni.navigateBack()
}, 1000)
}else{
uni.showToast({ title: subRes.message, icon: 'none' })
try{
const subRes = await this.$api.exhibit.addMaintenance(formData)
if(subRes.code == 200){
uni.showToast({ title: subRes.message, icon: 'success' })
//
setTimeout(() => {
uni.navigateBack()
}, 1000)
}else{
uni.showToast({ title: subRes.message, icon: 'none' })
}
}catch(err){
// uni.showToast({ title: err.message, icon: 'none' })
this.submiting = false
}
this.submiting = false
}
},
onLoad(options) {


+ 1
- 1
subPages/home/repairSubmit.vue View File

@ -468,7 +468,7 @@ export default {
// console.log(':', formData)
// uni.showToast({ title: '', icon: 'success' })
const subRes = await this.$api.exhibit.addMalfunction(formData)
const subRes = await this.$api.exhibit.addMalfunction({...formData})
if (subRes.code === 200) {
uni.showToast({ title: subRes.message})
setTimeout(() => {


+ 1
- 1
subPages/repair/maintainSubmit.vue View File

@ -428,7 +428,7 @@ export default {
//
amount() {
return this.processData.costDetails.reduce((sum, item) => {
return sum + (Number(item.quantity) * Number(item.amount))
return sum + (Number(item.quantity) * parseFloat(item.amount || 0))
}, 0)
}
},


Loading…
Cancel
Save