Commit 681e8318 authored by 石盼盼's avatar 石盼盼
parents 06c8349d f8ef0a02
...@@ -34,8 +34,9 @@ export default { ...@@ -34,8 +34,9 @@ export default {
REPAIR_BEGIN: baseUrl + '/worker/repair/begin', // 开始维修接口 REPAIR_BEGIN: baseUrl + '/worker/repair/begin', // 开始维修接口
REPAIR_ORDER_DETAIL: baseUrl + '/worker/repair/order/detail', // 报修单详情 REPAIR_ORDER_DETAIL: baseUrl + '/worker/repair/order/detail', // 报修单详情
REPAIR_ORDER: baseUrl + '/worker/material/order', // 发起收费生成耗材单 REPAIR_ORDER: baseUrl + '/worker/material/order', // 发起收费生成耗材单
MATERIAL_REMARK: baseUrl + '/worker/material/remark' // 备注耗材 MATERIAL_REMARK: baseUrl + '/worker/material/remark', // 备注耗材
// BINDLOGINTWO: baseUrl + '/scm/bind/login/two', // 绑定后台账号 REPAIR_MATERIAL_SHOW: baseUrl + '/worker/material/show', // 查看耗材
// REFRESHTOKEN: baseUrl + '/scm/change/token', // 更新token REPAIR_TRANSFER: baseUrl + '/worker/repair/transfer', // 发起转单
// LOGOUT: baseUrl + '/scm/logout', // 更新token REPAIR_COMPLETE: baseUrl + '/worker/repair/complete', // 确认完成
REPAIR_APPRAISAL: baseUrl + '/worker/repair/appraisal' // 查看评论
} }
...@@ -6,3 +6,12 @@ export function formatTel (tel) { ...@@ -6,3 +6,12 @@ export function formatTel (tel) {
var phone = tel.substr(0, 3) + '****' + tel.substring(7, 11) var phone = tel.substr(0, 3) + '****' + tel.substring(7, 11)
return phone return phone
} }
/**
* 清空左右空格
* @param {*} str
* @returns
*/
export function trimStrSpace (str) {
return str.replace(/(^\s*)|(\s*$)/g, '')
}
import { Toast, Dialog } from 'vant'
function selfLoading (msg = '加载中...') {
Toast.loading({
message: msg,
duration: 0,
forbidClick: true,
loadingType: 'spinner'
})
}
export default {
selfLoading: selfLoading
}
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
</div> </div>
<van-pull-refresh v-model="isloading" @refresh="onRefresh"> <van-pull-refresh v-model="isloading" @refresh="onRefresh">
<div class="order-item" v-for="(item, index) in list" :key="item.id"> <div class="order-item" v-for="(item, index) in list" :key="index">
<div class="title">{{item.order_status_display }}</div> <div class="title">{{item.order_status_display }}</div>
<div class="item flex-h flex-vc"> <div class="item flex-h flex-vc">
<div class="item-title">预约时间:</div> <div class="item-title">预约时间:</div>
...@@ -70,10 +70,9 @@ ...@@ -70,10 +70,9 @@
</div> </div>
<div class="line"></div> <div class="line"></div>
<div class="btn flex-h flex-hr"> <div class="btn flex-h flex-hr">
<div v-if="item.is_can_remark_material==1" class="btn-item bz-btn" @click="bz_click(item.id)" >备注耗材</div> <div v-if="item.is_can_remark_material==1" class="btn-item bz-btn" @click="bz_click(item)" >备注耗材</div>
<div <div
v-if="item.is_can_confirm_complete==1" v-if="item.is_can_confirm_complete==1" class="btn-item qr-btn" @click="sure_click(item, index)">确认完成</div>
class="btn-item qr-btn" >确认完成</div>
<div <div
v-if="item.is_can_initiate_charge==1" v-if="item.is_can_initiate_charge==1"
class="btn-item sf-btn" class="btn-item sf-btn"
...@@ -81,13 +80,13 @@ ...@@ -81,13 +80,13 @@
<div <div
v-if="item.is_can_initiate_transfer_order==1" v-if="item.is_can_initiate_transfer_order==1"
class="btn-item" class="btn-item"
@click="zd_click" >发起转单</div> @click="zd_click(item)">发起转单</div>
<div <div
v-if="item.is_can_begin_repair==1" v-if="item.is_can_begin_repair==1"
class="btn-item" class="btn-item"
@click="starRepir(item.id,index)" >开始维修</div> @click="starRepir(item.id,index)" >开始维修</div>
<div v-if="item.is_can_see_appraisal==1" class="btn-item" >查看评价</div> <div v-if="item.is_can_see_appraisal==1" class="btn-item" @click="look_comment(item)">查看评价</div>
<div v-if="item.is_can_see_material==1" class="btn-item sf-btn" @click="look_click" >查看耗材</div> <div v-if="item.is_can_see_material==1" class="btn-item sf-btn" @click="look_click(item)" >查看耗材</div>
</div> </div>
</div> </div>
<!-- 空数据 --> <!-- 空数据 -->
...@@ -101,7 +100,7 @@ ...@@ -101,7 +100,7 @@
<!-- 发起转单弹窗 --> <!-- 发起转单弹窗 -->
<van-popup v-model="zdShow" close-icon="close"> <van-popup v-model="zdShow" close-icon="close">
<div class="pop_title">备注转单原因</div> <div class="pop_title">备注转单原因</div>
<textarea placeholder="请输入转单理由"></textarea> <textarea placeholder="请输入转单理由" v-model="reason"></textarea>
<div class="btnItem flex-h"> <div class="btnItem flex-h">
<div class="cancel" @click="cancel" >取消</div> <div class="cancel" @click="cancel" >取消</div>
<div class="sure" @click="zd_submit" >提交</div> <div class="sure" @click="zd_submit" >提交</div>
...@@ -117,14 +116,14 @@ ...@@ -117,14 +116,14 @@
> >
<input <input
class="input" class="input"
v-model="item.hc" v-model="item.goods_name"
type="text" type="text"
placeholder="请输入耗材名称" placeholder="请输入耗材名称"
/> />
<input <input
class="input" class="input"
v-model="item.sl" v-model.number="item.number"
type="text" type="number"
placeholder="请输入耗材个数" placeholder="请输入耗材个数"
/> />
</div> </div>
...@@ -140,18 +139,13 @@ ...@@ -140,18 +139,13 @@
<!-- 查看耗材弹窗 --> <!-- 查看耗材弹窗 -->
<van-popup v-model="lookShow" close-icon="close"> <van-popup v-model="lookShow" close-icon="close">
<div class="pop_title">查看耗材</div> <div class="pop_title">查看耗材</div>
<div class="ma-item one-item flex-h flex-hb"> <div class="ma-item one-item flex-h flex-hb" v-for="(item, index) in expend_detail.list" :key="index">
<div class="one">洁具</div> <div class="one">{{item.parent_detail ? item.parent_detail.goods_name : '其它'}}</div>
<div class="one">水龙头*1</div> <div class="one">{{item.goods_name}}*{{item.number}}</div>
<div class="one">¥16</div> <div class="one">{{item.is_free ? '免费' : '' + item.price}}</div>
</div>
<div class="ma-item one-item flex-h flex-hb">
<div class="one">洁具</div>
<div class="one">水龙头*1</div>
<div class="one">¥16</div>
</div> </div>
<div class="hc_total">共计2件,总价: ¥26</div> <div class="hc_total">共计{{expend_detail.number}}件,总价: ¥{{expend_detail.price}}</div>
<div class="sure-btn" @click="bz_submit">确定</div> <div class="sure-btn" @click="cancel">确定</div>
</van-popup> </van-popup>
<!-- tabbar --> <!-- tabbar -->
<my-tabbar curname="home"></my-tabbar> <my-tabbar curname="home"></my-tabbar>
...@@ -160,6 +154,7 @@ ...@@ -160,6 +154,7 @@
<script> <script>
import myTabbar from '@components/common/tabbar.vue' import myTabbar from '@components/common/tabbar.vue'
import { trimStrSpace } from '@assets/js/format.js'
export default { export default {
name: 'home', name: 'home',
components: { components: {
...@@ -187,15 +182,20 @@ export default { ...@@ -187,15 +182,20 @@ export default {
status: {}, // 工作状态 status: {}, // 工作状态
imgList: [], imgList: [],
// 转单
curItem: '', // 当前选中要操作的数据
reason: '', // 原因
zdShow: false, // 发起转单弹窗
// 备注耗材
addList: [ addList: [
{ {
hc: '', goods_name: '',
sl: '' number: ''
} }
], ], // 添加的备注耗材数据
zdShow: false, // 发起转单弹窗
hcShow: false, // 耗材弹窗 hcShow: false, // 耗材弹窗
lookShow: false // 查看耗材弹窗 lookShow: false, // 查看耗材弹窗
expend_detail: {} // 耗材详情
} }
}, },
created () { created () {
...@@ -220,6 +220,7 @@ export default { ...@@ -220,6 +220,7 @@ export default {
}) })
.catch(() => {}) .catch(() => {})
}, },
// 获取工单列表
getList () { getList () {
if (this.more && !this.isloading) { if (this.more && !this.isloading) {
this.isloading = true this.isloading = true
...@@ -251,26 +252,6 @@ export default { ...@@ -251,26 +252,6 @@ export default {
this.getList() this.getList()
} }
}, },
// 开始维修
starRepir (id, index) {
console.log(id)
const curParams = {
repair_order_id: id
}
this.$http
.post(this.$myApi.REPAIR_BEGIN, curParams)
.then((res) => {})
.catch(() => {})
},
addMeth () {
this.addList.push({
hc: '',
sl: ''
})
},
delMeth (index) {
this.addList.splice(index, 1)
},
// 点击选择 // 点击选择
chooseTab (e) { chooseTab (e) {
this.tabShow = !this.tabShow this.tabShow = !this.tabShow
...@@ -286,36 +267,163 @@ export default { ...@@ -286,36 +267,163 @@ export default {
}, 0) }, 0)
} }
}, },
// 备注耗材弹窗 // 开始维修
bz_click (id) { starRepir (id, index) {
console.log(id, 'nfnsohnfgvdosrgvf') console.log(index)
this.hcShow = true const vm = this
const curParams = {
repair_order_id: id
}
this.$http
.post(this.$myApi.REPAIR_BEGIN, curParams)
.then((data) => {
vm.$set(vm.list, index, data)
})
.catch(() => {})
}, },
// 转单弹窗 // 转单弹窗
zd_click () { zd_click (item) {
this.curItem = item
this.reason = ''
this.zdShow = true this.zdShow = true
}, },
// 查看耗材弹窗
look_click () {
this.lookShow = true
},
cancel () {
this.zdShow = false
this.hcShow = false
this.lookShow = false
},
// 转单提交 // 转单提交
zd_submit () { zd_submit () {
this.zdShow = false if (this.reason === '') {
console.log(111) this.$toast('转单原因不可为空')
return
}
const curParams = {
repair_order_id: this.curItem.id,
content: this.reason
}
this.$http
.post(this.$myApi.REPAIR_TRANSFER, curParams)
.then((data) => {
this.zdShow = false
this.$toast('操作成功')
const idx = this.list.findIndex(item => item.id === this.curItem.id)
if (idx !== -1) {
this.list.splice(idx, 1)
}
})
.catch(() => {
this.zdShow = false
})
}, },
// 备注耗材弹窗
bz_click (item) {
this.curItem = item
this.hcShow = true
// 默认为一个空数据
this.addList = [{
goods_name: '',
number: ''
}]
},
// 添加耗材
addMeth () {
this.addList.push({
goods_name: '',
number: ''
})
},
// 删除耗材
delMeth (index) {
this.addList.splice(index, 1)
},
// 备注提交 // 备注提交
bz_submit (id) { bz_submit () {
console.log(id, 1111) const vm = this
// const index = this.list.findIndex(item => item.id === this.curItem.id)
let noall = false
this.addList.some(item => {
if (trimStrSpace(item.goods_name) === '' || item.number === '') {
item.goods_name = trimStrSpace(item.goods_name)
vm.$toast('耗材信息请填写完整')
noall = true
return true
}
if (item.number < 1) {
vm.$toast('请正确填写耗材数量')
noall = true
return true
}
})
if (noall) { return }
console.log('六点十分', this.addList) console.log('六点十分', this.addList)
const curParams = {
repair_order_id: this.curItem.id,
goods: this.addList
}
this.$http
.post(this.$myApi.MATERIAL_REMARK, curParams)
.then((data) => {
this.hcShow = false
// vm.$set(vm.list, index, data)
this.$toast('操作成功')
})
.catch(() => {
this.hcShow = false
})
},
// 查看耗材弹窗
look_click (item) {
const curParams = {
repair_order_id: item.id
}
this.$http
.get(this.$myApi.REPAIR_MATERIAL_SHOW, curParams)
.then((data) => {
console.log(data, 'data-------------')
this.expend_detail = data
this.lookShow = true
})
.catch(() => {})
},
// 查看评论
// look_comment (item) {
// const curParams = {
// repair_order_id: item.id
// }
// this.$http
// .get(this.$myApi.REPAIR_APPRAISAL, curParams)
// .then((data) => {
// this.comment_list = data
// })
// .catch(() => {})
// },
// 确认完成
sure_click (item, index) {
const vm = this
this.$dialog.confirm({
title: '提示',
message: '确认完成维修?'
})
.then(() => {
const curParams = {
repair_order_id: item.id
}
this.$http
.post(this.$myApi.REPAIR_COMPLETE, curParams)
.then((data) => {
vm.$set(vm.list, index, data)
this.$toast('操作成功')
})
.catch(() => {})
})
.catch(() => {})
},
// 取消按钮
cancel () {
this.zdShow = false
this.hcShow = false this.hcShow = false
this.lookShow = false this.lookShow = false
console.log('111')
}, },
// 发起收费 // 发起收费
tz_charge (id) { tz_charge (id) {
...@@ -325,8 +433,7 @@ export default { ...@@ -325,8 +433,7 @@ export default {
query: { id } query: { id }
}) })
} }
}, }
} }
</script> </script>
......
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