Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx-business
/
develop-platform
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit e594ef08
authored
Nov 18, 2020
by
cwq0219
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
验证
1 parent
2b401072
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
100 additions
and
11 deletions
src/common/constants.js
src/components/d2-form/index.vue
src/components/d2-form/relateProDialog.vue
src/views/goods/editCommodity.vue
src/common/constants.js
View file @
e594ef0
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: limin
* @Author: limin
* @Date: 2019-09-01 19:06:01
* @Date: 2019-09-01 19:06:01
* @Last Modified by: chenwq
* @Last Modified by: chenwq
* @Last Modified time: 2020-11-1
5 11:24:23
* @Last Modified time: 2020-11-1
8 15:19:52
*/
*/
// import { LOGIN_URL, REG_URL, ROLE_LIST_URL } from '@/api/sys.account'
// import { LOGIN_URL, REG_URL, ROLE_LIST_URL } from '@/api/sys.account'
...
@@ -106,3 +106,30 @@ export const brandMerchantList = [{
...
@@ -106,3 +106,30 @@ export const brandMerchantList = [{
confId
:
'10'
,
confId
:
'10'
,
confValue
:
'嘀嘀虎'
confValue
:
'嘀嘀虎'
}]
}]
// 新值,旧值,整数部分位数,小数部分位数,最小值,最大值,规则
export
function
limitPrice
(
newValue
,
oldValue
,
intergerDigit
,
pointDigit
,
minValue
,
maxValue
,
regRule
)
{
var
reg
=
{
priceReg
:
/^
\d[\d\.]
*$/
,
numReg
:
/^
[
1-9
]\d
*$/
}
regRule
=
regRule
||
'priceReg'
if
(
newValue
&&
(
minValue
&&
(
newValue
<
minValue
))
||
(
maxValue
&&
(
newValue
>
maxValue
)))
{
return
oldValue
||
''
}
if
(
newValue
&&
reg
[
regRule
].
test
(
newValue
+
''
))
{
if
((
/
\.
/
).
test
(
newValue
))
{
newValue
=
newValue
+
''
var
interger
=
newValue
.
split
(
'.'
)[
0
]
var
point
=
newValue
.
split
(
'.'
)[
1
]
var
intergerNum
=
interger
.
length
>
intergerDigit
?
oldValue
.
split
(
'.'
)[
0
]
:
interger
var
pointNum
=
point
.
length
>
pointDigit
?
point
.
slice
(
0
,
pointDigit
)
:
point
newValue
=
pointDigit
?
intergerNum
+
'.'
+
pointNum
:
newValue
.
split
(
'.'
)[
0
]
}
else
{
newValue
=
newValue
.
length
>
intergerDigit
?
oldValue
.
slice
(
0
,
intergerDigit
)
:
newValue
}
return
newValue
}
else
{
return
newValue
?
oldValue
:
''
}
}
src/components/d2-form/index.vue
View file @
e594ef0
...
@@ -35,6 +35,7 @@
...
@@ -35,6 +35,7 @@
:style=
"
{'width': item.width || formItemWidth}"
:style=
"
{'width': item.width || formItemWidth}"
:disabled="item.isDisabled"
:disabled="item.isDisabled"
clearable
clearable
@input="item.handleInput"
>
</el-input>
>
</el-input>
<!-- 选择框 -->
<!-- 选择框 -->
<el-select
<el-select
...
@@ -239,13 +240,19 @@
...
@@ -239,13 +240,19 @@
class=
"activity-img muti-imgs img-w-h"
class=
"activity-img muti-imgs img-w-h"
v-else-if=
"subItem.resType === 1"
v-else-if=
"subItem.resType === 1"
>
>
<div
v-show=
"!subItem.content"
class=
"add"
>
+
</div>
<div
v-show=
"!subItem.content"
class=
"add"
>
+
</div>
<img
<img
v-show=
"subItem.content"
v-show=
"subItem.content"
class=
"img-w-h"
class=
"img-w-h"
:src=
"subItem.content"
:src=
"subItem.content"
/>
/>
<span
class=
"img-btns"
v-show=
"subItem.content"
>
<span
class=
"img-btns"
v-show=
"subItem.content"
>
<span
class=
"btn-item"
>
<span
class=
"btn-item"
>
<i
<i
@
click=
'handleImgDelete(item, subIndex)'
@
click=
'handleImgDelete(item, subIndex)'
...
@@ -462,12 +469,16 @@ export default {
...
@@ -462,12 +469,16 @@ export default {
},
},
handleRelateProConfirm
(
proInfo
)
{
handleRelateProConfirm
(
proInfo
)
{
// this.relateProVisible = false
// this.relateProVisible = false
proInfo
.
profitType
=
1
// this.originProInfo = {}
// this.originProInfo = {}
if
(
this
.
proIndex
!==
-
1
)
{
if
(
this
.
proIndex
!==
-
1
)
{
this
.
formData
.
upgradeGoods
[
this
.
proIndex
]
=
proInfo
this
.
formData
.
upgradeGoods
[
this
.
proIndex
]
=
proInfo
}
else
{
}
else
{
proInfo
=
{
...
proInfo
,
profitType
:
1
}
this
.
formData
.
upgradeGoods
.
push
(
proInfo
)
this
.
formData
.
upgradeGoods
.
push
(
proInfo
)
console
.
log
(
this
.
formData
.
upgradeGoods
[
this
.
proIndex
])
this
.
judgeIsDisable
()
this
.
judgeIsDisable
()
}
}
this
.
handleRelateProClose
()
this
.
handleRelateProClose
()
...
...
src/components/d2-form/relateProDialog.vue
View file @
e594ef0
...
@@ -49,6 +49,7 @@
...
@@ -49,6 +49,7 @@
v-model=
"proInfo.upgradePrice"
v-model=
"proInfo.upgradePrice"
placeholder=
"请输入建议升级价"
placeholder=
"请输入建议升级价"
class=
"dis-in-block"
class=
"dis-in-block"
@
input=
"handleUpgradePrice"
></el-input>
></el-input>
<span>
元
</span>
<span>
元
</span>
</el-form-item>
</el-form-item>
...
@@ -60,6 +61,7 @@
...
@@ -60,6 +61,7 @@
v-model=
"proInfo.shopPrice"
v-model=
"proInfo.shopPrice"
placeholder=
"请输入建议到店价"
placeholder=
"请输入建议到店价"
class=
"dis-in-block"
class=
"dis-in-block"
@
input=
"handleShopPrice"
></el-input>
></el-input>
<span>
元
</span>
<span>
元
</span>
</el-form-item>
</el-form-item>
...
@@ -69,6 +71,7 @@
...
@@ -69,6 +71,7 @@
placeholder=
"请输入升级最大折扣"
placeholder=
"请输入升级最大折扣"
clearable
clearable
class=
"dis-in-block"
class=
"dis-in-block"
@
input=
"handleMaxUpgradeDiscount"
></el-input>
></el-input>
<span>
折
</span>
<span>
折
</span>
</el-form-item>
</el-form-item>
...
@@ -78,6 +81,8 @@
...
@@ -78,6 +81,8 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
_
from
'lodash'
import
{
limitPrice
}
from
'@/common/constants'
export
default
{
export
default
{
name
:
'relateProDialog'
,
name
:
'relateProDialog'
,
data
()
{
data
()
{
...
@@ -97,10 +102,27 @@ export default {
...
@@ -97,10 +102,27 @@ export default {
goodsCode
:
[{
required
:
true
,
message
:
'请选择关联升级商品'
,
trigger
:
'blur'
}],
goodsCode
:
[{
required
:
true
,
message
:
'请选择关联升级商品'
,
trigger
:
'blur'
}],
upgradePrice
:
[{
required
:
true
,
message
:
'请输入建议升级价'
,
trigger
:
'blur'
}],
upgradePrice
:
[{
required
:
true
,
message
:
'请输入建议升级价'
,
trigger
:
'blur'
}],
shopPrice
:
[{
required
:
true
,
message
:
'请输入到店价'
,
trigger
:
'blur'
}]
shopPrice
:
[{
required
:
true
,
message
:
'请输入到店价'
,
trigger
:
'blur'
}]
},
oldVal
:
{
upgradePrice
:
''
,
shopPrice
:
''
,
maxUpgradeDiscount
:
''
}
}
}
}
},
},
// watch: {
// 'proInfo.upgradePrice'(val, oldVal) {
// this.proInfo.upgradePrice = limitPrice(val, oldVal, 8, 2)
// },
// 'proInfo.shopPrice'(val, oldVal) {
// this.proInfo.shopPrice = limitPrice(val, oldVal, 6, 2)
// },
// 'proInfo.maxUpgradeDiscount'(val, oldVal) {
// this.proInfo.maxUpgradeDiscount = limitPrice(val, oldVal, 1, 1, 1)
// }
// },
props
:
{
props
:
{
relateProVisible
:
{
relateProVisible
:
{
type
:
Boolean
,
type
:
Boolean
,
...
@@ -117,9 +139,9 @@ export default {
...
@@ -117,9 +139,9 @@ export default {
},
},
mounted
()
{
mounted
()
{
this
.
proInfo
=
this
.
originProInfo
||
this
.
proInfo
this
.
proInfo
=
_
.
cloneDeep
(
this
.
originProInfo
)
||
_
.
cloneDeep
(
this
.
proInfo
)
console
.
log
(
this
.
proInfo
)
//
console.log(this.proInfo)
console
.
log
(
this
.
proList
)
//
console.log(this.proList)
},
},
methods
:
{
methods
:
{
...
@@ -140,6 +162,18 @@ export default {
...
@@ -140,6 +162,18 @@ export default {
},
},
handleRelateProClose
()
{
handleRelateProClose
()
{
this
.
$emit
(
'handleRelateProClose'
)
this
.
$emit
(
'handleRelateProClose'
)
},
handleUpgradePrice
(
newVal
)
{
this
.
proInfo
.
upgradePrice
=
limitPrice
(
newVal
,
this
.
oldVal
.
upgradePrice
,
8
,
2
)
this
.
oldVal
.
upgradePrice
=
this
.
proInfo
.
upgradePrice
},
handleShopPrice
(
newVal
)
{
this
.
proInfo
.
shopPrice
=
limitPrice
(
newVal
,
this
.
oldVal
.
shopPrice
,
6
,
2
)
this
.
oldVal
.
shopPrice
=
this
.
proInfo
.
shopPrice
},
handleMaxUpgradeDiscount
(
newVal
)
{
this
.
proInfo
.
maxUpgradeDiscount
=
limitPrice
(
newVal
,
this
.
oldVal
.
maxUpgradeDiscount
,
1
,
1
,
1
)
this
.
oldVal
.
maxUpgradeDiscount
=
this
.
proInfo
.
maxUpgradeDiscount
}
}
}
}
}
}
...
...
src/views/goods/editCommodity.vue
View file @
e594ef0
...
@@ -15,12 +15,12 @@
...
@@ -15,12 +15,12 @@
@
handleAddConfirm=
"handleAddConfirm"
@
handleAddConfirm=
"handleAddConfirm"
@
handleClose=
"handleAddClose"
@
handleClose=
"handleAddClose"
></d2-form>
></d2-form>
</d2-container>
</d2-container>
</
template
>
</
template
>
<
script
>
<
script
>
import
{
mapActions
}
from
'vuex'
import
{
mapActions
}
from
'vuex'
import
{
limitPrice
}
from
'@/common/constants'
import
{
commodityAddSeviceMerchant
,
getGoodsList
,
baseGoodsAdd
,
baseGoodsUpdate
,
getGoodsInfoById
}
from
'@/api/commodity'
import
{
commodityAddSeviceMerchant
,
getGoodsList
,
baseGoodsAdd
,
baseGoodsUpdate
,
getGoodsInfoById
}
from
'@/api/commodity'
export
default
{
export
default
{
name
:
'editCommodity'
,
name
:
'editCommodity'
,
...
@@ -39,6 +39,11 @@ export default {
...
@@ -39,6 +39,11 @@ export default {
upgradeGoods
:
[],
upgradeGoods
:
[],
linkMerchantIds
:
[]
linkMerchantIds
:
[]
},
},
markOldVal
:
{
retailPrice
:
''
,
shopPrice
:
''
,
maxRetailDiscount
:
''
},
formItemWidth
:
'200px'
,
formItemWidth
:
'200px'
,
rules
:
{
rules
:
{
goodsCode
:
[{
required
:
true
,
message
:
'请选择商品名称'
,
trigger
:
'change'
}],
goodsCode
:
[{
required
:
true
,
message
:
'请选择商品名称'
,
trigger
:
'change'
}],
...
@@ -86,18 +91,30 @@ export default {
...
@@ -86,18 +91,30 @@ export default {
label
:
'商品零售价'
,
label
:
'商品零售价'
,
type
:
'input'
,
type
:
'input'
,
unit
:
'元'
,
unit
:
'元'
,
tips
:
'(前端展示给车主)'
tips
:
'(前端展示给车主)'
,
handleInput
:
(
newVal
)
=>
{
this
.
$refs
.
d2Form
.
formData
.
retailPrice
=
limitPrice
(
newVal
,
this
.
markOldVal
.
retailPrice
,
6
,
2
)
this
.
markOldVal
.
retailPrice
=
this
.
$refs
.
d2Form
.
formData
.
retailPrice
}
},
{
},
{
name
:
'shopPrice'
,
name
:
'shopPrice'
,
label
:
'到店价'
,
label
:
'到店价'
,
type
:
'input'
,
type
:
'input'
,
unit
:
'元'
,
unit
:
'元'
,
tips
:
'(商品最终交易价格)'
tips
:
'(商品最终交易价格)'
,
handleInput
:
(
newVal
)
=>
{
this
.
$refs
.
d2Form
.
formData
.
shopPrice
=
limitPrice
(
newVal
,
this
.
markOldVal
.
shopPrice
,
6
,
2
)
this
.
markOldVal
.
shopPrice
=
this
.
$refs
.
d2Form
.
formData
.
shopPrice
}
},
{
},
{
name
:
'maxRetailDiscount'
,
name
:
'maxRetailDiscount'
,
label
:
'到店零售折扣'
,
label
:
'到店零售折扣'
,
type
:
'input'
,
type
:
'input'
,
unit
:
'折'
unit
:
'折'
,
handleInput
:
(
newVal
)
=>
{
this
.
$refs
.
d2Form
.
formData
.
maxRetailDiscount
=
limitPrice
(
newVal
,
this
.
markOldVal
.
maxRetailDiscount
,
1
,
1
,
1
)
this
.
markOldVal
.
maxRetailDiscount
=
this
.
$refs
.
d2Form
.
formData
.
maxRetailDiscount
}
}]
}]
},
{
},
{
title
:
'关联升级商品信息'
,
title
:
'关联升级商品信息'
,
...
...
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