Commit 504efe81 by 前端

Merge branch 'hotfix_SAAS+V4.51.3-0421' into 'SAAS+V4.52.0-0429'

上线合并

See merge request !383
2 parents f20cdaa5 64950607
......@@ -227,5 +227,9 @@ module.exports = {
// 校验订单是否需要上传合同协议
checkZyPayFlag(data) {
return api.post('dj.api.smartcarlife.vehicle.damage.upgrade.quotation.zyPayUrl.check', data)
}
},
// 更新合同协议内容
updateZyInfo(data) {
return api.post('dj.api.smartcarlife.vehicle.damage.upgrade.quotation.zyPayUrl.update', data)
}
}
......@@ -424,7 +424,7 @@
color: #FFFFFF;
background: #347BFF;
border-radius: var(--fontSize32);
padding: 0 var(--fontSize32);
padding: 0 var(--fontSize24);
margin-right: var(--fontSize16);
}
.order-btn:last-child{
......
......@@ -59,7 +59,7 @@ Page({
},
// 合同协议上传确定
zyPayConfirm(e) {
wx.showLoading({title: '加载中'})
wx.showLoading({title: '加载中', mask: true})
let { zyPayOrderInfo, zyConfirmFlag } = this.data
if (zyConfirmFlag) return false
this.setData({
......@@ -204,6 +204,7 @@ Page({
* 生命周期函数--监听页面隐藏
*/
onHide() {
let { timer } = this.data
clearInterval(timer) // 清除定时器
},
......@@ -211,6 +212,7 @@ Page({
* 生命周期函数--监听页面卸载
*/
onUnload() {
let { timer } = this.data
clearInterval(timer) // 清除定时器
},
......
......@@ -13,6 +13,7 @@ Component({
type: Boolean,
observer: function(n) {
if (n) {
let { showZyTarget, updateZyFlag } = this.data
let sysInfo = wx.getSystemInfoSync()
// sysInfo.environment 1 企业微信打开 0微信打开
// sysInfo.platform === 'windows' || sysInfo.platform === 'mac' || sysInfo.platform === 'linux' 是否pc端打开
......@@ -20,12 +21,23 @@ Component({
envName: sysInfo.environment ? 1 : 0,
envPlat: sysInfo.platform === 'windows' || sysInfo.platform === 'mac' || sysInfo.platform === 'linux' ? 1 : 0
})
// 已上传协议 修改协议
if (updateZyFlag && showZyTarget?.zyPayUrl) {
let fileUrl = wx.$util.deepClone(showZyTarget?.zyPayUrl)
let fileList = fileUrl?.split(',')?.map(v => ({url: v, fileName: v?.split('/').pop()}))
this.setData({
fileType: fileUrl?.includes('.pdf') ? 'pdf' : 'image',
fileList: fileList
})
}
}
}
},
isListShow: Boolean, // 是否报价单列表
onlinePaymentFlag: Boolean, // 是否线上支付
supplementaryFlag: Boolean // 是否订单补录
supplementaryFlag: Boolean, // 是否订单补录
showZyTarget: Object,
updateZyFlag: Boolean // 是否修改协议
},
/**
......@@ -107,6 +119,38 @@ Component({
})
},
// 预览pdf文件
previewFile(e) {
let { target } = e.currentTarget.dataset
wx.showLoading({
title: '加载中',
mask: true
})
wx.downloadFile({
url: target?.replace(/^http:/, 'https:'), // 将http文件地址转为https (开发环境文件服务器不支持https无法预览)
success: function (res) {
const manage = wx.getFileSystemManager()
let file = target.split('/')
let fileName = file[file.length - 1]
manage.saveFile({
tempFilePath: res.tempFilePath,
filePath: wx.env.USER_DATA_PATH + '/' + fileName,
success: function (res) {
wx.hideLoading()
wx.openDocument({
filePath: wx.env.USER_DATA_PATH + '/' + fileName,
fileType: 'pdf',
showMenu: true,
success: function (res) {
wx.hideLoading()
}
})
}
})
}
})
},
// 图片预览
previewImage(e) {
let { url, index } = e.currentTarget.dataset
......@@ -118,14 +162,14 @@ Component({
},
async uploadPDFs() {
let { envPlat, envName } = this.data
let { envPlat, envName, updateZyFlag } = this.data
if (envPlat == 1 || envName == 1) { // 企微或在pc端打开登录小程序使用跳转h5上传方式
this.setData({
showChangeFileType: false,
show: false
})
const { zyWebViewUrl } = await wx.$util.getMockData()
let path = `${zyWebViewUrl}/#/zyUpload`
let path = updateZyFlag ? `${zyWebViewUrl}/#/zyUpload?updateZyFlag=true` : `${zyWebViewUrl}/#/zyUpload`
return wx.navigateTo({
url: `/pages/webView/webView?url=${encodeURIComponent(path)}`,
events: {
......@@ -153,6 +197,9 @@ Component({
let tempFile = res.tempFiles[0]
let fileName = tempFile.name // 获取文件名
let fileType = fileName.split('.').pop() // 获取文件扩展名
if (tempFile?.size > 1024 * 1024 * 10) {
return wx.$util.showToast('上传文件需≤10M,请压缩后重传或联系总部')
}
// 读取文件
if (fileType != 'pdf') return wx.$util.showToast('只可上传pdf类型文件')
_this.setData({
......@@ -223,22 +270,42 @@ Component({
},
confirm(e, pageBackNum) {
// pageBackNum 从h5返回页面层级数
let { fileList, isListShow, onlinePaymentFlag, supplementaryFlag } = this.data
let thisPage = wx.$router.getPageInstance(pageBackNum || 1)
let _this = this
let { fileList, updateZyFlag } = _this.data
if (fileList.length) {
// 报价单列表上传协议或者线上支付方式上传协议或者补录订单上传协议
if (isListShow || onlinePaymentFlag || supplementaryFlag) {
this.triggerEvent('confirm', {zyPayUrl: fileList.map(item => item.url)})
} else {
thisPage.setData({
['orderInfo.zyPayUrl']: fileList.map(item => item.url)?.join(','),
confirmStatus: false
if (!pageBackNum && updateZyFlag) {
wx.showModal({
title: '修改确认',
content: '本次操作将永久替换原图或协议(仅限1次修改权限),请确认是否更新?',
confirmText: '确定',
confirmColor: '#347BFF',
success(res) {
if (res.confirm) {
_this.confirmEvent(pageBackNum)
}
}
})
thisPage.handleSecondConfirm()
} else {
_this.confirmEvent(pageBackNum)
}
} else {
wx.$util.showToast('请上传合同协议')
}
},
confirmEvent(pageBackNum) {
let _this = this
let { fileList, isListShow, onlinePaymentFlag, supplementaryFlag } = _this.data
let thisPage = wx.$router.getPageInstance(pageBackNum || 1)
// 报价单列表上传协议或者线上支付方式上传协议或者补录订单上传协议
if (isListShow || onlinePaymentFlag || supplementaryFlag) {
_this.triggerEvent('confirm', {zyPayUrl: fileList.map(item => item.url)})
} else {
thisPage.setData({
['orderInfo.zyPayUrl']: fileList.map(item => item.url)?.join(','),
confirmStatus: false
})
thisPage.handleSecondConfirm()
}
}
}
})
\ No newline at end of file
......@@ -4,11 +4,13 @@
}
.tips-text{
display: flex;
align-items: center;
align-items: flex-start;
padding: var(--fontSize40) 0 var(--fontSize32) 0;
font-size: var(--fontSize28);
color: #222222;
image{
flex-shrink: 0;
margin-top: var(--fontSize2);
width: var(--fontSize32);
height: var(--fontSize32);
margin-right: var(--fontSize12);
......
......@@ -2,17 +2,17 @@
<glsx-privacy appletName="生意助手员工版" bind:agreeClick="agreeClick" bind:disagreeClick="disagreeClick"></glsx-privacy>
<block wx:if="{{!showChangeFileType && !loadingFlag}}">
<popup
title="{{'上传合同协议'}}"
title="{{updateZyFlag ? '修改合同协议' : '上传合同协议'}}"
show="{{show}}"
bindconfirm="confirm"
bindcancel="close"
cancelText="稍后补录"
cancelText="{{updateZyFlag ? '取消' : '稍后补录'}}"
cancelStyle="color: #347BFF;"
notCloseOnClickOverlay="{{true}}"
height="auto">
<view class="content">
<block wx:if="{{!fileList.length}}">
<view class="tips-text"><image src="{{IMG_URL}}zy_tips_icon.png"></image>事系提成核算,务必提供</view>
<view class="tips-text"><image src="{{IMG_URL}}zy_tips_icon.png"></image>上传完毕计入有效成交,订单才可参与提成/清分/积分发放!</view>
<view class="upload_content" bindtap="selectUplaodType">
<image src="{{IMG_URL}}zy-upload_icon.png"></image>
<text class="text">图片或PDF</text>
......@@ -34,7 +34,7 @@
</block>
<block wx:else>
<view class="file_content" wx:for="{{fileList}}" wx:key="index">
<view class="file_box">
<view class="file_box" bindtap="previewFile" data-target="{{item.url}}">
<image class="pdf_icon" src="{{IMG_URL}}zy_upload_pdf.png" mode=""/>
<text class="file_name">{{item.fileName}}</text>
</view>
......
......@@ -265,7 +265,7 @@ Page({
// 补录订单上传合同协议点击确定
zyPayConfirm(e) {
let { supplementaryOrderId, zyConfirmFlag } = this.data // 补录订单id
wx.showLoading({title: '加载中'})
wx.showLoading({title: '加载中', mask: true})
if (zyConfirmFlag) return false
this.setData({
zyConfirmFlag: true
......
......@@ -8,7 +8,8 @@ import {
cancelOrderById,
getQuotationInfoById,
updateCustomerInfo,
errorOrderById
errorOrderById,
updateZyInfo
} from "../../../api";
import { checkDailyReport } from "~/store/ModalToQueueControl";
import data from "../constant/data";
......@@ -482,7 +483,14 @@ Component({
// 校验是否填写昨日日报
let staffCheck = await checkDailyReport(true);
if (staffCheck) return false;
return this.setData({ showZyPayPopup: true, showZyTarget: target })
return this.setData({ showZyPayPopup: true, showZyTarget: target, updateZyFlag: false })
}
// 修改合同协议
if (target?.zyPayStatus == '2' && target?.canUpdateZyPayUrl == 1 && type == 'upload') {
// 校验是否填写昨日日报
let staffCheck = await checkDailyReport(true);
if (staffCheck) return false;
return this.setData({ showZyPayPopup: true, showZyTarget: target, updateZyFlag: true })
}
// wx.$router.go('createOrderCarQuotation', {
// id: target.id
......@@ -589,43 +597,73 @@ Component({
},
// 合同协议上传确定
zyPayConfirm(e) {
let { showZyTarget, zyConfirmFlag } = this.data
wx.showLoading({title: '加载中'})
let { showZyTarget, zyConfirmFlag, updateZyFlag } = this.data
wx.showLoading({title: '加载中', mask: true})
if (zyConfirmFlag) return false
this.setData({
zyConfirmFlag: true
});
getQuotationInfoById({
id: showZyTarget?.id
}).then(res => {
let { code, message, data } = res
if (code == 0) {
let orderInfo = this.getInsurance(data)
// 更新客户信息
updateCustomerInfo({ ...orderInfo, zyPayUrl: e.detail?.zyPayUrl?.join(',') }).then(result => {
wx.hideLoading()
if (updateZyFlag) { // 更新合同协议
updateZyInfo({ id: showZyTarget?.id, zyPayUrl: e.detail?.zyPayUrl?.join(',') }).then(res => {
wx.hideLoading()
let { code, message } = res
if (code == 0) {
this.setData({
showZyPayPopup: false
}, () => {
this.setData({
zyConfirmFlag: false
});
zyConfirmFlag: false,
updateZyFlag: false
})
this.search()
})
})
} else {
wx.$util.showToast(message)
} else {
this.setData({
showZyPayPopup: false
}, () => {
wx.$util.showToast(message)
})
}
}).catch(() => {
wx.hideLoading()
this.setData({
zyConfirmFlag: false,
updateZyFlag: false
})
})
} else {
getQuotationInfoById({
id: showZyTarget?.id
}).then(res => {
let { code, message, data } = res
if (code == 0) {
let orderInfo = this.getInsurance(data)
// 更新客户信息
updateCustomerInfo({ ...orderInfo, zyPayUrl: e.detail?.zyPayUrl?.join(',') }).then(result => {
wx.hideLoading()
this.setData({
showZyPayPopup: false
}, () => {
this.setData({
zyConfirmFlag: false
});
this.search()
})
})
} else {
wx.$util.showToast(message)
wx.hideLoading()
this.setData({
zyConfirmFlag: false
})
}
}).catch(() => {
this.setData({
zyConfirmFlag: false
})
}
}).catch(() => {
this.setData({
zyConfirmFlag: false
wx.hideLoading()
})
wx.hideLoading()
})
}
},
remarkCancel() {
this.setData({
......
......@@ -163,6 +163,9 @@
</block>
<block wx:else>
<view wx:if="{{ item.orderStatus != '4' && item.orderStatus!=11&& item.orderStatus!=9 }}" class="btn_class">
<block wx:if="{{ item.canUpdateZyPayUrl == 1 && item.zyPayStatus == 2 }}">
<view class="order-btn default-btn padding_20" bindtap="handleClickBtn" data-type="upload" data-target="{{ item }}">修改协议</view>
</block>
<block wx:if="{{ item.orderStatus != '0' }}">
<view class="order-btn default-btn padding_20" bindtap="jumpReception" data-item="{{ item }}">接待记录</view>
</block>
......@@ -281,4 +284,4 @@
</view>
</view>
</view>
<zy-pay-popup wx:if="{{showZyPayPopup}}" isListShow="{{true}}" show="{{showZyPayPopup}}" bindconfirm="zyPayConfirm"></zy-pay-popup>
\ No newline at end of file
<zy-pay-popup wx:if="{{showZyPayPopup}}" showZyTarget="{{showZyTarget}}" updateZyFlag="{{updateZyFlag}}" isListShow="{{true}}" show="{{showZyPayPopup}}" bindconfirm="zyPayConfirm"></zy-pay-popup>
\ No newline at end of file
......@@ -516,7 +516,7 @@
.btn_class {
display: flex;
gap: var(--fontSize20);
gap: var(--fontSize16);
margin-left: auto;
}
......@@ -530,7 +530,7 @@
color: #FFFFFF;
background: #347BFF;
border-radius: var(--fontSize32);
padding: var(--fontSize8) var(--fontSize40);
padding: var(--fontSize8) var(--fontSize20);
flex-shrink: 0;
}
......@@ -542,7 +542,7 @@
}
.padding_20 {
padding: 0 var(--fontSize20);
padding: 0 var(--fontSize14);
}
.list .item .order {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!