Merge branch 'master' of http://192.168.30.2:3000/bonus/bonus-material-app
This commit is contained in:
commit
167f3e64ce
|
|
@ -132,7 +132,7 @@ const getTableList = () => {
|
||||||
// // "statusList":statusList.value,
|
// // "statusList":statusList.value,
|
||||||
// }
|
// }
|
||||||
// console.log(obj)
|
// console.log(obj)
|
||||||
uni.showLoading({ title: '提交中...', mask: true })
|
uni.showLoading({ title: '加载中...', mask: true })
|
||||||
getBackInfo(id.value,keyWord.value).then(res => {
|
getBackInfo(id.value,keyWord.value).then(res => {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
console.log(res)
|
console.log(res)
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,8 @@
|
||||||
</uni-col>
|
</uni-col>
|
||||||
<uni-col :span="10">
|
<uni-col :span="10">
|
||||||
<view>
|
<view>
|
||||||
<uni-data-select v-model="typeCode" placeholder="请选择规格型号" :localdata="maCodeSelectList"
|
<uni-data-select v-model="typeCode" placeholder="请选择规格型号"
|
||||||
|
:localdata="maCodeSelectList"
|
||||||
@change="selectMaCode">
|
@change="selectMaCode">
|
||||||
</uni-data-select>
|
</uni-data-select>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -66,17 +67,18 @@
|
||||||
</div>
|
</div>
|
||||||
<view class="line"></view>
|
<view class="line"></view>
|
||||||
<template v-for="field in fieldMap" :key="field.label">
|
<template v-for="field in fieldMap" :key="field.label">
|
||||||
<uni-row :gutter="24">
|
<uni-row :gutter="24" style="padding-top: 12px">
|
||||||
<uni-col :span="field.labelSpan">{{ field.label }}:</uni-col>
|
<uni-col :span="field.labelSpan">{{ field.label }}:</uni-col>
|
||||||
<uni-col :span="field.valueSpan">
|
<uni-col :span="field.valueSpan">
|
||||||
<view class="cont">
|
<view class="cont">
|
||||||
{{ field.formatter ? field.formatter(item[field.key]) : (item[field.key] ?? field.default ?? '无') }}
|
{{ field.formatter ? field.formatter(item[field.key]) : (item[field.key] ?? field.default ?? '无')
|
||||||
|
}}
|
||||||
</view>
|
</view>
|
||||||
</uni-col>
|
</uni-col>
|
||||||
</uni-row>
|
</uni-row>
|
||||||
</template>
|
</template>
|
||||||
<uni-row :gutter="24">
|
<uni-row :gutter="24" style="padding-top: 12px">
|
||||||
<uni-col :span="8">配件数量:</uni-col>
|
<uni-col :span="8">是否收费:</uni-col>
|
||||||
<uni-col :span="16">
|
<uni-col :span="16">
|
||||||
<view class="cont">
|
<view class="cont">
|
||||||
<uni-data-select v-model="item.charge" placeholder="请选择规格型号" :localdata="charge"
|
<uni-data-select v-model="item.charge" placeholder="请选择规格型号" :localdata="charge"
|
||||||
|
|
@ -85,7 +87,7 @@
|
||||||
</view>
|
</view>
|
||||||
</uni-col>
|
</uni-col>
|
||||||
</uni-row>
|
</uni-row>
|
||||||
<uni-row :gutter="24">
|
<uni-row :gutter="24" style="padding-top: 12px">
|
||||||
<uni-col :span="8">配件数量:</uni-col>
|
<uni-col :span="8">配件数量:</uni-col>
|
||||||
<uni-col :span="16">
|
<uni-col :span="16">
|
||||||
<view class="cont">
|
<view class="cont">
|
||||||
|
|
@ -108,15 +110,16 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import {
|
import {
|
||||||
ref,
|
ref,
|
||||||
reactive
|
reactive,
|
||||||
} from 'vue'
|
} from 'vue'
|
||||||
import {
|
import {
|
||||||
onLoad
|
onLoad,
|
||||||
} from '@dcloudio/uni-app'
|
} from '@dcloudio/uni-app'
|
||||||
import {
|
import {
|
||||||
getUseType,
|
getUseType,
|
||||||
insertDetails
|
insertDetails,
|
||||||
} from '@/services/fieldMaintenance/fieldMaintenance.js'
|
} from '@/services/fieldMaintenance/fieldMaintenance.js'
|
||||||
|
|
||||||
const maCodeSelectList = ref([])
|
const maCodeSelectList = ref([])
|
||||||
const charge = ref([{
|
const charge = ref([{
|
||||||
value: 1,
|
value: 1,
|
||||||
|
|
@ -127,26 +130,26 @@
|
||||||
}])
|
}])
|
||||||
const maTypeSelectList = ref([])
|
const maTypeSelectList = ref([])
|
||||||
const item = ref({})
|
const item = ref({})
|
||||||
const typeId = ref("") //类型
|
const typeId = ref('') //类型
|
||||||
const typeCode = ref("") //规格型号
|
const typeCode = ref('') //规格型号
|
||||||
const collapsed = ref(true)
|
const collapsed = ref(true)
|
||||||
const typeList = ref([])
|
const typeList = ref([])
|
||||||
const fieldMap = [{
|
const fieldMap = [{
|
||||||
label: '规格型号',
|
label: '规格型号',
|
||||||
key: 'typeName',
|
key: 'typeName',
|
||||||
labelSpan: 8,
|
labelSpan: 8,
|
||||||
valueSpan: 16
|
valueSpan: 16,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '在用数',
|
label: '在用数',
|
||||||
key: 'num',
|
key: 'num',
|
||||||
labelSpan: 8,
|
labelSpan: 8,
|
||||||
valueSpan: 16
|
valueSpan: 16,
|
||||||
}
|
},
|
||||||
]
|
]
|
||||||
const getMaType = () => {
|
const getMaType = () => {
|
||||||
let obj = {
|
let obj = {
|
||||||
"agreementId": item.value.agreementId,
|
'agreementId': item.value.agreementId,
|
||||||
}
|
}
|
||||||
getUseType(obj).then(res => {
|
getUseType(obj).then(res => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
|
|
@ -155,7 +158,7 @@
|
||||||
value: option.typeId,
|
value: option.typeId,
|
||||||
text: option.typeName,
|
text: option.typeName,
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
})
|
})
|
||||||
|
|
@ -163,8 +166,8 @@
|
||||||
//规格
|
//规格
|
||||||
const getMaCode = () => {
|
const getMaCode = () => {
|
||||||
let obj = {
|
let obj = {
|
||||||
"agreementId": item.value.agreementId,
|
'agreementId': item.value.agreementId,
|
||||||
"typeId": typeId.value
|
'typeId': typeId.value,
|
||||||
}
|
}
|
||||||
getUseType(obj).then(res => {
|
getUseType(obj).then(res => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
|
|
@ -176,32 +179,32 @@
|
||||||
text: option.typeName,
|
text: option.typeName,
|
||||||
}
|
}
|
||||||
return obj
|
return obj
|
||||||
});
|
})
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const generateUniqueId = () => {
|
const generateUniqueId = () => {
|
||||||
return Date.now().toString(36) + Math.random().toString(36).substr(2, 5);
|
return Date.now().toString(36) + Math.random().toString(36).substr(2, 5)
|
||||||
};
|
}
|
||||||
|
|
||||||
const deleteItem = (item) => {
|
const deleteItem = (item) => {
|
||||||
typeList.value = typeList.value.filter(i => i.itemId !== item.itemId);
|
typeList.value = typeList.value.filter(i => i.itemId !== item.itemId)
|
||||||
};
|
}
|
||||||
|
|
||||||
// 选择规格型号
|
// 选择规格型号
|
||||||
const selectMaCode = (e) => {
|
const selectMaCode = (e) => {
|
||||||
const matched = maCodeSelectList.value.find(item => item.typeId == e);
|
const matched = maCodeSelectList.value.find(item => item.typeId == e)
|
||||||
if (matched) {
|
if (matched) {
|
||||||
const itemCopy = JSON.parse(JSON.stringify(matched));
|
const itemCopy = JSON.parse(JSON.stringify(matched))
|
||||||
itemCopy.itemId = generateUniqueId();
|
itemCopy.itemId = generateUniqueId()
|
||||||
itemCopy.preNum = 0;
|
itemCopy.preNum = 0
|
||||||
itemCopy.charge = 0;
|
itemCopy.charge = 0
|
||||||
itemCopy.taskId = item.value.id;
|
itemCopy.taskId = item.value.id
|
||||||
typeList.value.push(itemCopy);
|
typeList.value.push(itemCopy)
|
||||||
|
}
|
||||||
|
console.log(typeList.value)
|
||||||
}
|
}
|
||||||
console.log(typeList.value);
|
|
||||||
};
|
|
||||||
|
|
||||||
const toggleCollapse = () => (collapsed.value = !collapsed.value)
|
const toggleCollapse = () => (collapsed.value = !collapsed.value)
|
||||||
const onChangeNumber = (item) => {
|
const onChangeNumber = (item) => {
|
||||||
|
|
@ -215,28 +218,28 @@
|
||||||
item.preNum = Number(String(item.preNum).replace(/[^\d]/g, ''))
|
item.preNum = Number(String(item.preNum).replace(/[^\d]/g, ''))
|
||||||
}
|
}
|
||||||
if (Number(item.preNum) <= 0) {
|
if (Number(item.preNum) <= 0) {
|
||||||
item.preNum = 0;
|
item.preNum = 0
|
||||||
}
|
}
|
||||||
if (Number(item.preNum) > maxNum) {
|
if (Number(item.preNum) > maxNum) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '已达到当前资最大在用数量!',
|
title: '已达到当前资最大在用数量!',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
})
|
})
|
||||||
item.preNum = maxNum;
|
item.preNum = maxNum
|
||||||
}
|
}
|
||||||
}, 500)
|
}, 500)
|
||||||
}
|
}
|
||||||
|
|
||||||
const submitNum = () => {
|
const submitNum = () => {
|
||||||
console.log(item)
|
console.log(item)
|
||||||
const jsonData = JSON.stringify(typeList.value);
|
const jsonData = JSON.stringify(typeList.value)
|
||||||
console.log(jsonData)
|
console.log(jsonData)
|
||||||
insertDetails(JSON.parse(jsonData)).then(res => {
|
insertDetails(JSON.parse(jsonData)).then(res => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
uni.showToast({ title: '编辑成功', icon: 'none' })
|
uni.showToast({ title: '编辑成功', icon: 'none' })
|
||||||
uni.navigateBack({
|
uni.navigateBack({
|
||||||
delta: 1 // 返回到已存在的页面
|
delta: 1, // 返回到已存在的页面
|
||||||
});
|
})
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({ title: res.msg, icon: 'none' })
|
uni.showToast({ title: res.msg, icon: 'none' })
|
||||||
}
|
}
|
||||||
|
|
@ -342,7 +345,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.scroll-container {
|
.scroll-container {
|
||||||
padding: 24rpx;
|
padding: 12rpx;
|
||||||
height: 85%;
|
height: 85%;
|
||||||
|
|
||||||
.table-list-item {
|
.table-list-item {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue