Commit 041f5d9e authored by Facius's avatar Facius

feat: 创建维修账单

parent af61fda6
Pipeline #2889 canceled with stages
...@@ -8,11 +8,11 @@ ...@@ -8,11 +8,11 @@
<view class="title-view"> <view class="title-view">
<view>{{ info.id }}</view> <view>{{ info.id }}</view>
<view class="status-view" <view class="status-view"
><text :style="'color:' + statusSetting[info.settleState].color">{{ ><text :style="'color:' + statusSetting[info.settleState.code].color">{{
statusSetting[info.settleState].text statusSetting[info.settleState.code].text
}}</text }}</text
>·<text :style="'color:' + statusSetting[info.sendStatus].color">{{ >·<text :style="'color:' + statusSetting[info.sendStatus.code].color">{{
statusSetting[info.sendStatus].text statusSetting[info.sendStatus.code].text
}}</text></view }}</text></view
> >
</view> </view>
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
<view class="item-view"> <view class="item-view">
<view class="label-view">数量</view> <view class="label-view">数量</view>
<view class="value-view"> <view class="value-view">
<u-number-box color="#cccccc" size="28" v-model="number" bg-color="#ffffff"></u-number-box> <u-number-box min="1" color="#cccccc" size="28" v-model="number" bg-color="#ffffff"></u-number-box>
</view> </view>
</view> </view>
<view class="line-view"></view> <view class="line-view"></view>
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
:clearable="false" :clearable="false"
:custom-style="customStyle" :custom-style="customStyle"
:placeholder-style="placeholderStyle" :placeholder-style="placeholderStyle"
v-model="price" v-model="unitPrice"
placeholder="填写单价费用" placeholder="填写单价费用"
/> />
</view> </view>
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
:clearable="false" :clearable="false"
:custom-style="customStyle" :custom-style="customStyle"
:placeholder-style="placeholderStyle" :placeholder-style="placeholderStyle"
v-model="all" v-model="total"
placeholder="填写总价费用" placeholder="填写总价费用"
/> />
</view> </view>
...@@ -81,26 +81,28 @@ export default { ...@@ -81,26 +81,28 @@ export default {
return { return {
name: '', name: '',
number: '', number: '',
price: '', unitPrice: '',
all: '', total: '',
} }
}, },
watch: { watch: {
showDelete(val) {
console.log('------showDelete------', val)
},
name(value) { name(value) {
this.handleChange('name', value) this.handleChange({'name': value})
}, },
number(value) { number(value) {
this.handleChange('number', value) if (this.unitPrice && this.number) {
this.total = this.formatCount(Number(this.unitPrice) * Number(this.number))
}
this.handleChange({'number': value})
}, },
price(value) { unitPrice(value) {
this.handleChange('price', value) if (this.unitPrice && this.number) {
this.total = this.formatCount(Number(this.unitPrice) * Number(this.number))
}
this.handleChange({'unitPrice': value})
}, },
all(value) { total(value) {
this.handleChange('all', value) this.handleChange({'total': value})
}, },
}, },
computed: { computed: {
...@@ -117,19 +119,21 @@ export default { ...@@ -117,19 +119,21 @@ export default {
}, },
created() { created() {
this.name = this.defaultInfo.name this.name = this.defaultInfo.name
this.price = this.defaultInfo.price this.unitPrice = this.formatCount(this.defaultInfo.unitPrice)
this.number = this.defaultInfo.number this.number = this.defaultInfo.number
this.all = this.defaultInfo.all this.total = this.formatCount(this.defaultInfo.total)
}, },
methods: { methods: {
handleChange(key, value) { handleChange(obj) {
this.$emit('change', { key: key, value: value }) this.$emit('change', obj)
}, },
handleClickDelete() { handleClickDelete() {
console.log('(-----handleClickDelete-----)')
this.$emit('delete') this.$emit('delete')
}, },
formatCount(count) {
return (Math.trunc((count || 0) * 100) / 100).toFixed(2)
},
}, },
} }
</script> </script>
......
...@@ -147,6 +147,7 @@ ...@@ -147,6 +147,7 @@
:custom-style="customConFirm" :custom-style="customConFirm"
@click="handleClickSure" @click="handleClickSure"
:disabled="!canConfirm" :disabled="!canConfirm"
:loading="buttonLoading"
> >
<view class="confirm-view">确定</view> <view class="confirm-view">确定</view>
</u-button> </u-button>
...@@ -193,10 +194,7 @@ export default { ...@@ -193,10 +194,7 @@ export default {
}, },
showDatePicker: false, showDatePicker: false,
showTimePicker: false, showTimePicker: false,
defaultTime: this.$u.timeFormat( buttonLoading: false,
new Date().getTime(),
'yyyy-mm-dd hh:MM:ss'
),
} }
}, },
computed: { computed: {
...@@ -305,18 +303,21 @@ export default { ...@@ -305,18 +303,21 @@ export default {
}, },
onLoad(options) { onLoad(options) {
// 测试数据 // 测试数据
options.billId = '9988' options.billId = '1550685581418168320'
if (options && options.billId) { if (options && options.billId) {
this.billId = options.billId this.billId = options.billId
this.repairDetail() }
if (this.billId) {
this.repairDetail()
} }
}, },
onReady() { onReady() {
this.$refs.uForm.setRules(this.rules) this.$refs.uForm.setRules(this.rules)
}, },
onUnload() {}, onUnload() {},
onShow() {}, onShow() {
},
methods: { methods: {
repairDetail() { repairDetail() {
this.loading = true this.loading = true
...@@ -331,52 +332,52 @@ export default { ...@@ -331,52 +332,52 @@ export default {
}) })
.catch((res) => { .catch((res) => {
this.loading = false this.loading = false
// 测试数据
this.setForm(res.data)
}) })
}, },
setForm(data) { setForm(data) {
// 测试 // 测试
var data = { // var data = {
id: '8778788', // id: '8778788',
settleState: 'NO', // settleState: 'NO',
sendStatus: 'WAIT', // sendStatus: 'WAIT',
customer: { // customer: {
name: '张三', // name: '张三',
phone: '1231312313423', // phone: '1231312313423',
}, // },
repairTime: '2077-87-87 12:23:43', // repairTime: '2022-07-07 12:23:43',
actualAmount: '40', // actualAmount: '40',
receivableAmount: '80', // receivableAmount: '80',
address: 'fdsafdsafdasfdafd发撒发大水范德萨范德萨范德萨发大水发', // address: '详细地址:广东省深圳市',
remark: '维修格力牌柜机一台,更换压缩机收费800\nfdsadfsafdasfads', // remark: '维修格力牌柜机一台,更换压缩机收费800\nfdsadfsafdasfads',
attach: [ // attach: [
'http://reu2asz23.hn-bkt.clouddn.com/icon%2Fbeizhutu%403x.png', // 'http://reu2asz23.hn-bkt.clouddn.com/icon%2Fbeizhutu%403x.png',
'http://reu2asz23.hn-bkt.clouddn.com/icon/wuweixiuzhangdan@3x.png', // 'http://reu2asz23.hn-bkt.clouddn.com/icon/wuweixiuzhangdan@3x.png',
'http://reu2asz23.hn-bkt.clouddn.com/icon/wusousuojieguo@3x.png', // 'http://reu2asz23.hn-bkt.clouddn.com/icon/wusousuojieguo@3x.png',
], // ],
histories: [ // histories: [
{ // {
createTime: '2099-98-76 09:09:87', // createTime: '2099-98-76 09:09:87',
type: 'SETTLE', // type: 'SETTLE',
}, // },
{ // {
createTime: '2099-98-76 09:09:87', // createTime: '2099-98-76 09:09:87',
type: 'ENSURE', // type: 'ENSURE',
}, // },
{ // {
createTime: '2099-98-76 09:09:87', // createTime: '2099-98-76 09:09:87',
type: 'SEND', // type: 'SEND',
}, // },
{ // {
createTime: '2099-98-76 09:09:87', // createTime: '2099-98-76 09:09:87',
type: 'CREATE', // type: 'CREATE',
}, // },
], // ],
syncFlag: false, // syncFlag: false,
} // latitude: '22.55329',
// longitude: '113.88308'
// }
this.form = { this.form = {
id: data.id,
customerName: data.customer.name, customerName: data.customer.name,
customerPhone: data.customer.phone, customerPhone: data.customer.phone,
receivableAmount: data.receivableAmount, receivableAmount: data.receivableAmount,
...@@ -384,8 +385,8 @@ export default { ...@@ -384,8 +385,8 @@ export default {
repairTime: data.repairTime, repairTime: data.repairTime,
partTime: data.partTime, partTime: data.partTime,
address: data.address, address: data.address,
latitude: '', latitude: data.latitude,
longitude: '', longitude: data.longitude,
remark: data.remark, remark: data.remark,
attach: data.attach, attach: data.attach,
} }
...@@ -437,12 +438,24 @@ export default { ...@@ -437,12 +438,24 @@ export default {
}) })
}, },
editeRepair() { editeRepair() {
this.buttonLoading = true
editeRepair(this.form).then((res)=> { editeRepair(this.form).then((res)=> {
if (res.code == 0) { if (res.code == 0) {
this.billId = res.data
this.toParticulars()
this.buttonLoading = false
} }
}).catch((res)=> { }).catch((res)=> {
this.buttonLoading = false
})
},
toParticulars() {
this.$u.route({
url: 'pages/maintain-bill/particulars',
type: 'navigateTo',
params: {
billId: this.billId,
},
}) })
}, },
formatCount(count) { formatCount(count) {
......
...@@ -9,11 +9,11 @@ ...@@ -9,11 +9,11 @@
/> />
<view class="content-view"> <view class="content-view">
<view class="status-view" <view class="status-view"
><text :style="'color:' + statusSetting[info.settleState].color">{{ ><text :style="'color:' + statusSetting[info.settleState.code].color">{{
statusSetting[info.settleState].text statusSetting[info.settleState.code].text
}}</text }}</text
>·<text :style="'color:' + statusSetting[info.sendStatus].color">{{ >·<text :style="'color:' + statusSetting[info.sendStatus.code].color">{{
statusSetting[info.sendStatus].text statusSetting[info.sendStatus.code].text
}}</text></view }}</text></view
> >
<view class="info-view part-view"> <view class="info-view part-view">
...@@ -102,7 +102,12 @@ ...@@ -102,7 +102,12 @@
</view> </view>
</view> </view>
<view class="right-view"> <view class="right-view">
<u-button :custom-style="customStatus" @click="handleClickStatus" :disabled="info.syncFlag" class="status-button"> <u-button
:custom-style="customStatus"
@click="handleClickStatus"
:disabled="info.syncFlag"
class="status-button"
>
<view <view
class="status-view" class="status-view"
:style="'color: ' + syncFlagSettings.color" :style="'color: ' + syncFlagSettings.color"
...@@ -168,7 +173,7 @@ export default { ...@@ -168,7 +173,7 @@ export default {
return this.baseUrl + 'huishouye@3x.png' return this.baseUrl + 'huishouye@3x.png'
}, },
isSure() { isSure() {
return this.info.sendStatus == 'SURE' return this.info.sendStatus.code == 'SURE'
}, },
// sendStatus WAIT:未发送;WAIT_SURE:未确定;SURE:已确定 // sendStatus WAIT:未发送;WAIT_SURE:未确定;SURE:已确定
// settleState NO:未结清;YES:已结清 // settleState NO:未结清;YES:已结清
...@@ -192,7 +197,7 @@ export default { ...@@ -192,7 +197,7 @@ export default {
} }
}, },
settleState() { settleState() {
return this.info.settleState == 'YES' return this.info.settleState.code == 'YES'
}, },
moneyKeys() { moneyKeys() {
var result = var result =
...@@ -235,26 +240,26 @@ export default { ...@@ -235,26 +240,26 @@ export default {
popInfos() { popInfos() {
return [ return [
{ {
title: '删除提醒', title: '删除提醒',
isSelect: true, isSelect: true,
confirmText: '删除', confirmText: '删除',
content: '确认删除账单吗?', content: '确认删除账单吗?',
bottomTip: '同时删除关联的账单明细', bottomTip: '同时删除关联的账单明细',
}, },
{ {
title: '操作提醒', title: '操作提醒',
isSelect: false, isSelect: false,
confirmText: '确定', confirmText: '确定',
content: '确认将该账单标记为已结清?', content: '确认将该账单标记为已结清?',
bottomTip: '', bottomTip: '',
}, },
{ {
title: '操作提醒', title: '操作提醒',
isSelect: false, isSelect: false,
confirmText: '确定', confirmText: '确定',
content: '是否将该账单转入账单明细统计?', content: '是否将该账单转入账单明细统计?',
bottomTip: '', bottomTip: '',
} },
] ]
}, },
currentPopInfo() { currentPopInfo() {
...@@ -295,7 +300,9 @@ export default { ...@@ -295,7 +300,9 @@ export default {
height: '104rpx', height: '104rpx',
'border-radius': '16rpx', 'border-radius': '16rpx',
width: this.isSure ? '372rpx' : '240rpx', width: this.isSure ? '372rpx' : '240rpx',
background: this.isSure ? '' : 'linear-gradient(100deg, transparent 32rpx, #02a074 0)', background: this.isSure
? ''
: 'linear-gradient(100deg, transparent 32rpx, #02a074 0)',
} }
}, },
// CREATE:创建账单;SEND:发送客户;ENSURE:客户确认;SETTLE:标记为已结清 // CREATE:创建账单;SEND:发送客户;ENSURE:客户确认;SETTLE:标记为已结清
...@@ -313,7 +320,7 @@ export default { ...@@ -313,7 +320,7 @@ export default {
this.billId = options.billId this.billId = options.billId
} }
// 测试数据 // 测试数据
this.billId = '8786788' this.billId = '1550685581418168320'
uni.$on('maintain-bill-detail', (res) => { uni.$on('maintain-bill-detail', (res) => {
this.repairDetail() this.repairDetail()
...@@ -340,50 +347,10 @@ export default { ...@@ -340,50 +347,10 @@ export default {
if (res.data) { if (res.data) {
this.info = res.data this.info = res.data
} }
this.loading = false this.loading = false
}) })
.catch((res) => { .catch((res) => {
this.loading = false this.loading = false
// 测试数据
this.info = {
id: '8778788',
settleState: 'NO',
sendStatus: 'WAIT',
customer: {
name: '张三',
phone: '1231312313423',
},
repairTime: '2077-87-87 12:23:43',
actualAmount: '40',
receivableAmount: '80',
address: 'fdsafdsafdasfdafd发撒发大水范德萨范德萨范德萨发大水发',
remark: '维修格力牌柜机一台,更换压缩机收费800\nfdsadfsafdasfads',
attach: [
'http://reu2asz23.hn-bkt.clouddn.com/icon%2Fbeizhutu%403x.png',
'http://reu2asz23.hn-bkt.clouddn.com/icon/wuweixiuzhangdan@3x.png',
'http://reu2asz23.hn-bkt.clouddn.com/icon/wusousuojieguo@3x.png',
],
histories: [
{
createTime: '2099-98-76 09:09:87',
type: 'SETTLE',
},
{
createTime: '2099-98-76 09:09:87',
type: 'ENSURE',
},
{
createTime: '2099-98-76 09:09:87',
type: 'SEND',
},
{
createTime: '2099-98-76 09:09:87',
type: 'CREATE',
},
],
syncFlag: false,
}
}) })
}, },
...@@ -418,7 +385,6 @@ export default { ...@@ -418,7 +385,6 @@ export default {
}) })
}, },
handleClickChange() { handleClickChange() {
console.log('--------handleClickChange---------')
this.$u.route({ this.$u.route({
url: 'pages/maintain-bill/create', url: 'pages/maintain-bill/create',
type: 'navigateTo', type: 'navigateTo',
...@@ -432,12 +398,11 @@ export default { ...@@ -432,12 +398,11 @@ export default {
// 删除账单 // 删除账单
} else if (this.current == 1) { } else if (this.current == 1) {
// 标记为已结清 // 标记为已结清
} else if (this.current == 2) { } else if (this.current == 2) {
// 同步账单 // 同步账单
} }
}, },
handleClickPreview(index) { handleClickPreview(index) {
console.log('-------handleClickPreview-------', index, this.info.attach)
uni.previewImage({ uni.previewImage({
urls: this.info.attach, urls: this.info.attach,
current: index, current: index,
......
...@@ -230,72 +230,72 @@ export default { ...@@ -230,72 +230,72 @@ export default {
onlyDebt: this.onlyDebt, onlyDebt: this.onlyDebt,
}) })
.then((res) => { .then((res) => {
// let data = res.data let data = res.data
// 测试 // 测试
let data = { // let data = {
records: [ // records: [
{ // {
id: '878788', // id: '878788',
settleState: 'YES', // settleState: 'YES',
sendStatus: 'WAIT', // sendStatus: 'WAIT',
customerName: '张三', // customerName: '张三',
customerPhone: '14141241413', // customerPhone: '14141241413',
repairTime: '2077-87-87 12:23:43', // repairTime: '2077-87-87 12:23:43',
actualAmount: '20', // actualAmount: '20',
receivableAmount: '80', // receivableAmount: '80',
}, // },
{ // {
id: '8783788', // id: '8783788',
settleState: 'NO', // settleState: 'NO',
sendStatus: 'SURE', // sendStatus: 'SURE',
customerName: '张三', // customerName: '张三',
customerPhone: '14141241413', // customerPhone: '14141241413',
repairTime: '2077-87-87 12:23:43', // repairTime: '2077-87-87 12:23:43',
actualAmount: '80', // actualAmount: '80',
receivableAmount: '80', // receivableAmount: '80',
}, // },
{ // {
id: '8787488', // id: '8787488',
settleState: 'NO', // settleState: 'NO',
sendStatus: 'WAIT', // sendStatus: 'WAIT',
customerName: '张三', // customerName: '张三',
customerPhone: '14141241413', // customerPhone: '14141241413',
repairTime: '2077-87-87 12:23:43', // repairTime: '2077-87-87 12:23:43',
actualAmount: '20', // actualAmount: '20',
receivableAmount: '80', // receivableAmount: '80',
}, // },
{ // {
id: '8785788', // id: '8785788',
settleState: 'YES', // settleState: 'YES',
sendStatus: 'SURE', // sendStatus: 'SURE',
customerName: '张三', // customerName: '张三',
customerPhone: '14141241413', // customerPhone: '14141241413',
repairTime: '2077-87-87 12:23:43', // repairTime: '2077-87-87 12:23:43',
actualAmount: '80', // actualAmount: '80',
receivableAmount: '80', // receivableAmount: '80',
}, // },
{ // {
id: '8786788', // id: '8786788',
settleState: 'YES', // settleState: 'YES',
sendStatus: 'WAIT_SURE', // sendStatus: 'WAIT_SURE',
customerName: '张三', // customerName: '张三',
customerPhone: '14141241413', // customerPhone: '14141241413',
repairTime: '2077-87-87 12:23:43', // repairTime: '2077-87-87 12:23:43',
actualAmount: '20', // actualAmount: '20',
receivableAmount: '80', // receivableAmount: '80',
}, // },
{ // {
id: '8778788', // id: '8778788',
settleState: 'NO', // settleState: 'NO',
sendStatus: 'WAIT', // sendStatus: 'WAIT',
customerName: '张三', // customerName: '张三',
customerPhone: '14141241413', // customerPhone: '14141241413',
repairTime: '2077-87-87 12:23:43', // repairTime: '2077-87-87 12:23:43',
actualAmount: '80', // actualAmount: '80',
receivableAmount: '80', // receivableAmount: '80',
}, // },
], // ],
} // }
if (this.current == 1) { if (this.current == 1) {
this.records = [] this.records = []
} }
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
:clearable="false" :clearable="false"
:custom-style="customStyle" :custom-style="customStyle"
:placeholder-style="placeholderStyle" :placeholder-style="placeholderStyle"
v-model="price" v-model="info.faultRecord.category"
placeholder="填写品牌名称" placeholder="填写品牌名称"
/> />
</view> </view>
...@@ -42,11 +42,11 @@ ...@@ -42,11 +42,11 @@
<view class="label-view">型号</view> <view class="label-view">型号</view>
<view class="value-view"> <view class="value-view">
<u-input <u-input
type="digit" type="text"
:clearable="false" :clearable="false"
:custom-style="customStyle" :custom-style="customStyle"
:placeholder-style="placeholderStyle" :placeholder-style="placeholderStyle"
v-model="all" v-model="info.faultRecord.machineModel"
placeholder="填写型号名称" placeholder="填写型号名称"
/> />
</view> </view>
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
:clearable="false" :clearable="false"
:custom-style="customAreaStyle" :custom-style="customAreaStyle"
:placeholder-style="placeholderStyle" :placeholder-style="placeholderStyle"
v-model="form.phone" v-model="info.faultRecord.symptom"
placeholder="填写故障现象详细信息" placeholder="填写故障现象详细信息"
/> />
</view> </view>
...@@ -76,14 +76,14 @@ ...@@ -76,14 +76,14 @@
:clearable="false" :clearable="false"
:custom-style="customAreaStyle" :custom-style="customAreaStyle"
:placeholder-style="placeholderStyle" :placeholder-style="placeholderStyle"
v-model="form.phone" v-model="info.faultRecord.repairResult"
placeholder="填写检修结果详细信息" placeholder="填写检修结果详细信息"
/> />
</view> </view>
</view> </view>
</view> </view>
<view class="list-view"> <view class="list-view">
<view v-for="(item, index) in list" :key="index"> <view v-for="(item, index) in info.expenseDetails" :key="index">
<CellParticulars <CellParticulars
:showDelete="showDeleteButton" :showDelete="showDeleteButton"
:defaultInfo="item" :defaultInfo="item"
...@@ -114,6 +114,7 @@ ...@@ -114,6 +114,7 @@
:custom-style="customConFirm" :custom-style="customConFirm"
@click="handleClickSure" @click="handleClickSure"
:disabled="!canConfirm" :disabled="!canConfirm"
:loading="buttonLoading"
> >
<view class="confirm-view">保存</view> <view class="confirm-view">保存</view>
</u-button> </u-button>
...@@ -134,6 +135,7 @@ ...@@ -134,6 +135,7 @@
import NavbarRight from '@/components/navbar-right' import NavbarRight from '@/components/navbar-right'
import CellParticulars from '@/components/cell-particular' import CellParticulars from '@/components/cell-particular'
import PopNormal from '@/components/pop-normal' import PopNormal from '@/components/pop-normal'
import { repairDetail, editeRepair } from '@/api/maintain/index.js'
export default { export default {
components: { components: {
...@@ -143,19 +145,16 @@ export default { ...@@ -143,19 +145,16 @@ export default {
}, },
data() { data() {
return { return {
billId: '',
visible: false, visible: false,
info: {}, info: {
list: [ expenseDetails: [],
{ faultRecord: null,
name: 'a', },
number: '1',
price: '2',
all: '3',
},
],
showRecord: false, showRecord: false,
canConfirm: false,
currentIndex: 0, currentIndex: 0,
buttonLoading: false,
faultRecord: {}, // 存储临时值
} }
}, },
computed: { computed: {
...@@ -177,7 +176,7 @@ export default { ...@@ -177,7 +176,7 @@ export default {
} }
}, },
showDeleteButton() { showDeleteButton() {
return this.list.length > 1 return this.info.expenseDetails.length > 1
}, },
placeholderStyle() { placeholderStyle() {
return 'color:#ccc;font-size:28rpx;font-weight: bold;' return 'color:#ccc;font-size:28rpx;font-weight: bold;'
...@@ -199,35 +198,113 @@ export default { ...@@ -199,35 +198,113 @@ export default {
'border-radius': '16rpx', 'border-radius': '16rpx',
} }
}, },
canConfirm() {
for (var item of this.info.expenseDetails) {
for (var key of this.expenseDetailsKeys) {
if (!item[key]) {
return false
}
}
}
if (this.info.faultRecord) {
for (var key of this.faultRecordKeys) {
console.log(key, this.info.faultRecord[key])
if (!this.info.faultRecord[key]) {
return false
}
}
}
return true
},
expenseDetailsKeys() {
return ['name', 'number', 'unitPrice', 'total']
},
faultRecordKeys() {
return ['category', 'machineModel', 'repairResult', 'symptom']
},
},
onLoad(options) {
// 测试数据
options.billId = '1550685581418168320'
if (options && options.billId) {
this.billId = options.billId
}
if (this.billId) {
this.repairDetail()
}
}, },
onLoad(options) {},
onReady() {}, onReady() {},
onUnload() {}, onUnload() {},
onShow() {}, onShow() {
},
methods: { methods: {
repairDetail() {
this.loading = true
repairDetail({
id: this.billId,
})
.then((res) => {
if (res.data) {
this.setInfo(res.data)
}
this.loading = false
})
.catch((res) => {
this.loading = false
})
},
setInfo(data) {
var array =
data.expenseDetails && data.expenseDetails.length > 0
? data.expenseDetails
: [{ repairRecordId: data.id }]
this.info = {
id: data.id,
expenseDetails: array,
faultRecord: data.faultRecord,
// 上一页的数据
customerName: data.customer.name,
customerPhone: data.customer.phone,
receivableAmount: data.receivableAmount,
actualAmount: data.actualAmount,
repairTime: data.repairTime,
partTime: data.partTime,
address: data.address,
latitude: data.latitude,
longitude: data.longitude,
remark: data.remark,
attach: data.attach,
}
this.faultRecord = data.faultRecord || {
category: '',
machineModel: '',
repairResult: '',
symptom: '',
repairRecordId: data.id,
}
this.showRecord = this.info.faultRecord != null
},
handleChangeShowRecord(event) { handleChangeShowRecord(event) {
this.showRecord = event.value this.showRecord = event
this.info.faultRecord = this.showRecord ? this.faultRecord : null
}, },
handleChange(event, index) { handleChange(event, index) {
this.list[index][event.key] = event.value this.$set(this.info.expenseDetails, index, {
for (var item of this.list) { ...this.info.expenseDetails[index],
for (var key in item) { ...event,
if (!this.list[index][key]) { })
this.canConfirm = false
return
}
}
}
this.canConfirm = true
}, },
handleClickAdd() { handleClickAdd() {
this.list = [ this.info.expenseDetails = [
...this.list, ...this.info.expenseDetails,
{ {
repairRecordId: this.billId,
name: '', name: '',
number: '', number: '1',
price: '', unitPrice: '',
all: '', total: '',
}, },
] ]
}, },
...@@ -238,14 +315,40 @@ export default { ...@@ -238,14 +315,40 @@ export default {
handleClickConfirm() { handleClickConfirm() {
this.list.splice(this.currentIndex, 1) this.list.splice(this.currentIndex, 1)
}, },
handleClickSkip(date) {}, editeRepair() {
handleClickSure() {}, this.buttonLoading = true
editeRepair(this.info)
.then((res) => {
if (res.code == 0) {
this.toDetailPage()
this.buttonLoading = false
}
})
.catch((res) => {
this.buttonLoading = false
})
},
toDetailPage() {
this.$u.route({
url: 'pages/maintain-bill/detail',
type: 'navigateTo',
params: {
billId: this.billId,
},
})
},
handleClickSkip(date) {
this.toDetailPage()
},
handleClickSure() {
this.editeRepair()
},
}, },
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.maintain-particulars { .maintain-particulars {
/deep/.u-number-input { /deep/.u-number-input {
color: #333333 !important; color: #333333 !important;
font-weight: bold; font-weight: bold;
} }
...@@ -292,7 +395,7 @@ export default { ...@@ -292,7 +395,7 @@ export default {
align-items: center; align-items: center;
font-size: 28rpx; font-size: 28rpx;
&.one-line { &.one-line {
padding: 8rpx 0; padding: 8rpx 0;
} }
.label-view { .label-view {
color: #8d8d8d; color: #8d8d8d;
......
...@@ -310,6 +310,7 @@ export default { ...@@ -310,6 +310,7 @@ export default {
type: 'switchTab', type: 'switchTab',
}) })
}, },
init() { init() {
this.loading = false this.loading = false
this.info = { this.info = {
......
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