Commit b9d92736 by 岑成威

fix:zhinengti

1 parent 0f5a6103
No preview for this file type
No preview for this file type

3.22 MB | W: | H:

3.23 MB | W: | H:

assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
<!-- 异常订单 -->
<template>
<view v-if="show" class="error-order-popup-mask" @click="handleMaskClick">
<view
class="error-order-popup-content"
<view
class="error-order-popup-content"
:style="contentStyle"
@click.stop
>
<!-- 顶部图片 -->
......@@ -46,7 +46,7 @@
},
height: {
type: [Number, String],
default: 1054
default: null
},
title: {
type: String,
......@@ -75,10 +75,13 @@
},
computed: {
contentStyle() {
return {
width: this.formatSize(this.width),
minHeight: this.formatSize(this.height)
const style = {
width: this.formatSize(this.width)
}
if (this.height != null && this.height !== '') {
style.minHeight = this.formatSize(this.height)
}
return style
},
topImageStyle() {
return {
......
......@@ -144,7 +144,7 @@
</template>
</ErrorOrderPopup>
<!-- #ifdef APP-PLUS -->
<AiAssistantBall :visible="showAiAssistant" />
<AiAssistantBall :visible="showAiAssistant && sceneType == 1" />
<!-- #endif -->
<FloatLogPanel v-if="showFloatLog" />
</view>
......
......@@ -39,6 +39,10 @@
:class="['item flex', { active: checkActive(i) }]"
>
<view class="sprite-icon icon-tag-checked"></view>
<view
v-if="shouldShowMarketingIcon(i)"
class="sprite-icon icon-activeIcon marketing-icon"
></view>
<text class="goods-name text-hide">
{{ replaceItemText(i.goods, 'goodsAlias') || replaceItemText(i.goods, 'upgradeGoodsName') || replaceItemText(i.goodsInfo, 'goodsName') }}
</text>
......@@ -59,6 +63,7 @@
<script type="text/ecmascript-6">
import popupmixin from './popupmixin'
import { snapshotOriginalPrice } from '@/utils/marketingFlag'
export default {
mixins: [popupmixin],
name: 'GoodsList',
......@@ -168,6 +173,7 @@ export default {
subVal.positionStr = subVal.position
subVal.upgradePrice = subVal.sellPrice
subVal.price = subVal.sellPrice
snapshotOriginalPrice(subVal)
subVal.goodsId = subVal.merchantGoodsId
if (goodsType.includes(subVal.merchantGoodsPosition)) arr.push(val)
}
......@@ -260,6 +266,12 @@ export default {
.price {
margin-left: auto;
}
.marketing-icon {
display: inline-block !important;
position: static !important;
margin-right: toRpx(8);
flex-shrink: 0;
}
.goods-name {
max-width: toRpx(600);
}
......
......@@ -23,6 +23,14 @@ export default {
methods: {
async getList () {
const params = this.params
if (this.boutiqueOrderTypesOnly) {
const data = [
{ name: '正常订单', value: '1' },
{ name: '内部结算', value: '6' }
]
this.updateParams(params, data)
return
}
let flag = null
let hasStorage = !!(uni && uni.$storage && uni.$storage.get)
// 默认支持所有订单类型
......
......@@ -23,7 +23,11 @@
class="filled"
></uni-icons>
</view>
{{item.packageGoods.packageAlias||item.packageGoods.packageName}}
<view
v-if="shouldShowMarketingIcon(item)"
class="sprite-icon icon-activeIcon marketing-icon"
></view>
<text class="package-name">{{item.packageGoods.packageAlias||item.packageGoods.packageName}}</text>
<text class="price">¥{{item.packageGoods.upgradePrice}}</text>
</view>
<view class="package-list">
......@@ -32,7 +36,9 @@
class="package-item flex"
:key="ind"
>
<view class="name">{{i.goodsAlias||i.upgradeGoodsAlias||i.upgradeGoodsName}}</view>
<view class="name flex align-center">
<text>{{i.goodsAlias||i.upgradeGoodsAlias||i.upgradeGoodsName}}</text>
</view>
<view class="price">¥{{i.sellPrice}}</view>
</view>
</template>
......@@ -47,6 +53,7 @@
<script type='text/ecmascript-6'>
import NP from 'number-precision'
import popupmixin from './popupmixin'
import { snapshotOrderItemOriginalPrice } from '@/utils/marketingFlag'
export default {
mixins: [popupmixin],
name: 'PackageList',
......@@ -67,11 +74,22 @@ export default {
if (searchValue) this.handleSearch(searchValue)
return
}
const { shopMerchantId, sceneType } = userInfo,
const { shopMerchantId, sceneType } = userInfo
const baseSceneCode = this.data?.baseSceneCodeValue || this.data?.baseSceneCode
let data = []
if (baseSceneCode) {
data = await uni.$api.boutiqueApi.getSelectOrderGoodsList({
merchantId: shopMerchantId,
sceneType,
baseSceneCode
})
} else {
data = await uni.$api.popupApi.getGoodsList({
merchantId: shopMerchantId,
sceneType
sceneType,
baseSceneCode
})
}
this.updateParams(params, data || [])
},
handleSearch (searchValue) {
......@@ -100,6 +118,7 @@ export default {
prev = NP.plus(prev + cur.sellPrice);
return prev;
}, 0), 2)
snapshotOrderItemOriginalPrice(val)
arr.push(val)
}
})
......@@ -160,11 +179,26 @@ export default {
.price {
margin-left: auto;
}
.marketing-icon {
display: inline-block !important;
flex-shrink: 0;
margin-right: toRpx(8);
}
.title {
height: toRpx(88);
padding: toRpx(24) 0 toRpx(20);
align-items: center;
min-width: 0;
.icon {
margin-right: toRpx(16);
flex-shrink: 0;
}
.package-name {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.filled {
display: none;
......@@ -182,6 +216,10 @@ export default {
padding: toRpx(24) 0;
border-bottom: toRpx(2) solid #f0f0ef;
padding-right: toRpx(32);
.name {
flex: 1;
min-width: 0;
}
.price {
margin-left: auto;
}
......
......@@ -28,6 +28,10 @@
class="filled"
></uni-icons>
</view>
<view
v-if="shouldShowMarketingIcon(i)"
class="sprite-icon icon-activeIcon marketing-icon"
></view>
<text class="goods-name">
<template v-if="sceneType == 1">
{{ replaceItemText(i.goods, 'goodsAlias')
......@@ -68,6 +72,10 @@
class="filled"
></uni-icons>
</view>
<view
v-if="shouldShowMarketingIcon(i)"
class="sprite-icon icon-activeIcon marketing-icon"
></view>
{{ i.multipleSpecificationsGoods.baseGoodsName }}
<template v-if="i.multipleSpecificationsGoods.goods && i.multipleSpecificationsGoods.goods.sellPrice">
<text class="price">¥{{ i.multipleSpecificationsGoods.goods.sellPrice }}</text>
......@@ -132,6 +140,10 @@
class="filled"
></uni-icons>
</view>
<view
v-if="shouldShowMarketingIcon(i)"
class="sprite-icon icon-activeIcon marketing-icon"
></view>
<text class="goods-name">
{{ i.packageGoods.packageAlias || i.packageGoods.packageName }}
</text>
......@@ -143,15 +155,15 @@
class="package-item flex"
:key="`${index}_${specificIndex}`"
>
<view class="label">
{{
<view class="label flex align-center">
<text>{{
replaceItemText(specific, 'goodsAlias')
|| replaceItemText('','',
specific.upgradeGoodsName +( specific.specificationData ? ('/'+specific.specificationData): '')
)
|| replaceItemText('','',
specific.goodsInfo.goodsName+( specific.specificationData? ('/'+specific.specificationData): '')
)}}
)}}</text>
</view>
<view class="value flex">
¥{{ specific.sellPrice }}
......@@ -170,6 +182,7 @@
<script type="text/ecmascript-6">
import popupmixin from './popupmixin'
import NP from 'number-precision'
import { snapshotOriginalPrice, snapshotOrderItemOriginalPrice } from '@/utils/marketingFlag'
export default {
mixins: [popupmixin],
name: 'SkuGoodsList',
......@@ -270,6 +283,7 @@ export default {
subVal.positionStr = subVal.position
subVal.upgradePrice = subVal.sellPrice
subVal.price = subVal.sellPrice
snapshotOriginalPrice(subVal)
subVal.goodsId = subVal.merchantGoodsId || subVal.id
if (![1, 2, 3, 4, 5, 6, 7].includes(subVal.merchantGoodsPosition)) {
arr.push(val)
......@@ -309,6 +323,7 @@ export default {
pre = NP.plus(pre, item.sellPrice)
return pre
}, 0)
snapshotOrderItemOriginalPrice(val)
arr.push(val)
}
})
......@@ -432,6 +447,7 @@ export default {
goodsList[index].multipleSpecificationsGoods.goods = goodsArr[0]
goodsList[index].multipleSpecificationsGoods.goods.goodsId = goodsList[index].multipleSpecificationsGoods.goods.merchantGoodsId
goodsList[index].multipleSpecificationsGoods.goods.specificationStr = goodsList[index].multipleSpecificationsGoods.goods.specificationData.replace(/;~;/g, '/')
snapshotOriginalPrice(goodsList[index].multipleSpecificationsGoods.goods)
if (addIndex == -1) this.chooseList.push(goodsList[index])
else this.chooseList[addIndex] = goodsList[index]
this.$emit('choose', this.chooseList)
......@@ -571,6 +587,12 @@ export default {
font-weight: 600;
}
.marketing-icon {
display: inline-block !important;
flex-shrink: 0;
margin-right: toRpx(8);
}
.title {
min-height: toRpx(88);
padding: toRpx(24) 0 toRpx(20);
......
import { shouldShowMarketingIcon as checkMarketingIcon } from '@/utils/marketingFlag'
export default {
inject: ['userInfo', 'baseConfigData'],
inject: {
userInfo: { default: () => ({}) },
baseConfigData: { default: () => ({}) }
},
data () {
return {
list: [],
......@@ -16,6 +21,14 @@ export default {
dataKey: String,
isDefeatOrder: Boolean,
positionTypeList: Array,
showMarketingIcon: {
type: Boolean,
default: false
},
boutiqueOrderTypesOnly: {
type: Boolean,
default: false
}
},
computed: {
listData () {
......@@ -49,6 +62,9 @@ export default {
componentLoading (params) {
params.loadComplete = false
this.$emit('update:params', this.params)
},
shouldShowMarketingIcon(item) {
return checkMarketingIcon(item, this.showMarketingIcon)
}
}
......
......@@ -17,7 +17,7 @@
</template>
<view v-if="componentObject[popupType]" :class="['popup-body', { 'hide-footer': componentObject[popupType].hideFooter }, { 'hide-search': componentObject[popupType].hideSearch }, { 'hide-footer-search': componentObject[popupType].hideFooter && componentObject[popupType].hideSearch }]">
<scroll-view scroll-y :class="['popup-scroll-view', { show: componentObject[popupType].loadComplete }]">
<component :is="componentObject[popupType].name" :params.sync="componentObject[popupType]" :data="data" :dataKey="dataKey" :isDefeatOrder="isDefeatOrder" :defaultTime="defaultTime" :positionTypeList="positionTypeList" ref="componentRef" @choose="chooseContent = $event" @openSkuPopup="openSkuPopup" @onComplete="componentObject[popupType].loadComplete = true" @confirm="confirm"></component>
<component :is="componentObject[popupType].name" :params.sync="componentObject[popupType]" :data="data" :dataKey="dataKey" :isDefeatOrder="isDefeatOrder" :defaultTime="defaultTime" :positionTypeList="positionTypeList" :show-marketing-icon="showMarketingIcon" :boutique-order-types-only="boutiqueOrderTypesOnly" ref="componentRef" @choose="chooseContent = $event" @openSkuPopup="openSkuPopup" @onComplete="componentObject[popupType].loadComplete = true" @confirm="confirm"></component>
<template v-if="componentObject[popupType].noData">
<view class="nothing flex">暂无数据</view>
</template>
......@@ -102,14 +102,23 @@ export default {
default: false
},
defaultTime: String,
popupTitle: String
popupTitle: String,
showMarketingIcon: {
type: Boolean,
default: false
},
boutiqueOrderTypesOnly: {
type: Boolean,
default: false
}
},
provide () {
return {
userInfo: this.userInfo,
baseConfigData: this.baseConfigData,
sceneType: this.sceneType
sceneType: this.sceneType,
showMarketingIcon: this.showMarketingIcon
}
},
data () {
......
......@@ -18,12 +18,16 @@
</view>
</view>
<view>
<view class="goods-list" :style="{ paddingBottom: orderCardDetail.subOrderList && orderCardDetail.subOrderList.length < 1 ? '0' : '' }" v-if="orderCardDetail.subOrderList && orderCardDetail.subOrderList.length > 0">
<view class="goods-list" :style="{ paddingBottom: cardGoodsList.length < 1 ? '0' : '' }" v-if="cardGoodsList.length > 0">
<view>
<view v-for="(i, sindex) in orderCardDetail.subOrderList" :key="sindex" class="goods flex justify-between" :class="{ 'no-margin': orderCardDetail.subOrderList.length === 1 }" v-if="orderCardDetail.showAllGoodsListFlag ? true : sindex < 2">
<view class="goods-name text-hide flex">
<view v-for="(i, sindex) in cardGoodsList" :key="sindex" class="goods flex justify-between" :class="{ 'no-margin': cardGoodsList.length === 1 }" v-if="orderCardDetail.showAllGoodsListFlag ? true : sindex < 2">
<view class="goods-name flex align-center">
<view class="point"></view>
{{ i.upgradeGoodsAlias || i.upgradeGoodsName || i.packageName || '' }}
<view
v-if="shouldShowMarketingIcon(i)"
class="sprite-icon icon-activeIcon marketing-icon"
></view>
<text class="goods-name-text text-hide">{{ getGoodsDisplayName(i) }}</text>
</view>
<view class="goods-price">
¥
......@@ -31,11 +35,11 @@
</view>
</view>
<view v-if="orderCardDetail.subOrderList.length > 2" class="goods-more">
<view v-if="cardGoodsList.length > 2" class="goods-more">
<text @click.stop="showAllGoodsList">
{{ orderCardDetail.showAllGoodsListFlag ? '收起' : '查看全部' }}
</text>
(共{{ orderCardDetail.subOrderList.length }}件)
(共{{ cardGoodsList.length }}件)
</view>
</view>
</view>
......@@ -161,6 +165,7 @@ import { checkDailyReport, showNextModal } from '@/utils/modalUtils'
import PublishPopup from '@/components/PublishPopup.vue'
import StudyPopup from '@/components/StudyPopup.vue'
import StudyCenterPermissionPopup from '@/components/StudyCenterPermissionPopup.vue'
import { shouldShowMarketingIcon as checkMarketingIcon } from '@/utils/marketingFlag'
import { debounce } from 'lodash'
export default {
mixins: [interceptionMixin],
......@@ -188,6 +193,16 @@ export default {
},
orderType() {
return order_mixins.data.orderType || {}
},
cardGoodsList() {
const detail = this.orderCardDetail || {}
const subList = detail.subOrderList || []
const packageList = detail.packageGoodsList || []
const singles = subList.filter(item => item.merchantGoodsId && !item.packageName && !item.packageAlias)
if (packageList.length) {
return [...singles, ...packageList]
}
return subList
}
},
data() {
......@@ -252,6 +267,13 @@ export default {
this.localUserInfo = uni.$storage.get('userInfo')
},
methods: {
shouldShowMarketingIcon(item) {
return checkMarketingIcon(item, true)
},
getGoodsDisplayName(item) {
if (!item) return ''
return item.upgradeGoodsAlias || item.upgradeGoodsName || item.packageAlias || item.packageName || ''
},
// 查看全部商品
showAllGoodsList: debounce(function (e) {
this.$emit('toggle-goods-list', {
......@@ -637,7 +659,12 @@ export default {
margin-bottom: 0;
}
.goods-name {
flex: 1;
min-width: 0;
margin-right: toRpx(16);
.point {
flex-shrink: 0;
width: toRpx(12);
height: toRpx(12);
opacity: 1;
......@@ -646,6 +673,17 @@ export default {
background: #4673ff;
margin-right: toRpx(16);
}
.marketing-icon {
display: inline-block !important;
flex-shrink: 0;
margin-right: toRpx(8);
}
.goods-name-text {
flex: 1;
min-width: 0;
}
}
}
.goods-more {
......
......@@ -30,7 +30,13 @@
<!-- 套餐 -->
<view class="meal-box" v-for="(item, index) in orderInfo.packageGoodsList">
<view class="meal-hd flex justify-between align-center">
<view>{{ item.packageAlias || item.packageName }}</view>
<view class="meal-hd-name flex align-center">
<view
v-if="shouldShowMarketingIcon(item)"
class="sprite-icon icon-activeIcon marketing-icon"
></view>
<view>{{ item.packageAlias || item.packageName }}</view>
</view>
<view class="price">¥{{ item.finalPrice }}</view>
</view>
<view class="meal-bd">
......@@ -52,7 +58,13 @@
<view class="good-list">
<view class="good mt-16" v-for="(item, index) in orderInfo.subOrderList">
<view class="flex justify-between align-center">
<text class="good-name">商品名称:{{ replaceItemText(item.upgradeGoodsName) || '' }}</text>
<view class="good-name flex align-center">
<view
v-if="shouldShowMarketingIcon(item)"
class="sprite-icon icon-activeIcon marketing-icon"
></view>
<text class="good-name-text text-hide">商品名称:{{ replaceItemText(item.upgradeGoodsName) || '' }}</text>
</view>
<text class="good-price">¥{{ item.price }}</text>
</view>
<view class="flex justify-between align-center pt-12">
......@@ -215,6 +227,7 @@ import order_mixins from '../../order_mixins.js'
import dayjs from 'dayjs'
import PublishPopup from '@/components/PublishPopup.vue'
import OrderPopup from '@/components/OrderPopup/index.vue'
import { shouldShowMarketingIcon as checkMarketingIcon } from '@/utils/marketingFlag'
import { debounce } from 'lodash'
export default {
name: 'OrderConfirm',
......@@ -264,6 +277,9 @@ export default {
// this.successDate = dayjs().format('YYYY-MM-DD HH:mm:ss')
},
methods: {
shouldShowMarketingIcon(item) {
return checkMarketingIcon(item, true)
},
replaceItemText(item) {
var reg = getRegExp(';~;', 'g')
return item ? item.replace(reg, ' ') : ''
......@@ -863,11 +879,22 @@ export default {
padding: toRpx(24) toRpx(32);
box-sizing: border-box;
margin-top: toRpx(16);
.marketing-icon {
display: inline-block !important;
flex-shrink: 0;
margin-right: toRpx(8);
}
.meal-hd {
color: #333333;
font-size: toRpx(32);
font-weight: 400;
margin-bottom: toRpx(20);
.meal-hd-name {
flex: 1;
min-width: 0;
}
.price {
font-weight: 500;
}
......@@ -884,6 +911,7 @@ export default {
color: #333333;
font-size: toRpx(28);
font-weight: 400;
min-width: 0;
}
.meal-bd-bottom {
color: #999999;
......@@ -913,9 +941,21 @@ export default {
.good-name {
font-weight: 400;
flex: 4;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
.good-name-text {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.marketing-icon {
display: inline-block !important;
flex-shrink: 0;
margin-right: toRpx(8);
}
.good-price {
font-weight: 500;
......
<template>
<uni-popup ref="popup" type="right" :mask-click="false" @change="onPopupChange">
<view class="approval-drawer">
<view class="drawer-header">
<text class="drawer-title">审批商品</text>
<uni-icons class="close-icon" type="closeempty" size="20" color="#999EA8" @click="close" />
<view class="drawer-desc">该订单将提交总部运营审批,审批通过后订单生效</view>
</view>
<scroll-view scroll-y class="drawer-body">
<view class="approval-list">
<view
v-for="(item, index) in list"
:key="index"
class="approval-card"
>
<view class="card-main">
<view class="card-left">
<view class="name-row">
<view class="dot"></view>
<view class="name-block">
<view class="name-tag-wrap">
<text class="name">{{ item.name }}</text>
<view
v-if="shouldShowMarketingIcon(item.sourceItem)"
class="sprite-icon icon-activeIcon marketing-icon"
></view>
</view>
<view
v-if="item.type === 'single' && hasMinSellPrice(item.minSellPrice)"
class="min-price"
>活动价 ¥ {{ item.minSellPrice }}</view>
</view>
</view>
</view>
<view class="card-right">
<view class="current-price">¥ {{ item.sellPrice }}</view>
<view v-if="item.type === 'single'" class="quantity">共 {{ item.number }} 件</view>
</view>
</view>
<view v-if="item.type === 'package'" class="package-children">
<view
v-for="(child, childIndex) in item.children"
:key="childIndex"
class="package-child"
>
<view class="child-left">
<view class="child-name-row">
<view class="child-name">{{ child.name }}</view>
</view>
<view
v-if="hasMinSellPrice(child.minSellPrice)"
class="min-price"
>活动价 ¥ {{ child.minSellPrice }}</view>
</view>
<view class="card-right">
<view class="current-price">¥ {{ child.sellPrice }}</view>
<view class="quantity">共 {{ child.number }} 件</view>
</view>
</view>
</view>
</view>
</view>
</scroll-view>
<view class="drawer-footer">
<view class="footer-btn cancel" @click="close">取消</view>
<view class="footer-btn submit" @click="handleSubmit">提交</view>
</view>
</view>
</uni-popup>
</template>
<script>
import { shouldShowMarketingIcon as checkMarketingIcon } from '@/utils/marketingFlag'
export default {
name: 'MinPriceApprovalDrawer',
props: {
list: {
type: Array,
default: () => []
}
},
methods: {
hasMinSellPrice(value) {
return value != null && value !== ''
},
shouldShowMarketingIcon(item) {
return checkMarketingIcon(item, true)
},
open() {
this.$refs.popup.open()
},
close() {
this.$refs.popup.close()
},
onPopupChange(e) {
this.$emit('change', e)
},
handleSubmit() {
this.$emit('submit')
this.close()
}
}
}
</script>
<style lang="scss" scoped>
.approval-drawer {
width: toRpx(1040);
height: 100vh;
display: flex;
flex-direction: column;
background: #fff;
border-radius: toRpx(48) 0 0 toRpx(48);
overflow: hidden;
}
.drawer-header {
position: relative;
flex-shrink: 0;
padding: toRpx(48) toRpx(64) toRpx(32);
background: #ffffff;
background-size: 100% auto;
border-radius: toRpx(48) 0 0 0;
}
.drawer-title {
display: block;
text-align: center;
font-size: toRpx(40);
font-weight: 500;
color: #292d33;
line-height: toRpx(56);
}
.close-icon {
position: absolute;
right: toRpx(48);
top: toRpx(56);
}
.drawer-desc {
margin-top: toRpx(16);
text-align: left;
color: #5A5E66;
font-size: toRpx(30);
line-height: 1.5;
}
.drawer-body {
flex: 1;
min-height: 0;
box-sizing: border-box;
}
.approval-list {
padding: toRpx(8) toRpx(32) toRpx(32);
box-sizing: border-box;
}
.approval-card {
background: #f7f8fa;;
border-radius: toRpx(16);
padding: toRpx(32);
box-sizing: border-box;
& + .approval-card {
margin-top: toRpx(24);
}
}
.card-main,
.package-child {
display: flex;
align-items: flex-start;
justify-content: space-between;
}
.card-left,
.child-left {
flex: 1;
min-width: 0;
}
.name-row {
display: flex;
align-items: flex-start;
}
.dot {
flex-shrink: 0;
width: toRpx(12);
height: toRpx(12);
margin-top: toRpx(14);
margin-right: toRpx(16);
border-radius: 50%;
background: #4673ff;
}
.name-block {
flex: 1;
min-width: 0;
}
.name-tag-wrap,
.child-name-row {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: toRpx(12);
}
.marketing-icon {
display: inline-block !important;
flex-shrink: 0;
}
.name,
.child-name {
color: #222;
font-size: toRpx(32);
font-weight: 500;
line-height: 1.5;
word-break: break-word;
}
.activity-tag {
flex-shrink: 0;
padding: 0 toRpx(12);
height: toRpx(36);
line-height: toRpx(36);
border-radius: toRpx(8);
background: #ff8a1f;
color: #ffffff;
font-size: toRpx(22);
font-weight: 500;
}
.min-price {
margin-top: toRpx(12);
color: #999ea8;
font-size: toRpx(28);
line-height: 1.4;
}
.card-right {
flex-shrink: 0;
margin-left: toRpx(24);
text-align: right;
}
.current-price {
color: #292d33;
font-size: toRpx(32);
font-weight: 500;
line-height: 1.4;
white-space: nowrap;
}
.quantity {
margin-top: toRpx(8);
color: #999ea8;
font-size: toRpx(24);
line-height: 1.4;
white-space: nowrap;
}
.package-children {
margin-top: toRpx(24);
padding-top: toRpx(8);
border-top: toRpx(2) solid #f0f1f5;
}
.package-child {
padding: toRpx(24) 0;
&:last-child {
padding-bottom: 0;
}
& + .package-child {
border-top: toRpx(2) solid #f0f1f5;
}
}
.drawer-footer {
flex-shrink: 0;
display: flex;
gap: toRpx(24);
padding: toRpx(24) toRpx(40);
padding-bottom: toRpx(64);
background: #ffffff;
box-sizing: border-box;
.footer-btn {
flex: 1;
height: toRpx(88);
line-height: toRpx(88);
border-radius: toRpx(64);
text-align: center;
font-size: toRpx(32);
font-weight: 400;
}
.cancel {
background: #f0f1f5;
color: #666666;
}
.submit {
color: #ffffff;
background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
}
}
</style>
......@@ -65,7 +65,13 @@
<!-- 套餐 -->
<view class="meal-box" v-for="(item, index) in orderInfo.packageGoodsList">
<view class="meal-hd flex justify-between align-center">
<view>{{ item.packageAlias || item.packageName }}</view>
<view class="meal-hd-name flex align-center">
<view
v-if="shouldShowMarketingIcon(item)"
class="sprite-icon icon-activeIcon marketing-icon"
></view>
<view>{{ item.packageAlias || item.packageName }}</view>
</view>
<view class="price">¥{{ item.finalPrice }}</view>
</view>
<view class="meal-bd">
......@@ -87,7 +93,13 @@
<view class="good-list">
<view class="good" v-for="(item, index) in orderInfo.subOrderList" :key="index">
<view class="flex justify-between align-center mb-20">
<text class="good-name">商品名称:{{ replaceItemText(item.upgradeGoodsName) || '' }}</text>
<view class="good-name flex align-center">
<view
v-if="shouldShowMarketingIcon(item)"
class="sprite-icon icon-activeIcon marketing-icon"
></view>
<text class="good-name-text text-hide">商品名称:{{ replaceItemText(item.upgradeGoodsName) || '' }}</text>
</view>
<text class="good-price">¥{{ item.finalPrice }}</text>
</view>
<view class="flex justify-between align-center mb-12" v-if="item.upgradeGoodsAlias">
......@@ -308,6 +320,7 @@ import order_mixins from '../../order_mixins.js'
import dayjs from 'dayjs'
import { index } from '@/env'
import PublishPopup from '@/components/PublishPopup.vue'
import { shouldShowMarketingIcon as checkMarketingIcon } from '@/utils/marketingFlag'
export default {
name: 'OrderDetail',
components: {
......@@ -377,6 +390,9 @@ export default {
},
async mounted() {},
methods: {
shouldShowMarketingIcon(item) {
return checkMarketingIcon(item, true)
},
replaceItemText(item) {
var reg = getRegExp(';~;', 'g')
return item ? item.replace(reg, ' ') : ''
......@@ -1164,11 +1180,21 @@ export default {
padding: toRpx(24) toRpx(32);
box-sizing: border-box;
margin-top: toRpx(16);
.marketing-icon {
display: inline-block !important;
flex-shrink: 0;
margin-right: toRpx(8);
}
.meal-hd {
color: #333333;
font-size: toRpx(32);
font-weight: 400;
margin-bottom: toRpx(20);
.meal-hd-name {
flex: 1;
min-width: 0;
}
.price {
font-weight: 500;
}
......@@ -1185,6 +1211,7 @@ export default {
color: #333333;
font-size: toRpx(28);
font-weight: 400;
min-width: 0;
}
.meal-bd-bottom {
color: #999999;
......@@ -1215,9 +1242,21 @@ export default {
.good-name {
font-weight: 400;
flex: 4;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
.good-name-text {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.marketing-icon {
display: inline-block !important;
flex-shrink: 0;
margin-right: toRpx(8);
}
.good-price {
font-weight: 500;
......
......@@ -5,6 +5,10 @@
<view class="header">
<view class="header-left">
<view class="sprite-icon icon-blue-delete" @click="deleteGoods(index)"></view>
<view
v-if="shouldShowMarketingIcon(item)"
class="sprite-icon icon-activeIcon marketing-icon"
></view>
<view class="name">{{ item.packageGoods.packageAlias || item.packageGoods.packageName }}</view>
<view class="control">
<view class="minus" @click="decreaseNumber(item)">-</view>
......@@ -12,7 +16,9 @@
<view class="add" @click="increaseNumber(item)">+</view>
</view>
</view>
<view class="price">¥{{ changeTotal(item) }}</view>
<view class="price flex align-center">
<text>¥{{ changeTotal(item) }}</text>
</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>
......@@ -36,6 +42,8 @@
<script>
import utils from '@/utils/utils'
import OrderStrategy from './OrderStrategy.vue'
import { shouldShowMarketingIcon as checkMarketingIcon, snapshotOriginalPrice } from '@/utils/marketingFlag'
import { isBelowMinSellPrice, normalizeGoodsPrice, shouldUseMinPriceApproval, applyLegacyMinSellPriceClamp } from '@/utils/minSellPrice'
export default {
name: 'Package',
......@@ -54,6 +62,10 @@ export default {
orderTypeCode: {
type: [String, Number],
default: ''
},
showMarketingIcon: {
type: Boolean,
default: false
}
},
created() {
......@@ -127,11 +139,9 @@ export default {
if (!item.packageGoods.number) {
this.$set(item.packageGoods, 'number', '1')
}
// 存储旧值
// 仅首次快照原价,避免 updated 时把改价后的 sellPrice 写回 oldPrice
item.packageGoods.goodsList.forEach(goods => {
if (!goods.price) {
goods.oldPrice = goods.sellPrice
}
snapshotOriginalPrice(goods)
})
})
}
......@@ -186,43 +196,14 @@ export default {
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('.')
let value = normalizeGoodsPrice(event.detail.value)
if (shouldUseMinPriceApproval(this.orderTypeCode)) {
if (isBelowMinSellPrice(goods, value)) {
this.$emit('min-price-warning', value)
}
} else {
value = applyLegacyMinSellPriceClamp(goods, value)
}
// 限制最大值为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)
// 价格变动时,清空该商品的折扣/买赠/抵扣配置,并按原价重算 finalPrice
......@@ -468,6 +449,9 @@ export default {
}
})
})
},
shouldShowMarketingIcon(item) {
return checkMarketingIcon(item, this.showMarketingIcon)
}
}
}
......@@ -574,10 +558,17 @@ export default {
margin-left: toRpx(26);
color: #333;
}
}
.price {
color: #666;
}
.price {
color: #666;
}
.marketing-icon {
display: inline-block !important;
margin-right: toRpx(8);
margin-left: toRpx(8);
flex-shrink: 0;
}
}
......
......@@ -5,7 +5,13 @@
<view class="flex flex-1 pb-24">
<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="shop-name flex align-center">
<view
v-if="shouldShowMarketingIcon(item)"
class="sprite-icon icon-activeIcon marketing-icon"
></view>
<text class="text-hide flex-1">商品名称:{{ item.goods.goodsAlias || item.goods.upgradeGoodsName || item.goods.goodsInfo.goodsName }}</text>
</view>
<!-- <view class="alias">商品别名:{{ item.goods.goodsAlias }}</view> -->
<view class="front-gear-box">
<view class="front-gear-input-box">
......@@ -35,6 +41,8 @@
<script>
import utils from '@/utils/utils'
import OrderStrategy from './OrderStrategy.vue'
import { shouldShowMarketingIcon as checkMarketingIcon } from '@/utils/marketingFlag'
import { isBelowMinSellPrice, normalizeGoodsPrice, shouldUseMinPriceApproval, applyLegacyMinSellPriceClamp } from '@/utils/minSellPrice'
export default {
name: 'Product',
......@@ -58,6 +66,10 @@ export default {
orderTypeCode: {
type: [String, Number],
default: ''
},
showMarketingIcon: {
type: Boolean,
default: false
}
},
components: {
......@@ -255,48 +267,16 @@ export default {
},
// 验证价格输入
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('.')
let value = normalizeGoodsPrice(event.detail.value)
if (shouldUseMinPriceApproval(this.orderTypeCode)) {
if (isBelowMinSellPrice(item.goods, value)) {
this.$emit('min-price-warning', value)
}
} else {
value = applyLegacyMinSellPriceClamp(item.goods, value)
}
// 限制最 大值为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(this.list[index].goods, 'sellPrice', value)
// 商品价格修改时,清空折扣 / 抵扣配置,避免旧的优惠继续生效
this.resetStrategyWhenPriceChange(this.list[index])
// 价格变化时,如果已选择订单类型,触发策略组件重新计算价格
this.$forceUpdate()
this.$emit('changeTotalPrice')
},
......@@ -377,6 +357,9 @@ export default {
deleteGoods(index) {
this.list.splice(index, 1)
this.$emit('changeTotalPrice')
},
shouldShowMarketingIcon(item) {
return checkMarketingIcon(item, this.showMarketingIcon)
}
}
}
......@@ -401,6 +384,12 @@ export default {
color: #ff781f;
}
.marketing-icon {
display: inline-block !important;
margin-right: toRpx(8);
flex-shrink: 0;
}
.alias {
margin-top: toRpx(12);
font-size: toRpx(24);
......
......@@ -5,7 +5,13 @@
<view class="flex flex-1 pb-24">
<view class="sprite-icon icon-blue-delete" @click="deleteGoods(index)"></view>
<view class="right">
<view class="shop-name">商品名称:{{ item.multipleSpecificationsGoods ? item.multipleSpecificationsGoods.baseGoodsName : item.goods.goodsAlias || item.goods.upgradeGoodsName || item.goods.goodsInfo.goodsName }}</view>
<view class="shop-name flex align-center">
<view
v-if="shouldShowMarketingIcon(item)"
class="sprite-icon icon-activeIcon marketing-icon"
></view>
<text class="text-hide flex-1">商品名称:{{ item.multipleSpecificationsGoods ? item.multipleSpecificationsGoods.baseGoodsName : item.goods.goodsAlias || item.goods.upgradeGoodsName || item.goods.goodsInfo.goodsName }}</text>
</view>
<view class="alias" v-if="item.multipleSpecificationsGoods && item.multipleSpecificationsGoods.goods.goodsAlias">商品别名:{{ item.multipleSpecificationsGoods.goods.goodsAlias }}</view>
<view class="front-gear-box">
<view class="front-gear-input-box">
......@@ -62,6 +68,8 @@
<script>
import utils from '@/utils/utils'
import OrderStrategy from './OrderStrategy.vue'
import { shouldShowMarketingIcon as checkMarketingIcon } from '@/utils/marketingFlag'
import { getSkuGoodsPriceTarget, isBelowMinSellPrice, normalizeGoodsPrice, shouldUseMinPriceApproval, applyLegacyMinSellPriceClamp } from '@/utils/minSellPrice'
export default {
name: 'SkuGoods',
......@@ -88,6 +96,10 @@ export default {
orderTypeCode: {
type: [String, Number],
default: ''
},
showMarketingIcon: {
type: Boolean,
default: false
}
},
created() {
......@@ -143,106 +155,21 @@ export default {
},
// 验证价格输入
validatePrice(event, item, index) {
let value = event.detail.value
console.log('value', 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('.')
let value = normalizeGoodsPrice(event.detail.value)
const priceTarget = getSkuGoodsPriceTarget(item)
if (shouldUseMinPriceApproval(this.orderTypeCode)) {
if (isBelowMinSellPrice(priceTarget, value)) {
this.$emit('min-price-warning', value)
}
} else if (priceTarget) {
value = applyLegacyMinSellPriceClamp(priceTarget, value)
}
// 限制最 大值为100000
if (parseFloat(value) > 100000) {
value = '100000'
}
// 限制最小值为0
if (parseFloat(value) < 0 || parseFloat(value) == 0) {
value = '0'
}
// 检查最小价格
if (!item.multipleSpecificationsGoods) {
// 普通商品的最小价格检查
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()
}
} else if (item.multipleSpecificationsGoods && item.multipleSpecificationsGoods.goods) {
// 多规格商品的最小价格检查
if (item.multipleSpecificationsGoods.goods.validMinSellPrice === 'Y' && item.multipleSpecificationsGoods.goods.minSellPrice && parseFloat(value) < parseFloat(item.multipleSpecificationsGoods.goods.minSellPrice)) {
console.log('最小值', item.multipleSpecificationsGoods.goods.minSellPrice)
uni.showToast({
title: '单价不可低于商品最低价',
icon: 'none'
})
value = item.multipleSpecificationsGoods.goods.minSellPrice.toString()
}
}
// 更新值
if (!item.multipleSpecificationsGoods) {
// 如果没有多规格商品,更新普通商品的价格
this.$set(this.list[index].goods, 'sellPrice', value)
} else if (item.multipleSpecificationsGoods && item.multipleSpecificationsGoods.goods) {
// 如果有多规格商品,更新多规格商品的价格
this.$set(this.list[index].multipleSpecificationsGoods.goods, 'sellPrice', value)
}
this.$emit('changeTotalPrice')
},
// 验证价格输入
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.multipleSpecificationsGoods && item.multipleSpecificationsGoods.goods) {
this.$set(this.list[index].multipleSpecificationsGoods.goods, 'sellPrice', value)
} else if (item.goods) {
this.$set(this.list[index].goods, 'sellPrice', value)
}
// 商品价格修改时,清空折扣 / 抵扣配置
this.resetStrategyWhenPriceChange(this.list[index])
this.$emit('changeTotalPrice')
},
// 验证数量输入
......@@ -556,6 +483,9 @@ export default {
})
}
})
},
shouldShowMarketingIcon(item) {
return checkMarketingIcon(item, this.showMarketingIcon)
}
}
}
......@@ -580,6 +510,12 @@ export default {
color: #ff781f;
}
.marketing-icon {
display: inline-block !important;
margin-right: toRpx(8);
flex-shrink: 0;
}
.alias {
margin-top: toRpx(12);
font-size: toRpx(24);
......
......@@ -5,7 +5,6 @@
@start="start"
ref="home"
:id="id"
:show-ai-assistant="recording && !!id"
@openStep="openStep"
@backHome="backHome"
@changeTab="changeTab"
......
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
......@@ -16,6 +16,10 @@ export function setSkipMenu(value) {
uni.setStorageSync(SKIP_MENU_KEY, !!value)
}
export function clearSkipMenu() {
uni.removeStorageSync(SKIP_MENU_KEY)
}
/** 是否应在今日展示引导气泡(每天首次) */
export function shouldShowDailyGuide() {
const last = uni.getStorageSync(GUIDE_DATE_KEY)
......
// 活动标识:marketingFlag 为 1 时显示活动 icon
const SHOW_MARKETING_VALUE = 1
function findActiveMarketingInList(list) {
if (!Array.isArray(list)) return undefined
const activeGoods = list.find(
g => g.marketingFlag == SHOW_MARKETING_VALUE || g.marketingFlag === String(SHOW_MARKETING_VALUE)
)
return activeGoods?.marketingFlag
}
function findActiveActivityInList(list) {
if (!Array.isArray(list)) return undefined
const activeGoods = list.find(
g => g.marketingFlag == SHOW_MARKETING_VALUE || g.marketingFlag === String(SHOW_MARKETING_VALUE)
)
const activityId = activeGoods?.activityId
if (activityId === undefined || activityId === null || activityId === '') return undefined
return activityId
}
function hasActivityValue(value) {
return value != null && value !== ''
}
export function getMarketingFlag(item) {
if (!item) return undefined
if (item.marketingFlag !== undefined && item.marketingFlag !== null && item.marketingFlag !== '') {
return item.marketingFlag
}
const nested =
item.goods?.marketingFlag ??
item.packageGoods?.marketingFlag ??
item.multipleSpecificationsGoods?.marketingFlag ??
item.multipleSpecificationsGoods?.goods?.marketingFlag
if (nested !== undefined && nested !== null && nested !== '') {
return nested
}
const activeFromPackageGoods =
findActiveMarketingInList(item.packageGoods?.goodsList) ??
findActiveMarketingInList(item.packageGoodsOrderList) ??
findActiveMarketingInList(item.goodsList)
if (activeFromPackageGoods !== undefined) return activeFromPackageGoods
return undefined
}
export function shouldShowMarketingIcon(item, enabled = false) {
if (!enabled) return false
const flag = getMarketingFlag(item)
return flag == SHOW_MARKETING_VALUE || flag === String(SHOW_MARKETING_VALUE)
}
export function getActivityId(item) {
if (!item) return undefined
if (hasActivityValue(item.activityId)) {
return item.activityId
}
const nested =
item.goods?.activityId ??
item.packageGoods?.activityId ??
item.multipleSpecificationsGoods?.activityId ??
item.multipleSpecificationsGoods?.goods?.activityId
if (hasActivityValue(nested)) {
return nested
}
const activeFromPackageGoods =
findActiveActivityInList(item.packageGoods?.goodsList) ??
findActiveActivityInList(item.packageGoodsOrderList) ??
findActiveActivityInList(item.goodsList)
if (activeFromPackageGoods !== undefined) return activeFromPackageGoods
return undefined
}
export function getSubmitMarketingFlag(orderItem, goods) {
const flag = getMarketingFlag(orderItem) ?? goods?.marketingFlag
return flag == SHOW_MARKETING_VALUE || flag === String(SHOW_MARKETING_VALUE) ? 1 : 0
}
export function getSubmitActivityId(orderItem, goods) {
if (getSubmitMarketingFlag(orderItem, goods) !== 1) return undefined
const activityId = goods?.activityId ?? getActivityId(orderItem)
if (!hasActivityValue(activityId)) return undefined
return activityId
}
// 商品加入订单时快照原价,供 modifyFlag 提交时对比
export function snapshotOriginalPrice(goods) {
if (!goods) return
if (goods.oldPrice != null && goods.oldPrice !== '') return
const source = goods.upgradePrice ?? goods.price ?? goods.sellPrice
if (source == null || source === '') return
goods.oldPrice = source
}
export function snapshotOrderItemOriginalPrice(item) {
if (!item) return
if (item.goodsFlag == 1 && item.goods) {
snapshotOriginalPrice(item.goods)
} else if (item.goodsFlag == 2 && item.multipleSpecificationsGoods?.goods) {
snapshotOriginalPrice(item.multipleSpecificationsGoods.goods)
} else if (item.goodsFlag == 3 && item.packageGoods?.goodsList) {
item.packageGoods.goodsList.forEach(snapshotOriginalPrice)
}
}
export function snapshotOrderItemsOriginalPrice(items) {
if (!Array.isArray(items)) return
items.forEach(snapshotOrderItemOriginalPrice)
}
export function getSubmitModifyFlag(goods) {
if (!goods) return 0
const current = parseFloat(goods.sellPrice ?? 0)
const originalSource = goods.oldPrice ?? goods.upgradePrice ?? goods.price
if (originalSource == null || originalSource === '') return 0
const original = parseFloat(originalSource)
if (Number.isNaN(current) || Number.isNaN(original)) return 0
return Math.abs(current - original) > 0.001 ? 1 : 0
}
export function isBelowMinSellPrice(goods, value) {
if (!goods || goods.validMinSellPrice !== 'Y' || goods.minSellPrice == null || goods.minSellPrice === '') {
return false
}
return parseFloat(value) < parseFloat(goods.minSellPrice)
}
export function getGoodsDisplayName(goods) {
if (!goods) return ''
return goods.goodsAlias || goods.upgradeGoodsName || goods.goodsInfo?.goodsName || goods.baseGoodsName || ''
}
function buildSingleApprovalItem(item, goods, number) {
const sellPrice = normalizeGoodsPrice(goods.sellPrice)
if (!isBelowMinSellPrice(goods, sellPrice)) return null
return {
type: 'single',
name: getGoodsDisplayName(goods),
sellPrice,
minSellPrice: goods.minSellPrice,
number: number || '1',
sourceItem: item
}
}
function getPackageDisplayTotal(item, orderTypeCode) {
const orderType = String(orderTypeCode || '')
let total = 0
item.packageGoods.goodsList.forEach(goods => {
const sellPrice = parseFloat(goods.sellPrice || 0)
if (orderType === '1' || orderType === '4') {
total += sellPrice
} else if (goods.finalPricePerUnit != null) {
total += parseFloat(goods.finalPricePerUnit || 0)
} else {
total += sellPrice
}
})
return total
}
function buildPackageApprovalItem(item, orderTypeCode) {
const children = (item.packageGoods.goodsList || [])
.map(goods => {
const sellPrice = normalizeGoodsPrice(goods.sellPrice)
if (!isBelowMinSellPrice(goods, sellPrice)) return null
return {
name: getGoodsDisplayName(goods),
sellPrice,
minSellPrice: goods.minSellPrice,
number: item.packageGoods.number || '1',
sourceGoods: goods
}
})
.filter(Boolean)
if (!children.length) return null
return {
type: 'package',
name: item.packageGoods.packageAlias || item.packageGoods.packageName || '',
sellPrice: getPackageDisplayTotal(item, orderTypeCode),
number: item.packageGoods.number || '1',
children,
sourceItem: item
}
}
export function collectBelowMinSellPriceItems(orderObj) {
if (!orderObj) return []
const productFields = ['frontGear', 'frontWindow', 'rearGear', 'rearWindow', 'sunRoof', 'package', 'skuGoods']
const result = []
productFields.forEach(field => {
const list = orderObj[field]
if (!Array.isArray(list)) return
list.forEach(item => {
if (item.goodsFlag == 1 && item.goods) {
const approvalItem = buildSingleApprovalItem(item, item.goods, item.goods.number)
if (approvalItem) result.push(approvalItem)
return
}
if (item.goodsFlag == 2) {
if (item.multipleSpecificationsGoods?.goods) {
const approvalItem = buildSingleApprovalItem(
item,
item.multipleSpecificationsGoods.goods,
item.multipleSpecificationsGoods.number
)
if (approvalItem) result.push(approvalItem)
return
}
if (item.goods) {
const approvalItem = buildSingleApprovalItem(item, item.goods, item.goods.number)
if (approvalItem) result.push(approvalItem)
}
return
}
if (item.goodsFlag == 3 && item.packageGoods) {
const approvalItem = buildPackageApprovalItem(item, orderObj.orderTypeCode)
if (approvalItem) result.push(approvalItem)
}
})
})
return result
}
export function hasBelowMinSellPriceGoods(orderObj) {
return collectBelowMinSellPriceItems(orderObj).length > 0
}
export function shouldUseMinPriceApproval(orderTypeCode) {
return String(orderTypeCode || '') === '1'
}
export function applyLegacyMinSellPriceClamp(goods, value) {
let price = normalizeGoodsPrice(value)
if (isBelowMinSellPrice(goods, price)) {
uni.showToast({
title: '单价不可低于商品最低价',
icon: 'none'
})
price = String(goods.minSellPrice)
}
return price
}
export function normalizeGoodsPrice(value) {
let price = value
if (!price || String(price).trim() === '') {
price = '0'
}
price = String(price).replace(/[^\d.]/g, '')
if (price.split('.').length > 2) {
price = price.slice(0, price.lastIndexOf('.')) + price.slice(price.lastIndexOf('.') + 1)
}
if (price.includes('.')) {
const parts = price.split('.')
if (parts[1].length > 2) {
parts[1] = parts[1].substring(0, 2)
price = parts.join('.')
}
}
if (parseFloat(price) > 100000) {
price = '100000'
}
if (parseFloat(price) < 0 || parseFloat(price) == 0) {
price = '0'
}
return price
}
export function getSkuGoodsPriceTarget(item) {
if (item?.multipleSpecificationsGoods?.goods) {
return item.multipleSpecificationsGoods.goods
}
return item?.goods || null
}
......@@ -295,7 +295,7 @@ class RecordService {
const useWs = !!wsBase
const transport = useWs ? TransportType.WEBSOCKET : TransportType.HTTP
// HTTP 服务端固定为 /health(可在 AiAssistantBall 内按需覆盖)
const httpBaseUrl = 'http://192.168.10.141:8616'
const httpBaseUrl = 'http://192.168.3.84:8616'
const client = new NativeChannelClient(
useWs ? { transport } : { transport, baseUrl: httpBaseUrl }
......
......@@ -64,24 +64,28 @@ class NativeHttpClient {
* @param {object} options uni.request 参数,url 可为相对路径
*/
request(options = {}) {
const url = this._resolveUrl(options.url)
const { onTask, url: rawUrl, header: extraHeader, ...rest } = options
const url = this._resolveUrl(rawUrl)
if (!url) {
return Promise.reject(new Error('request 缺少 url'))
}
const header = { ...this.header, ...(options.header || {}) }
const header = { ...this.header, ...(extraHeader || {}) }
if (this.auth && this.token && !header.token) {
header.token = this.token
}
return new Promise((resolve, reject) => {
uni.request({
const task = uni.request({
timeout: this.timeout,
dataType: this.dataType,
...options,
...rest,
url,
header,
success: (res) => resolve(res),
fail: (err) => reject(err)
})
if (typeof onTask === 'function') {
onTask(task)
}
})
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!