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
e09d6425
Commit
e09d6425
authored
Jul 10, 2021
by
mengwenhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:修改价格校验标准
parent
a9f986e4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
32 deletions
+52
-32
index.vue
src/pages/Goods/Detail/index.vue
+52
-32
No files found.
src/pages/Goods/Detail/index.vue
View file @
e09d6425
...
...
@@ -63,6 +63,7 @@
show-word-limit
v-if=
"$route.params.operation === 'EDIT'"
v-model=
"goodsObj.goods_name"
@
blur=
"()=>
{this.checkSameName();}"
>
</el-input>
<span
v-else
>
{{
goodsObj
.
goods_name
}}
</span>
</el-form-item>
...
...
@@ -163,7 +164,6 @@
<el-input
v-if=
"$route.params.operation === 'EDIT'"
type=
"textarea"
:readonly=
"true"
:autosize=
"{ minRows: 4 }"
v-model=
"goodsObj.introduce"
></el-input>
...
...
@@ -220,7 +220,7 @@
<el-popover
v-if=
"$route.params.operation === 'EDIT'"
placement=
"bottom"
:width=
"
6
00"
:width=
"
8
00"
trigger=
"click"
>
<
template
#
reference
>
...
...
@@ -307,7 +307,11 @@
></el-input>
</el-form-item>
<el-form-item
label=
"联系电话:"
>
<el-input
v-model=
"shopForm.connect_phone"
></el-input>
<el-input
v-model=
"shopForm.connect_phone"
maxlength=
"11"
show-word-limit
></el-input>
</el-form-item>
<el-form-item
label=
"地址:"
>
<el-input
v-model=
"shopForm.address"
></el-input>
...
...
@@ -329,7 +333,7 @@
type=
"primary"
@
click=
"addShop"
>
保存
</el-button>
<el-button
@
click=
"
addShopShow = false
"
>
取消
</el-button>
<el-button
@
click=
"
closeAddShops
"
>
取消
</el-button>
</section>
</el-popover>
</el-popover>
...
...
@@ -678,7 +682,7 @@ export default {
optionsValue
:
[],
// 商品分类的值
// 商品回显信息
goodsObj
:
{
introduce
:
""
introduce
:
""
,
// 商品介绍
},
isGoodsNameRepeat
:
false
,
// 商品名称是否重复
...
...
@@ -890,20 +894,22 @@ export default {
};
if
(
!
query
.
shop_name
)
{
return
this
.
$message
.
error
(
"请填写门店名称"
);
}
;
}
if
(
!
query
.
address
)
{
return
this
.
$message
.
error
(
"请填写门店地址"
);
}
;
}
if
(
!
query
.
phone
)
{
return
this
.
$message
.
error
(
"请填写联系电话"
);
}
if
(
!
query
.
longitude
||
!
query
.
latitude
)
{
return
this
.
$message
.
error
(
"请填写地理定位"
);
};
if
(
!
/
([
0-9
]{3,4}
-
)?[
0-9
]{7,8}
/
.
test
(
query
.
phone
)
&&
!
/^
[
1
][
3,4,5,7,8,9
][
0-9
]{9}
$/
.
test
(
query
.
phone
))
{
}
if
(
!
/
([
0-9
]{3,4}
-
)?[
0-9
]{7,8}
/
.
test
(
query
.
phone
)
&&
!
/^
[
1
][
3,4,5,7,8,9
][
0-9
]{9}
$/
.
test
(
query
.
phone
)
)
{
return
this
.
$message
.
error
(
"联系电话格式不正确"
);
};
}
const
res
=
await
postAddShop
(
query
);
if
(
res
.
code
!==
0
)
return
this
.
$message
.
error
(
res
.
reason
);
...
...
@@ -930,6 +936,15 @@ export default {
this
.
getShops
();
},
// 取消新建门店
closeAddShops
()
{
this
.
shopForm
.
shop_name
=
""
;
this
.
shopForm
.
address
=
""
;
this
.
shopForm
.
connect_phone
=
""
;
this
.
shopForm
.
deep_place
=
""
;
this
.
addShopShow
=
false
;
},
// 商品分类列表变化
optionsChange
(
value
)
{
this
.
optionsValue
=
value
;
...
...
@@ -938,6 +953,7 @@ export default {
// 检查商品名称是否重复
async
checkSameName
()
{
console
.
log
(
1
);
const
res
=
await
checkGoodsName
({
life_account_id
:
this
.
goodsObj
.
life_account_id
,
goods_name
:
this
.
goodsObj
.
goods_name
,
...
...
@@ -978,8 +994,8 @@ export default {
// 剩余库存量更改
hasNumber
()
{
if
(
!
this
.
goodsObj
.
inventory_rest
||
this
.
goodsObj
.
inventory_rest
<
0
)
{
this
.
goodsObj
.
inventory_rest
=
0
}
;
this
.
goodsObj
.
inventory_rest
=
0
;
}
},
// 选择时间
...
...
@@ -1055,16 +1071,16 @@ export default {
// 更改售价
salePrice
()
{
if
(
this
.
goodsObj
.
price
.
length
===
0
)
{
this
.
goodsObj
.
price
=
0
}
;
this
.
goodsObj
.
price
=
0
;
}
this
.
goodsObj
.
price
=
parseFloat
(
this
.
goodsObj
.
price
).
toFixed
(
2
);
},
// 更改原价
perPrice
()
{
if
(
this
.
goodsObj
.
original_price
.
length
===
0
)
{
this
.
goodsObj
.
original_price
=
0
}
;
this
.
goodsObj
.
original_price
=
0
;
}
this
.
goodsObj
.
original_price
=
parseFloat
(
this
.
goodsObj
.
original_price
).
toFixed
(
2
);
...
...
@@ -1121,7 +1137,6 @@ export default {
};
console
.
log
(
query
);
this
.
checkSameName
();
// 必填校验
if
(
!
this
.
goodsObj
.
goods_spu_id
)
{
return
this
.
$message
.
error
(
"未传入商品id"
);
...
...
@@ -1138,33 +1153,38 @@ export default {
if
(
!
query
.
expiration_time
)
{
return
this
.
$message
.
error
(
"过期时间未填写,请填写后再提交"
);
};
if
(
!
query
.
rule_limit
)
{
if
(
query
.
rule_limit
===
""
)
{
return
this
.
$message
.
error
(
"请填写单人可购买上限"
);
};
if
(
typeof
parseInt
(
query
.
rule_limit
)
!==
"number"
)
{
return
this
.
$message
.
error
(
"单人可购上线只可为数值"
);
};
if
(
!
query
.
rule_desc
)
{
return
this
.
$message
.
error
(
"请填写使用规则描述"
);
};
if
(
!
query
.
rule_refund
)
{
return
this
.
$message
.
error
(
"请填写退款规则"
);
}
;
if
(
!
query
.
inventory_add
.
length
===
0
)
{
}
if
(
query
.
inventory_add
.
length
===
0
)
{
return
this
.
$message
.
error
(
"请填写库存剩余量"
);
}
;
if
(
!
query
.
original_price
)
{
}
if
(
query
.
original_price
.
length
===
0
)
{
return
this
.
$message
.
error
(
"请填写原价(保留两位小数)"
);
};
if
(
typeof
query
.
original_price
!==
"number"
)
{
}
if
(
query
.
price
.
length
===
0
)
{
return
this
.
$message
.
error
(
"请填写售价(保留两位小数)"
);
}
console
.
log
(
typeof
parseInt
(
query
.
original_price
));
if
(
typeof
parseInt
(
query
.
original_price
)
!==
"number"
)
{
return
this
.
$message
.
error
(
"原价价格必须为数字"
);
}
;
if
(
typeof
query
.
price
!==
"number"
)
{
}
if
(
typeof
parseInt
(
query
.
price
)
!==
"number"
)
{
return
this
.
$message
.
error
(
"售价价格必须为数字格式"
);
};
if
(
!
query
.
price
)
{
return
this
.
$message
.
error
(
"请填写现价(保留两位小数)"
);
};
}
if
(
!
query
.
sub_shop_ids
)
{
return
this
.
$message
.
error
(
"请填写门店id"
);
}
;
}
const
res
=
await
editGoods
(
query
);
if
(
res
.
code
!==
0
)
{
...
...
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