Commit 0d04cd01 by cen

feat: 新增pos机支付弹窗

1 parent 8f4a7cf2
......@@ -3,7 +3,7 @@
<page-meta :page-style="'overflow:' + (show ? 'hidden' : 'visible')"></page-meta>
<uni-popup :class="popupClass" ref="publishPopup" :type="type" @change="change" :is-mask-click="isMaskClick" :safe-area="safeArea" :showClose="showClose">
<!-- 顶部标题栏插槽 -->
<slot name="header" ></slot>
<slot name="header">
<view class="popup-top-box flex align-center" v-if="showTitle">
<text class="popup-top-box-title">{{ title }}</text>
<uni-icons @click="closePopup" class="icon-close" type="closeempty"></uni-icons>
......@@ -13,10 +13,10 @@
<slot name="content"></slot>
<!-- 底部插槽 插槽有内容就优先自定义内容-->
<slot name="footer">
<view class="footer-box flex justify-center">
<view class="cancle-btn btn" @click.stop="closePopup">取消</view>
<view class="sure-btn btn" @click.stop="confirm">确认</view>
</view>
<view class="footer-box flex justify-center" v-if="isShowFooter">
<view class="cancle-btn btn" @click.stop="closePopup">{{ cancelText }}</view>
<view class="sure-btn btn" @click.stop="confirm">{{ confirmText }}</view>
</view>
</slot>
</uni-popup>
</template>
......@@ -49,11 +49,22 @@ export default {
type: String,
default: ''
},
showTitle:{
showTitle: {
type: Boolean,
default: true
},
isShowFooter: {
type: Boolean,
default: true
},
cancelText: {
type: String,
default: '取消'
},
confirmText: {
type: String,
default: '确定'
}
},
data() {
return {
......@@ -83,7 +94,7 @@ export default {
font-size: toRpx(36);
font-weight: 500;
text-align: center;
padding: toRpx(32);
.popup-top-box-title {
flex: 1;
}
......@@ -106,30 +117,30 @@ export default {
font-weight: 600;
}
.footer-box {
width: 100%;
height: toRpx(164);
background-color: #fff;
position: absolute;
border-radius: 0 0 toRpx(42) toRpx(42);
bottom: 0;
.btn {
width: 40%;
height: toRpx(80);
border-radius: toRpx(48);
opacity: 1;
line-height: toRpx(80);
text-align: center;
color: rgba(26, 26, 26, 0.6);
font-size: toRpx(32);
font-weight: 500;
}
.cancle-btn {
background: #f0f1f5;
}
.sure-btn {
color: #fff;
background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
margin-left: toRpx(32);
}
width: 100%;
height: toRpx(164);
background-color: #fff;
position: absolute;
border-radius: 0 0 toRpx(42) toRpx(42);
bottom: 0;
.btn {
width: 40%;
height: toRpx(80);
border-radius: toRpx(48);
opacity: 1;
line-height: toRpx(80);
text-align: center;
color: rgba(26, 26, 26, 0.6);
font-size: toRpx(32);
font-weight: 500;
}
.cancle-btn {
background: #f0f1f5;
}
.sure-btn {
color: #fff;
background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
margin-left: toRpx(32);
}
}
</style>
......@@ -32,7 +32,7 @@
</view>
<view v-if="orderCardDetail.subOrderList.length > 2" class="goods-more">
<text @click="showAllGoodsList">
<text @click.stop="showAllGoodsList">
{{ orderCardDetail.showAllGoodsListFlag ? '收起' : '查看全部' }}
</text>
(共{{ orderCardDetail.subOrderList.length }}件)
......@@ -219,13 +219,13 @@ export default {
if (name == 'CreateOrder' && (await this.inspectionOfProhibitionBill())) return /**禁止提单 */
// 是微信支付直接跳转确认页面
if (userType == 2 && item?.selectPayType == 1) {
this.$emit('jump', 'ConfirmOrder')
this.$emit('jump', 'ConfirmOrder', this.orderCardDetail)
} else if (userType == 2) {
item
? this.showSelectType({
item
})
: this.$emit('jump', name)
: this.$emit('jump', name, this.orderCardDetail)
} else {
utils.showNoAccess()
}
......@@ -234,10 +234,9 @@ export default {
}
// 已支付加已施工
} else if (item.constructionFlag == 'Y' && item.status != 10) {
// wx.$router.go('tabWorkOrder.constructionOrderDetail', item)
// this.$emit('jump', name, item)
this.$emit('jump', name, this.orderCardDetail)
} else {
this.$emit('jump', name)
this.$emit('jump', name, this.orderCardDetail)
}
},
// 确定是否要显示
......
<template>
<view class="order-confirm">
<view class="common-title">工单确认</view>
<view class="px-48 scroll-y">
<view class="top-tips flex align-center">
<text class="fs-16 fw-7">等待客户付款</text>
<text class="fs-13 ml-12">点击下一步,锁定并生成工单码。</text>
<view class="px-48 scroll-y" v-if="orderInfo">
<view class="top-tips flex align-center" v-if="orderInfo.selectPayType == 3 || orderInfo.selectPayType == 1">
<text class="fs-32 fw-7">等待客户付款</text>
<text class="fs-26 ml-12">点击下一步,锁定并生成工单码。</text>
</view>
<view class="top-tips flex align-center" v-if="orderInfo.selectPayType == 2 || orderInfo.selectPayType == 5 || orderInfo.selectPayType == 6 || orderInfo.selectPayType == 7">
<view class="fs-32 fw-7">请上传付款凭证结束工单</view>
<view class="fs-26 ml-12">点击确认工单,提交付款凭证。</view>
</view>
<view class="top-tips flex align-center" v-if="orderInfo.selectPayType == 0 || orderInfo.selectPayType == null">
<view class="fs-32 fw-7">请提交客户拒绝升级原因</view>
<view class="fs-26 ml-12">点击确认工单,根据操作结束工单。</view>
</view>
<view v-if="!isErrorOrder && (orderInfo.selectPayType == 2 || orderInfo.selectPayType == 5 || orderInfo.selectPayType == 6 || orderInfo.selectPayType == 7)" class="box date-box box-shell flex justify-between align-center">
<view class="date-box-label">
......@@ -13,7 +21,7 @@
</view>
<view class="flex justify-between align-center">
<view class="date-box-value">{{ successDate }}</view>
<view class="handlerBtn" @click="toshowDateModal">编辑</view>
<view class="handlerBtn" @click="openDate">编辑</view>
</view>
</view>
<!-- 商品信息 -->
......@@ -68,6 +76,8 @@
<view v-if="item.copy" class="copy-btn" @click="setCopyData(orderInfo[item.key])">
<view class="sprite-icon icon-icon-copy copy"></view>
</view>
<view class="customize-btn" v-if="item.dateChange" @click.stop="customizeDate">自定义</view>
</view>
<view v-if="(orderInfo.selectPayType == 2 || orderInfo.selectPayType == 5 || orderInfo.selectPayType == 6 || orderInfo.selectPayType == 7) && orderInfo.payVoucherList.length">
<view class="flex align-center pt-8">
......@@ -146,11 +156,35 @@
</view>
</template>
</PublishPopup>
<OrderPopup :orderType="orderInfo.selectPayType" v-if="showPopup" :show="showPopup" :qrCode="orderInfo.payOrder.outTradeNo || ''" :price="orderInfo.total_price" :orderCode="orderInfo.orderCode" />
<PublishPopup ref="calendarPopup" popupClass="calendarPopup" :showClose="false" :showTitle="false" @confirm="confirmCalendar">
<template #content>
<uni-calendar class="calendar" :showMonth="false" @change="calendarChange" />
</template>
</PublishPopup>
<!-- <OrderPopup :orderType="orderInfo.selectPayType" v-if="showPopup" :show="showPopup" :qrCode="orderInfo.payOrder.outTradeNo || ''" :price="orderInfo.total_price" :orderCode="orderInfo.orderCode" /> -->
<PublishPopup ref="payPopup" popupClass="payPopup" type="center" :isShowFooter="false">
<template #header>
<view class="popup-top">
<view class="popup-top-box flex align-center">
<text class="popup-top-box-title">工单确认码</text>
<uni-icons @click="closePopup" class="icon-close" type="closeempty"></uni-icons>
</view>
</view>
</template>
<template #content>
<view class="pos-popup">
<view class="price">¥{{ orderInfo.total_price }}</view>
<image class="qrcode" :src="orderInfo.selectPayType == 1 ? wxqrcode : posQrCode"></image>
<view class="level-1-tips">{{ orderInfo.selectPayType == 1 ? '请让客户打开微信扫描上方付款码进行支付' : '请使用POS机扫描此码,再向客户收款' }}</view>
<view class="level-2-tips">超过24小时未支付将关闭此订单</view>
</view>
</template>
</PublishPopup>
</view>
</template>
<script>
import utils from '@/utils/utils'
import qrcode from '@/utils/qrcode'
import order_mixins from '../../order_mixins.js'
import dayjs from 'dayjs'
import PublishPopup from '@/components/PublishPopup.vue'
......@@ -164,20 +198,26 @@ export default {
}
},
components: {
PublishPopup
PublishPopup,
OrderPopup
},
data() {
return {
...order_mixins.data,
positionTypeList: [],
isErrorOrder: false,
orderInfo: {}
orderInfo: null,
successDate: null,
selectDate: null,
time: null,
wxqrcode: '',
posQrCode: ''
}
},
mounted() {
this.getPositionList()
// 250819144103724
this.getDetail('250818205800944')
this.getDetail('250819144103724')
this.successDate = dayjs().format('YYYY-MM-DD HH:mm:ss')
},
methods: {
......@@ -194,7 +234,7 @@ export default {
})
.then(data => {
if (data.payOrder && data.payOrder.payStatus == 2) {
if (time) clearInterval(time)
if (this.time) clearInterval(this.time)
// wx.$router.redirectTo('orderDetail', {
// orderCode
// })
......@@ -315,10 +355,8 @@ export default {
})
if (res.code == 0) {
this.setData({
packageGoodsList: res.data.packageGoodsList,
'orderInfo.total_price': Number(utils.decimal(total_price, 2)).toFixed(2)
})
this.packageGoodsList = res.data.packageGoodsList
this.orderInfo.total_price = Number(utils.decimal(total_price, 2)).toFixed(2)
}
})
} catch (err) {}
......@@ -336,17 +374,73 @@ export default {
edit() {
this.$emit('jump', 'CreateOrder', this.orderInfo)
},
confirmDate(date) {
const { chooseContent } = date
this.successDate = dayjs(chooseContent).format('YYYY-MM-DD HH:mm:ss')
console.log(this.successDate)
},
calendarChange(date) {
console.log(date)
this.selectDate = date.year + '-' + date.month + '-' + date.date
},
confirmCalendar() {
this.rangeSelect(this.selectDate)
},
checkPayType() {
// 生成小程序码
createWxQrcode() {
let _this = this
let oParams = {}
let { sessionId } = uni.$storage.get()
oParams.appId = 'wx06d1198e751435d1'
oParams.qrcodeType = 'QR_WXA_UNLIMIT'
oParams.path = 'packagesPayment/pages/payment/index'
// oParams.path = 'packagesPayment/pages/QRPayment/QRPayment'
// oParams.scene = `merchantId=111`
oParams.scene = `orderCode=${_this.orderCode}&workWxSessionId=${sessionId}`
oParams.channelType = 1
// B端小程序调用接口生成领券码时,传参userId用uuid,类型由int变string
uni.$api.boutiqueApi.createQrcodeImage(oParams).then(data => {
_this.wxqrcode = data
})
},
// 修改订单时间
rangeSelect(date) {
let { orderInfo } = this
let params = {
orderCode: orderInfo.orderCode,
orderTime: date + ' 00:00:00'
}
uni.$api.boutiqueApi
.updateOrderTime(params)
.then(result => {
if (result) {
uni.showToast({ title: '修改日期成功' })
this.orderInfo.time = params.orderTime
} else {
uni.showToast({ title: '修改日期失败' })
}
})
.catch(err => {
console.log(err)
})
this.$refs.calendarPopup.closePopup()
},
closePopup() {
this.$refs.payPopup.closePopup()
},
async checkPayType() {
console.log(this.orderInfo.selectPayType, 'this.orderInfo.selectPayType')
let _this = this
// 微信支付
if (this.orderInfo.selectPayType == 1) {
// _this.setData({
// showPopup: true,
// });
await this.createWxQrcode()
this.$refs.payPopup.open()
_this.getDetail(this.orderInfo.orderCode)
if (!time) {
time = setInterval(() => {
if (!this.time) {
this.time = setInterval(() => {
_this.getDetail(_this.orderInfo.orderCode)
}, 5 * 1000)
}
......@@ -361,14 +455,20 @@ export default {
_this.createPayOrder()
}
} else {
console.log('支付完成')
if (!this.successDate && !this.isErrorOrder && this.orderInfo.selectPayType != 0) return uni.showToast({ title: this.orderInfo.selectPayType == 2 ? '请选择4S店收款时间' : '请选择嘀加收款时间' })
this.showPopup = true
this.$emit('jump', 'UploadProofOfPayment', { orderCode: this.orderInfo.orderCode, payType: this.orderInfo.selectPayType, payeeType: this.orderInfo.payeeType })
}
},
confirmTips() {
this.createPayOrder()
},
openDate() {
this.$refs.test.open()
},
customizeDate() {
console.log(this.$refs.calendarPopup, 'this.$refs.calendarPopup')
this.$refs.calendarPopup.open()
},
createPayOrder() {
let {
orderInfo: { selectPayType, orderCode, payeeType },
......@@ -396,29 +496,38 @@ export default {
uni.showLoading()
// 状态更新 需刷新工单列表和预约管理列表
utils.refreshPageData()
uni.$api.boutiqueApi.createPayOrder(obj).then(res => {
console.log(res)
let { code, data, message } = res
if (code == 0) {
wx.hideLoading()
uni.$api.boutiqueApi.createPayOrder(obj).then(data => {
if (data) {
console.log(`类型为:${selectPayType}`)
if (selectPayType == 3 || selectPayType == 1) {
this.setData({
['orderInfo.payOrder.outTradeNo']: data.outTradeNo,
showPopup: true
this.orderInfo.payOrder.outTradeNo = data.outTradeNo
let size = 0
try {
const info = uni.getSystemInfoSync()
let scale = info.windowWidth / 750 //不同屏幕下QRcode的适配比例;设计稿是750宽
let width = 300 * scale
size = width
} catch (e) {
size = 150
}
this.posQrCode = qrcode.createQrCodeImg(data.outTradeNo, {
size: parseInt(size)
})
uni.hideLoading()
console.log(this.posQrCode)
this.$refs.payPopup.open()
this.getDetail(orderCode)
if (!time) {
time = setInterval(() => {
if (!this.time) {
this.time = setInterval(() => {
// console.log('6666666666')
this.getDetail(orderCode)
}, 5 * 1000)
}
} else {
wx.$router.redirectTo('orderDetail', data)
this.$emit('jump', 'OrderDetail', data)
}
} else {
wx.$util.showToast(message)
uni.showToast({ title: message, icon: null })
}
})
}
......@@ -455,9 +564,73 @@ export default {
}
}
}
::v-deep .calendarPopup .uni-popup__wrapper {
width: 100%;
height: 62vh;
.calendar {
width: 100%;
height: calc(100% - #{toRpx(164)});
}
}
::v-deep .payPopup .uni-popup__wrapper {
width: 60%;
border-radius: toRpx(48);
background: #ffffff !important;
.popup-top {
border-radius: toRpx(48) toRpx(48) 0 0;
background: url('@/assets/images/boutique/payTipsBc.png') no-repeat;
background-size: 100% 100%;
margin-bottom: toRpx(16);
.popup-top-box {
color: #333333;
font-size: toRpx(36);
font-weight: 500;
text-align: center;
padding: toRpx(32);
.popup-top-box-title {
flex: 1;
}
.icon-close {
text-align: end;
}
}
}
.pos-popup {
text-align: center;
box-shadow: 0 toRpx(12) toRpx(24) 0 #2c66f726;
width: 90%;
border-radius: toRpx(48);
background: #ffffff;
margin: 0 auto toRpx(63) auto;
padding: toRpx(63) 0;
.qrcode {
width: toRpx(320);
height: toRpx(320);
margin-bottom: toRpx(32);
}
.price {
color: #4673ff;
font-size: toRpx(56);
font-weight: 700;
margin-bottom: toRpx(32);
}
.level-1-tips {
color: #1a1a1a;
font-size: toRpx(40);
font-weight: 500;
margin-bottom: toRpx(16);
}
.level-2-tips {
color: #808291;
font-size: toRpx(32);
font-weight: 400;
}
}
}
.order-confirm {
position: relative;
height: 100%;
.scroll-y {
height: calc(100% - #{toRpx(296)});
overflow-y: scroll;
......@@ -485,8 +658,11 @@ export default {
.fs-14 {
font-size: toRpx(14);
}
.fs-16 {
font-size: toRpx(16);
.fs-32 {
font-size: toRpx(32);
}
.fs-26 {
font-size: toRpx(26);
}
.fw-7 {
font-weight: 700;
......@@ -528,6 +704,12 @@ export default {
font-weight: 400;
margin-left: toRpx(8);
}
.customize-btn {
color: #4673ff;
font-size: toRpx(26);
font-weight: 400;
margin-left: toRpx(16);
}
.copy-btn {
display: flex;
align-items: center;
......@@ -539,12 +721,12 @@ export default {
}
.top-tips {
width: 100%;
height: toRpx(48);
border-radius: toRpx(8);
height: toRpx(86);
border-radius: toRpx(16);
background: linear-gradient(-90deg, #61c0ff 0%, #2c66f7 100%);
box-shadow: inset 0 0 toRpx(20) 0 #ffffff99;
color: #fff;
padding: 0 toRpx(16);
padding: 0 toRpx(32);
}
.box-shell {
width: 100%;
......
<template>
<view class="order-detail">
<view class="common-title">工单详情</view>
<view class="px-48 scroll-y" v-if="orderInfo">
<view class="top-tips flex align-center" v-if="orderInfo.status != 10 && orderInfo.status != 9">
<uni-icons class="checkbox-filled" type="checkbox-filled" color="#4ac18e"></uni-icons>
<view>
<view class="fs-34 fw-5">客户已付款</view>
<view class="fs-26">技师施工完毕后,点击完成施工按钮可通知车主前来取车</view>
</view>
<view class="sprite-icon icon-topTipsRightIcon topTipsRightIcon"></view>
</view>
<view class="top-tips flex align-center" v-if="orderInfo.status == 10">
<view class="fs-34 fw-7">订单关闭</view>
<view class="fs-26 ml-12">客户支付超过24小时,系统自动关闭订单</view>
</view>
<view class="top-tips flex align-center" v-if="orderInfo.status == 9">
<view class="fs-34 fw-7">订单已撤销</view>
<!-- <view class="tips">客户支付超过24小时,系统自动关闭订单</view> -->
</view>
<!-- 商品信息 -->
<view class="box-shell">
<view class="box-shell-title">商品信息</view>
<view class="good-list">
<view class="good" v-for="(item, index) in orderInfo.subOrderList" :key="index">
<view class="flex justify-between align-center">
<text class="good-name">商品名称:{{ replaceItemText(item.upgradeGoodsName) || '' }}</text>
<text class="good-price">¥{{ item.price }}</text>
</view>
<view class="flex justify-between align-center pt-6">
<text class="good-alias">商品别名:{{ replaceItemText(item.upgradeGoodsAlias) || '' }}</text>
</view>
<view class="flex align-center pt-12">
<text class="good-sku">{{ item.positionStr || item.upgradeGoodsTypeName }}</text>
<text class="good-count">x{{ item.number }}</text>
</view>
</view>
</view>
<view class="flex align-center py-8">
<view class="sprite-icon icon-coupon fs-14"></view>
<text class="fs-14 coupon-name">{{ orderInfo.couponName || '' }}{{ orderInfo.customerCoupon.customerCouponCode || '' }}({{ orderInfo.customerCoupon.employeeName || '' }})</text>
</view>
<view class="flex justify-end align-center">
<text class="good-total-lable">商品总金额:</text>
<text class="good-total-value">
<text class="unit">¥</text>
{{ orderInfo.total_price }}
</text>
</view>
</view>
<!-- 工单信息 -->
<view class="box-shell">
<view class="box-shell-title">工单信息</view>
<view class="order-info pt-16">
<view v-for="(item, index) in orderObj" :key="index" class="flex align-center pt-8">
<view class="label">{{ item.label }}</view>
<view v-if="item.key == 'status'">
<view class="value" :style="{ color: status[orderInfo.status].color || '' }">
{{ status[orderInfo.status].text }}
</view>
</view>
<view v-else>
<view class="value">
<view v-if="item.key == 'payType'">
{{ payType[orderInfo.selectPayType] || '' }}
</view>
<view v-else>{{ orderInfo[item.key] || '' }}</view>
</view>
</view>
<view v-if="item.copy" class="copy-btn" @click="setCopyData(orderInfo[item.key])">
<view class="sprite-icon icon-icon-copy copy"></view>
</view>
<view class="customize-btn" v-if="item.dateChange" @click.stop="customizeDate">自定义</view>
</view>
<view v-if="(orderInfo.selectPayType == 2 || orderInfo.selectPayType == 5 || orderInfo.selectPayType == 6 || orderInfo.selectPayType == 7) && orderInfo.payVoucherList.length">
<view class="flex align-start pt-16">
<view class="label">付款凭证</view>
<view class="image-box flex">
<view class="value" @click="previewImage" v-for="(item, index) in orderInfo.payVoucherList" :key="index">
<view class="image">
<image :src="item.payVoucher" />
</view>
</view>
</view>
</view>
</view>
<view v-if="orderInfo.status == 5 || orderInfo.status == 12">
<view class="flex align-center pt-8">
<view class="label">退款明细</view>
<view class="value">{{ orderInfo.refundType == 1 ? '退全款' : '退部分款' }}¥{{ orderInfo.refundAmount }}</view>
</view>
</view>
<view class="paid" v-if="orderInfo.payOrder && orderInfo.payOrder.payStatus == 2">
<!-- <image src="../../images/paid.png" /> -->
</view>
</view>
</view>
<!-- 客户信息 -->
<view class="box-shell">
<view class="box-shell-title">客户信息</view>
<view class="order-info pt-16">
<view class="flex align-center pt-8" v-for="(item, index) in customerObj" :key="index">
<view class="label">{{ item.label }}</view>
<view class="value" :style="{ color: item.color || '#333' }">
<view v-if="item.arr">
<view v-if="orderInfo[item.arr[1]]" class="flex">
<view v-for="(i, ind) in item.arr" :key="ind">
<view class="value-item text-hide">
<text v-if="ind == 1" class="lineText">|</text>
{{ orderInfo[i] }}
</view>
</view>
</view>
</view>
<view v-else>
{{ item.enum ? item.enum[orderInfo[item.key]] : orderInfo[item.key] || '' }}
</view>
</view>
<view v-if="item.copy" class="copy-btn" @click="setCopyData(orderInfo[item.key])">
<view class="sprite-icon icon-icon-copy copy"></view>
</view>
</view>
</view>
<view v-if="orderInfo.selectPayType == 0">
<view class="flex align-center pt-8">
<view class="label">拒升理由</view>
<view class="value">
{{ orderInfo.customer.refusalReason ? orderInfo.customer.refusalReason : '' }}
</view>
</view>
</view>
</view>
<view v-if="warrantyCardList.length || warrantyCardVisible" class="box-shell">
<view class="box">
<view class="box-shell-title">{{ orderInfo.selectPayType == 0 ? '客服' : '质保' }}</view>
<view class="warranty-list" v-for="(item, index) in warrantyCardList" :key="index">
<view class="warranty flex align-center pt-8">
<view class="label">质保产品</view>
<view class="value">{{ replaceItemText(item.goodsName) }}</view>
</view>
<view class="warranty flex align-center pt-8">
<view class="label">质保期</view>
<view class="value">{{ item.warrantyPeriod }}</view>
</view>
<view class="warranty flex align-start pt-8">
<view class="label">质保编码</view>
<view class="codeImg-box">
<image v-if="item.barCodeUrl" :src="item.barCodeUrl" class="barCodeImg" />
<view class="barCode">{{ item.cardCode }}</view>
</view>
</view>
</view>
<view class="warranty-list">
<view class="warranty flex align-start pt-8">
<view class="label">质保查询</view>
<view class="value">
<view class="warranty-tips" v-if="warrantyCardVisible">
{{ orderInfo.selectPayType == 0 ? '建议让客户扫码关注客服号领取礼包' : '建议让客户扫码关注客服查询质保' }}
</view>
<image v-if="warrantyCardVisible" :src="customerService" class="customerService" />
</view>
</view>
</view>
</view>
</view>
<view class="flex align-center footer-box justify-center">
<view class="edit btn flex-1" @click="repeal">撤销工单</view>
</view>
</view>
</view>
</template>
<script>
import utils from '@/utils/utils'
import order_mixins from '../../order_mixins.js'
import dayjs from 'dayjs'
export default {
name: 'OrderDetail',
props: {
transmissionOfData: {
type: Object,
default: () => ({})
}
},
data() {
return {
...order_mixins.data,
orderInfo: {},
baseConfigData: {},
defaultCustomerService: 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/kf.png',
failCustomerService: '../images/kfrefresh.png',
warrantyCardVisible: true,
signatureSwitch: false, //不需要走签名逻辑 没有开启签名功能或则是战败订单
warrantyCardList: []
}
},
async mounted() {
console.log('this.orderObjData', this.transmissionOfData)
let baseConfigData = await this.setConfigInfo(getApp().globalData)
this.baseConfigData = baseConfigData
this.getDetail(this.transmissionOfData.orderCode)
},
methods: {
replaceItemText(item) {
var reg = getRegExp(';~;', 'g')
return item ? item.replace(reg, ' ') : ''
},
async getPositionList() {
const res = await uni.$api.boutiqueApi.getPositionList({})
return res
},
async getDetail(orderCode) {
const userInfo = uni.$storage.get('userInfo')
const positionTypeList = (await this.getPositionList()) || []
let _this = this
uni.$api.boutiqueApi
.getPackageGoodsDetail({
orderCode
})
.then(async data => {
await this.getServiceBaseInfo(data.merchantId)
await this.getSignatureSwitch(data.merchantId)
if (data.selectPayType != 2 && (data.status == 4 || data.status == 6 || data.status == 12)) {
// 查询订单可展示按钮
commonApi.getMoreBtnAPI({ orderCode: data.orderCode }).then(res => {
let { code, data } = res
if (code == 0) {
this.showMoreBtn = data.refundApplyButton == 'Y' || data.refundApplyDetailButton == 'Y'
}
})
}
console.log('3255555666')
// 服务商是否使用膜卷号配置
if (!userInfo?.isSuper && userInfo.userType == 2 && data.status != 10 && data.status != 9) {
let isUseFilmRoll = await this.getServiceFilmRollSetting(data?.sellerMerchantId)
this.isUseFilmRoll = isUseFilmRoll
}
console.log('32555556669999')
let couponName = data.customerCoupon ? data.customerCoupon.couponName : ''
let total_price = 0
for (var i = 0; i < data?.subOrderList?.length; i++) {
let e = data?.subOrderList[i]
total_price += e.totalPrice
e.price = Number(utils.decimal(Number(e.totalPrice / e.number), 2)).toFixed(2)
e.positionStr = positionTypeList.filter(v => v.positionValue == e.upgradeGoodsPosition)[0]?.positionName || ''
if ((e.upgradeWarrantyPeriod || e.upgradeWarrantyPeriod > 0) && data.selectPayType != 0) {
this.warrantyCardList.push({
warrantyPeriod: e.upgradeWarrantyPeriod,
goodsName: e.upgradeGoodsAlias || e.upgradeGoodsName,
cardCode: e.cardCode
})
}
// 膜类商品 并且服务商开通了使用膜卷号配置 不走签名流程
if (this.baseConfigData?.membraneTypeList?.includes(e?.upgradeGoodsType) && isUseFilmRoll && !signatureSwitch) {
let result = await api.getfilmRollNoByGoods({
upgradeGoodsId: e.upgradeGoodsId,
yqMerchantId: data?.sellerMerchantId,
merchantId: data?.merchantId
})
e.filmNumberData = result?.data || []
// 仅配置一个膜卷号 自动选中
if (!e.filmRollNo && e.filmNumberData?.length == 1) e.filmRollNo = e.filmNumberData[0]
}
}
if (data.packageGoodsList) {
data.packageGoodsList.forEach(item => {
item.packageGoodsOrderList.forEach(g => {
g.price = g.totalPrice ? Number(g.totalPrice) / Number(g.number) : g.upgradePrice
})
item.goodsList = item.packageGoodsOrderList
item.price = item.goodsList.reduce((prev, cur) => {
return prev + Number(cur.totalPrice) / Number(cur.number)
}, 0)
item.count = item.goodsList.length ? item.goodsList[0].number : 1
let total = item.price * item.count
item.totalPrice = utils.decimal(total, 2)
item.packageGoodsOrderList.forEach(g => {
g.positionStr = positionTypeList.filter(v => v.positionValue == g.upgradeGoodsPosition)[0]?.positionName || ''
})
total_price += item.totalPrice
})
}
data = {
...data.customer,
...data.payOrder,
...data,
packageGoodsList: data.packageGoodsList,
couponName,
total_price: data.selectPayType == 0 ? 0 : Number(utils.decimal(total_price, 2)).toFixed(2)
}
if (data.customerCoupon) {
data.customerCoupon.customerCouponCode = data.customerCoupon.customerCouponCode.split('-')[0]
}
if (data.orderTime) data.time = dayjs(data.orderTime).format('YYYY-MM-DD HH:mm:ss')
if (data.customer && data.customer.carSeriesName) {
data.carType = `${data.customer.carBrand || ''}-${data.customer.carChildsBrandName || ''}-${data.customer.carSeriesName || ''}`
}
this.orderInfo = data
console.log(this.orderInfo, 'this.orderInfo')
this.invoiceName = data.invoiceStatus == 2 ? '查看发票' : '申请开票'
// 去掉车主评价功能
// this.setQrBoxHeight()
// if (data.status == 6) return
// this.getQrCode(data)
this.getWorkWechatLiveQRCode()
// 条形码
this.warrantyCardList.length && this.getBarCode()
// 校验是否显示二级流量方
if (data.subShopMerchantName) {
if (_this.customerObj.findIndex(val => val?.key && val.key == 'subShopMerchantName') < 0) {
_this.customerObj[_this.customerObj.length - 2] = {
label: '二级流量方',
key: 'subShopMerchantName'
}
}
}
// 获取园区店技师配置信息
// uni.$api.boutiqueApi
// .getQYTechnicianList({
// yqMerchantId: uni.$storage.get('userInfo')?.merchantId
// })
// .then(respone => {
// if (respone?.code == 0) {
// if (respone?.data.length > 0) this.isArtificer(respone.data)
// }
// })
// } else {
// wx.showModal({
// title: '温馨提示',
// content: message,
// showCancel: false,
// confirmText: '刷新',
// confirmColor: '#347BFF',
// success(res) {
// if (res.confirm) {
// _this.getDetail(orderCode)
// }
// }
// })
// }
})
},
getServiceBaseInfo(merchantId) {
uni.$api.boutiqueApi
.getServiceBaseInfo({
merchantId
})
.then(data => {
const warrantyCardVisible = data.cardCodeFlag && data.cardCodeFlag == 1
this.warrantyCardVisible = !warrantyCardVisible
})
},
getSignatureSwitch(merchantId) {
uni.$api.boutiqueApi
.getSignatureSwitch({
merchantId
})
.then(data => {
// const warrantyCardVisible = data.cardCodeFlag && data.cardCodeFlag == 1
const signatureSwitchValue = data?.signatureSwitch && data?.signatureSwitch == 1
this.signatureSwitch = signatureSwitchValue
})
},
getWorkWechatLiveQRCode() {
this.customerService = ''
let { failCustomerService, defaultCustomerService } = this
let { orderCode, customerPhone: phoneNumber, selectPayType } = this.orderInfo
// console.log(orderCode, phoneNumber, selectPayType)
// 订单状态 1-升级订单 2-战败订单
let orderType = selectPayType == 0 ? 2 : 1
uni.$api.boutiqueApi
.getWorkWechatLiveQRCode({
orderCode,
phoneNumber,
orderType
})
.then(data => {
if (data) {
this.customerService = data
} else {
this.customerService = defaultCustomerService
}
// else {
// wx.$util.showToast(message)
// }
})
.catch(err => {
this.customerService = failCustomerService
})
// }, 3000)
},
/** 获取服务商是否使用膜卷号 */
getServiceFilmRollSetting(yqMerchantId) {
console.log('getServiceFilmRollSetting')
const app = getApp()
return new Promise((resolve, reject) => {
uni.$api.boutiqueApi
.getServiceFilmRollSetting({
merchantId: yqMerchantId
})
.then(data => {
app.globalData.serviceFilmRollSetting = data
resolve(app.globalData.serviceFilmRollSetting)
})
.catch(error => {
console.log(error)
})
})
},
setConfigInfo(globalData) {
const app = getApp()
return new Promise((resolve, reject) => {
// 如果有 直接返回
// console.log(app.globalData.YQorderSetting, 'app.globalData.YQorderSetting')
// console.log('app.globalData.YQorderSetting', app.globalData.YQorderSetting)
let { configInfo } = globalData
const target = ['develop', 'develop', 'test', 'production', 'beta']
if (configInfo) {
return resolve(configInfo)
} else {
wx.request({
// url: `${domain}${path}?method=${method}`,
url: `https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=dj-car-boutique-work-wechat-miniapp&env=${target[envIndex]}`,
// data,
method: 'GET',
// header,
dataType: 'json',
responseType: 'text',
success(response) {
app.globalData.configInfo = response.data
resolve(response.data)
},
fail(error) {
console.log(error, 'error')
},
complete() {
// wx.stopPullDownRefresh()
// wx.hideNavigationBarLoading()
}
})
}
})
},
getBarCode() {
// warrantyCardList
let that = this
let { warrantyCardList } = this
console.log(warrantyCardList, 'warrantyCardList')
warrantyCardList.forEach((element, index) => {
setTimeout(() => {
element.cardCode &&
uni.$api.boutiqueApi
.createBarCode({
content: element.cardCode
})
.then(data => {
// 待优化 应该都有之后再一次性更新
// warrantyCardList[index].barCodeUrl = 'http://qcimg01.glsx.com.cn:7060/group1/M00/02/96/wKgD3mNXkD-ALMu3AAABmn9Id4c794.png'
warrantyCardList[index].barCodeUrl = data
this.$set(this.warrantyCardList, index, warrantyCardList[index])
console.log(this.warrantyCardList, 'getBarCode')
})
.catch(err => {})
}, 1000 * index)
})
},
// 撤销该工单
async repeal() {
// 校验是否填写昨日日报
// let staffCheck = await checkDailyReport();
// if (staffCheck) return false;
let _this = this
uni.$api.boutiqueApi
.revokeOrder({
orderCode: this.transmissionOfData.orderCode
})
.then(data => {
uni.showToast({
title: '操作成功',
icon: 'success'
})
})
}
}
}
</script>
<style scope lang="scss">
.order-detail {
position: relative;
height: 100%;
.scroll-y {
height: calc(100% - #{toRpx(296)});
overflow-y: scroll;
&::-webkit-scrollbar {
width: 0;
height: 0;
background: transparent;
}
}
.px-48 {
padding: 0 toRpx(48);
}
.pt-6 {
padding-top: toRpx(6);
}
.pt-8 {
padding-top: toRpx(8);
}
.pt-16 {
padding-top: toRpx(16);
}
.pt-12 {
padding-top: toRpx(12);
}
.fs-14 {
font-size: toRpx(14);
}
.fs-32 {
font-size: toRpx(32);
}
.fs-26 {
font-size: toRpx(26);
}
.fs-34 {
font-size: toRpx(34);
}
.fw-5 {
font-weight: 500;
}
.fw-7 {
font-weight: 700;
}
.fs-13 {
font-size: toRpx(13);
}
.ml-12 {
margin-left: toRpx(12);
}
.py-8 {
padding: toRpx(8) 0;
}
.date-box {
display: flex;
align-items: center;
position: relative;
}
.date-box-label {
font-weight: 400;
font-size: toRpx(28);
color: #333333;
}
.date-box-value {
font-weight: 500;
font-size: toRpx(40);
color: #333333;
}
.required {
color: #f00;
margin-left: toRpx(8);
}
.handlerBtn {
color: #4673ff;
font-size: toRpx(26);
font-weight: 400;
margin-left: toRpx(8);
}
.customize-btn {
color: #4673ff;
font-size: toRpx(26);
font-weight: 400;
margin-left: toRpx(16);
}
.copy-btn {
display: flex;
align-items: center;
color: #808291;
.copy {
margin-right: toRpx(8);
margin-left: toRpx(20);
}
}
.top-tips {
width: 100%;
height: toRpx(152);
border-radius: toRpx(16);
background: linear-gradient(136.3deg, #fdffff 0%, #ebfff6 46%, #f4fffc 100%);
color: #666666;
padding: 0 toRpx(32);
position: relative;
.checkbox-filled {
font-size: toRpx(56) !important;
margin-right: toRpx(24);
}
.topTipsRightIcon {
position: absolute !important;
bottom: 0;
right: toRpx(16);
}
}
.box-shell {
width: 100%;
border-radius: toRpx(16);
background: #ffffff;
padding: toRpx(24) toRpx(32);
margin-top: toRpx(16);
&-title {
font-size: toRpx(28);
color: #333333;
font-weight: 400;
}
.good-list {
margin-top: toRpx(16);
.good {
color: #333333;
font-size: toRpx(28);
border-radius: toRpx(24);
background: #f5f7fa;
padding: toRpx(24);
margin-bottom: toRpx(16);
.good-name {
font-weight: 400;
flex: 4;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.good-price {
font-weight: 500;
flex: 1;
text-align: right;
}
.good-alias {
font-size: toRpx(24);
font-weight: 400;
}
.good-sku {
color: #999999;
font-size: toRpx(24);
font-weight: 400;
}
.good-count {
color: #999999;
font-size: toRpx(24);
font-weight: 400;
}
}
}
.coupon-name {
color: #292d33;
font-size: toRpx(24);
font-weight: 400;
margin-left: toRpx(8);
}
.good-total-lable {
color: #757980;
font-size: toRpx(28);
font-weight: 400;
}
.good-total-value {
color: #4673ff;
font-size: toRpx(40);
font-weight: 700;
}
.order-info {
.value .value-item text {
margin: 0 toRpx(6);
}
.label {
width: toRpx(156);
color: #999999;
font-size: toRpx(26);
font-weight: 400;
}
.value {
color: #222222;
font-size: toRpx(26);
font-weight: 400;
}
.image-box {
.value {
}
.image {
width: toRpx(106);
height: toRpx(112);
margin-right: toRpx(16);
image {
width: 100%;
height: 100%;
border-radius: toRpx(8);
}
}
}
}
.warranty-list {
.value .value-item text {
margin: 0 toRpx(6);
}
.label {
width: toRpx(156);
color: #999999;
font-size: toRpx(26);
font-weight: 400;
}
.value {
color: #222222;
font-size: toRpx(26);
font-weight: 400;
}
.codeImg-box {
.barCode {
color: #292d33;
font-size: toRpx(28);
font-weight: 400;
}
.barCodeImg {
width: toRpx(600);
height: toRpx(158);
}
}
}
.warranty-tips {
margin-bottom: toRpx(12);
}
.customerService {
width: toRpx(320);
height: toRpx(320);
}
}
.footer-box {
position: absolute;
bottom: toRpx(24);
width: 100%;
left: 0;
.btn {
width: 80%;
height: toRpx(80);
border-radius: toRpx(48);
font-size: toRpx(28);
font-weight: 500;
line-height: toRpx(80);
text-align: center;
}
.confirm {
background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
color: #ffffff;
margin-left: toRpx(32);
}
.edit {
background: #3b73ff1a;
color: #4673ff;
}
}
}
</style>
......@@ -9,6 +9,10 @@
<text>{{ item.tabName }}</text>
<text class="num">{{ item.num }}</text>
</view>
<view>
筛选
<view class="sprite-icon icon-filter"></view>
</view>
</view>
<view class="px-48">
<view class="tips" v-if="waitInputCount">
......@@ -119,6 +123,7 @@
</scroll-view>
</template>
</PublishPopup>
<order-screen ref="test" @onConfirm="回调" />
</view>
</template>
......@@ -130,12 +135,14 @@ import OrderCard from '../../components/OrderCard'
import PublishPopup from '@/components/PublishPopup.vue'
import dayjs from 'dayjs'
import utils from '@/utils/utils'
import OrderScreen from '@/components/OrderScreen/index.vue'
export default {
name: 'OrderManagement',
mixins: [ZPMixin, interceptionMixin],
components: {
OrderCard,
PublishPopup
PublishPopup,
OrderScreen
},
data() {
return {
......
<template>
<view class="upload-proof-of-payment">
<view class="common-title">上传付款凭证</view>
<view class="px-48">
<view class="box-shell">
<view class="flex align-center justify-between box-flow">
<view class="box-label">
交易流水号
<text class="required">*</text>
</view>
<input v-model="outTradeNo" class="uni-input" maxlength="100" placeholder="请输入" />
</view>
<view class="payment">
<view class="payment-label">
付款凭证
<text class="required">*</text>
</view>
<view class="upload-box flex flex-wrap">
<view class="upload-item" @click="selectImg"></view>
<view v-for="(item, index) in payVoucherList" :key="index" class="previewImageList">
<image :src="item"></image>
<view class="close-box" @click="deleteImg(index)">
<uni-icons class="icon-close" type="closeempty" color="#ffffff"></uni-icons>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="uploadBtn" @click="confirm">确定提交</view>
</view>
</template>
<script>
import { uploadFile } from '@/utils/ossUploadFile/uploadFile.js'
export default {
name: 'UploadProofOfPayment',
props: {
transmissionOfData: {
type: Object,
default: () => null
}
},
data() {
return {
payVoucherList: [],
outTradeNo: ''
}
},
mounted() {
console.log(this.transmissionOfData, 'console.log(this.transmissionOfData)')
},
methods: {
selectImg() {
let _this = this
uni.chooseImage({
count: 1, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album'], //从相册选择
success: function (res) {
console.log(res)
_this.upLoad(res)
}
})
},
// 上传付款凭证
async upLoad(event) {
console.log(event)
let _this = this
const { tempFilePaths } = event
let url = await uploadFile(tempFilePaths[0])
this.payVoucherList.push(url)
},
confirm(e) {
console.log(this.transmissionOfData)
let { outTradeNo, payVoucherList } = this
if (payVoucherList.length && outTradeNo) {
this.createPayOrder()
} else {
uni.showToast({ title: '交易流水号或付款凭证不能为空!', icon: 'none' })
}
},
deleteImg(index) {
this.payVoucherList.splice(index, 1)
},
createPayOrder() {
const { orderCode, payType, payeeType } = this.transmissionOfData
let obj = {
orderCode,
payType: payType,
payeeType: payeeType
}
if (this.payVoucherList?.length && this.outTradeNo) {
obj.payVoucherList = this.payVoucherList.map(v => {
return v?.url
})
obj.outTradeNo = this.outTradeNo
}
console.log(obj)
uni.$api.boutiqueApi.createPayOrder(obj).then(data => {
uni.showToast({ title: '提交成功', icon: 'success' })
this.$emit('jump', 'OrderDetail', data)
})
}
}
}
</script>
<style scoped lang="scss">
.px-48 {
padding: 0 toRpx(48);
}
.upload-proof-of-payment {
width: 100%;
height: 100%;
position: relative;
.box-shell {
width: 100%;
border-radius: toRpx(16);
background: #ffffff;
padding: toRpx(24) toRpx(32);
margin-top: toRpx(16);
.box-flow {
border-bottom: toRpx(2) solid #f7f7f6;
padding-bottom: toRpx(28);
.box-label {
font-weight: 400;
font-size: toRpx(28);
color: #333333;
}
.required {
color: #f00;
margin-left: toRpx(8);
}
.uni-input {
text-align: right;
.uni-input-placeholder {
font-size: toRpx(28);
font-weight: 400;
}
}
}
.payment {
.payment-label {
font-weight: 400;
font-size: toRpx(28);
color: #333333;
margin-top: toRpx(32);
margin-bottom: toRpx(24);
.required {
color: #f00;
margin-left: toRpx(8);
}
}
.upload-box {
gap: toRpx(20);
.upload-item {
width: toRpx(320) !important;
height: toRpx(240) !important;
border-radius: toRpx(12);
background: url('@/assets/images/boutique/uploadImage.png') no-repeat;
background-size: 100% 100%;
}
.previewImageList {
position: relative;
image {
width: toRpx(320) !important;
height: toRpx(240) !important;
border-radius: toRpx(12);
}
.close-box {
width: toRpx(36);
height: toRpx(36);
position: absolute;
top: - toRpx(12);
right: - toRpx(12);
background: rgba(0, 0, 0, 0.6);
border-radius: 50%;
text-align: center;
line-height: toRpx(40);
}
.icon-close {
font-size: toRpx(12);
}
}
}
}
}
.uploadBtn {
width: 80%;
height: toRpx(80);
border-radius: toRpx(48);
background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
color: #ffffff;
font-size: toRpx(28);
font-weight: 500;
position: absolute;
bottom: toRpx(20);
margin: 0 auto;
left: 0;
right: 0;
text-align: center;
line-height: toRpx(80);
}
}
</style>
......@@ -32,6 +32,8 @@ import DailyReport from './components/DailyReport.vue'
import DefeatOrder from './components/DefeatOrder.vue'
import OrderManagement from './components/OrderManagement.vue'
import ConfirmOrder from './components/ConfirmOrder.vue'
import OrderDetail from './components/OrderDetail.vue'
import UploadProofOfPayment from './components/UploadProofOfPayment.vue'
import NoticePopup from './components/NoticePopup.vue'
export default {
components: {
......@@ -41,7 +43,9 @@ export default {
DefeatOrder,
OrderManagement,
ConfirmOrder,
NoticePopup
NoticePopup,
UploadProofOfPayment,
OrderDetail
},
data() {
return {
......@@ -57,34 +61,37 @@ export default {
console.log(item)
// 保存当前选择的组件信息,但不立即切换
const selectedItem = item
// 如果当前组件是OrderManagement,直接切换组件,不显示弹窗
if (this.toolComponentName === 'OrderManagement') {
this.toolComponentName = selectedItem.name
this.transmissionOfData = null
return
}
// 配置弹窗按钮
this.$refs.notice.buttons = [{
text: '确认退出',
type: 'default',
callback: () => {
// 点击确认后才切换组件
this.toolComponentName = selectedItem.name
if (selectedItem.name !== 'CreateOrder') {
this.transmissionOfData = null
this.$refs.notice.buttons = [
{
text: '确认退出',
type: 'default',
callback: () => {
// 点击确认后才切换组件
this.toolComponentName = selectedItem.name
if (selectedItem.name !== 'CreateOrder') {
this.transmissionOfData = null
}
this.$refs.notice.close()
}
},
{
text: '继续编辑',
type: 'primary',
callback: () => {
this.$refs.notice.close()
}
this.$refs.notice.close()
}
}, {
text: '继续编辑',
type: 'primary',
callback: () => {
this.$refs.notice.close()
}
}]
]
// 打开弹窗
this.$refs.notice.open()
},
......
......@@ -256,6 +256,7 @@ const refreshPageData = notRefreshOrder => {
getApp().globalData.dateListRefresh = true
getApp().globalDataorderListDateListScreenRefresh = true
}
export default {
compareVersions,
convertDateTimeFormat,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!