Commit 4c359099 authored by Facius's avatar Facius

Merge branch 'dev-1.4.1' of https://git.banshouhui.com/lijundan/self-support into dev-1.4.1

parents 61a42247 66c3bdd7
...@@ -7,13 +7,22 @@ ...@@ -7,13 +7,22 @@
padding="0"> padding="0">
<u-tr class="u-tr"> <u-tr class="u-tr">
<u-th class="u-th content-tab-th" v-for="(value, key) in titles" :key="key" width="auto"> <u-th class="u-th content-tab-th" v-for="(value, key) in titles" :key="key" width="auto">
<text :class="['tab-th-txt', {'left': key == firstKey}]">{{value}}</text> <view class="tab-th-txt" v-if="key == 'useLength'">
<u-parse :html="value" :tag-style="style"></u-parse>
</view>
<text v-else :class="['tab-th-txt', {'left': key == firstKey}]">{{value}}</text>
</u-th> </u-th>
</u-tr> </u-tr>
<view class="line-view"></view> <view class="line-view"></view>
<u-tr class="u-tr" v-for="(item, index) in list" :key="index"> <u-tr class="u-tr" v-for="(item, index) in list" :key="index">
<u-td class="u-td" v-for="(value, key) in titles" :key="key"> <u-td class="u-td" v-for="(value, key) in titles" :key="key">
<u-input v-if="key == 'useLength'" @blur="handleBlur(item)" @focus="handleFocus(item)" type="digit" :placeholder="null" v-model="item[key]" placeholder-style="color: #999999;font-size:26rpx" input-align="center" :clearable="false"><u-icon name="edit"></u-icon></u-input> <view v-if="key == 'useLength'" class="uselen-input">
<u-input @blur="handleBlur(item)" :border="true" border-color="#2979FF"
@focus="handleFocus(item)" type="digit" placeholder="请输入"
v-model="item[key]" placeholder-style="color: #999999;font-size:26rpx"
input-align="center" :clearable="false" :verify-number="true">
<u-icon name="edit"></u-icon></u-input>
</view>
<text v-else :class="['tab-th-txt', {'left': key == firstKey}]">{{item[key]}}</text> <text v-else :class="['tab-th-txt', {'left': key == firstKey}]">{{item[key]}}</text>
</u-td> </u-td>
</u-tr> </u-tr>
...@@ -22,31 +31,25 @@ ...@@ -22,31 +31,25 @@
<!-- 其他 --> <!-- 其他 -->
<view class="mtr-other"> <view class="mtr-other">
<view class="line-view"></view> <view class="line-view"></view>
<view class="other-space"> <view class="u-flex u-row-between other-space">
<text>其他</text> <view class="other-label">其他</view>
<image class="image-view" :src="addImage" @click="handleAdd"></image> <view class="list">
</view> <view v-for="(item, index) in other" :key="index"
<view v-if="other.length > 0" class="other-content"> class="u-flex u-row-between">
<view class="other-space" v-for="(item, index) in other" :key="index"> <u-input v-model="item.otherExplain" :border="true"
<view class="input-view"> class="u-m-r-15" :clearable="false" placeholder="请输入内容"
<view class="other-space"> :border-color="index === 0 ? '#2979FF' : '#FF930D'"/>
<text class="input-title">说明:</text> <u-input v-model="item.extraAmt" type="number" :border="true"
<view class="input-content"> class="u-m-l-15" :clearable="false" placeholder="请输入金额"
<u-input v-model="item.otherExplain" :clearable="false" placeholder-style="color:#999999;font-size:26rpx" /> :border-color="index === 0 ? '#2979FF' : '#FF930D'"/>
</view> <image v-if="index === 0" class="image-view"
</view> :src="addImage" @click="handleAdd"/>
<view class="other-space"> <image v-else class="image-view"
<text class="input-title">金额:</text> :src="subtractImage" @click="handleSubtract(index)"/>
<view class="input-content">
<u-input v-model="item.extraAmt" type="number" :clearable="false" placeholder-style="color:#999999;font-size:26rpx" />
</view> </view>
</view> </view>
</view> </view>
<image class="image-view" :src="subtractImage" @click="handleSubtract"></image> <view class="other-space u-p-t-20">
</view>
</view>
<view class="other-space">
<text>超出金额</text> <text>超出金额</text>
<text>{{money}}元</text> <text>{{money}}元</text>
</view> </view>
...@@ -70,6 +73,10 @@ ...@@ -70,6 +73,10 @@
fieldName:'materialList', fieldName:'materialList',
list: [], // 材料列表 list: [], // 材料列表
other: [], // 其他列表 other: [], // 其他列表
style: {
// 字符串的形式
p: 'color: red;font-size: 24rpx'
}
}; };
}, },
computed: { computed: {
...@@ -83,11 +90,11 @@ ...@@ -83,11 +90,11 @@
}, },
titles() { titles() {
return { return {
matName: this.isMaterial ? '工艺名称' : '材料名称', matName: this.isMaterial ? '材料名称' : '工艺名称',
matUnit: '单位', matUnit: '单位',
freeLength: '免费量', freeLength: '免费量',
unitAmt: '单价/元', unitAmt: '单价/元',
useLength: '用量' useLength: '用量<p>(请输入实际用量)</p>'
} }
}, },
thStyle() { thStyle() {
...@@ -141,6 +148,24 @@ ...@@ -141,6 +148,24 @@
self.formatServiceMoreList(data) self.formatServiceMoreList(data)
} }
}); });
this.list = [
{matType: "02", priceType: "01", matName: '开孔厚40cm以上,直径11cm以下',
matUnit: "个", freeLength: 0, unitAmt: 0, useLength: 0},
{matType: "02", priceType: "01", matName: '验收完成后移动安装地点',
matUnit: "次", freeLength: 0, unitAmt: 0, useLength: 0},
{matType: "02", priceType: "01", matName: '北京地区报装',
matUnit: "次", freeLength: 0, unitAmt: 0, useLength: 0},
{matType: "02", priceType: "01", matName: '墙面开墙及恢复',
matUnit: "米", freeLength: 0, unitAmt: 0, useLength: 0},
{matType: "02", priceType: "01", matName: '安装位置单次往返经销商距离',
matUnit: "千米", freeLength: 0, unitAmt: 0, useLength: 0},
{matType: "02", priceType: "01", matName: '开孔厚40cm以上,直径11cm以下',
matUnit: "个", freeLength: 0, unitAmt: 0, useLength: 0},
{matType: "02", priceType: "01", matName: '桥架50mm*50mm',
matUnit: "米", freeLength: 0, unitAmt: 0, useLength: 0},
{matType: "02", priceType: "01", matName: '铺装庭院开挖(复合材料)',
matUnit: "米", freeLength: 0, unitAmt: 220, useLength: 0},
]
}, },
created() { created() {
}, },
...@@ -166,14 +191,15 @@ ...@@ -166,14 +191,15 @@
}) })
}, },
handleBlur(item) { // 失去焦点如果没输入用原先的值 handleBlur(item) { // 失去焦点如果没输入用原先的值
if (!item.useLength) { if(this.$u.test.isEmpty(item.useLength)
item.useLength = item.temp || !this.$u.test.number(item.useLength)) {
item.useLength = 0
} }
}, },
handleFocus(item) { // 点击清空 handleFocus(item) { // 点击清空
item.temp = item.useLength; if(this.$u.test.isEmpty(item.useLength)) {
item.useLength = '' item.useLength = null
}
}, },
/* 其他添加新的 */ /* 其他添加新的 */
handleAdd() { handleAdd() {
...@@ -182,7 +208,7 @@ ...@@ -182,7 +208,7 @@
isDel:'N', isDel:'N',
isWebAdd:true, isWebAdd:true,
matName:'其他', matName:'其他',
extraAmt:0, extraAmt:null,
priceType:this.priceType, priceType:this.priceType,
matType:'04', matType:'04',
otherExplain:'' otherExplain:''
...@@ -192,7 +218,27 @@ ...@@ -192,7 +218,27 @@
handleSubtract(index) { handleSubtract(index) {
this.other.splice(index, 1) this.other.splice(index, 1)
}, },
validateForm() {
if(this.isMaterial) {
let row = this.list.find((item, index) => {
return item.useLength != 0;
})
if(!this.$u.test.isEmpty(this.list) && this.$u.test.isEmpty(row)) {
this.$refs.uToast.show({
title: '请填写电缆、漏保、空开等用量',
type: 'error',
icon: false,
position: 'bottom'
})
return false
}
}
return true
},
handleSure() { handleSure() {
if(!this.validateForm()) {
return false
}
for (let item of this.other){ for (let item of this.other){
if(!item.otherExplain){ if(!item.otherExplain){
this.$refs.uToast.show({ this.$refs.uToast.show({
...@@ -238,6 +284,7 @@ ...@@ -238,6 +284,7 @@
.tab-th-txt { .tab-th-txt {
background-color: #FFFFFF; background-color: #FFFFFF;
padding: 10rpx 0; padding: 10rpx 0;
line-break: anywhere;
&.left { &.left {
text-align: left; text-align: left;
...@@ -291,4 +338,9 @@ ...@@ -291,4 +338,9 @@
height: 104rpx; height: 104rpx;
} }
} }
.other-label {
width: 150rpx;
align-self: flex-start;
line-height: 80rpx;
}
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment