You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
fude/pages/index/acceptRecord.vue

382 lines
10 KiB

<template>
<view class="acceptRecord">
<navbar title="验收记录" :isCenter="true" :back="true"></navbar>
<view class="record">
<view class="section">
<view class="recordItem">
<view class="left">订单创建时间</view>
<view class="right">{{detaildInfo.createtime}}</view>
</view>
<view class="recordItem">
<view class="left">代理商签字时间</view>
<view class="right">{{detaildInfo.agent_sign_time_text?detaildInfo.agent_sign_time_text:''}}</view>
</view>
<view class="recordItem">
<view class="left">代理商公司名称</view>
<view class="right">{{detaildInfo.agent_company_name}}</view>
</view>
<view class="recordItem">
<view class="left">代理商签字人姓名</view>
<view class="right" v-show="detaildInfo.status!=1">{{detaildInfo.agent_name}}</view>
</view>
<view class="recordItem">
<view class="left">代理商签字人手机号</view>
<view class="right" v-show="detaildInfo.status!=1">{{detaildInfo.agent_mobile}}</view>
</view>
<view class="recordItem">
<view class="left">代理商地址</view>
<view class="right" v-show="detaildInfo.status!=1">{{detaildInfo.agent_address}}</view>
</view>
</view>
<view class="section" style="margin-top:36rpx">
<view class="recordItem">
<view class="left">审核员签字时间</view>
<view class="right">{{detaildInfo.auditor_sign_time_text?detaildInfo.auditor_sign_time_text:''}}</view>
</view>
<view class="recordItem">
<view class="left">审核员姓名</view>
<view class="right">{{detaildInfo.auditor_name}}</view>
</view>
</view>
<view class="section" style="margin-top:36rpx;border:none;">
<view class="recordItem">
<view class="left">用户签字时间</view>
<view class="right">{{detaildInfo.user_sign_time_text?detaildInfo.user_sign_time_text:''}}</view>
</view>
<view class="recordItem">
<view class="left">用户姓名</view>
<view class="right">{{detaildInfo.user_name}}</view>
</view>
<view class="recordItem">
<view class="left">用户手机号</view>
<view class="right">{{detaildInfo.user_mobile}}</view>
</view>
<view class="recordItem">
<view class="left">用户地址</view>
<view class="right">{{detaildInfo.user_address}}</view>
</view>
</view>
<view class="status nopass" v-if="detaildInfo.status==5">
验收不通过原因: {{detaildInfo.no_reason}}
</view>
<!-- status为3用户待签字 -->
<view class="btnContent" v-if="detaildInfo.status!=5">
<button class="btnItem unpass" v-if="userInfo.user_type==1" @click="unpassHandle">验收不合格</button>
<button class="btnItem pass" v-show="detaildInfo.status==1" @click="signHandle">验收签字</button>
<button class="btnItem pass" v-show="detaildInfo.status!=1" @click="lookReport">查看报告</button>
<button class="btnItem pass" open-type="share" v-show="userInfo.user_type==2&&detaildInfo.status==3">分享链接</button>
</view>
<view class="btnContent" v-else>
<button class="btnItem pass" v-show="detaildInfo.status==5" @click="signHandle">验收签字</button>
</view>
<u-modal :show="show" confirmColor="#8EC31F" @confirm="confirmHandle" @cancel="cancelHandle" :showCancelButton="true">
<view class="slot-content">
<view class="title">
验收不通过原因
</view>
<u--textarea v-model="failReason" placeholder="请输入内容" ></u--textarea>
</view>
</u-modal>
</view>
</view>
</template>
<script>
import navbar from '@/components/navbar.vue'
import {getDetails,unpassHandle} from '@/common/api.js'
import {getToken,getUserInfo,checkUserSign} from '@/common/auth.js'
export default {
components:{navbar},
data() {
return {
id:null,
detaildInfo:{},
show:false,
failReason:'',
userInfo:{},
shareShow:false,
confirmForm:{
name:'',
phone:''
},
rules: {
'name': {
required: true,
message: '请输入姓名',
trigger: ['blur', 'change']
},
'phone': {
required: true,
message: '请输入手机号',
trigger: ['blur', 'change']
},
},
}
},
onLoad(option) {
if(option.isShare){
this.id=option.id
this.shareShow = true;
}else{
this.userInfo = getUserInfo()
console.log(this.userInfo)
this.id=option.id
// this.getDetails()
}
},
onShow() {
this.getDetails()
},
methods: {
shareConfirm(){
let params={
wordorder_id:this.id,
username:this.confirmForm.name,
mobile:this.confirmForm.phone
}
checkUserSign(params).then(res=>{
if(res.code==1){
if(res.data.status==4){//已签
if(res.data.user_name==this.confirmForm.name){//已签且是本人
uni.setStorageSync("acceptance_content",res.data.acceptance_content)
uni.navigateTo({
url:'/pages/index/userSignPage?id='+this.id+'&isUserSign='+1+'&name='+this.confirmForm.name+'&mobile='+this.confirmForm.mobile
})
}
}else if(res.data.status==3){//待用户签字
uni.navigateTo({
url:'/pages/index/userInformation?id='+this.id+'&isUserSign='+0+'&name='+this.confirmForm.name+'&mobile='+this.confirmForm.mobile
})
}
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
})
},
unpassHandle(){
this.show = true;
},
newDate(time) {
var date = new Date(time)
var y = date.getFullYear()
var m = date.getMonth() + 1
m = m < 10 ? '0' + m : m
var d = date.getDate()
d = d < 10 ? '0' + d : d
var h = date.getHours()
h = h < 10 ? '0' + h : h
var minute = date.getMinutes()
minute = minute < 10 ? '0' + minute : minute
var s = date.getSeconds()
s = s < 10 ? '0' + s : s
return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + s
},
getDetails(){
getDetails({id:this.id,custom: { auth: true }}).then(res=>{
let obj = JSON.parse(JSON.stringify(res.data))
for(let i in obj){
this.$set(this.detaildInfo,i,obj[i])
}
// this.detaildInfo.createtime?this.newDate(this.detaildInfo.createtime):null
// this.detaildInfo.agent_sign_time? this.newDate(this.detaildInfo.agent_sign_time):null
// this.detaildInfo.auditor_sign_time?this.newDate(this.detaildInfo.auditor_sign_time):null
// this.detaildInfo.user_sign_time?this.newDate(this.detaildInfo.user_sign_time):null
// console.log(obj.acceptance_content)
// uni.setStorageSync('acceptance_content',obj.acceptance_content)
})
},
cancelHandle(){
this.show = false
},
confirmHandle(){
unpassHandle({wordorder_id:this.id,content:this.failReason}).then(res=>{
this.getDetails()
this.show = false
})
},
signHandle(){
if(this.userInfo.user_type==2){
uni.navigateTo({
url:'/pages/index/sign?id='+this.id+'&status='+this.detaildInfo.status
})
}else{
uni.navigateTo({
url:'/pages/index/userInformation?id='+this.id+'&isUserSign='+0+'&name='+this.userInfo.username+'&mobile='+this.userInfo.mobile
})
}
},
lookReport(){
let pdfUrl = uni.getStorageSync('pdf')
uni.navigateTo({
url:'/pages/webview/webview?url='+pdfUrl
})
},
shareHandle() {
let that = this
let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
let curRoute = routes[routes.length - 1].$page.fullPath.substr(1) // 获取当前页面路由,也就是最后一个打开的页面路由
console.log(that.baseUrl,curRoute,that.id)
uni.share({
provider: "weixin", //分享服务提供商(即weixin|qq|sinaweibo)
scene: 'WXSceneSession', //场景,可取值参考下面说明。
type: 0, //分享形式
href: `${that.baseUrl}${curRoute}&isShare=true`, //跳转链接
title: "验收记录", //分享内容的标题
// summary: that.storeInfo.storeInfo, //分享内容的摘要
// imageUrl: that.storeInfo.image, //图片地址
success: function(res) {
uni.showToast({
title: '分享成功',
icon: 'none',
duration: 2000
})
},
fail: function(err) {
console.log(err)
uni.showToast({
title: '分享失败',
icon: 'none',
duration: 2000
})
}
});
},
},
onShareAppMessage (res) {
if(res.from==='button'){
return {
title: '验收记录',
path: `/pages/my/sharePage?id=${this.id}&isShare=`+true,
success(res) {
uni.showToast({
title: '分享成功'
})
},
fail(res) {
console.log(res,"iii")
uni.showToast({
title: '分享失败',
icon: 'none'
})
}
}
}
}
}
</script>
<style lang="scss" scoped>
.acceptRecord{
min-height: calc(100vh);
background-color: #F4F5F7;
display: flex;
flex-direction: column;
}
.record{
background: #FFFFFF;
border-radius: 10px;
padding:36rpx 30rpx 44rpx 30rpx;
margin:24rpx;
flex: 1;
position: relative;
.section{
border-bottom: 1px solid #EAEAEA;
.recordItem{
display: flex;
margin-bottom:36rpx;
.left{
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 500;
color: #999999;
width:270rpx;
}
.right{
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 500;
color: #222222;
}
}
}
.status{
padding:18rpx 24rpx;
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 500;
margin-bottom: 120rpx;
border-radius: 10rpx;
}
.nopass{
color: #E72525;
background: #FFF1F2;
}
.btnContent{
position: absolute;
bottom:20rpx;
display: flex;
justify-content: space-between;
width: calc(100% - 60rpx);
}
.btnItem{
line-height: 91rpx;
height: 91px;
text-align: center;
background: #FFFFFF;
border: 1px solid #8EC31F;
border-radius: 10px;
flex:1;
height: auto;
}
.unpass{
font-size: 30rpx;
font-family: PingFang SC;
font-weight: 500;
color: #8EC31F;
}
.pass{
background: #8EC31F;
font-size: 30rpx;
font-family: PingFang SC;
font-weight: 500;
color: #FFFFFF;
margin-left:41rpx;
}
}
.slot-content{
width: 100%;
.title{
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 500;
color: #222222;
text-align: center;
}
/deep/.u-textarea{
margin-top:20rpx;
}
}
</style>