移交保险公司否

This commit is contained in:
xiaofajia 2024-11-20 21:04:57 +08:00
parent 0b9b3a5811
commit bdd4df2890

View File

@ -70,6 +70,7 @@
<view class="header">
配件信息
<view v-if="canOperate" style="float: right; color: #0174F6" @click="addWares">添加配件</view>
<view v-if="canOperate" style="float: right; color: #0174F6;margin-right: 1rem" @click="handleSetting">移交保险公司</view>
</view>
<uni-collapse ref="collapse">
<uni-collapse-item v-for="(groupItem, index) in repairList" :key="groupItem.groupId"
@ -117,6 +118,35 @@
</view>
</view>
<view>
<uni-popup ref="settingPopup" type="center" :mask-click="false">
<view class="popup-content">
<view class="popup-title">设置</view>
<form @submit="doSetting">
<view class="uni-form-item">
<text class="uni-label">是否传给保险公司</text>
<switch :checked="settingForm.toSafe === '1'" @change="toggleToSafe" />
</view>
<view class="uni-form-item" v-if="settingForm.toSafe === '1'">
<text class="uni-label">保险公司名称</text>
<input class="uni-input" v-model="settingForm.safeName" placeholder="保险公司名称" />
</view>
<view class="uni-form-item" v-if="settingForm.toSafe === '1'">
<text class="uni-label">联系人</text>
<input class="uni-input" v-model="settingForm.safeContact" placeholder="联系人姓名" />
</view>
<view class="uni-form-item" v-if="settingForm.toSafe === '1'">
<text class="uni-label">联系电话</text>
<input class="uni-input" v-model="settingForm.safeMobile" placeholder="联系电话" />
</view>
<view class="popup-footer">
<button formType="submit" class="confirm-btn">确认</button>
<button @click="$refs.settingPopup.close()" class="cancel-btn">取消</button>
</view>
</form>
</view>
</uni-popup>
</view>
</view>
</template>
@ -160,6 +190,13 @@ export default {
selectWares: [],
info: {},
imageUrls: [],
settingForm:{
id: null,
toSafe: '0',
safeName: null,
safeContact: null,
safeMobile: null,
}
};
},
onLoad(data) {
@ -171,6 +208,36 @@ export default {
this.getDetail()
},
methods: {
toggleToSafe(e){
this.settingForm.toSafe = e.detail.value ? '1' : '0';
},
doSetting(){
request({
url: '/admin-api/repair/tw/updateSafe',
method: 'post',
data: this.settingForm
}).then(res => {
this.$refs.settingPopup.close()
uni.showToast({
title: '设置成功!',
icon: 'none'
})
})
},
handleSetting(){
request({
url: "/admin-api/repair/tw/getById?id=" + this.id,
method: 'get'
}).then(res => {
const data = res.data
this.settingForm.toSafe = data.toSafe
this.settingForm.safeName = data.safeName
this.settingForm.safeContact = data.safeContact
this.settingForm.safeMobile = data.safeMobile
this.settingForm.id = this.id
this.$refs.settingPopup.open()
})
},
addWares(){
//
uni.navigateTo({
@ -529,4 +596,54 @@ export default {
cursor: pointer;
margin: 0 20rpx; /* 增加左右边距,使图片距离屏幕边缘有一定距离 */
}
.popup-content {
width: 80%;
max-width: 400px;
background-color: #fff;
padding: 20px;
border-radius: 10px;
margin: auto;
}
.popup-title {
font-size: 18px;
margin-bottom: 20px;
text-align: center;
}
.uni-form-item {
display: flex;
align-items: center;
margin-bottom: 15px;
}
.uni-label {
width: 20rem;
}
.uni-input {
padding: 2px;
border: 1px solid #ccc;
border-radius: 5px;
box-sizing: border-box;
height: 2rem;
width: 26rem;
}
.popup-footer {
display: flex;
justify-content: space-between;
margin-top: 20px;
}
.confirm-btn, .cancel-btn {
flex: 1;
margin: 0 5px;
height: 40px;
line-height: 40px;
border: none;
border-radius: 5px;
}
.confirm-btn {
background-color: #0174F6;
color: #fff;
}
.cancel-btn {
background-color: #f5f5f5;
color: #666;
}
</style>