<template>
|
<up-sticky bgColor="#fff">
|
<view class="c-p-18">
|
<up-input v-model="contentVal">
|
<template #suffix>
|
<up-button @tap="reservation" :text="isEdit?'保存':'预约送货'" :loading='isLoading' type="primary"
|
size="mini"></up-button>
|
</template>
|
</up-input>
|
</view>
|
</up-sticky>
|
<view class="c-p-b-100">
|
<view class="c-p-l-20 c-p-r-20" v-if="orderList&&orderList.length>0">
|
<view class="listrecord c-p-t-20" v-for="(item,index) in orderList" :key="item.keyid">
|
<view class="coreshop-ff chuany-bradius20">
|
<view class="chuany-font26">
|
<view class="chuany-flex chuany-justify-between">
|
<text class="chuany-width5">{{index+1}}</text>
|
<view class="chuany-width15">
|
{{$util.formatDate(item.createTime,'riqi')}}
|
</view>
|
<view class="chuany-width65">
|
<u-text size='14' :text="item.remark" lines="1">
|
</u-text>
|
</view>
|
<view class="chuany-width11 chuany-flex chuany-justify-between">
|
<up-icon name="edit-pen" @click='editOrder(item)'></up-icon>
|
<up-icon name="trash" @click='delOrder(item)'></up-icon>
|
</view>
|
</view>
|
<view class="c-p-t-8">
|
<u--text :lines="1" :text="item.planContent"></u--text>
|
</view>
|
</view>
|
</view>
|
</view>
|
<up-loadmore :status="loadStatus" />
|
</view>
|
<view v-else>
|
<up-empty text='暂无' icon="/static/order.png">
|
</up-empty>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import {
|
mapActions,
|
mapGetters,
|
mapMutations
|
} from 'vuex'
|
export default {
|
data() {
|
return {
|
orderList: [],
|
loadStatus: 'loadmore',
|
pageIndex: 1,
|
pageSize: 30,
|
contentVal: '',
|
options2: [{
|
text: '编辑',
|
style: {
|
backgroundColor: '#3c9cff'
|
}
|
}, {
|
text: '删除',
|
style: {
|
backgroundColor: '#f56c6c'
|
}
|
}],
|
isEdit: false,
|
editItem: {},
|
isLoading: false
|
}
|
},
|
onShow() {
|
this.init()
|
},
|
onPullDownRefresh() {
|
this.init()
|
uni.stopPullDownRefresh();
|
},
|
computed: {
|
...mapGetters(['userInfo', 'identity']),
|
isAdmin() {
|
return this.userInfo.userCompany ? this.userInfo.userCompany.isAdmin : false
|
},
|
// 是否是司机
|
isDriver() {
|
// if (this.userInfo.oaPermissions) {
|
// return this.userInfo.oaPermissions.bF_IsDriver ? true : false
|
// }
|
return false
|
},
|
},
|
methods: {
|
editOrder(item) {
|
this.isEdit = true
|
this.contentVal = item.remark
|
this.editItem = item
|
},
|
delOrder(item) {
|
let that = this
|
uni.showModal({
|
title: '提示',
|
content: '确认删除该送货吗?',
|
success: function(res) {
|
if (res.confirm) {
|
// 执行确认后的操作
|
that.$api.DelAppointmentDeliver({
|
keyid: item.keyid
|
}).then(req => {
|
if (req.code == 1) {
|
that.$util.showToast({
|
title: '删除成功!'
|
})
|
that.init()
|
} else {
|
that.$util.showToast({
|
title: req.error
|
})
|
}
|
})
|
} else {
|
// 执行取消后的操作
|
}
|
}
|
})
|
},
|
init() {
|
this.pageIndex = 1
|
this.pageSize = 30
|
this.loadStatus = 'loadmore'
|
this.orderList = []
|
this.contentVal = ''
|
this.getList()
|
},
|
reservation() {
|
if (!this.contentVal) {
|
return this.$util.showToast({
|
title: '请先输入内容!'
|
})
|
}
|
this.isLoading = true
|
if (this.isEdit) {
|
let obj = {
|
keyid: this.editItem.keyid,
|
remark: this.contentVal
|
}
|
this.$api.UpDataAppointmentDeliver(obj).then(res => {
|
if (res.code == 1) {
|
this.isEdit = false
|
this.editItem = {}
|
this.contentVal = ''
|
this.init()
|
} else {
|
this.$util.showToast({
|
title: res.error
|
})
|
}
|
this.isLoading = false
|
})
|
return
|
}
|
this.$api.CreatAppointmentDeliver({
|
remark: this.contentVal
|
}).then(res => {
|
if (res.code == 1) {
|
this.contentVal = ''
|
this.init()
|
} else {
|
this.$util.showToast({
|
title: res.error
|
})
|
}
|
this.isLoading = false
|
})
|
},
|
getList() {
|
let data = {
|
deliverState: 0,
|
page: {
|
pageIndex: this.pageIndex,
|
pageSize: this.pageSize,
|
}
|
}
|
this.$api.GetListAppointmentDeliverList(data).then(res => {
|
console.log(res, res.code, '-----------123’');
|
if (res.code == 1) {
|
if (this.pageIndex == 1) {
|
this.orderList = res.data.data
|
} else {
|
this.orderList = this.orderList.concat(...res.data.data)
|
}
|
console.log(this.orderList, 'orderList’');
|
// totalPages = res.data.totalCount
|
// 根据count数量判断是否还有数据
|
if (res.data.page.totalCount > this.orderList.length) {
|
this.loadStatus = 'loadmore'
|
this.pageIndex++
|
} else {
|
// 数据已加载完毕
|
this.loadStatus = 'nomore'
|
}
|
} else {
|
// _that.$refs.uToast.show({ message: res.msg, type: 'error' });
|
}
|
})
|
},
|
accept(item) {
|
let that = this
|
uni.showModal({
|
title: '提示',
|
content: '确认受理该送货吗?',
|
success: function(res) {
|
if (res.confirm) {
|
// 执行确认后的操作
|
that.$api.AcceptAppointmentDeliver(item.keyid).then(req => {
|
if (req.code == 1) {
|
that.$util.showToast({
|
title: '受理成功!'
|
})
|
that.init()
|
} else {
|
that.$util.showToast({
|
title: req.error
|
})
|
}
|
})
|
} else {
|
// 执行取消后的操作
|
}
|
}
|
})
|
},
|
actionClick(item, e) {
|
console.log(e);
|
if (e.index == 0) {
|
this.contentVal = item.remark
|
}
|
}
|
}
|
}
|
</script>
|
|
<style>
|
</style>
|