Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
op-web-service
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bp
op-web-service
Commits
201207c7
Commit
201207c7
authored
Jul 14, 2021
by
mengwenhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:商品-门店列表选择/表情符号校验
parent
7ea287f2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
19 deletions
+58
-19
index.vue
src/pages/Goods/Detail/index.vue
+48
-19
filterInput.js
src/pages/Goods/utils/filterInput.js
+10
-0
No files found.
src/pages/Goods/Detail/index.vue
View file @
201207c7
...
@@ -63,6 +63,7 @@
...
@@ -63,6 +63,7 @@
show-word-limit
show-word-limit
v-if=
"$route.params.operation === 'EDIT'"
v-if=
"$route.params.operation === 'EDIT'"
v-model=
"goodsObj.goods_name"
v-model=
"goodsObj.goods_name"
@
input=
"checkHaveExpression"
@
blur=
"checkSameName"
@
blur=
"checkSameName"
></el-input>
></el-input>
<span
v-else
>
{{
goodsObj
.
goods_name
}}
</span>
<span
v-else
>
{{
goodsObj
.
goods_name
}}
</span>
...
@@ -85,9 +86,9 @@
...
@@ -85,9 +86,9 @@
maxlength=
"50"
maxlength=
"50"
show-word-limit
show-word-limit
:autosize=
"
{ minRows: 4 }"
:autosize=
"
{ minRows: 4 }"
v-model="goodsObj.
introduce
"
v-model="goodsObj.
desc
"
>
</el-input>
>
</el-input>
<span
v-else
>
{{
goodsObj
.
introduce
}}
</span>
<span
v-else
>
{{
goodsObj
.
desc
}}
</span>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
</section>
</section>
...
@@ -235,6 +236,7 @@
...
@@ -235,6 +236,7 @@
</
template
>
</
template
>
<!-- 门店列表 -->
<!-- 门店列表 -->
<el-table
<el-table
ref=
"shopListRef"
:data=
"shopsList"
:data=
"shopsList"
@
selection-change=
"handleShopsChange"
@
selection-change=
"handleShopsChange"
>
>
...
@@ -242,6 +244,7 @@
...
@@ -242,6 +244,7 @@
type=
"selection"
type=
"selection"
width=
"55"
width=
"55"
:selectable=
"canChooseShop"
:selectable=
"canChooseShop"
aria-checked=
"true"
>
>
</el-table-column>
</el-table-column>
<el-table-column
<el-table-column
...
@@ -569,18 +572,18 @@
...
@@ -569,18 +572,18 @@
:maxlength=
"200"
:maxlength=
"200"
type=
"textarea"
type=
"textarea"
style=
"width:100%"
style=
"width:100%"
v-model=
"rejectReason.reason"
v-model
.
trim
=
"rejectReason.reason"
></el-input>
></el-input>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
<section
style=
"display:flex;justify-content:center;"
>
<section
style=
"display:flex;justify-content:center;"
>
<el-button
<el-button
type=
"danger"
type=
"danger"
@
click
.
stop
=
"onDefault"
@
click=
"onDefault"
>
驳回
</el-button>
>
驳回
</el-button>
<el-button
<el-button
type=
"primary"
type=
"primary"
@
click
.
stop
=
"rejectVisible = false"
@
click=
"rejectVisible = false"
>
取消
>
取消
</el-button>
</el-button>
</section>
</section>
...
@@ -623,6 +626,8 @@ import {
...
@@ -623,6 +626,8 @@ import {
import
{
GOODS_URI
}
from
"../../../../server/config.js"
;
import
{
GOODS_URI
}
from
"../../../../server/config.js"
;
import
filterInput
from
"../utils/filterInput"
;
export
default
{
export
default
{
name
:
"GoodsDetail"
,
name
:
"GoodsDetail"
,
...
@@ -735,6 +740,8 @@ export default {
...
@@ -735,6 +740,8 @@ export default {
},
},
shopsList
:
[],
// 门店列表
shopsList
:
[],
// 门店列表
shopId
:
[],
// 门店id数组
chooseShopsList
:
[],
// 已选门店列表
shopsCount
:
0
,
shopsCount
:
0
,
shopCurrentPage
:
1
,
// 门店列表当前页
shopCurrentPage
:
1
,
// 门店列表当前页
...
@@ -795,10 +802,10 @@ export default {
...
@@ -795,10 +802,10 @@ export default {
// 渲染过期时间
// 渲染过期时间
this
.
expirationTime
=
goods_info
.
expiration_time
;
this
.
expirationTime
=
goods_info
.
expiration_time
;
// 初始化门店id
// 初始化门店id
const
shopId
=
goods_info
.
sub_shop
.
map
(
item
=>
{
this
.
shopId
=
goods_info
.
sub_shop
.
map
(
item
=>
{
return
item
.
sub_shop_id
;
return
item
.
sub_shop_id
;
});
});
this
.
shopIds
=
shopId
.
join
(
","
);
this
.
shopIds
=
this
.
shopId
.
join
(
","
);
// 初始化规则开始时间
// 初始化规则开始时间
this
.
activeStartTime
=
goods_info
.
rule_start_time
;
this
.
activeStartTime
=
goods_info
.
rule_start_time
;
// 初始化规则结束时间
// 初始化规则结束时间
...
@@ -856,6 +863,16 @@ export default {
...
@@ -856,6 +863,16 @@ export default {
return
new
Date
(
nowYear
,
nowMonth
,
nowDate
,
Hour
,
Minute
,
Second
);
return
new
Date
(
nowYear
,
nowMonth
,
nowDate
,
Hour
,
Minute
,
Second
);
},
},
// 检查输入是否带有表情符号
checkHaveExpression
(
value
)
{
if
(
!
filterInput
.
checkString
(
value
))
{
this
.
$nextTick
(()
=>
{
this
.
goodsObj
.
goods_name
=
""
;
});
return
this
.
$message
.
error
(
"商品名称中不可有表情符号"
);
}
},
// 获取门店列表
// 获取门店列表
async
getShops
()
{
async
getShops
()
{
const
query
=
{
const
query
=
{
...
@@ -868,6 +885,13 @@ export default {
...
@@ -868,6 +885,13 @@ export default {
console
.
log
(
res
);
console
.
log
(
res
);
this
.
shopsList
=
res
.
result
;
this
.
shopsList
=
res
.
result
;
this
.
shopsCount
=
res
.
count
;
this
.
shopsCount
=
res
.
count
;
this
.
$nextTick
(()
=>
{
this
.
shopsList
.
forEach
(
row
=>
{
if
(
this
.
shopId
.
indexOf
(
row
.
sub_shop_id
)
!==
-
1
)
{
this
.
$refs
.
shopListRef
.
toggleRowSelection
(
row
,
true
);
}
});
});
},
},
// 门店列表更改时操作
// 门店列表更改时操作
...
@@ -880,11 +904,14 @@ export default {
...
@@ -880,11 +904,14 @@ export default {
this
.
shopIds
=
shopList
.
join
(
","
);
this
.
shopIds
=
shopList
.
join
(
","
);
},
},
// 是否可选门店
// 是否可选门店
canChooseShop
()
{
canChooseShop
(
row
)
{
if
(
this
.
goodsObj
.
sub_shop
.
length
===
1
)
{
if
(
return
false
;
this
.
goodsObj
.
sub_shop
.
length
===
0
||
}
else
{
this
.
shopIds
===
row
.
sub_shop_id
)
{
return
true
;
return
true
;
}
else
{
return
false
;
}
}
},
},
...
@@ -931,10 +958,10 @@ export default {
...
@@ -931,10 +958,10 @@ export default {
this
.
goodsObj
.
sub_shop
=
this
.
goodsObj
.
sub_shop
.
filter
(
item
=>
{
this
.
goodsObj
.
sub_shop
=
this
.
goodsObj
.
sub_shop
.
filter
(
item
=>
{
return
item
.
sub_shop_id
!==
subShopId
;
return
item
.
sub_shop_id
!==
subShopId
;
});
});
const
shopIdsList
=
this
.
goodsObj
.
sub_shop
.
map
(
item
=>
{
this
.
shopId
=
this
.
goodsObj
.
sub_shop
.
map
(
item
=>
{
return
item
.
sub_shop_id
;
return
item
.
sub_shop_id
;
});
});
this
.
shopIds
=
shopIdsList
.
join
(
","
);
this
.
shopIds
=
this
.
shopId
.
join
(
","
);
},
},
// 商品列表换页
// 商品列表换页
...
@@ -1127,16 +1154,18 @@ export default {
...
@@ -1127,16 +1154,18 @@ export default {
// 审核拒绝
// 审核拒绝
async
onDefault
()
{
async
onDefault
()
{
console
.
log
(
this
.
rejectReason
.
reason
);
if
(
this
.
rejectReason
.
reason
==
""
)
{
return
this
.
$message
.
error
(
"审核驳回时,驳回原因不能为空"
);
}
const
query
=
{
const
query
=
{
goods_spu_id
:
this
.
goodsObj
.
goods_spu_id
,
goods_spu_id
:
this
.
goodsObj
.
goods_spu_id
,
rejected_reason
:
this
.
rejectReason
.
reason
rejected_reason
:
this
.
rejectReason
.
reason
};
};
console
.
log
(
query
.
rejected_reason
);
if
(
query
.
rejected_reason
!==
"0"
&&
!
query
.
rejected_reason
)
{
return
this
.
$message
.
error
(
"审核驳回时,审核原因不可为空"
);
}
const
res
=
await
auditReject
(
query
);
const
res
=
await
auditReject
(
query
);
if
(
res
.
code
!==
0
)
return
this
.
$message
.
error
(
res
.
reason
);
if
(
res
.
code
!==
0
)
{
return
this
.
$message
.
error
(
res
.
reason
);
}
this
.
$message
.
warning
(
"审核驳回成功!"
);
this
.
$message
.
warning
(
"审核驳回成功!"
);
this
.
$router
.
replace
({
name
:
"GoodsList"
});
this
.
$router
.
replace
({
name
:
"GoodsList"
});
},
},
...
@@ -1213,7 +1242,7 @@ export default {
...
@@ -1213,7 +1242,7 @@ export default {
}
}
if
(
!
query
.
sub_shop_ids
)
{
if
(
!
query
.
sub_shop_ids
)
{
return
this
.
$message
.
error
(
"请
填写门店id
"
);
return
this
.
$message
.
error
(
"请
至少选择一个门店
"
);
}
}
const
res
=
await
editGoods
(
query
);
const
res
=
await
editGoods
(
query
);
...
...
src/pages/Goods/utils/filterInput.js
0 → 100644
View file @
201207c7
// 检测内容是否带表情符号
function
checkString
(
strings
)
{
const
checkKey
=
/
[^\u
0020-
\u
007E
\u
00A0-
\u
00BE
\u
2E80-
\u
A4CF
\u
F900-
\u
FAFF
\u
FE30-
\u
FE4F
\u
FF00-
\u
FFEF
\u
0080-
\u
009F
\u
2000-
\u
201f
\u
2026
\u
2022
\u
20ac
\r\n]
/g
;
if
(
checkKey
.
test
(
strings
))
{
return
false
;
}
else
{
return
true
;
};
};
export
default
{
checkString
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment