Commit cd060017 by 李伟康

权益新增录单

1 parent ed6aadd7

2.87 MB | W: | H:

2.87 MB | W: | H:

assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -42,37 +42,41 @@ export default { ...@@ -42,37 +42,41 @@ export default {
{ {
icon: 'daily-report', icon: 'daily-report',
label: '驻店日报', label: '驻店日报',
name: 'DailyReport' name: 'DailyReport',
sceneType: [0, 1, 7]
},
{
icon: 'equity-order',
label: '权益提单',
name: 'EquityOrder',
sceneType: [0]
}, },
{ {
icon: 'create-order', icon: 'create-order',
label: '新建工单', label: '新建工单',
name: 'CreateOrder' name: 'CreateOrder',
sceneType: [1]
}, },
{ {
icon: 'defeat-order', icon: 'defeat-order',
label: '战败下单', label: '战败下单',
name: 'DefeatOrder' name: 'DefeatOrder',
sceneType: [0, 1]
}, },
{ {
icon: 'order-management', icon: 'order-management',
label: '工单列表', label: '工单列表',
name: 'OrderManagement' name: 'OrderManagement',
sceneType: [0, 1]
}, },
{ {
icon: 'evaluation-management', icon: 'evaluation-management',
label: '评估单管理', label: '评估单管理',
name: 'EvaluationFormList' name: 'EvaluationFormList',
sceneType: [7]
} }
] ]
if (sceneType == 0) return [] return entranceList.filter(e => e.sceneType.includes(sceneType))
else if (sceneType === 7) {
return entranceList.filter(e => ['DailyReport', 'EvaluationFormList'].includes(e.name));
}
if (sceneType === 1) {
return entranceList.filter(e => e.name !== 'EvaluationFormList');
}
} }
}, },
methods: { methods: {
......
<template> <template>
<view class="container" @click="handleTouchStart"> <view
class="container"
@click="handleTouchStart"
>
<view :class="['home', { show: !id && showHome }]"> <view :class="['home', { show: !id && showHome }]">
<left-side :userInfo="userInfo" :tabIndex.sync="tabIndex" ref="leftBox" @changeTab="changeTab" @stopAudio="stopAudio" @showReadCountTips="showReadCountTips" @closeTips="closeTips" /> <left-side
<view class="tips-box" :style="tipsObject.style" @click.stop="closeTips">{{ tipsObject.text }}</view> :userInfo="userInfo"
:tabIndex.sync="tabIndex"
ref="leftBox"
@changeTab="changeTab"
@stopAudio="stopAudio"
@showReadCountTips="showReadCountTips"
@closeTips="closeTips"
/>
<view
class="tips-box"
:style="tipsObject.style"
@click.stop="closeTips"
>{{ tipsObject.text }}</view>
<view class="right-side"> <view class="right-side">
<view :class="['app-content-box right-content', { 'show-content-box': tabIndex == 0 }]"> <view :class="['app-content-box right-content', { 'show-content-box': tabIndex == 0 }]">
<view class="start" @click="start"> <view
class="start"
@click="start"
>
<template v-if="sceneType != 7"> <template v-if="sceneType != 7">
<view class="sprite-icon icon-start-text"></view> <view class="sprite-icon icon-start-text"></view>
</template> </template>
...@@ -26,7 +44,7 @@ ...@@ -26,7 +44,7 @@
:imgKey="bannerKey" :imgKey="bannerKey"
:loadComplete="loadComplete" :loadComplete="loadComplete"
:noDataObject="swiperNoDataObject" :noDataObject="swiperNoDataObject"
> >
</swiper-component> </swiper-component>
</template> </template>
</view> </view>
...@@ -41,19 +59,36 @@ ...@@ -41,19 +59,36 @@
<view class="content-right box-class"> <view class="content-right box-class">
<view class="common-title">服务中心</view> <view class="common-title">服务中心</view>
<view class="content-box"> <view class="content-box">
<MessageIndex class="message-box" ref="messageRef" /> <MessageIndex
class="message-box"
ref="messageRef"
/>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view :class="['app-content-box right-content', { 'show-content-box': tabIndex == 99 }]"> <view :class="['app-content-box right-content', { 'show-content-box': tabIndex == 99 }]">
<component :is="'Point'" ref="pointRef" :userInfo="userInfo" @showPage="handleShowPage" /> <component
:is="'Point'"
ref="pointRef"
:userInfo="userInfo"
@showPage="handleShowPage"
/>
</view> </view>
<template v-if="tabIndex != 0 && tabIndex != 99"> <template v-if="tabIndex != 0 && tabIndex != 99">
<component :is="componentName" ref="pointRef" :userInfo="userInfo" @showPage="handleShowPage" :isPermissionFunction="isPermission" /> <component
:is="componentName"
ref="pointRef"
:userInfo="userInfo"
@showPage="handleShowPage"
:isPermissionFunction="isPermission"
/>
</template> </template>
</view> </view>
<view class="store-addr" v-if="footerBox"> <view
class="store-addr"
v-if="footerBox"
>
<view class="icon-addr sprite-icon icon-addr"></view> <view class="icon-addr sprite-icon icon-addr"></view>
<view class="addr-text">{{ userInfo.shopMerchantName }}</view> <view class="addr-text">{{ userInfo.shopMerchantName }}</view>
</view> </view>
...@@ -61,17 +96,41 @@ ...@@ -61,17 +96,41 @@
<view :class="['detail', { show: id }]"> <view :class="['detail', { show: id }]">
<slot name="detail" /> <slot name="detail" />
</view> </view>
<view class="point-page" v-if="!showHome"> <view
<component :is="pointComponentName" @backHome="backHome" @jump="jump" :transfer="transfer" /> class="point-page"
v-if="!showHome"
>
<component
:is="pointComponentName"
@backHome="backHome"
@jump="jump"
:transfer="transfer"
/>
</view> </view>
<!-- 未点击开始接待,弹窗 --> <!-- 未点击开始接待,弹窗 -->
<MessageBox ref="previewRef" @confirm="previewHandler('preview', true)" :popupW="704" content="直接点击素材可进行预览,若面向车主展示,请点击「开始接待」" confirmBtnText="预览素材" @cancel="previewHandler('previewCancel')" @close="previewHandler('previewClose')"></MessageBox> <MessageBox
ref="previewRef"
@confirm="previewHandler('preview', true)"
:popupW="704"
content="直接点击素材可进行预览,若面向车主展示,请点击「开始接待」"
confirmBtnText="预览素材"
@cancel="previewHandler('previewCancel')"
@close="previewHandler('previewClose')"
></MessageBox>
<!-- 停留弹框 --> <!-- 停留弹框 -->
<!-- <MessageBox ref="tipBox" @cancel="tipCancel" @confirm="tipConfirm" content="系统检测到您在当前页面停留较久,是否仍在客户接待中?" cancelBtnText="否" confirmBtnText="是"></MessageBox> --> <!-- <MessageBox ref="tipBox" @cancel="tipCancel" @confirm="tipConfirm" content="系统检测到您在当前页面停留较久,是否仍在客户接待中?" cancelBtnText="否" confirmBtnText="是"></MessageBox> -->
<!-- 退出弹框 --> <!-- 退出弹框 -->
<MessageBox :popupW="704" ref="finish" :content="finishContene" :isFooter="false"> <MessageBox
:popupW="704"
ref="finish"
:content="finishContene"
:isFooter="false"
>
<view class="footer"> <view class="footer">
<view class="footer-btn confirm flex" @click="$emit('openStep')"> <view
class="footer-btn confirm flex"
@click="$emit('openStep')"
>
<template v-if="finishDoneText"> <template v-if="finishDoneText">
{{ finishDoneText }} {{ finishDoneText }}
</template> </template>
...@@ -80,7 +139,10 @@ ...@@ -80,7 +139,10 @@
<text>(推荐)</text> <text>(推荐)</text>
</template> </template>
</view> </view>
<view class="footer-btn cancel flex" @click="$emit('backHome')"> <view
class="footer-btn cancel flex"
@click="$emit('backHome')"
>
仍要退出 仍要退出
<text>(不推荐)</text> <text>(不推荐)</text>
</view> </view>
...@@ -89,7 +151,11 @@ ...@@ -89,7 +151,11 @@
<!-- 升级弹框 --> <!-- 升级弹框 -->
<update-box /> <update-box />
<slot name="content" /> <slot name="content" />
<web-view @message="handlerMessage" ref="webview" src="/hybrid/html/index.html"></web-view> <web-view
@message="handlerMessage"
ref="webview"
src="/hybrid/html/index.html"
></web-view>
<!-- <web-view <!-- <web-view
ref="studyWebview" ref="studyWebview"
:src="jumpUrl" :src="jumpUrl"
...@@ -149,7 +215,7 @@ export default { ...@@ -149,7 +215,7 @@ export default {
}, },
swiperCustom: Boolean, swiperCustom: Boolean,
}, },
data() { data () {
return { return {
studyUrl: '', studyUrl: '',
jumpUrl: '', jumpUrl: '',
...@@ -165,35 +231,35 @@ export default { ...@@ -165,35 +231,35 @@ export default {
previewOff: false previewOff: false
} }
}, },
mounted() { mounted () {
const userInfo = uni.$storage.get('userInfo') || {} const userInfo = uni.$storage.get('userInfo') || {}
this.userInfo = userInfo this.userInfo = userInfo
if (this.checkRecordAudio) permision.requestAndroidPermission('android.permission.RECORD_AUDIO') // 进入界面时检查权限 if (this.checkRecordAudio) permision.requestAndroidPermission('android.permission.RECORD_AUDIO') // 进入界面时检查权限
}, },
provide() { provide () {
return { return {
showPage: this.handleShowPage, showPage: this.handleShowPage,
hideFooter: this.handleFooter hideFooter: this.handleFooter
} }
}, },
computed: { computed: {
previewRef() { previewRef () {
return this.$refs.previewRef return this.$refs.previewRef
}, },
finishRef() { finishRef () {
return this.$refs.finish return this.$refs.finish
}, },
componentName() { componentName () {
let tabs = this.$refs.leftBox?.tabs let tabs = this.$refs.leftBox?.tabs
return tabs ? tabs[this.tabIndex].name : '' return tabs ? tabs[this.tabIndex].name : ''
}, },
sceneType() { sceneType () {
const { sceneType } = uni.$storage.get('userInfo') const { sceneType } = uni.$storage.get('userInfo')
return sceneType return sceneType
} }
}, },
methods: { methods: {
async changeTab({ item, index }) { async changeTab ({ item, index }) {
if (index == 0) this.$refs.messageRef.getMessageSummary() if (index == 0) this.$refs.messageRef.getMessageSummary()
this.previewOff = index != 0 this.previewOff = index != 0
this.$emit('changeTab', index) this.$emit('changeTab', index)
...@@ -212,16 +278,16 @@ export default { ...@@ -212,16 +278,16 @@ export default {
// this.jumpUrl = '' // this.jumpUrl = ''
// } // }
}, },
handleFooter(val) { handleFooter (val) {
this.footerBox = val this.footerBox = val
}, },
backHome() { backHome () {
this.showHome = true this.showHome = true
Promise.resolve().then(() => { Promise.resolve().then(() => {
this.$refs.pointRef?.$refs?.centerRef?.init && this.$refs.pointRef.$refs.centerRef.init() this.$refs.pointRef?.$refs?.centerRef?.init && this.$refs.pointRef.$refs.centerRef.init()
}) })
}, },
jump(val) { jump (val) {
this.showHome = true this.showHome = true
if (val == 'CustomerFile') { if (val == 'CustomerFile') {
this.tabIndex = 2 this.tabIndex = 2
...@@ -229,12 +295,12 @@ export default { ...@@ -229,12 +295,12 @@ export default {
} }
this.start() this.start()
}, },
handleShowPage(name, transfer) { handleShowPage (name, transfer) {
this.transfer = transfer this.transfer = transfer
this.showHome = false this.showHome = false
this.pointComponentName = name this.pointComponentName = name
}, },
handleOperation(val, data) { handleOperation (val, data) {
const { type } = val const { type } = val
// 提取公共的webview设置逻辑 // 提取公共的webview设置逻辑
...@@ -304,14 +370,14 @@ export default { ...@@ -304,14 +370,14 @@ export default {
} }
}, },
// 学习中心修改阅读状态,打开后才修改 // 学习中心修改阅读状态,打开后才修改
async getStudyCenterRead(id) { async getStudyCenterRead (id) {
const res = await uni.$api.commonApi.getStudyCenterRead({ id }) const res = await uni.$api.commonApi.getStudyCenterRead({ id })
}, },
showReadCountTips(res) { showReadCountTips (res) {
this.tipsObject = res this.tipsObject = res
}, },
closeTips() { closeTips () {
this.$refs.leftBox.readCount = 0 this.$refs.leftBox.readCount = 0
this.tipsObject = { this.tipsObject = {
style: '', style: '',
...@@ -325,11 +391,11 @@ export default { ...@@ -325,11 +391,11 @@ export default {
this.previewOff = true this.previewOff = true
this.$emit('swiperClick', e) this.$emit('swiperClick', e)
}, },
previewHandler(name, off = false) { previewHandler (name, off = false) {
this.previewOff = off this.previewOff = off
this.$emit(name) this.$emit(name)
}, },
start() { start () {
const { sceneType } = this const { sceneType } = this
if (sceneType == 7) return //二手车无接待功能 if (sceneType == 7) return //二手车无接待功能
uni.$track.add({ uni.$track.add({
...@@ -337,11 +403,11 @@ export default { ...@@ -337,11 +403,11 @@ export default {
}) })
this.$emit('start') this.$emit('start')
}, },
async updateApp(requested = false) { async updateApp (requested = false) {
if (!requested) await uni.$api.systemApi.getMockData(true) if (!requested) await uni.$api.systemApi.getMockData(true)
this.checkVersion() this.checkVersion()
}, },
async entranceClick(item) { async entranceClick (item) {
// 清除评估单的图片视频资源缓存 // 清除评估单的图片视频资源缓存
const noInterceptPage = ['DailyReport'], const noInterceptPage = ['DailyReport'],
...@@ -356,6 +422,7 @@ export default { ...@@ -356,6 +422,7 @@ export default {
return return
} }
let pageName = { let pageName = {
0: 'equity',
1: 'boutique', 1: 'boutique',
7: 'usedCar' 7: 'usedCar'
}[this.sceneType] }[this.sceneType]
......
module.exports = {
data: {
orderObj: [
{
label: '工单编号',
key: 'orderCode',
copy: true
},
{
label: '工单时间',
key: 'time',
dateChange: true
},
{
label: '工单状态',
key: 'status',
color: '#14CC68',
status: true
},
{
label: '支付方式',
key: 'payType',
payType: true
}
],
customerObj: [
{
label: '客户姓名',
key: 'customerName'
},
{
label: '性别',
key: 'customerSex',
enum: {
1: '男',
2: '女'
}
},
{
label: '手机号',
key: 'customerPhone',
color: '#347BFF',
callBack: 'makePhoneCall',
copy: true
},
{
label: '车型',
key: 'carType'
},
{
label: '车架号',
key: 'standNo'
},
{
label: '车牌号',
key: 'plateNumber'
},
{
label: '是否体验',
key: 'experienceFlag',
enum: {
Y: '是',
N: '否'
}
},
{
label: '销售顾问',
arr: ['merchantName', 'employeeName']
},
{
label: '转化专员',
arr: ['sellerMerchantName', 'sellerName']
},
{
label: '备注',
key: 'remark'
}
],
payType: {
0: '战败',
1: '微信支付',
2: '门店收款',
3: 'pos机支付',
4: '支付宝支付',
5: '嘀加收款',
6: '对公转账',
7: '其它收款'
},
orderType: [
{
name: '全部',
active: true,
value: []
},
{
name: '升级下单',
value: [1, 2, 3, 4, 6]
},
{
name: '核销抵扣',
value: [5]
}
],
status: {
12: {
text: '已退款',
color: '#F7A431',
background: '#FFF5E6'
},
11: {
text: '已失效',
color: '#8F959E',
background: ' #F3F4F5'
},
10: {
text: '已关闭',
color: '#8F959E'
},
9: {
text: '已撤销',
color: '#8F959E',
background: '#F0F0F0'
},
1: {
text: '待跟进',
color: '#FF9D0A',
background: '#FFF5E6'
},
2: {
text: '战败',
color: '#F24724',
background: '#FDECE9'
},
3: {
text: '待支付',
color: '#FF9D0A',
background: '#FFF5E6'
},
4: {
text: '已支付',
color: '#35C376',
background: '#EAF9F1'
},
6: {
text: '已评价',
color: '#347BFF',
background: '#EAF1FF'
}
},
// 订单状态 1 待跟进, 2 不升级, 3 待支付,4 已支付,6 已评价 , 9 已撤销
statusList: [
{
name: '待跟进',
value: [1]
},
{
name: '已支付',
value: [4]
},
{
name: '待支付',
value: [3]
},
{
name: '已撤销',
value: [9]
},
{
name: '战败',
value: [2]
},
{
name: '已评价',
value: [6]
},
{
name: '已关闭',
value: [10]
},
{
name: '已失效',
value: [11]
}
],
grassInfo: {},
orderCode: '',
userInfo: {}
}
}
<template>
<view>
<view :class="[list.length > 0 ? 'package-list' : '']">
<view class="package-item" v-for="(item, index) in list" :key="index">
<view class="header">
<view class="header-left">
<view class="sprite-icon icon-blue-delete" @click="deleteGoods(index)"></view>
<view class="name">{{ item.packageGoods.packageAlias || item.packageGoods.packageName }}</view>
<view class="control">
<view class="minus" @click="decreaseNumber(item)">-</view>
<input class="uni-input control-input" type="number" maxlength="3" v-model="item.packageGoods.number" @blur="validateNumber($event, item)" />
<view class="add" @click="increaseNumber(item)">+</view>
</view>
</view>
<view class="price">¥{{ changeTotal(item) }}</view>
</view>
<view class="goods-item" v-for="(goods, ind) in item.packageGoods.goodsList" :key="ind">
<view class="goods-name">{{ goods.goodsAlias || goods.upgradeGoodsName }}</view>
<!-- <view class="alias-name">商品别名:阿尔法 T5极狐非三电整车延保(新车2年6万公里)</view> -->
<view class="front-gear-box">
<view class="front-gear-input-box">
<!-- <view class="front-gear-label" v-if="goods.merchantGoodsPosition || goods.goodsInfo.goodsTypeName">{{goods.goodsInfo.goodsType===1?formatPosition(goods.merchantGoodsPosition, positionTypeList):goods.goodsInfo.goodsTypeName}}</view> -->
<view class="front-gear-input">
<view class="unit">¥</view>
<input class="uni-input" type="digit" maxlength="9" placeholder="请输入价格" placeholder-style="font-size: 14px" v-model="goods.sellPrice" @blur="validatePrice($event, goods, ind, index)" />
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'Package',
props: {
list: {
type: Array,
default: () => []
},
positionTypeList: {
type: Array,
default: []
}
},
created() {
// 初始化商品数量
this.initProductNumbers()
console.log(this.list, 'Package-list')
},
mounted() {
// 确保每次使用组件时都检查并设置number属性
this.initProductNumbers()
},
updated() {
// 当组件数据更新时也检查number属性
this.initProductNumbers()
console.log(this.list, 'Package-list2')
},
methods: {
// 初始化商品数量方法
initProductNumbers() {
if (this.list && this.list.length > 0) {
this.list.forEach(item => {
if (!item.packageGoods.number) {
this.$set(item.packageGoods, 'number', '1')
}
// 存储旧值
item.packageGoods.goodsList.forEach(goods => {
if (!goods.price) {
goods.oldPrice = goods.sellPrice
}
})
})
}
},
// // 格式化位置信息
// formatPosition(item, positionTypeList) {
// const filterData = positionTypeList.filter(v => v.positionValue == item)
// return (filterData.length && filterData[0] && filterData[0].positionName) || ''
// },
// 验证数量输入
validateNumber(event, item) {
let value = event.detail.value
// 限制只能输入整数
value = value.replace(/[^\d]/g, '')
// 如果为空或0,设置为1
if (!value || value.trim() === '' || parseInt(value) === 0) {
value = '1'
}
// 更新值
this.$set(item.packageGoods, 'number', value)
this.$emit('changeTotalPrice')
},
// 增加数量
increaseNumber(item) {
if (!item.packageGoods.number) {
this.$set(item.packageGoods, 'number', '1')
} else {
const currentValue = parseInt(item.packageGoods.number)
// 限制最大数量为999
const newValue = currentValue >= 999 ? 999 : currentValue + 1
this.$set(item.packageGoods, 'number', newValue.toString())
}
this.$emit('changeTotalPrice')
},
// 减少数量
decreaseNumber(item) {
// 如果商品数量不存在或小于等于1,设置为1
if (!item.packageGoods.number || parseInt(item.packageGoods.number) <= 1) {
this.$set(item.packageGoods, 'number', '1')
return
}
const currentValue = parseInt(item.packageGoods.number)
// 确保减少后的值不小于1
const newValue = Math.max(1, currentValue - 1)
this.$set(item.packageGoods, 'number', newValue.toString())
this.$emit('changeTotalPrice')
},
validatePrice(event, goods, ind, index) {
let value = event.detail.value
// 如果为空则设置为0
if (!value || value.trim() === '') {
value = '0'
}
// 限制只能输入数字和小数点
value = value.replace(/[^\d.]/g, '')
// 限制只能有一个小数点
if (value.split('.').length > 2) {
value = value.slice(0, value.lastIndexOf('.')) + value.slice(value.lastIndexOf('.') + 1)
}
// 限制最多两位小数
if (value.includes('.')) {
const parts = value.split('.')
if (parts[1].length > 2) {
parts[1] = parts[1].substring(0, 2)
value = parts.join('.')
}
}
// 限制最大值为100000
if (parseFloat(value) > 100000) {
value = '100000'
}
// 限制最小值为0
if (parseFloat(value) < 0 || parseFloat(value) == 0) {
value = '0'
}
// 如果validMinSellPrice为Y,则强制修改值为最小值
if (goods.validMinSellPrice === 'Y' && goods.minSellPrice && parseFloat(value) < parseFloat(goods.minSellPrice)) {
console.log('最小值', goods.minSellPrice)
uni.showToast({
title: '单价不可低于商品最低价',
icon: 'none'
})
value = goods.minSellPrice.toString()
}
// 更新值
this.$set(this.list[index].packageGoods.goodsList[ind], 'sellPrice', value)
this.$emit('changeTotalPrice')
},
// 删除商品
deleteGoods(index) {
this.list.splice(index, 1)
this.$emit('changeTotalPrice')
},
// 计算套餐的总价
changeTotal(item) {
let total = 0
item.packageGoods.goodsList.forEach(i => {
// total += parseFloat(i.sellPrice) * parseInt(item.packageGoods.number)
total += parseFloat(i.sellPrice)
})
item.packageGoods.upgradePrice = total
return total.toFixed(2)
}
}
}
</script>
<style scoped lang="scss">
.front-gear-box {
display: flex;
justify-content: space-between;
margin-top: toRpx(24);
.front-gear-input-box {
display: flex;
align-items: center;
.front-gear-label {
font-size: toRpx(24);
margin-right: toRpx(24);
color: #999999;
}
.front-gear-input {
position: relative;
display: flex;
border: toRpx(2) solid #eff0f2;
background-color: #fff;
font-size: toRpx(28);
height: toRpx(72);
width: toRpx(250);
line-height: toRpx(70);
text-align: right;
border-radius: toRpx(12);
.uni-input {
padding: 0 toRpx(32);
height: 100%;
}
.unit {
position: absolute;
top: 50%;
left: toRpx(32);
transform: translateY(-50%);
}
}
}
}
.package-list {
padding: toRpx(12) toRpx(32) toRpx(12) 0;
.package-item {
background-color: #f5f7fa;
border-radius: toRpx(16);
margin-bottom: toRpx(16);
.control {
margin-left: toRpx(32);
display: flex;
align-items: center;
.control-input {
width: toRpx(94);
height: toRpx(74);
background-color: #fff;
border: toRpx(2) solid #eff0f2;
padding: 0 toRpx(10);
text-align: center;
}
.minus,
.add {
width: toRpx(80);
height: toRpx(74);
line-height: toRpx(70);
text-align: center;
background-color: #fff;
border-top: toRpx(2) solid #eff0f2;
border-bottom: toRpx(2) solid #eff0f2;
}
.minus {
border-radius: toRpx(12) 0 0 toRpx(12);
border-left: toRpx(2) solid #eff0f2;
}
.add {
border-radius: 0 toRpx(12) toRpx(12) 0;
border-right: toRpx(2) solid #eff0f2;
}
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: toRpx(1.6) solid #dce1e6;
padding: toRpx(24);
&-left {
display: flex;
align-items: center;
font-size: toRpx(28);
.name {
margin-left: toRpx(26);
color: #333;
}
.price {
color: #666;
}
}
}
.goods-item {
padding: toRpx(24);
border-bottom: toRpx(1.6) solid #dce1e6;
&:last-child {
border-bottom: none;
}
.goods-name {
color: #ff781f;
font-size: toRpx(28);
}
.alias-name {
margin-top: toRpx(12);
font-size: toRpx(24);
color: #666;
}
}
}
}
</style>
<template>
<view>
<view :class="[list.length ? 'shop-list':'']">
<view class="shop-item" v-for="(item, index) in list" :key="item.goods.goodsId">
<view class="sprite-icon icon-blue-delete" @click="deleteGoods(index)"></view>
<view class="right">
<view class="shop-name">商品名称:{{ item.goods.goodsAlias || item.goods.upgradeGoodsName || item.goods.goodsInfo.goodsName }}</view>
<!-- <view class="alias">商品别名:{{ item.goods.goodsAlias }}</view> -->
<view class="front-gear-box">
<view class="front-gear-input-box">
<view class="front-gear-label" v-if="(item.goods.merchantGoodsPosition || item.goods.upgradeGoodsPosition) && (item.goods.goodsInfo.goodsType == 1 || item.goods.upgradeGoodsType == 1 || item.goods.goodsInfo.goodsType == baseConfigData.selfBuildFilmType || item.goods.upgradeGoodsType == baseConfigData.selfBuildFilmType)">
{{ formatPosition(item.goods.merchantGoodsPosition || item.goods.upgradeGoodsPosition, positionTypeList) }}
</view>
<view class="front-gear-input">
<view class="unit">¥</view>
<input class="uni-input" :disabled="isDisabled" type="digit" maxlength="9" placeholder="请输入价格" placeholder-style="font-size: 14px" v-model="item.goods.sellPrice" @blur="validatePrice($event, item, index)" />
</view>
</view>
<view class="control">
<view class="minus" @click="decreaseNumber(item)">-</view>
<input class="uni-input control-input" type="number" maxlength="3" v-model="item.goods.number" @blur="validateNumber($event, item)" />
<view class="add" @click="increaseNumber(item)">+</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'Product',
props: {
list: {
type: Array,
default: []
},
positionTypeList: {
type: Array,
default: []
},
baseConfigData: {
type: Object,
default: {}
},
isDisabled: {
type: Boolean,
default: false
}
},
created() {
// 初始化商品数量
this.initProductNumbers()
},
mounted() {
// 确保每次使用组件时都检查并设置number属性
this.initProductNumbers()
},
updated() {
// 当组件数据更新时也检查number属性
this.initProductNumbers()
},
methods: {
// 初始化商品数量方法
initProductNumbers() {
if (this.list && this.list.length > 0) {
this.list.forEach(item => {
if (!item.goods.number) {
this.$set(item.goods, 'number', '1')
}
})
}
},
circulation(data, str) {
let arr = str.split('.'),
result
if (arr.length) {
result = arr.reduce((pre, key) => {
return pre[key]
}, data)
}
return result
},
// 格式化位置信息
formatPosition(item, positionTypeList) {
const filterData = positionTypeList.filter(v => v.positionValue == item)
return (filterData.length && filterData[0] && filterData[0].positionName) || ''
},
// 验证价格输入
validatePrice(event, item, index) {
let value = event.detail.value
// 如果为空则设置为0
if (!value || value.trim() === '') {
value = '0'
}
// 限制只能输入数字和小数点
value = value.replace(/[^\d.]/g, '')
// 限制只能有一个小数点
if (value.split('.').length > 2) {
value = value.slice(0, value.lastIndexOf('.')) + value.slice(value.lastIndexOf('.') + 1)
}
// 限制最多两位小数
if (value.includes('.')) {
const parts = value.split('.')
if (parts[1].length > 2) {
parts[1] = parts[1].substring(0, 2)
value = parts.join('.')
}
}
// 限制最 大值为100000
if (parseFloat(value) > 100000) {
value = '100000'
}
// 限制最小值为0
if (parseFloat(value) < 0 || parseFloat(value) == 0) {
value = '0'
}
if (item.goods.validMinSellPrice === 'Y' && item.goods.minSellPrice && parseFloat(value) < parseFloat(item.goods.minSellPrice)) {
console.log('最小值', item.goods.minSellPrice)
uni.showToast({
title: '单价不可低于商品最低价',
icon: 'none'
})
value = item.goods.minSellPrice.toString()
}
// 更新值
// this.$set(item.goods, 'sellPrice', value)
this.$set(this.list[index].goods, 'sellPrice', value)
this.$emit('changeTotalPrice')
},
// 验证数量输入
validateNumber(event, item) {
let value = event.detail.value
// 限制只能输入整数
value = value.replace(/[^\d]/g, '')
// 如果为空或0,设置为1
if (!value || value.trim() === '' || parseInt(value) === 0) {
value = '1'
}
// 更新值
this.$set(item.goods, 'number', value)
this.$emit('changeTotalPrice')
},
// 增加数量
increaseNumber(item) {
if (!item.goods.number) {
this.$set(item.goods, 'number', '1')
} else {
const currentValue = parseInt(item.goods.number)
// 限制最大数量为999
const newValue = currentValue >= 999 ? 999 : currentValue + 1
this.$set(item.goods, 'number', newValue.toString())
}
this.$emit('changeTotalPrice')
},
// 减少数量
decreaseNumber(item) {
// 如果商品数量不存在或小于等于1,设置为1
if (!item.goods.number || parseInt(item.goods.number) <= 1) {
this.$set(item.goods, 'number', '1')
return
}
const currentValue = parseInt(item.goods.number)
// 确保减少后的值不小于1
const newValue = Math.max(1, currentValue - 1)
this.$set(item.goods, 'number', newValue.toString())
this.$emit('changeTotalPrice')
},
// 删除商品
deleteGoods(index) {
this.list.splice(index, 1)
this.$emit('changeTotalPrice')
}
}
}
</script>
<style scoped lang="scss">
.shop-list {
padding: toRpx(12) toRpx(32) toRpx(12) 0;
.shop-item {
display: flex;
align-items: center;
background-color: #f5f7fa;
border-radius: toRpx(16);
margin-bottom: toRpx(16);
padding: toRpx(24);
.right {
flex: 1;
font-size: toRpx(28);
margin-left: toRpx(24);
.shop-name {
color: #ff781f;
}
.alias {
margin-top: toRpx(12);
font-size: toRpx(24);
color: #666;
}
}
}
}
.front-gear-box {
display: flex;
justify-content: space-between;
margin-top: toRpx(24);
.front-gear-input-box {
display: flex;
align-items: center;
.front-gear-label {
font-size: toRpx(24);
margin-right: toRpx(24);
color: #999999;
}
.front-gear-input {
position: relative;
display: flex;
border: toRpx(2) solid #eff0f2;
background-color: #fff;
font-size: toRpx(28);
height: toRpx(72);
width: toRpx(250);
line-height: toRpx(70);
text-align: right;
border-radius: toRpx(12);
.uni-input {
padding: 0 toRpx(32);
height: 100%;
}
.unit {
position: absolute;
top: 50%;
left: toRpx(32);
transform: translateY(-50%);
}
}
}
.control {
display: flex;
align-items: center;
.control-input {
width: toRpx(94);
height: toRpx(74);
background-color: #fff;
border: toRpx(2) solid #eff0f2;
padding: 0 toRpx(10);
text-align: center;
}
.minus,
.add {
width: toRpx(80);
height: toRpx(74);
line-height: toRpx(70);
text-align: center;
background-color: #fff;
border-top: toRpx(2) solid #eff0f2;
border-bottom: toRpx(2) solid #eff0f2;
}
.minus {
border-radius: toRpx(12) 0 0 toRpx(12);
border-left: toRpx(2) solid #eff0f2;
}
.add {
border-radius: 0 toRpx(12) toRpx(12) 0;
border-right: toRpx(2) solid #eff0f2;
}
}
}
</style>
<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" type="text" @input="outTradeNoInput" class="uni-input" maxlength="150" 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.stop="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.stop="confirm">确定提交</view>
</view>
</template>
<script>
import { uploadFile } from '@/utils/ossUploadFile/uploadFile.js'
import { debounce } from 'lodash'
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)
}
})
},
outTradeNoInput(e) {
const filteredValue = e.detail.value.replace(/[\u4E00-\u9FA5]/g, '')
this.$nextTick(() => {
this.$set(this, 'outTradeNo', filteredValue)
})
console.log(this.outTradeNo)
},
// 上传付款凭证
async upLoad(event) {
console.log(event)
let _this = this
const { tempFilePaths } = event
let url = await uploadFile(tempFilePaths[0])
this.payVoucherList.push(url)
},
confirm: debounce(function (e) {
console.log(this.transmissionOfData)
let { outTradeNo, payVoucherList } = this
if (payVoucherList.length && outTradeNo) {
this.createPayOrder()
} else {
uni.showToast({ title: '交易流水号或付款凭证不能为空!', icon: 'none' })
}
}, 300),
deleteImg(index) {
this.payVoucherList.splice(index, 1)
},
createPayOrder() {
const { orderCode, payType, payeeType, successDate } = this.transmissionOfData
let obj = {
orderCode,
payType: payType,
payeeType: payeeType,
successDate
}
if (this.payVoucherList?.length && this.outTradeNo) {
obj.payVoucherList = this.payVoucherList
obj.outTradeNo = this.outTradeNo
}
uni.showLoading({
title: '提交中...',
mask: true
})
uni.$api.boutiqueApi.createPayOrder(obj).then(data => {
uni.hideLoading()
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>
<template>
<view class="detail-box">
<view class="nav-bar">
<view
class="back"
@click="backPage"
>
<uni-icons
type="left"
:size="20"
color="#000"
></uni-icons>
</view>
<view class="title">展业工具</view>
</view>
<view class="detail-content">
<view class="detail-left">
<view class="common-title">展业</view>
<view class="content">
<image
class="banner"
src="../../../assets/images/common/tool_banner.png"
mode="scaleToFill"
/>
<template v-if="toolComponentName !== 'DailyReport'">
<Entrance @entranceClick="entranceClick"></Entrance>
</template>
<template v-else>
<uni-calendar
ref="calendar"
:clearDate="false"
:endDate="endDate"
:showMonth="false"
@monthSwitch="currentMonth = `${$event.year}-${$event.month}`"
@change="currentDate = $event.fulldate"
backgroundColor="transparent"
:selected="selectedDays"
:date="currentDate"
/>
</template>
</view>
</view>
<view class="detail-right">
<component
:is="toolComponentName"
@jump="jump"
:transmission-of-data="transmissionOfData"
:currentDate="currentDate"
:currentMonth="currentMonth"
@setCalendarSelected="selectedDays = $event"
/>
</view>
</view>
<NoticePopup
ref="notice"
title="重要提示"
text="当前页面暂未保存,是否确认退出"
type="warning"
></NoticePopup>
</view>
</template>
<script>
import Entrance from '@/components/Entrance.vue'
import CreateOrder from './components/CreateOrder.vue'
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'
import dayjs from 'dayjs'
import { interceptionMixin } from '@/mixin/index'
export default {
mixins: [interceptionMixin],
components: {
Entrance,
CreateOrder,
DailyReport,
DefeatOrder,
OrderManagement,
ConfirmOrder,
NoticePopup,
UploadProofOfPayment,
OrderDetail
},
data () {
return {
toolComponentName: '',
transmissionOfData: null,
endDate: dayjs().format('YYYY-MM-DD'),
currentDate: dayjs().format('YYYY-MM-DD'),
currentMonth: dayjs().format('YYYY-MM'),
selectedDays: []
}
},
onLoad (options) {
if (options.componentName) this.toolComponentName = options.componentName
if (options.currentDate) this.setCurrentDate(options.currentDate)
uni.$on('jumpToDailyReport', currentDate => {
this.toolComponentName = 'DailyReport'
if (currentDate) this.setCurrentDate(currentDate)
})
},
methods: {
setCurrentDate (currentDate) {
this.currentDate = currentDate
this.currentMonth = dayjs(currentDate).format('YYYY-MM')
},
async entranceClick (item) {
const noInterceptPage = ['DailyReport']
if (!noInterceptPage.includes(item.name) && ((await this.checkDailyReport()) || (await this.inspectionOfProhibitionBill()))) return
// 保存当前选择的组件信息,但不立即切换
const selectedItem = item
if (this.toolComponentName === selectedItem.name && (!this.transmissionOfData || this.transmissionOfData.type !== 'supplementOrder')) return
// 如果当前组件是OrderManagement,直接切换组件,不显示弹窗
// 只有从CreateOrder、DefeatOrder切换其他组件时需要二次确认
if (this.toolComponentName !== 'CreateOrder' && this.toolComponentName !== 'DefeatOrder') {
this.toolComponentName = selectedItem.name
this.transmissionOfData = null
return
}
// 配置弹窗按钮
this.$refs.notice.buttonsList = [
{
text: '确认退出',
type: 'default',
callback: () => {
// 点击确认后才切换组件
this.toolComponentName = selectedItem.name
// if (selectedItem.name !== 'CreateOrder') {
// this.transmissionOfData = null
// }else {
// console.log(111)
// this.transmissionOfData = null
// }
this.transmissionOfData = null
this.$refs.notice.close()
}
},
{
text: '继续编辑',
type: 'primary',
callback: () => {
this.$refs.notice.close()
}
}
]
// 打开弹窗
this.$refs.notice.open()
},
backPage () {
uni.navigateBack()
},
// name:跳转组件名,val:跳转参数
jump (name, val) {
this.toolComponentName = name
console.log(this.toolComponentName, val)
if (val) {
this.transmissionOfData = val
}
}
}
}
</script>
<style scoped lang="scss">
.detail-content {
display: flex;
height: calc(100vh - #{toRpx(212)});
.detail-left {
width: toRpx(800);
height: 100%;
border-radius: toRpx(48);
background: #ffffff59;
box-shadow: inset 0 0 toRpx(16) 0 #ffffff;
margin-right: toRpx(32);
z-index: 1;
overflow: hidden;
.content {
padding: 0 toRpx(48);
.banner {
width: toRpx(704);
height: toRpx(296);
margin-top: toRpx(10);
margin-bottom: toRpx(64);
}
}
}
.detail-right {
width: toRpx(1368);
height: 100%;
border-radius: toRpx(48);
background: #ffffff59;
box-shadow: inset 0 0 toRpx(16) 0 #ffffff;
z-index: 1;
overflow: hidden;
}
.common-title {
display: flex;
align-items: center;
justify-content: space-between;
font-size: toRpx(34);
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!