Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
gl_tape
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
3
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit ad2b8ca0
authored
Aug 28, 2025
by
cen
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix: 战败回显
1 parent
5693c008
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
385 additions
and
190 deletions
api/module/boutique.js
components/Form/GlCell.vue
components/OrderPopup/components/GoodsList.vue
pages/boutique/tool/components/CreateOrder.vue
pages/boutique/tool/components/DefeatOrder.vue
pages/boutique/tool/components/Package.vue
pages/boutique/tool/components/Product.vue
api/module/boutique.js
View file @
ad2b8ca
...
...
@@ -188,6 +188,14 @@ module.exports = {
...
data
})
},
/**战败商品列表- upradeFlag(N为基础,Y为升级) */
getOrderBaseGoodsList
(
data
)
{
return
http
.
post
({
method
:
'dj.api.smartcarlife.orderUpgradeGoods.listByMerchantId'
,
projectName
:
'boutique'
,
...
data
})
},
/** 选择支付方式下单 */
createWithPay
(
data
)
{
console
.
log
(
data
)
...
...
components/Form/GlCell.vue
View file @
ad2b8ca
...
...
@@ -5,11 +5,7 @@
<template
v-for=
"(item, idx) in items"
>
<view
v-if=
"!item.hidden"
>
<view
class=
"cell-row"
:key=
"idx"
>
<view
class=
"cell"
@
click=
"onCellClick(item)"
:class=
"[
item.noBorder ? '' : 'border',
item.onlyLabel ? 'small-height' : '',
item.class
]"
>
<view
class=
"cell"
@
click=
"onCellClick(item)"
:class=
"[item.noBorder ? '' : 'border', item.onlyLabel ? 'small-height' : '', item.class]"
>
<view
:class=
"['cell-label',
{ 'only-label': item.onlyLabel }]">
<view
v-if=
"item.labellIcon"
:class=
"['sprite-icon', `icon-$
{item.labellIcon}`]">
</view>
{{
item
.
label
}}
...
...
@@ -19,12 +15,8 @@
<!-- 输入框 -->
<template
v-if=
"item.type === 'input'"
>
<view
class=
"input-box"
>
<input
class=
"input-value"
v-model=
"formData[item.value]"
:type=
"item.inputType || 'text'"
@
blur=
"handleBlur($event, item)"
:placeholder=
"item.placeholder || '请输入'"
:maxlength=
"item.inputType === 'number' ? false : (item.maxlength || -1)"
@
input=
"item.inputType === 'number' && item.maxlength ? (formData[item.value] = String($event.target.value).slice(0, item.maxlength)) : null"
/>
<view
v-if=
"item.valueIcon"
:class=
"['sprite-icon', `icon-$
{item.valueIcon}`]"
@click="onValueClick(item)">
</view>
<input
class=
"input-value"
v-model=
"formData[item.value]"
:type=
"item.inputType || 'text'"
@
blur=
"handleBlur($event, item)"
:placeholder=
"item.placeholder || '请输入'"
:maxlength=
"item.inputType === 'number' ? false : item.maxlength || -1"
@
input=
"item.inputType === 'number' && item.maxlength ? (formData[item.value] = String($event.target.value).slice(0, item.maxlength)) : null"
/>
<view
v-if=
"item.valueIcon"
:class=
"['sprite-icon', `icon-$
{item.valueIcon}`]" @click="onValueClick(item)">
</view>
</view>
</
template
>
<!-- 下拉选择 -->
...
...
@@ -32,7 +24,8 @@
<view
class=
"value"
>
<template
v-if=
"!item.addHtml && formData[item.value] && formData[item.value]"
>
<template
v-if=
"item.showText && userInfo && userInfo[item.showText]"
>
{{
userInfo
[
item
.
showText
]
}}
<text>
|
</text>
{{
userInfo
[
item
.
showText
]
}}
<text>
|
</text>
</
template
>
{{ formData[item.value] }}
</template>
...
...
@@ -45,19 +38,15 @@
<!-- 单选框 -->
<
template
v-else-if=
"item.type === 'radio'"
>
<radio-group
class=
"radio-group value"
@
change=
"onRadioChange($event, item)"
>
<label
class=
"uni-list-cell uni-list-cell-pd"
v-for=
"radio in item.radioList"
:key=
"radio.value + item.value"
>
<radio
style=
"transform:scale(0.7)"
:value=
"radio.value"
:disabled=
"item.disabled || radio.disabled"
:checked=
"radio.value == item.current"
/>
<label
class=
"uni-list-cell uni-list-cell-pd"
v-for=
"radio in item.radioList"
:key=
"radio.value + item.value"
>
<radio
style=
"transform: scale(0.7)"
:value=
"radio.value"
:disabled=
"item.disabled || radio.disabled"
:checked=
"radio.value == item.current"
/>
<view
class=
"radio-name"
>
{{
radio
.
name
}}
</view>
</label>
</radio-group>
</
template
>
<!-- 多行文本 -->
<
template
v-else-if=
"item.type === 'textarea'"
>
<textarea
class=
"textarea"
v-model=
"formData[item.value]"
:placeholder=
"item.placeholder || '请输入'"
placeholder-class=
"textarea-placeholder"
confirm-type=
"done"
auto-height
:maxlength=
"item.maxlength"
></textarea>
<textarea
class=
"textarea"
v-model=
"formData[item.value]"
:placeholder=
"item.placeholder || '请输入'"
placeholder-class=
"textarea-placeholder"
confirm-type=
"done"
auto-height
:maxlength=
"item.maxlength"
></textarea>
</
template
>
</view>
</view>
...
...
@@ -72,7 +61,7 @@
<
script
>
export
default
{
name
:
"GlCell"
,
name
:
'GlCell'
,
props
:
{
/**
* noBorder:默认false:有下边框,true:无下边框
...
...
@@ -106,11 +95,11 @@ export default {
methods
:
{
onCellClick
(
item
)
{
if
(
item
.
type
===
'select'
)
{
this
.
$emit
(
'handleCell'
,
item
)
;
this
.
$emit
(
'handleCell'
,
item
)
}
},
onRadioChange
(
e
,
item
)
{
this
.
$emit
(
'radioChange'
,
e
,
item
)
;
this
.
$emit
(
'radioChange'
,
e
,
item
)
},
onValueClick
(
item
)
{
this
.
$emit
(
'handleValue'
,
item
)
...
...
@@ -119,7 +108,7 @@ export default {
this
.
$emit
(
'inputBlur'
,
e
,
item
)
}
}
}
;
}
</
script
>
<
style
scoped
lang=
"scss"
>
...
...
@@ -168,7 +157,7 @@ export default {
.required
{
display
:
inline-block
;
margin-left
:
toRpx
(
8
);
color
:
#
F
24724
;
color
:
#
f
24724
;
}
&
.only-label
{
...
...
@@ -248,8 +237,6 @@ export default {
display
:
inline-block
;
}
.textarea
{
width
:
100%
;
border-radius
:
toRpx
(
16
);
...
...
components/OrderPopup/components/GoodsList.vue
View file @
ad2b8ca
<
template
>
<view
:class=
"['goods-list',
{'is-defeat-order':isDefeatOrder
}]">
<view
:class=
"['goods-list',
{ 'is-defeat-order': isDefeatOrder
}]">
<template
v-if=
"params.loadComplete"
>
<template
v-if=
"listData.length"
>
<template
v-for=
"(i, index) in listData"
>
<template
v-if=
"isDefeatOrder"
>
<view
class=
"item-box"
:key=
"index"
>
<view
class=
"goods-title flex"
>
{{
i
.
goodsTypeName
}}
|建议价
</view>
<view
class=
"item-box"
:key=
"index"
>
<view
class=
"goods-title flex"
>
{{
i
.
goodsTypeName
}}
|建议价
</view>
<view
class=
"defeat-goods-list"
>
<template
v-for=
"(item,ind) in i.upgradeGoodsList"
>
<view
:class=
"['item flex',
{active:checkActive(item)}]"
:key="`${index}_${ind}`"
@click="choose(item)"
>
<template
v-for=
"(item, ind) in i.upgradeGoodsList"
>
<view
:class=
"['item flex',
{ active: checkActive(item) }]" :key="`${index}_${ind}`" @click="choose(item)">
<view
class=
"sprite-icon icon-tag-checked"
></view>
<text
class=
"goods-name text-hide"
>
{{
replaceItemText
(
item
,
'upgradeGoodsAlias'
)
||
replaceItemText
(
item
,
'upgradeGoodsName'
)
||
replaceItemText
(
item
.
goodsInfo
,
'goodsName'
)
}}
{{
replaceItemText
(
item
,
'upgradeGoodsAlias'
)
||
replaceItemText
(
item
,
'upgradeGoodsName'
)
||
replaceItemText
(
item
.
goodsInfo
,
'goodsName'
)
}}
</text>
<template
v-if=
"item.merchantGoodsPosition && (item.goodsInfo.goodsType == 1 || item.goodsInfo.goodsType == baseConfigData.selfBuildFilmType)"
>
<text>
「
{{
item
.
positionStr
}}
」
</text>
<text>
「
{{
item
.
positionStr
}}
」
</text>
</
template
>
<
template
v-if=
"!item.merchantGoodsPosition && (item.goodsInfo.goodsType == 1 || item.goodsInfo.goodsType == baseConfigData.selfBuildFilmType)"
>
<view
class=
"no-postion"
>
无部位
</view>
</
template
>
<text
class=
"price"
>
¥{{
item.upgradePrice
}}
</text>
<text
class=
"price"
>
¥{{
item.upgradePrice
}}
</text>
</view>
</template>
</view>
</view>
</template>
<
template
v-else
>
<view
:key=
"index"
@
click=
"choose(i)"
:class=
"['item flex',
{active: checkActive(i)}]"
>
<view
:key=
"index"
@
click=
"choose(i)"
:class=
"['item flex',
{ active: checkActive(i) }]">
<view
class=
"sprite-icon icon-tag-checked"
></view>
<text
class=
"goods-name text-hide"
>
{{
replaceItemText
(
i
.
goods
,
'goodsAlias'
)
||
replaceItemText
(
i
.
goods
,
'upgradeGoodsName'
)
||
replaceItemText
(
i
.
goodsInfo
,
'goodsName'
)
}}
{{
replaceItemText
(
i
.
goods
,
'goodsAlias'
)
||
replaceItemText
(
i
.
goods
,
'upgradeGoodsName'
)
||
replaceItemText
(
i
.
goodsInfo
,
'goodsName'
)
}}
</text>
<template
v-if=
"i.goods.merchantGoodsPosition && (i.goods.goodsInfo.goodsType == 1 || i.goods.goodsInfo.goodsType == baseConfigData.selfBuildFilmType)"
>
<text>
「
{{
i
.
goods
.
positionStr
}}
」
</text>
<text>
「
{{
i
.
goods
.
positionStr
}}
」
</text>
</
template
>
<text
class=
"price"
>
¥{{
i.goods.price
}}
</text>
<text
class=
"price"
>
¥{{
i.goods.price
}}
</text>
</view>
</template>
</template>
...
...
@@ -54,7 +43,7 @@
</view>
</template>
<
script
type=
'text/ecmascript-6'
>
<
script
type=
"text/ecmascript-6"
>
import
popupmixin
from
'./popupmixin'
export
default
{
mixins
:
[
popupmixin
],
...
...
@@ -158,6 +147,7 @@ export default {
this
.
list
=
arr
},
choose
(
i
)
{
let
{
currentIds
,
isDefeatOrder
}
=
this
,
id
=
''
if
(
isDefeatOrder
)
id
=
i
.
id
...
...
@@ -190,7 +180,7 @@ export default {
}
</
script
>
<
style
scoped
lang=
'scss'
>
<
style
scoped
lang=
"scss"
>
.goods-list
{
display
:
grid
;
grid-template-columns
:
repeat
(
2
,
1
fr
);
...
...
@@ -282,4 +272,4 @@ export default {
}
}
}
</
style
>
\ No newline at end of file
</
style
>
pages/boutique/tool/components/CreateOrder.vue
View file @
ad2b8ca
...
...
@@ -4,21 +4,16 @@
<view
class=
"box"
>
<scroll-view
class=
"scroll-view"
scroll-y=
"true"
>
<view
class=
"box-content"
>
<GlCell
:formList=
"formList"
:formData=
"orderObj"
@
radioChange=
"radioChange"
@
inputBlur=
"inputBlur"
@
handleCell=
"handleCell"
>
<GlCell
:formList=
"formList"
:formData=
"orderObj"
@
radioChange=
"radioChange"
@
inputBlur=
"inputBlur"
@
handleCell=
"handleCell"
>
<!-- 使用v-for循环渲染产品组件,减少重复代码 -->
<template
v-for=
"(_, slotName) in productSlots"
:slot=
"slotName"
>
<Product
:key=
"slotName"
v-if=
"orderObj[slotName] && orderObj[slotName].length"
@
changeTotalPrice=
"changeTotalPrice"
:list=
"orderObj[slotName]"
:positionTypeList=
"positionTypeList"
:baseConfigData=
"baseConfigData"
></Product>
<Product
:key=
"slotName"
v-if=
"orderObj[slotName] && orderObj[slotName].length"
@
changeTotalPrice=
"changeTotalPrice"
:list=
"orderObj[slotName]"
:positionTypeList=
"positionTypeList"
:baseConfigData=
"baseConfigData"
></Product>
</
template
>
<
template
slot=
"package"
>
<Package
v-if=
"orderObj.package"
@
changeTotalPrice=
"changeTotalPrice"
:list=
"orderObj.package"
:positionTypeList=
"positionTypeList"
></Package>
<Package
v-if=
"orderObj.package"
@
changeTotalPrice=
"changeTotalPrice"
:list=
"orderObj.package"
:positionTypeList=
"positionTypeList"
></Package>
</
template
>
<
template
slot=
"skuGoods"
>
<SkuGoods
v-if=
"orderObj.skuGoods"
:list=
"orderObj.skuGoods"
@
changeTotalPrice=
"changeTotalPrice"
:positionTypeList=
"positionTypeList"
:baseConfigData=
"baseConfigData"
></SkuGoods>
<SkuGoods
v-if=
"orderObj.skuGoods"
:list=
"orderObj.skuGoods"
@
changeTotalPrice=
"changeTotalPrice"
:positionTypeList=
"positionTypeList"
:baseConfigData=
"baseConfigData"
></SkuGoods>
<view
class=
"total"
v-if=
"totalPrice > 0"
>
<view
class=
"total-left"
>
总价
</view>
<view
class=
"total-right"
>
¥
{{
totalPrice
}}
</view>
...
...
@@ -33,8 +28,7 @@
</scroll-view>
</view>
<!-- 弹窗 -->
<order-popup
ref=
"orderPopup"
:data=
"orderObj"
:dataKey=
"valueKey"
@
onConfirm=
"onConfirm"
:externalData=
"externalData"
:popupType=
"popupType"
/>
<order-popup
ref=
"orderPopup"
:data=
"orderObj"
:dataKey=
"valueKey"
@
onConfirm=
"onConfirm"
:externalData=
"externalData"
:popupType=
"popupType"
/>
</view>
</template>
...
...
@@ -68,15 +62,18 @@ export default {
handler
(
newVal
)
{
if
(
newVal
)
{
// 处理交易数据
const
handleTransactionData
=
(
newVal
)
=>
{
const
handleTransactionData
=
newVal
=>
{
this
.
orderCreateType
=
newVal
.
type
if
(
this
.
orderCreateType
===
'supplementOrder'
)
{
// 补录订单处理
const
{
outTradeNo
,
tradeNo
}
=
newVal
.
selectedItems
.
reduce
((
acc
,
item
)
=>
({
outTradeNo
:
[...(
acc
.
outTradeNo
||
[]),
item
.
outTradeNo
],
tradeNo
:
[...(
acc
.
tradeNo
||
[]),
item
.
tradeNo
]
}),
{})
const
{
outTradeNo
,
tradeNo
}
=
newVal
.
selectedItems
.
reduce
(
(
acc
,
item
)
=>
({
outTradeNo
:
[...(
acc
.
outTradeNo
||
[]),
item
.
outTradeNo
],
tradeNo
:
[...(
acc
.
tradeNo
||
[]),
item
.
tradeNo
]
}),
{}
)
Object
.
assign
(
this
.
orderObj
,
{
outTradeNo
:
outTradeNo
.
join
(
','
),
...
...
@@ -86,21 +83,19 @@ export default {
}
// 编辑和修改订单进入这里
// 新增订单处理
const
{
paramsData
:
{
customer
,
customerCoupon
,
...
rest
}
}
=
newVal
const
{
paramsData
:
{
customer
,
customerCoupon
,
...
rest
}
}
=
newVal
// 基础字段映射
const
baseFields
=
[
'id'
,
'orderCode'
,
'userId'
,
'employeeName'
,
'deliveryEmployeeName'
,
'deliveryUserId'
,
'subShopMerchantName'
,
'subShopMerchantId'
,
'sellerName'
,
'sellerUserId'
,
'sellerMerchantName'
,
'sellerMerchantId'
,
'merchantId'
,
'merchantName'
,
'customerCouponId'
,
'selectPayType'
]
const
baseFields
=
[
'id'
,
'orderCode'
,
'userId'
,
'employeeName'
,
'deliveryEmployeeName'
,
'deliveryUserId'
,
'subShopMerchantName'
,
'subShopMerchantId'
,
'sellerName'
,
'sellerUserId'
,
'sellerMerchantName'
,
'sellerMerchantId'
,
'merchantId'
,
'merchantName'
,
'customerCouponId'
,
'selectPayType'
]
Object
.
assign
(
this
.
orderObj
,
Object
.
fromEntries
(
baseFields
.
map
(
field
=>
[
field
,
rest
[
field
]])))
// 设置支付类型
this
.
orderObj
.
payeeType
=
rest
.
selectPayType
==
'2'
?
'1'
:
'0'
// 客户信息映射
const
customerFields
=
[
'customerName'
,
'customerSex'
,
'customerPhone'
,
'salesType'
,
'standNo'
,
'plateNumber'
,
'experienceFlag'
]
const
customerFields
=
[
'customerName'
,
'customerSex'
,
'customerPhone'
,
'salesType'
,
'standNo'
,
'plateNumber'
,
'experienceFlag'
]
Object
.
assign
(
this
.
orderObj
,
Object
.
fromEntries
(
customerFields
.
map
(
field
=>
[
field
,
customer
[
field
]])))
// 优惠券信息
...
...
@@ -157,7 +152,7 @@ export default {
},
data
()
{
return
{
orderCreateType
:
'createWithPay'
,
// supplementOrder(补录订单) createWithPay(新增)
orderCreateType
:
'createWithPay'
,
// supplementOrder(补录订单) createWithPay(新增)
formList
:
utils
.
deepClone
(
FORM_LIST
),
userInfo
:
{},
baseConfigData
:
{},
...
...
@@ -168,13 +163,13 @@ export default {
experienceFlag
:
'Y'
,
payeeType
:
1
,
salesType
:
'0'
,
frontGear
:
null
,
// 1 ,回显upgradeGoodsPosition == 1
frontGear
:
null
,
// 1 ,回显upgradeGoodsPosition == 1
frontWindow
:
null
,
// 2
rearWindow
:
null
,
// 3
rearGear
:
null
,
// 4
sunRoof
:
null
,
// 5, 6,7
rearGear
:
null
,
// 4
sunRoof
:
null
,
// 5, 6,7
package
:
null
,
skuGoods
:
null
// upgradeGoodsPosition 为空,则是其他精品单商品
skuGoods
:
null
// upgradeGoodsPosition 为空,则是其他精品单商品
},
// 弹窗传入的数据},
popupType
:
0
,
popupTypeEnum
,
...
...
@@ -325,6 +320,7 @@ export default {
}
}
else
{
this
.
$set
(
this
.
orderObj
,
_typeValue
.
key
,
chooseContent
)
console
.
log
(
this
.
orderObj
,
'this.orderObj'
)
}
// 商品类,需计算总价
setTimeout
(()
=>
{
...
...
@@ -412,7 +408,7 @@ export default {
async
submit
()
{
console
.
log
(
this
.
orderObj
)
if
(
!
this
.
checkRequired
())
return
if
(
!
await
this
.
checkDailyReport
(
))
{
if
(
!
(
await
this
.
checkDailyReport
()
))
{
const
{
orderCreateType
}
=
this
const
obj
=
utils
.
deepClone
(
this
.
orderObj
)
const
otherCustomer
=
[
'standNo'
,
'plateNumber'
,
'customerSex'
,
'experienceFlag'
,
'salesType'
]
...
...
@@ -516,7 +512,7 @@ export default {
})
}
else
if
(
item
.
multipleSpecificationsGoods
&&
item
.
multipleSpecificationsGoods
.
goods
&&
item
.
multipleSpecificationsGoods
.
goods
.
sellPrice
)
{
console
.
log
(
item
.
multipleSpecificationsGoods
,
'多规格'
)
total
+=
parseFloat
(
item
.
multipleSpecificationsGoods
.
goods
.
sellPrice
)
*
parseInt
(
item
.
multipleSpecificationsGoods
.
number
||
1
)
total
+=
parseFloat
(
item
.
multipleSpecificationsGoods
.
goods
.
sellPrice
)
*
parseInt
(
item
.
multipleSpecificationsGoods
.
number
||
1
)
}
})
}
...
...
@@ -700,7 +696,7 @@ export default {
this
.
otherProduct
.
push
(
val
)
}
})
console
.
log
(
arrMap
,
'arrMap'
)
// 批量设置 hidden 属性
Object
.
keys
(
arrMap
).
forEach
(
key
=>
{
const
cell
=
this
.
formList
[
2
].
find
(
item
=>
item
.
value
===
key
)
...
...
@@ -708,23 +704,24 @@ export default {
})
const
subOrderList
=
this
.
goodsList
||
[]
let
chooseList
=
[];
console
.
log
(
'subOrderList'
,
subOrderList
)
let
chooseList
=
[]
subOrderList
.
map
(
e
=>
{
// 普通商品
if
(
e
&&
!
e
.
packageName
)
{
if
(
e
.
specificationData
.
indexOf
(
';~;'
)
==
-
1
)
{
// 修复取值字段名字错误问题
if
(
!
e
.
price
)
{
e
.
price
=
utils
.
decimal
(
Number
(
e
.
totalPrice
/
e
.
number
),
2
)
;
e
.
price
=
utils
.
decimal
(
Number
(
e
.
totalPrice
/
e
.
number
),
2
)
//最低价
}
e
.
sellPrice
=
e
.
price
e
.
goodsId
=
e
.
merchantGoodsId
if
(
!
e
.
minSellPrice
)
e
.
minSellPrice
=
e
.
upgradeShopMinPrice
;
if
(
!
e
.
minSellPrice
)
e
.
minSellPrice
=
e
.
upgradeShopMinPrice
e
.
goodsInfo
=
{
goodsName
:
e
.
upgradeGoodsAlias
||
e
.
upgradeGoodsName
,
}
;
e
.
merchantGoodsId
=
e
.
merchantGoodsId
||
e
.
id
;
goodsName
:
e
.
upgradeGoodsAlias
||
e
.
upgradeGoodsName
}
e
.
merchantGoodsId
=
e
.
merchantGoodsId
||
e
.
id
chooseList
.
push
({
goodsFlag
:
1
,
goods
:
e
,
...
...
@@ -736,17 +733,17 @@ export default {
if
(
e
.
specificationData
.
indexOf
(
';~;'
)
>
-
1
)
{
// 修复取值字段名字错误问题
if
(
!
e
.
price
)
{
e
.
price
=
utils
.
decimal
(
Number
(
e
.
totalPrice
/
e
.
number
),
2
)
;
e
.
price
=
utils
.
decimal
(
Number
(
e
.
totalPrice
/
e
.
number
),
2
)
//最低价
e
.
sellPrice
=
e
.
price
}
e
.
goodsId
=
e
.
merchantGoodsId
if
(
!
e
.
minSellPrice
)
e
.
minSellPrice
=
e
.
upgradeShopMinPrice
;
if
(
!
e
.
minSellPrice
)
e
.
minSellPrice
=
e
.
upgradeShopMinPrice
e
.
goodsInfo
=
{
goodsName
:
e
.
upgradeGoodsAlias
||
e
.
upgradeGoodsName
,
}
;
e
.
count
=
e
.
number
;
e
.
merchantGoodsId
=
e
.
merchantGoodsId
||
e
.
id
;
goodsName
:
e
.
upgradeGoodsAlias
||
e
.
upgradeGoodsName
}
e
.
count
=
e
.
number
e
.
merchantGoodsId
=
e
.
merchantGoodsId
||
e
.
id
let
specificdata
=
this
.
handleSpecificationsEcho
(
e
)
console
.
log
(
specificdata
,
'specificdata'
)
chooseList
=
chooseList
.
concat
(
specificdata
)
...
...
@@ -754,24 +751,22 @@ export default {
}
// 套餐
if
(
e
&&
e
.
packageName
)
{
e
.
packageGoodsOrderList
.
forEach
(
(
g
)
=>
{
e
.
packageGoodsOrderList
.
forEach
(
g
=>
{
g
.
oldPrice
=
g
.
sellPrice
||
g
.
upgradePrice
// g.sellPrice = g.sellPrice || g.upgradePrice;
g
.
price
=
g
.
totalPrice
?
Number
(
g
.
totalPrice
)
/
Number
(
g
.
number
)
:
g
.
sellPrice
;
g
.
price
=
g
.
totalPrice
?
Number
(
g
.
totalPrice
)
/
Number
(
g
.
number
)
:
g
.
sellPrice
g
.
sellPrice
=
g
.
price
})
;
})
e
.
goodsList
=
e
.
packageGoodsOrderList
e
.
upgradePrice
=
e
.
goodsList
.
reduce
((
prev
,
cur
)
=>
{
console
.
log
(
prev
,
cur
)
return
prev
+
cur
.
sellPrice
;
},
0
)
;
e
.
number
=
e
.
goodsList
.
length
?
e
.
goodsList
[
0
].
number
:
1
;
return
prev
+
cur
.
sellPrice
},
0
)
e
.
number
=
e
.
goodsList
.
length
?
e
.
goodsList
[
0
].
number
:
1
e
.
price
=
e
.
goodsList
.
reduce
((
prev
,
cur
)
=>
{
return
prev
+
Number
(
cur
.
totalPrice
)
/
Number
(
cur
.
number
)
;
},
0
)
;
return
prev
+
Number
(
cur
.
totalPrice
)
/
Number
(
cur
.
number
)
},
0
)
chooseList
.
push
({
isType
:
'meal'
,
...
...
@@ -787,17 +782,38 @@ export default {
const
_singleGoods
=
chooseList
.
filter
(
item
=>
item
.
goodsFlag
==
1
)
const
_packageGoods
=
chooseList
.
filter
(
item
=>
item
.
goodsFlag
==
3
)
const
_skuGoods
=
chooseList
.
filter
(
item
=>
item
.
goodsFlag
==
2
)
||
[]
console
.
log
(
_singleGoods
,
'singleGoods'
)
if
(
_singleGoods
)
{
// 回显upgradeGoodsPosition 1:前挡 2:前窗 3:后窗 4:后挡 5、6、7:天窗。 为空则是其他精品
this
.
$set
(
this
.
orderObj
,
'frontGear'
,
_singleGoods
.
filter
(
item
=>
item
.
goods
.
upgradeGoodsPosition
==
1
))
this
.
$set
(
this
.
orderObj
,
'frontWindow'
,
_singleGoods
.
filter
(
item
=>
item
.
goods
.
upgradeGoodsPosition
==
2
))
this
.
$set
(
this
.
orderObj
,
'rearWindow'
,
_singleGoods
.
filter
(
item
=>
item
.
goods
.
upgradeGoodsPosition
==
3
))
this
.
$set
(
this
.
orderObj
,
'rearGear'
,
_singleGoods
.
filter
(
item
=>
item
.
goods
.
upgradeGoodsPosition
==
4
))
this
.
$set
(
this
.
orderObj
,
'sunRoof'
,
_singleGoods
.
filter
(
item
=>
item
.
goods
.
upgradeGoodsPosition
==
5
||
item
.
goods
.
upgradeGoodsPosition
==
6
||
item
.
goods
.
upgradeGoodsPosition
==
7
))
this
.
$set
(
this
.
orderObj
,
'frontGear'
,
_singleGoods
.
filter
(
item
=>
item
.
goods
.
upgradeGoodsPosition
==
1
)
)
this
.
$set
(
this
.
orderObj
,
'frontWindow'
,
_singleGoods
.
filter
(
item
=>
item
.
goods
.
upgradeGoodsPosition
==
2
)
)
this
.
$set
(
this
.
orderObj
,
'rearWindow'
,
_singleGoods
.
filter
(
item
=>
item
.
goods
.
upgradeGoodsPosition
==
3
)
)
this
.
$set
(
this
.
orderObj
,
'rearGear'
,
_singleGoods
.
filter
(
item
=>
item
.
goods
.
upgradeGoodsPosition
==
4
)
)
this
.
$set
(
this
.
orderObj
,
'sunRoof'
,
_singleGoods
.
filter
(
item
=>
item
.
goods
.
upgradeGoodsPosition
==
5
||
item
.
goods
.
upgradeGoodsPosition
==
6
||
item
.
goods
.
upgradeGoodsPosition
==
7
)
)
// 将没有upgradeGoodsPosition的商品添加到_skuGoods中
const
noPositionGoods
=
_singleGoods
.
filter
(
item
=>
!
item
.
goods
.
upgradeGoodsPosition
)
;
const
noPositionGoods
=
_singleGoods
.
filter
(
item
=>
!
item
.
goods
.
upgradeGoodsPosition
)
if
(
noPositionGoods
.
length
>
0
)
{
_skuGoods
.
push
(...
noPositionGoods
)
;
_skuGoods
.
push
(...
noPositionGoods
)
}
}
if
(
_packageGoods
)
{
...
...
@@ -807,10 +823,11 @@ export default {
if
(
_skuGoods
&&
_skuGoods
.
length
)
{
this
.
$set
(
this
.
orderObj
,
'skuGoods'
,
_skuGoods
)
}
console
.
log
(
this
.
orderObj
,
'this.orderObj'
)
this
.
changeTotalPrice
()
},
handleSpecificationsEcho
(
item
)
{
let
skuArr
=
[]
;
let
skuArr
=
[]
const
{
otherProduct
}
=
this
,
arr
=
item
.
specificationData
.
split
(
'/'
),
str
=
arr
.
join
(
';~;'
),
...
...
@@ -820,7 +837,7 @@ export default {
goods
:
null
,
active
:
true
,
isFlag
:
true
//初始化进来不显示标识
}
;
}
otherProduct
.
forEach
(
data
=>
{
if
(
data
.
goodsFlag
==
2
)
{
let
tempData
=
data
.
multipleSpecificationsGoods
.
specificationGoodsMap
[
str
]
...
...
@@ -841,15 +858,12 @@ export default {
skuArr
.
push
(
obj
)
}
})
}
}
})
console
.
log
(
skuArr
)
return
skuArr
}
,
}
}
}
</
script
>
...
...
pages/boutique/tool/components/DefeatOrder.vue
View file @
ad2b8ca
<
template
>
<view
class=
"defeat-order"
>
<view
class=
"common-title"
>
战败
录
单
</view>
<view
class=
"common-title"
>
战败
下
单
</view>
<view
class=
"box"
>
<scroll-view
class=
"scroll-view"
scroll-y=
"true"
>
<view
class=
"box-content"
>
<GlCell
:formList=
"formList"
:formData=
"orderObj"
@
radioChange=
"radioChange"
@
inputBlur=
"inputBlur"
@
handleCell=
"handleCell"
>
<!-- 使用v-for循环渲染产品组件,减少重复代码 -->
<template
v-for=
"(_, slotName) in productSlots"
:slot=
"slotName"
>
<Product
:key=
"slotName"
v-if=
"orderObj[slotName] && orderObj[slotName].length"
@
changeTotalPrice=
"changeTotalPrice"
:list=
"orderObj[slotName]"
:positionTypeList=
"positionTypeList"
:baseConfigData=
"baseConfigData"
></Product>
<Product
:key=
"slotName"
:isDisabled=
"true"
v-if=
"orderObj[slotName] && orderObj[slotName].length"
@
changeTotalPrice=
"changeTotalPrice"
:list=
"orderObj[slotName]"
:positionTypeList=
"positionTypeList"
:baseConfigData=
"baseConfigData"
></Product>
</
template
>
<
template
slot=
"package"
>
<Package
v-if=
"orderObj.package"
@
changeTotalPrice=
"changeTotalPrice"
:list=
"orderObj.package"
:positionTypeList=
"positionTypeList"
></Package>
...
...
@@ -35,7 +35,7 @@
</scroll-view>
</view>
<!-- 弹窗 -->
<order-popup
ref=
"orderPopup"
:data=
"orderObj"
:dataKey=
"valueKey"
@
onConfirm=
"onConfirm"
:externalData=
"externalData"
:popupType=
"popupType"
/>
<order-popup
ref=
"orderPopup"
:data=
"orderObj"
:dataKey=
"valueKey"
:isDefeatOrder=
"true"
@
onConfirm=
"onConfirm"
:externalData=
"externalData"
:popupType=
"popupType"
/>
</view>
</template>
...
...
@@ -47,6 +47,7 @@ import GlCell from '../../../../components/Form/GlCell.vue'
import
Product
from
'./Product.vue'
import
Package
from
'./Package.vue'
import
SkuGoods
from
'./SkuGoods.vue'
import
{
checkDailyReport
,
showNextModal
}
from
'@/utils/modalUtils'
import
{
DEFEAT_FORM_LIST
,
popupTypeEnum
,
payTypeList
}
from
'../contant'
export
default
{
name
:
'DefeatOrder'
,
...
...
@@ -77,14 +78,11 @@ export default {
}
=
newVal
// 基础字段映射
const
baseFields
=
[
'id'
,
'orderCode'
,
'userId'
,
'employeeName'
,
'deliveryEmployeeName'
,
'deliveryUserId'
,
'subShopMerchantName'
,
'subShopMerchantId'
,
'sellerName'
,
'sellerUserId'
,
'sellerMerchantName'
,
'sellerMerchantId'
,
'merchantId'
,
'merchantName'
,
'customerCouponId'
,
'selectPayType'
]
const
baseFields
=
[
'id'
,
'orderCode'
,
'userId'
,
'employeeName'
,
'deliveryEmployeeName'
,
'deliveryUserId'
,
'subShopMerchantName'
,
'subShopMerchantId'
,
'sellerName'
,
'sellerUserId'
,
'sellerMerchantName'
,
'sellerMerchantId'
,
'merchantId'
,
'merchantName'
,
'customerCouponId'
]
Object
.
assign
(
this
.
orderObj
,
Object
.
fromEntries
(
baseFields
.
map
(
field
=>
[
field
,
rest
[
field
]])))
// 设置支付类型
this
.
orderObj
.
payeeType
=
rest
.
selectPayType
===
'2'
?
'1'
:
'0'
// 客户信息映射
const
customerFields
=
[
'customerName'
,
'customerSex'
,
'customerPhone'
,
's
alesType'
,
's
tandNo'
,
'plateNumber'
,
'experienceFlag'
]
const
customerFields
=
[
'customerName'
,
'customerSex'
,
'customerPhone'
,
'standNo'
,
'plateNumber'
,
'experienceFlag'
]
Object
.
assign
(
this
.
orderObj
,
Object
.
fromEntries
(
customerFields
.
map
(
field
=>
[
field
,
customer
[
field
]])))
// 优惠券信息
...
...
@@ -108,11 +106,12 @@ export default {
plateNumber
:
customer
.
plateNumber
,
customerSex
:
customer
.
customerSex
,
experienceFlag
:
customer
.
experienceFlag
,
salesType
:
customer
.
salesType
,
customerName
:
customer
.
customerName
}
this
.
orderObj
.
carBrand
=
`
${
customer
.
carBrand
}
-
${
customer
.
carChildsBrandName
}
-
${
customer
.
carSeriesName
}
`
const
weeks
=
[
'星期日'
,
'星期一'
,
'星期二'
,
'星期三'
,
'星期四'
,
'星期五'
,
'星期六'
]
this
.
$set
(
this
.
orderObj
,
'todayShow'
,
dayjs
(
this
.
orderObj
.
createDate
).
format
(
'YYYY-MM-DD'
)
+
' '
+
weeks
[
dayjs
(
this
.
orderObj
.
createDate
).
day
()])
// 更新表单状态
const
updateFormCell
=
(
formIndex
,
fieldName
,
value
)
=>
{
...
...
@@ -121,10 +120,8 @@ export default {
}
const
formUpdates
=
[
[
1
,
'salesType'
,
customer
.
salesType
],
[
1
,
'customerSex'
,
customer
.
customerSex
],
[
1
,
'experienceFlag'
,
customer
.
experienceFlag
],
[
2
,
'selectPayType'
,
this
.
orderObj
.
selectPayType
],
[
2
,
'payeeType'
,
this
.
orderObj
.
payeeType
]
]
...
...
@@ -150,7 +147,6 @@ export default {
customerSex
:
'1'
,
experienceFlag
:
'Y'
,
payeeType
:
1
,
salesType
:
'0'
,
frontGear
:
null
,
// 1 ,回显upgradeGoodsPosition == 1
frontWindow
:
null
,
// 2
rearWindow
:
null
,
// 3
...
...
@@ -169,6 +165,7 @@ export default {
configPayTypeList
:
[],
// 园区店配置支持的支付方式
payTypeList
,
goodsList
:
[],
otherProduct
:
[],
positionTypeList
:
[],
valueKey
:
''
,
totalPrice
:
0
,
...
...
@@ -202,6 +199,9 @@ export default {
initData
()
{
const
{
userInfo
}
=
this
if
(
!
this
.
orderObj
.
id
)
{
const
weeks
=
[
'星期日'
,
'星期一'
,
'星期二'
,
'星期三'
,
'星期四'
,
'星期五'
,
'星期六'
]
this
.
$set
(
this
.
orderObj
,
'todayShow'
,
dayjs
().
format
(
'YYYY-MM-DD'
)
+
' '
+
weeks
[
dayjs
().
day
()])
this
.
$set
(
this
.
orderObj
,
'createDate'
,
dayjs
().
format
(
'YYYY-MM-DD'
))
// 在原有的 orderObj 对象上新增这些属性
Object
.
assign
(
this
.
orderObj
,
{
sellerMerchantName
:
userInfo
.
merchantName
,
...
...
@@ -212,6 +212,7 @@ export default {
merchantName
:
userInfo
.
shopMerchantName
})
}
this
.
getShopMerchantPointConfig
(
userInfo
.
shopMerchantId
)
this
.
getSubShopMerchantList
(
userInfo
.
shopMerchantId
)
this
.
getSetting
()
...
...
@@ -265,7 +266,9 @@ export default {
this
.
$set
(
this
.
orderObj
,
_typeValue
.
key
,
`
${
chooseContent
.
carBrand
}
-
${
chooseContent
.
carChildsBrandName
}
-
${
chooseContent
.
carSeriesName
}
`
)
this
.
orderObj
.
customer
=
{
...(
this
.
orderObj
.
customer
||
{}),
...
chooseContent
...
chooseContent
,
standNo
:
''
,
plateNumber
:
''
}
}
else
if
(
_typeValue
.
key
==
'couponInfo'
)
{
// 礼券
...
...
@@ -277,18 +280,35 @@ export default {
})
this
.
$set
(
this
.
orderObj
,
'couponInfo'
,
couponName
+
customerCouponCode
)
}
else
if
(
productFields
.
includes
(
_typeValue
.
key
))
{
if
(
_typeValue
.
key
==
'skuGoods'
)
{
if
(
!
this
.
orderObj
[
_typeValue
.
key
])
{
this
.
$set
(
this
.
orderObj
,
_typeValue
.
key
,
chooseContent
)
}
else
{
// 过滤出已选的goodFlag为2的对象
const
selectedGoods
=
this
.
orderObj
[
_typeValue
.
key
].
filter
(
item
=>
item
.
goodsFlag
===
2
)
const
singleGoods
=
chooseContent
.
filter
(
item
=>
item
.
goodsFlag
===
1
)
const
moreGoods
=
chooseContent
.
filter
(
item
=>
item
.
goodsFlag
===
2
)
.
filter
(
item
=>
{
return
!
selectedGoods
.
some
(
selectedItem
=>
selectedItem
.
multipleSpecificationsGoods
.
id
===
item
.
multipleSpecificationsGoods
.
id
)
})
// 合并已选的goodFlag为2的对象
this
.
orderObj
[
_typeValue
.
key
]
=
[...
singleGoods
,
...
moreGoods
,
...
selectedGoods
]
}
}
else
{
// 手动拼装和新增工单一样的结构
console
.
log
(
this
.
orderObj
)
this
.
$set
(
this
.
orderObj
,
_typeValue
.
key
,
Array
.
isArray
(
chooseContent
)
?
chooseContent
.
map
(
item
=>
({
goodsFlag
:
1
,
goods
:
{
...
item
,
sellPrice
:
item
.
price
}
}))
:
[{
goodsFlag
:
1
,
goods
:
chooseContent
}])
}
// 商品类,需计算总价
this
.
$set
(
this
.
orderObj
,
_typeValue
.
key
,
val
.
chooseContent
)
this
.
$nextTick
(()
=>
{
// 确保数据更新后再计算总价
setTimeout
(()
=>
{
this
.
changeTotalPrice
()
})
}
,
0
)
}
else
if
(
_typeValue
.
key
==
'todayShow'
)
{
const
weeks
=
[
'星期日'
,
'星期一'
,
'星期二'
,
'星期三'
,
'星期四'
,
'星期五'
,
'星期六'
]
this
.
$set
(
this
.
orderObj
,
'todayShow'
,
dayjs
(
chooseContent
).
format
(
'YYYY-MM-DD'
)
+
' '
+
weeks
[
dayjs
(
chooseContent
).
day
()])
this
.
$set
(
this
.
orderObj
,
'createDate'
,
dayjs
(
chooseContent
).
format
(
'YYYY-MM-DD'
))
}
else
if
(
_typeValue
.
key
)
{
console
.
log
(
_typeValue
)
this
.
orderObj
[
_typeValue
.
targetIdKey
]
=
chooseContent
[
_typeValue
.
sourceIdKey
]
this
.
$set
(
this
.
orderObj
,
_typeValue
.
targetNameKey
,
chooseContent
[
_typeValue
.
sourceNameKey
])
}
...
...
@@ -348,7 +368,7 @@ export default {
// 处理onlyLabel为true的特殊校验
if
(
onlyLabelItem
.
length
>
0
)
{
// 检查frontGear、frontWindow、rearGear、rearWindow、sunRoof和couponInfo字段中是否至少有一个不为空
const
labelFields
=
[
'frontGear'
,
'frontWindow'
,
'rearGear'
,
'rearWindow'
,
'sunRoof'
]
const
labelFields
=
[
'frontGear'
,
'frontWindow'
,
'rearGear'
,
'rearWindow'
,
'sunRoof'
,
'package'
,
'skuGoods'
]
const
hasValue
=
labelFields
.
some
(
field
=>
{
console
.
log
(
field
,
this
.
orderObj
[
field
])
const
value
=
this
.
orderObj
[
field
]
...
...
@@ -357,7 +377,7 @@ export default {
console
.
log
(
hasValue
,
hasValue
)
if
(
!
hasValue
)
{
uni
.
showToast
({
title
:
'
请至少选择一个产品
'
,
title
:
'
商品不能为空
'
,
icon
:
'none'
})
return
false
...
...
@@ -369,11 +389,13 @@ export default {
// 提交
async
submit
()
{
console
.
log
(
this
.
orderObj
)
// 校验是否填写昨日日报
let
staffCheck
=
await
checkDailyReport
()
if
(
staffCheck
)
return
false
if
(
!
this
.
checkRequired
())
return
const
{
orderCreateType
}
=
this
const
obj
=
utils
.
deepClone
(
this
.
orderObj
)
const
otherCustomer
=
[
'
standNo'
,
'plateNumber'
,
'customerSex'
,
'experienceFlag'
,
'salesType
'
]
const
otherCustomer
=
[
'
customerSex'
,
'experienceFlag
'
]
obj
.
customer
=
{
...
obj
.
customer
,
...
otherCustomer
.
reduce
((
acc
,
key
)
=>
{
...
...
@@ -398,11 +420,12 @@ export default {
return
{
totalPrice
:
item
.
goods
.
sellPrice
,
number
:
item
.
goods
.
number
,
merchantGoodsId
:
item
.
goods
.
merchantGoodsId
merchantGoodsId
:
item
.
goods
.
merchantGoodsId
||
item
.
goods
.
id
,
baseGoodsId
:
item
.
goods
.
baseGoodsId
}
})
}
obj
.
notUpgradeOrderList
=
[{
customer
:
obj
.
customer
,
subOrderList
:
obj
.
subOrderList
}]
obj
.
notUpgradeOrderList
=
[{
customer
:
obj
.
customer
,
subOrderList
:
obj
.
subOrderList
,
confirmIndex
:
false
,
isTouchMove
:
false
,
txtStyle
:
'left:0'
}]
delete
obj
.
carBrand
delete
obj
.
couponInfo
...
...
@@ -413,6 +436,8 @@ export default {
delete
obj
.
package
delete
obj
.
payeeType
delete
obj
.
skuGoods
delete
obj
.
customerName
delete
obj
.
customerPhone
console
.
log
(
obj
,
'rucan'
)
const
res
=
await
uni
.
$api
.
boutiqueApi
.
notUpgradeOrder
({
json
:
JSON
.
stringify
(
obj
)
})
...
...
@@ -428,14 +453,27 @@ export default {
// 计算所有产品的总价
changeTotalPrice
()
{
let
total
=
0
// 遍历所有产品槽位
Object
.
keys
(
this
.
productSlots
).
forEach
(
slotName
=>
{
// 遍历所有商品
const
productFields
=
[
'frontGear'
,
'frontWindow'
,
'rearGear'
,
'rearWindow'
,
'sunRoof'
,
'package'
,
'skuGoods'
]
productFields
.
forEach
(
slotName
=>
{
const
productList
=
this
.
orderObj
[
slotName
]
if
(
Array
.
isArray
(
productList
)
&&
productList
.
length
>
0
)
{
// 计算每个产品的价格 * 数量,并累加到总价
productList
.
forEach
(
item
=>
{
if
(
item
.
goods
&&
item
.
goods
.
sellPrice
&&
item
.
goods
.
number
)
{
total
+=
parseFloat
(
item
.
goods
.
sellPrice
)
*
parseInt
(
item
.
goods
.
number
)
}
else
if
(
item
.
packageGoods
&&
item
.
packageGoods
.
upgradePrice
&&
item
.
packageGoods
.
number
)
{
console
.
log
(
item
.
packageGoods
,
'套餐'
)
// if (item.packageGoods.price) {
// total += parseFloat(item.packageGoods.price) * parseInt(item.packageGoods.number)
// } else {
// total += parseFloat(item.packageGoods.upgradePrice) * parseInt(item.packageGoods.number)
// }
item
.
packageGoods
.
goodsList
.
forEach
(
i
=>
{
total
+=
parseFloat
(
i
.
sellPrice
)
*
parseInt
(
item
.
packageGoods
.
number
)
})
}
else
if
(
item
.
multipleSpecificationsGoods
&&
item
.
multipleSpecificationsGoods
.
goods
&&
item
.
multipleSpecificationsGoods
.
goods
.
sellPrice
&&
item
.
multipleSpecificationsGoods
.
number
)
{
total
+=
parseFloat
(
item
.
multipleSpecificationsGoods
.
goods
.
sellPrice
)
*
parseInt
(
item
.
multipleSpecificationsGoods
.
number
)
}
})
}
...
...
@@ -461,10 +499,10 @@ export default {
const
employeeCell
=
this
.
formList
[
0
].
find
(
item
=>
item
.
label
===
'销售顾问'
)
if
(
employeeCell
)
employeeCell
.
label
=
'销售顾问/录单员'
// 找到formList中label为"交付专员"的对象,添加hidden: true
const
deliveryCell
=
this
.
formList
[
0
].
find
(
item
=>
item
.
label
===
'交付专员'
)
if
(
deliveryCell
)
{
deliveryCell
.
hidden
=
false
}
//
const deliveryCell = this.formList[0].find(item => item.label === '交付专员')
//
if (deliveryCell) {
//
deliveryCell.hidden = false
//
}
}
},
// 判断二级流量方
...
...
@@ -543,7 +581,7 @@ export default {
cell
.
radioList
=
this
.
orderObj
.
payeeType
==
1
?
this
.
merchantPayList
:
this
.
djPayList
if
(
cell
.
radioList
&&
cell
.
radioList
.
length
>
0
)
{
cell
.
current
=
cell
.
radioList
[
0
].
value
this
.
orderObj
.
selectPayType
=
cell
.
radioList
[
0
].
value
//
this.orderObj.selectPayType = cell.radioList[0].value
}
}
},
...
...
@@ -568,11 +606,10 @@ export default {
// 商品列表
async
getSelectOrderGoodsList
()
{
const
{
userInfo
}
=
this
const
res
=
await
uni
.
$api
.
boutiqueApi
.
get
SelectOrder
GoodsList
({
const
res
=
await
uni
.
$api
.
boutiqueApi
.
get
OrderBase
GoodsList
({
merchantId
:
userInfo
.
shopMerchantId
,
sceneType
:
userInfo
.
sceneType
upradeFlag
:
'N'
})
console
.
log
(
res
,
'=====getSelectOrderGoodsList'
)
// 分类映射
const
posMap
=
{
...
...
@@ -590,28 +627,151 @@ export default {
rearWindow
:
[],
sunRoof
:
[]
}
// 目前战败下单,只能选取 太阳膜这个类别的商品
const
dataList
=
res
.
filter
(
val
=>
val
.
goodsType
===
1
).
flatMap
(
val
=>
val
.
upgradeGoodsList
)
console
.
log
(
dataList
)
dataList
.
forEach
(
subVal
=>
{
subVal
.
positionStr
=
subVal
.
position
subVal
.
upgradePrice
=
subVal
.
sellPrice
subVal
.
price
=
subVal
.
sellPrice
subVal
.
goodsId
=
subVal
.
merchantGoodsId
res
.
forEach
(
val
=>
{
if
(
val
.
goodsFlag
==
1
)
{
let
subVal
=
val
.
goods
subVal
.
positionStr
=
subVal
.
position
subVal
.
upgradePrice
=
subVal
.
sellPrice
subVal
.
price
=
subVal
.
sellPrice
subVal
.
goodsId
=
subVal
.
merchantGoodsId
Object
.
keys
(
posMap
).
forEach
(
key
=>
{
if
(
posMap
[
key
].
includes
(
subVal
.
merchantGoodsPosition
))
{
arrMap
[
key
].
push
(
val
)
}
})
}
Object
.
keys
(
posMap
).
forEach
(
key
=>
{
if
(
posMap
[
key
].
includes
(
subVal
.
merchantGoodsPosition
))
{
arrMap
[
key
].
push
({
goodsFlag
:
1
,
goods
:
subVal
})
}
})
})
console
.
log
(
'arrMap'
,
arrMap
)
// 批量设置 hidden 属性
Object
.
keys
(
arrMap
).
forEach
(
key
=>
{
const
cell
=
this
.
formList
[
2
].
find
(
item
=>
item
.
value
===
key
)
if
(
cell
)
cell
.
hidden
=
arrMap
[
key
].
length
===
0
})
const
subOrderList
=
this
.
goodsList
||
[]
let
chooseList
=
[]
console
.
log
(
'subOrderList'
,
subOrderList
)
subOrderList
.
map
(
e
=>
{
// 普通商品
if
(
e
&&
!
e
.
packageName
)
{
if
(
e
.
specificationData
.
indexOf
(
';~;'
)
==
-
1
)
{
// 修复取值字段名字错误问题
if
(
!
e
.
price
)
{
e
.
price
=
utils
.
decimal
(
Number
(
e
.
totalPrice
/
e
.
number
),
2
)
//最低价
}
e
.
sellPrice
=
e
.
price
e
.
goodsId
=
e
.
merchantGoodsId
if
(
!
e
.
minSellPrice
)
e
.
minSellPrice
=
e
.
upgradeShopMinPrice
e
.
goodsInfo
=
{
goodsName
:
e
.
upgradeGoodsAlias
||
e
.
upgradeGoodsName
}
e
.
merchantGoodsId
=
e
.
merchantGoodsId
||
e
.
id
chooseList
.
push
({
goodsFlag
:
1
,
goods
:
e
,
number
:
e
.
number
,
active
:
true
})
}
// 多规格商品
// if (e.specificationData.indexOf(';~;') > -1) {
// // 修复取值字段名字错误问题
// if (!e.price) {
// e.price = utils.decimal(Number(e.totalPrice / e.number), 2)
// //最低价
// e.sellPrice = e.price
// }
// e.goodsId = e.merchantGoodsId
// if (!e.minSellPrice) e.minSellPrice = e.upgradeShopMinPrice
// e.goodsInfo = {
// goodsName: e.upgradeGoodsAlias || e.upgradeGoodsName
// }
// e.count = e.number
// e.merchantGoodsId = e.merchantGoodsId || e.id
// let specificdata = this.handleSpecificationsEcho(e)
// console.log(specificdata, 'specificdata')
// chooseList = chooseList.concat(specificdata)
// }
}
// 套餐
// if (e && e.packageName) {
// e.packageGoodsOrderList.forEach(g => {
// g.oldPrice = g.sellPrice || g.upgradePrice
// // g.sellPrice = g.sellPrice || g.upgradePrice;
// g.price = g.totalPrice ? Number(g.totalPrice) / Number(g.number) : g.sellPrice
// g.sellPrice = g.price
// })
// e.goodsList = e.packageGoodsOrderList
// e.upgradePrice = e.goodsList.reduce((prev, cur) => {
// console.log(prev, cur)
// return prev + cur.sellPrice
// }, 0)
// e.number = e.goodsList.length ? e.goodsList[0].number : 1
// e.price = e.goodsList.reduce((prev, cur) => {
// return prev + Number(cur.totalPrice) / Number(cur.number)
// }, 0)
// chooseList.push({
// isType: 'meal',
// active: true,
// goodsFlag: 3,
// packageGoods: e,
// number: e.number,
// totalPrice: e.price
// })
// }
})
console
.
log
(
chooseList
,
'chooseList'
)
const
_singleGoods
=
chooseList
// const _packageGoods = chooseList.filter(item => item.goodsFlag == 3)
// const _skuGoods = chooseList.filter(item => item.goodsFlag == 2) || []
console
.
log
(
_singleGoods
,
'singleGoods'
)
if
(
_singleGoods
)
{
// 回显upgradeGoodsPosition 1:前挡 2:前窗 3:后窗 4:后挡 5、6、7:天窗。 为空则是其他精品
this
.
$set
(
this
.
orderObj
,
'frontGear'
,
_singleGoods
.
filter
(
item
=>
item
.
goods
.
upgradeGoodsPosition
==
1
)
)
this
.
$set
(
this
.
orderObj
,
'frontWindow'
,
_singleGoods
.
filter
(
item
=>
item
.
goods
.
upgradeGoodsPosition
==
2
)
)
this
.
$set
(
this
.
orderObj
,
'rearWindow'
,
_singleGoods
.
filter
(
item
=>
item
.
goods
.
upgradeGoodsPosition
==
3
)
)
this
.
$set
(
this
.
orderObj
,
'rearGear'
,
_singleGoods
.
filter
(
item
=>
item
.
goods
.
upgradeGoodsPosition
==
4
)
)
this
.
$set
(
this
.
orderObj
,
'sunRoof'
,
_singleGoods
.
filter
(
item
=>
item
.
goods
.
upgradeGoodsPosition
==
5
||
item
.
goods
.
upgradeGoodsPosition
==
6
||
item
.
goods
.
upgradeGoodsPosition
==
7
)
)
// 将没有upgradeGoodsPosition的商品添加到_skuGoods中
// const noPositionGoods = _singleGoods.filter(item => !item.goods.upgradeGoodsPosition)
// if (noPositionGoods.length > 0) {
// _skuGoods.push(...noPositionGoods)
// }
}
// if (_packageGoods) {
// this.$set(this.orderObj, 'package', _packageGoods)
// }
// console.log(_skuGoods, '_skuGoods')
// if (_skuGoods && _skuGoods.length) {
// this.$set(this.orderObj, 'skuGoods', _skuGoods)
// }
console
.
log
(
this
.
orderObj
,
'this.orderObj'
)
this
.
changeTotalPrice
()
},
// 获取不升级常用字符列表
getConfigList
()
{
...
...
@@ -629,6 +789,44 @@ export default {
this
.
$set
(
this
.
orderObj
,
'refusalReason'
,
(
this
.
orderObj
?.
refusalReason
||
''
)
+
text
)
this
.
orderObj
.
customer
.
refusalReason
=
(
this
.
orderObj
.
customer
.
refusalReason
||
''
)
+
text
console
.
log
(
this
.
orderObj
.
customer
?.
refusalReason
)
},
handleSpecificationsEcho
(
item
)
{
let
skuArr
=
[]
const
{
otherProduct
}
=
this
,
arr
=
item
.
specificationData
.
split
(
'/'
),
str
=
arr
.
join
(
';~;'
),
obj
=
{
count
:
item
.
count
,
goodsFlag
:
2
,
goods
:
null
,
active
:
true
,
isFlag
:
true
//初始化进来不显示标识
}
otherProduct
.
forEach
(
data
=>
{
if
(
data
.
goodsFlag
==
2
)
{
let
tempData
=
data
.
multipleSpecificationsGoods
.
specificationGoodsMap
[
str
]
if
(
tempData
)
{
tempData
.
forEach
(
temp
=>
{
if
(
temp
.
merchantGoodsId
==
item
.
goodsId
)
{
obj
.
multipleSpecificationsGoods
=
{
...
data
.
multipleSpecificationsGoods
,
baseGoodsName
:
item
.
goodsName
||
item
.
upgradeGoodsName
,
goods
:
{
...
temp
,
price
:
item
.
price
,
sellPrice
:
item
.
price
,
goodsId
:
item
.
goodsId
,
specificationStr
:
item
.
specificationData
.
replace
(
/;~;/g
,
'/'
)
}
}
skuArr
.
push
(
obj
)
}
})
}
}
})
console
.
log
(
skuArr
)
return
skuArr
}
}
}
...
...
pages/boutique/tool/components/Package.vue
View file @
ad2b8ca
...
...
@@ -5,24 +5,24 @@
<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=
"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
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=
"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)"
/>
<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>
...
...
@@ -32,7 +32,6 @@
</view>
</
template
>
<
script
>
export
default
{
name
:
'Package'
,
props
:
{
...
...
@@ -43,7 +42,7 @@ export default {
positionTypeList
:
{
type
:
Array
,
default
:
[]
}
,
}
},
created
()
{
// 初始化商品数量
...
...
@@ -57,7 +56,7 @@ export default {
updated
()
{
// 当组件数据更新时也检查number属性
this
.
initProductNumbers
()
console
.
log
(
this
.
list
,
'Package-list'
)
console
.
log
(
this
.
list
,
'Package-list
2
'
)
},
methods
:
{
// 初始化商品数量方法
...
...
@@ -70,7 +69,7 @@ export default {
// 存储旧值
item
.
packageGoods
.
goodsList
.
forEach
(
goods
=>
{
if
(
!
goods
.
price
)
{
goods
.
oldPrice
=
goods
.
sellPrice
goods
.
oldPrice
=
goods
.
sellPrice
}
})
})
...
...
@@ -121,7 +120,6 @@ export default {
},
validatePrice
(
event
,
goods
,
ind
,
index
)
{
let
value
=
event
.
detail
.
value
console
.
log
(
'value'
,
value
)
// 如果为空则设置为0
if
(
!
value
||
value
.
trim
()
===
''
)
{
value
=
'0'
...
...
@@ -269,7 +267,7 @@ export default {
align-items
:
center
;
border-bottom
:
toRpx
(
1.6
)
solid
#dce1e6
;
padding
:
toRpx
(
24
);
&-left
{
display
:
flex
;
align-items
:
center
;
...
...
@@ -307,5 +305,4 @@ export default {
}
}
}
</
style
>
\ No newline at end of file
</
style
>
pages/boutique/tool/components/Product.vue
View file @
ad2b8ca
<
template
>
<view>
<view
class=
"shop-list"
>
<view
class=
"shop-item"
v-for=
"(item, index) in list"
:key=
"item.goods.goodsId"
>
<view
class=
"shop-item"
v-for=
"(item, index) in list"
:key=
"item.goods.goodsId
|| item.goods.id
"
>
<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"
>
商品名称:
{{
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-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"
type=
"digit"
maxlength=
"9"
placeholder=
"请输入价格"
placeholder-style=
"font-size: 14px"
v-model=
"item.goods.sellPrice"
@
blur=
"validatePrice($event, item, index)"
/>
<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"
>
...
...
@@ -45,6 +43,10 @@ export default {
baseConfigData
:
{
type
:
Object
,
default
:
{}
},
isDisabled
:
{
type
:
Boolean
,
default
:
false
}
},
created
()
{
...
...
@@ -72,13 +74,13 @@ export default {
},
circulation
(
data
,
str
)
{
let
arr
=
str
.
split
(
'.'
),
result
;
result
if
(
arr
.
length
)
{
result
=
arr
.
reduce
((
pre
,
key
)
=>
{
return
pre
[
key
]
},
data
)
}
return
result
;
return
result
},
// 格式化位置信息
formatPosition
(
item
,
positionTypeList
)
{
...
...
@@ -88,7 +90,6 @@ export default {
// 验证价格输入
validatePrice
(
event
,
item
,
index
)
{
let
value
=
event
.
detail
.
value
console
.
log
(
'value'
,
value
)
// 如果为空则设置为0
if
(
!
value
||
value
.
trim
()
===
''
)
{
value
=
'0'
...
...
@@ -280,4 +281,4 @@ export default {
}
}
}
</
style
>
\ No newline at end of file
</
style
>
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment