Commit 59bf190c by zhangxw

门店收款 多凭证交易流水号需求开发

1 parent da3c2141
......@@ -98,7 +98,8 @@
"gl-image": "components/GlImage/index",
"van-field": "@vant/weapp/field/index",
"van-popup": "@vant/weapp/popup/index",
"van-dialog": "@vant/weapp/dialog/index"
"van-dialog": "@vant/weapp/dialog/index",
"van-uploader": "@vant/weapp/uploader/index"
},
"preloadRule": {
"pages/tabWorkOrder/pages/index/index": {
......
......@@ -5,6 +5,9 @@ Component({
/**
* 组件的属性列表
*/
options: {
styleIsolation: 'shared', // 自定义覆盖vant样式
},
properties: {
show: Boolean,
orderType: {
......@@ -62,8 +65,8 @@ Component({
textareaValue: '',
routerBack: null,
outTradeNo: '',
payVoucher: '',
wxqrcode: ''
wxqrcode: '',
payVoucherList: []
},
/** 组件生命周期 */
......@@ -137,45 +140,54 @@ Component({
},
input(e) {
let { value } = e.detail
let val = value.replace(/[^a-zA-Z0-9]/g, '')
let val = value.replace(/[^\a-\z\A-\Z0-9\.\,\?\<\>\。\,\-\——\=\;\;\/\'\"\’\‘\?\“\”\@\!\!\+\$]/g, '')
this.setData({
outTradeNo: val
})
},
upLoad() {
// 上传付款凭证
upLoad(event) {
let _this = this
wx.chooseImage({
count: 1,
success(res) {
let [tempFiles] = res.tempFilePaths
let imgType = tempFiles.split('.')[1]
let type = imgType == 'unknown' ? 'jpg' : imgType
wx.getFileSystemManager().readFile({
filePath: tempFiles, //选择图片返回的相对路径
encoding: 'base64', //编码格式
success(_res) {
wx.$util.showLoading('上传中...')
api
.uploadImg({
file: `${type}@${_res.data}`
})
.then(img => {
wx.$util.hideLoading()
console.log(img)
let { code, data, message } = img
if (code == 0) {
_this.setData({
payVoucher: data
})
} else {
wx.$util.showToast(message)
}
let { payVoucherList } = _this.data
const { file } = event.detail
let tempFiles = file?.url
let imgType = tempFiles.split('.')[1]
let type = imgType == 'unknown' ? 'jpg' : imgType
wx.getFileSystemManager().readFile({
filePath: tempFiles, //选择图片返回的相对路径
encoding: 'base64', //编码格式
success(_res) {
wx.$util.showLoading('上传中...')
api
.uploadImg({
file: `${type}@${_res.data}`
})
.then(img => {
wx.$util.hideLoading()
console.log(img)
let { code, data, message } = img
if (code == 0) {
payVoucherList.push({url: data})
_this.setData({
payVoucherList
})
}
})
} else {
wx.$util.showToast(message)
}
})
}
})
},
// 删除上传
deletePayVoucher(e) {
let { index } = e?.detail
let _this = this
let { payVoucherList } = _this.data
payVoucherList.splice(index, 1)
this.setData({
payVoucherList
})
},
changeOrderSource(e) {
console.log(e)
let { index } = e.currentTarget.dataset
......@@ -187,20 +199,19 @@ Component({
})
},
confirm(e) {
let { orderType, outTradeNo, payVoucher, textareaValue, orderTypeList } = this.data
let { orderType, outTradeNo, payVoucherList, textareaValue, orderTypeList } = this.data
// debugger
console.log(wx.$router)
let thisPage = wx.$router.getPageInstance()
if (orderType == 2) {
console.log(payVoucher, outTradeNo)
if (payVoucher && outTradeNo) {
if (payVoucherList.length && outTradeNo) {
thisPage.setData({
outTradeNo,
payVoucher
payVoucherList
})
thisPage.createPayOrder()
} else {
wx.$util.showToast('订单号或付款凭证不能为空!')
wx.$util.showToast('交易流水号或付款凭证不能为空!')
}
} else if (orderType == 0) {
if (textareaValue) {
......
<view class="order-popup" wx:if="{{show}}" catchtouchmove="noScroll">
<view class="order-popup-bg" bindtap="close" />
<view class="order-popup-content">
<view class="title" wx:if="{{orderType == 2}}">上传付款凭证</view>
<view class="order-popup-close" bindtap="close">
<image src="../images/order-close.png" />
</view>
<!-- 4s店 开始 -->
<block wx:if="{{orderType == 2}}">
<view class="title">上传付款凭证</view>
<view class="input-item">
交易流水号
<view class="input-box">
<input
type="text"
class="input"
bindinput="input"
value="{{outTradeNo}}"
maxlength="32" />
placeholder="输入交易流水号"
placeholder-class="outTradeNo_placeholder"
maxlength="100" />
</view>
</view>
<view class="camera-box" bindtap="upLoad">
<block wx:if="{{payVoucher}}">
<image src="{{payVoucher}}" />
</block>
<block wx:else>
<view class="camera-icon">
<image src="../images/order-camera.png" />
</view>
</block>
</view>
<view class="upload-content">
<view class="title-text">上传图片</view>
<view class="upload-box">
<van-uploader
file-list="{{ payVoucherList }}"
max-count="9"
deletable
preview-size="160rpx"
bind:after-read="upLoad"
bind:delete="deletePayVoucher"
>
</van-uploader>
</view>
</view>
<view class="btn" bindtap="confirm">确定</view>
</block>
<!-- 4s店 end -->
......
......@@ -40,7 +40,7 @@
position: absolute;
left: 50%;
top: 50%;
width: 82.9%;
width: calc(100% - 128rpx);
background: #FFFFFF;
box-shadow: 0 4rpx 20rpx 0 rgba(0, 0, 0, 0.10);
border-radius: 16rpx;
......@@ -70,10 +70,10 @@
}
.order-popup-content .title {
padding: 70rpx 0 32rpx;
padding: 26rpx 0 32rpx;
font-size: 32rpx;
color: #333333;
font-weight: 700;
font-weight: 600;
text-align: center;
}
......@@ -121,18 +121,18 @@
.order-popup-content .input-item {
display: flex;
padding: 0 50rpx;
align-items: center;
font-size: 24rpx;
color: #333333;
justify-content: space-between;
padding: 0 48rpx;
}
.order-popup-content .input-box {
width: 370rpx;
height: 60rpx;
border: 2rpx solid #C3C3C3;
width: 100%;
height: 64rpx;
border: 2rpx solid #EFF0F2;
border-radius: 8rpx;
background: #F4F5F7;
box-sizing: border-box;
padding: 0 20rpx;
display: flex;
......@@ -144,6 +144,62 @@
height: 100%;
}
.order-popup-content .input-box .input .outTradeNo_placeholder{
color: #B6B6B8;
font-size: 24rpx;
}
.order-popup-content .upload-content{
display: flex;
flex-flow: column;
padding: 24rpx 48rpx;
}
.order-popup-content .upload-content .title-text{
font-weight: 500;
font-size: 28rpx;
color: #282829;
margin-bottom: 18rpx;
}
.van-uploader .van-uploader__wrapper {
display: flex;
flex-wrap: wrap;
gap: 22rpx;
}
.van-uploader .van-uploader__wrapper .van-uploader__upload{
order: -1;
}
.van-uploader .van-uploader__wrapper .van-uploader__preview,.van-uploader__upload{
margin: 0;
border-radius: 8rpx;
/* width: 160rpx !important;
height: 160rpx !important; */
position: relative;
}
.van-uploader .van-uploader__wrapper .van-uploader__preview image{
border-radius: 8rpx;
/* width: 160rpx !important;
height: 160rpx !important; */
}
.van-uploader .van-uploader__wrapper .van-uploader__preview .van-uploader__preview-delete{
width: 36rpx;
height: 36rpx;
background-color: rgba(0, 0, 0, 1);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
position: absolute;
top: -8rpx;
right: -8rpx;
}
.van-uploader .van-uploader__wrapper .van-uploader__preview .van-uploader__preview-delete .van-uploader__preview-delete-icon{
font-size: 36rpx;
transform: scale(.7);
}
.van-uploader .van-uploader__wrapper .van-uploader__preview .van-uploader__preview-delete::after{
width: 0;
}
.order-popup-content .camera-box {
margin: 30rpx auto 40rpx;
width: 522rpx;
......
......@@ -129,6 +129,12 @@ class Router {
query
}
}
/**跳转至H5 */
jumpH5(url) {
wx.navigateTo({
url: `/pages/webView/webView?url=${encodeURIComponent(url)}`
})
}
/**页面跳转
*
*/
......
......@@ -12,8 +12,9 @@ export default {
recordId:29
},
{
name: '商品排行',
url: ''
name: '趋势分析',
url: 'http://baidu.com',
isH5: true
},
{
name: '员工排名',
......@@ -55,8 +56,13 @@ export default {
icon: 'none'
})
} else {
if (item.isH5) {
wx.$router.jumpH5(item.url)
} else {
wx.$router.go(item.url)
}
console.log(item.url)
wx.$router.go(item.url)
item.recordId&&wx.$util.pointRecord(item.recordId)
}
// 暂未上线,敬请期待
......
......@@ -138,14 +138,14 @@ Page({
let {
orderInfo: { selectPayType, orderCode },
outTradeNo,
payVoucher
payVoucherList
} = this.data
let obj = {
orderCode,
payType: selectPayType
}
if (payVoucher && outTradeNo) {
obj.payVoucher = payVoucher
if (payVoucherList && outTradeNo) {
obj.payVoucherList = payVoucherList.map(v => {return v?.url})
obj.outTradeNo = outTradeNo
}
wx.$util.showLoading()
......
......@@ -198,7 +198,7 @@
orderType="{{orderInfo.selectPayType }}"
wx:if="{{showPopup}}"
show="{{showPopup}}"
qrCode="{{orderInfo.payOrder.outTradeNo}}"
qrCode="{{orderInfo.payOrder.outTradeNo || ''}}"
price="{{orderInfo.total_price}}"
orderCode="{{orderInfo.orderCode}}" />
<artificer-select-popup
......
......@@ -423,11 +423,11 @@ Page({
},
previewImage(e) {
let { url } = e.currentTarget.dataset
let { url, index } = e.currentTarget.dataset
console.log(url)
wx.previewImage({
urls: [url],
current: url
urls: url,
current: url[index]
})
},
/**
......
......@@ -100,11 +100,13 @@
<block wx:if="{{orderInfo.selectPayType == 2}}">
<view class="cell">
<view class="label">付款凭证:</view>
<view class="value" bindtap="previewImage" data-url="{{orderInfo.payOrder.payVoucher}}">
<view class="image">
<image src="{{orderInfo.payOrder.payVoucher}}" />
</view>
</view>
<view class="image-box">
<view class="value" bindtap="previewImage" wx:for="{{orderInfo.payVoucherList}}" wx:key="index" data-index="{{index}}" data-url="{{orderInfo.payVoucherList}}">
<view class="image">
<image src="{{item}}" />
</view>
</view>
</view>
</view>
</block>
<view class="paid" wx:if="{{orderInfo.payOrder&&orderInfo.payOrder.payStatus == 2}}">
......
......@@ -211,6 +211,12 @@ page {
width: 180rpx;
}
.box .cell .image-box{
display: flex;
flex-flow: wrap;
gap: 10rpx;
}
.box .cell .value {
color: #333333;
max-width: 370rpx;
......@@ -219,8 +225,8 @@ page {
}
.box .cell .value .image {
width: 150rpx;
height: 150rpx;
width: 140rpx;
height: 140rpx;
}
.customer.box .cell .value {
......
......@@ -363,12 +363,12 @@ Page({
},
previewImage(e) {
let { url } = e.currentTarget.dataset
let { url, index } = e.currentTarget.dataset
// if (url.includes('http')) {
wx.previewImage({
urls: [url],
current: url
urls: url,
current: url[index]
})
},
/**
......
......@@ -82,11 +82,13 @@
<block wx:if="{{orderInfo.selectPayType == 2}}">
<view class="cell">
<view class="label">付款凭证:</view>
<view class="value" bindtap="previewImage" data-url="{{orderInfo.payOrder.payVoucher}}">
<view class="image">
<image src="{{orderInfo.payOrder.payVoucher}}" />
</view>
</view>
<view class="image-box">
<view class="value" bindtap="previewImage" wx:for="{{orderInfo.payVoucherList}}" wx:key="index" data-index="{{index}}" data-url="{{orderInfo.payVoucherList}}">
<view class="image">
<image src="{{item}}" />
</view>
</view>
</view>
</view>
</block>
<view class="paid" wx:if="{{orderInfo.payOrder&&orderInfo.payOrder.payStatus == 2}}">
......
......@@ -118,6 +118,12 @@ page {
width: 180rpx;
}
.box .cell .image-box{
display: flex;
flex-flow: wrap;
gap: 10rpx;
}
.box .cell .value {
color: #333333;
max-width: 370rpx;
......@@ -126,8 +132,8 @@ page {
}
.box .cell .value .image {
width: 150rpx;
height: 150rpx;
width: 140rpx;
height: 140rpx;
}
.customer.box .cell .value {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!