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
4f5f1b64
Commit
4f5f1b64
authored
Aug 31, 2021
by
gengshaojing
Browse files
Options
Browse Files
Download
Plain Diff
fix: 合并hotfix
parents
354158d0
c9861793
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
18001 additions
and
18217 deletions
+18001
-18217
package-lock.json
package-lock.json
+15447
-15418
index.html
public/index.html
+2
-0
relay.js
server/controllers/relay.js
+93
-0
router.js
server/router.js
+6
-0
request.js
server/utils/request.js
+35
-25
index.vue
src/pages/Activity/ActivityDetail/index.vue
+267
-295
addProduc.vue
src/pages/Activity/releaseProduc/components/addProduc.vue
+631
-769
infoEditing.vue
src/pages/Activity/releaseProduc/components/infoEditing.vue
+142
-151
myMap.vue
src/pages/Activity/releaseProduc/components/myMap.vue
+256
-244
index.vue
src/pages/Goods/Detail/index.vue
+1073
-1272
groupmeal.js
src/service/Groupmeal/groupmeal.js
+17
-14
util.js
src/utils/util.js
+32
-29
No files found.
package-lock.json
View file @
4f5f1b64
This source diff could not be displayed because it is too large. You can
view the blob
instead.
public/index.html
View file @
4f5f1b64
...
@@ -16,6 +16,8 @@
...
@@ -16,6 +16,8 @@
<
%
for
(
let
i
in
htmlWebpackPlugin
.
options
.
cdn
&&
htmlWebpackPlugin
.
options
.
cdn
.
js
)
{
%
>
<
%
for
(
let
i
in
htmlWebpackPlugin
.
options
.
cdn
&&
htmlWebpackPlugin
.
options
.
cdn
.
js
)
{
%
>
<script
src=
"<%= htmlWebpackPlugin.options.cdn.js[i] %>"
></script>
<script
src=
"<%= htmlWebpackPlugin.options.cdn.js[i] %>"
></script>
<
%
}
%
>
<
%
}
%
>
<script
src=
"//webapi.amap.com/maps?v=1.3&key=bb057625545d8cf77df1379e7aaae0b5"
></script>
<script
src=
"//webapi.amap.com/ui/1.0/main.js"
></script>
<title><
%=
htmlWebpackPlugin
.
options
.
title
%
></title>
<title><
%=
htmlWebpackPlugin
.
options
.
title
%
></title>
</head>
</head>
...
...
server/controllers/relay.js
0 → 100644
View file @
4f5f1b64
const
fs
=
require
(
"fs"
);
const
API_INTERNAL_URI
=
require
(
"../config.js"
).
API_INTERNAL_URI
;
const
reqOther
=
require
(
"../utils/request"
).
httpReqOther
;
const
FormData
=
require
(
"form-data"
);
const
http
=
require
(
"http"
);
const
GROUPMEAL_URI
=
require
(
"../config.js"
).
GROUPMEAL_URI
;
exports
.
uploadPic
=
async
(
ctx
,
next
)
=>
{
const
url
=
`
${
API_INTERNAL_URI
}
/ksy/ks3apiunencrypt/ks3api_upload`
;
const
{
body
:
{
type
},
files
,
}
=
ctx
.
request
;
console
.
log
(
"type"
,
type
);
const
filePath
=
files
.
file
.
path
;
const
file
=
fs
.
createReadStream
(
filePath
);
const
form
=
new
FormData
();
form
.
append
(
"file"
,
file
);
form
.
append
(
"type"
,
type
);
const
opts
=
{
method
:
"post"
,
url
:
url
,
body
:
form
,
headers
:
form
.
getHeaders
(),
};
ctx
.
body
=
await
reqOther
(
opts
);
};
exports
.
oldOrderExport
=
async
(
ctx
)
=>
{
const
{
marketing_id
,
type
}
=
ctx
.
query
;
// `${ENV}order/oldbackground/order_export?marketing_id=${eventId}&type=${type}`;
const
url
=
`
${
GROUPMEAL_URI
}
/order/oldbackground/order_export?marketing_id=
${
marketing_id
}
&type=
${
type
}
`
;
console
.
log
(
"url"
,
url
);
const
options
=
new
URL
(
url
);
let
{
buffer
,
res
}
=
await
requestPromise
(
options
);
const
fileName
=
res
.
headers
[
"content-disposition"
].
split
(
"="
)[
1
];
ctx
.
set
(
"Content-Type"
,
"application/octet-stream"
);
ctx
.
set
(
"Content-Disposition"
,
`attachment; filename=
${
fileName
}
`
);
ctx
.
body
=
buffer
;
};
exports
.
orderExport
=
async
(
ctx
)
=>
{
const
{
marketing_id
,
type
}
=
ctx
.
query
;
const
url
=
`
${
GROUPMEAL_URI
}
/order/background/order_export?marketing_id=
${
marketing_id
}
&type=
${
type
}
`
;
console
.
log
(
"url"
,
url
);
const
options
=
new
URL
(
url
);
let
{
buffer
,
res
}
=
await
requestPromise
(
options
);
const
fileName
=
res
.
headers
[
"content-disposition"
].
split
(
"="
)[
1
];
ctx
.
set
(
"Content-Type"
,
"application/octet-stream"
);
ctx
.
set
(
"Content-Disposition"
,
`attachment; filename=
${
fileName
}
`
);
ctx
.
body
=
buffer
;
};
function
requestPromise
(
options
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
const
req
=
http
.
request
(
options
,
function
(
res
)
{
let
{
statusCode
}
=
res
;
//返回不是200
if
(
statusCode
!==
200
)
{
return
reject
(
new
Error
(
"error"
));
}
let
arr
=
[];
let
len
=
0
;
res
.
on
(
"data"
,
(
chunk
)
=>
{
len
+=
chunk
.
length
;
arr
.
push
(
Buffer
.
from
(
chunk
));
});
res
.
on
(
"end"
,
()
=>
{
//正确 success
return
resolve
({
buffer
:
Buffer
.
concat
(
arr
,
len
),
res
,
});
});
});
//请求出错
req
.
on
(
"error"
,
(
err
)
=>
{
return
reject
(
err
);
});
req
.
end
();
});
}
server/router.js
View file @
4f5f1b64
...
@@ -10,6 +10,7 @@ const activity = require("./controllers/activity");
...
@@ -10,6 +10,7 @@ const activity = require("./controllers/activity");
const
withdrawal
=
require
(
"./controllers/withdrawal"
);
const
withdrawal
=
require
(
"./controllers/withdrawal"
);
const
groupmeal
=
require
(
"./controllers/groupmeal"
);
const
groupmeal
=
require
(
"./controllers/groupmeal"
);
const
qr_code
=
require
(
"./controllers/qr-code"
);
const
qr_code
=
require
(
"./controllers/qr-code"
);
const
relay
=
require
(
"./controllers/relay"
);
const
router
=
Router
();
const
router
=
Router
();
const
API_VERSION
=
"/api/v1"
;
const
API_VERSION
=
"/api/v1"
;
...
@@ -130,4 +131,9 @@ router.post(`${API_VERSION}/get_reblack_list`, withdrawal.getReblackList);
...
@@ -130,4 +131,9 @@ router.post(`${API_VERSION}/get_reblack_list`, withdrawal.getReblackList);
router
.
get
(
`
${
API_VERSION
}
/get_wallet_account_status`
,
withdrawal
.
getWalletAccountStatus
);
router
.
get
(
`
${
API_VERSION
}
/get_wallet_account_status`
,
withdrawal
.
getWalletAccountStatus
);
router
.
post
(
`
${
API_VERSION
}
/reset_wallet_account_status`
,
withdrawal
.
resetAccountStatus
);
router
.
post
(
`
${
API_VERSION
}
/reset_wallet_account_status`
,
withdrawal
.
resetAccountStatus
);
// 图片上传
router
.
post
(
`
${
API_VERSION
}
/relay/ks3api_upload`
,
relay
.
uploadPic
);
router
.
get
(
`
${
API_VERSION
}
/relay/order_export`
,
relay
.
orderExport
);
router
.
get
(
`
${
API_VERSION
}
/relay/old_order_export`
,
relay
.
oldOrderExport
);
module
.
exports
=
router
;
module
.
exports
=
router
;
server/utils/request.js
View file @
4f5f1b64
const
request
=
require
(
"request"
);
const
request
=
require
(
"request"
);
exports
.
httpReq
=
(
ctx
,
opts
)
=>
{
exports
.
httpReq
=
(
ctx
,
opts
)
=>
{
opts
.
timeout
=
opts
.
timeout
||
10000
;
opts
.
timeout
=
opts
.
timeout
||
10000
;
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
var
time_start
=
+
new
Date
();
var
time_start
=
+
new
Date
();
const
defaultQs
=
{
const
defaultQs
=
{
appid
:
"merchant-op"
,
appid
:
"merchant-op"
,
cv
:
"1.0.0"
,
cv
:
"1.0.0"
,
version
:
"999999"
,
version
:
"999999"
,
distribution
:
"op"
,
distribution
:
"op"
,
net
:
"wifi"
,
net
:
"wifi"
,
platform
:
"2"
platform
:
"2"
,
};
};
opts
.
qs
=
{
...
defaultQs
,
...
ctx
.
request
.
query
,
...
opts
.
qs
};
opts
.
qs
=
{
...
defaultQs
,
...
ctx
.
request
.
query
,
...
opts
.
qs
};
request
(
opts
,
(
err
,
res
,
body
)
=>
{
request
(
opts
,
(
err
,
res
,
body
)
=>
{
console
.
info
(
console
.
info
(
`[Api] httpReq (
${
opts
.
url
}
, user:[
${
opts
.
qs
.
op_cur_user
}
]) spent:
${
+
new
Date
()
-
time_start
}
ms`
);
`[Api] httpReq (
${
opts
.
url
}
, user:[
${
opts
.
qs
.
op_cur_user
}
]) spent:
${
+
new
Date
()
-
time_start
}
ms`
);
if
(
!
err
)
{
if
(
!
err
)
{
resolve
(
body
);
resolve
(
body
);
}
else
{
}
else
{
reject
(
err
);
reject
(
err
);
console
.
error
(
opts
.
url
,
err
);
console
.
error
(
opts
.
url
,
err
);
}
}
});
});
};
exports
.
httpReqOther
=
(
opts
)
=>
{
opts
.
timeout
=
opts
.
timeout
||
10000
;
return
new
Promise
((
resolve
,
reject
)
=>
{
request
(
opts
,
(
err
,
res
,
body
)
=>
{
if
(
!
err
)
{
resolve
(
body
);
}
else
{
reject
(
err
);
console
.
error
(
opts
.
url
,
err
);
}
});
});
});
});
};
};
src/pages/Activity/ActivityDetail/index.vue
View file @
4f5f1b64
<
template
>
<
template
>
<div
<div
class=
"wrapper"
class=
"wrapper"
v-loading=
"pageLoading"
v-loading=
"pageLoading"
element-loading-text=
"拼命加载中"
element-loading-text=
"拼命加载中"
element-loading-spinner=
"el-icon-loading"
element-loading-spinner=
"el-icon-loading"
element-loading-background=
"rgba(0, 0, 0, 0.8)"
element-loading-background=
"rgba(0, 0, 0, 0.8)"
>
>
<!-- 商品详情信息 -->
<!-- 商品详情信息 -->
<div
class=
"activityInfo-wrapper"
>
<div
class=
"activityInfo-wrapper"
>
<el-card
class=
"activityInfo"
>
<el-card
class=
"activityInfo"
>
<div
class=
"infoItem"
>
<div
class=
"infoItem"
>
<p
class=
"infoItemText"
>
{{
detailInfo
.
sumOrder
}}
</p>
<p
class=
"infoItemText"
>
{{
detailInfo
.
sumOrder
}}
</p>
<p>
订单数量
</p>
<p>
订单数量
</p>
</div>
<div
class=
"infoItem"
>
<p
class=
"infoItemText"
>
{{
detailInfo
.
sumGoods
}}
</p>
<p>
已售商品数量
</p>
</div>
<div
class=
"infoItem"
>
<p
class=
"infoItemText"
>
{{
detailInfo
.
payAmount
}}
</p>
<p>
支付金额
</p>
</div>
<div
class=
"infoItem"
>
<p
class=
"infoItemText"
>
{{
detailInfo
.
sumCouponAmount
}}
</p>
<p>
优惠金额
</p>
</div>
<div
class=
"infoItem"
>
<p
class=
"infoItemText"
>
{{
detailInfo
.
refundAmount
}}
</p>
<p>
退款
</p>
</div>
<div
class=
"infoItem"
>
<p
class=
"infoItemText"
>
{{
detailInfo
.
income
}}
</p>
<p>
实际收入
</p>
</div>
</el-card>
</div>
</div>
<div
class=
"infoItem"
>
<!-- 商品详情 -->
<p
class=
"infoItemText"
>
{{
detailInfo
.
sumGoods
}}
</p>
<div
class=
"activityDetail"
>
<p>
已售商品数量
</p>
<section
class=
"content"
>
</div>
<!-- 商品列表 -->
<div
class=
"infoItem"
>
<el-card
class=
"activityGoods box-card"
>
<p
class=
"infoItemText"
>
{{
detailInfo
.
payAmount
}}
</p>
<div
class=
"my-header"
>
<p>
支付金额
</p>
<h3>
{{
marketingInfo
.
marketing_name
}}
</h3>
</div>
<!-- 查看参与字段待确认 -->
<div
class=
"infoItem"
>
<p>
<p
class=
"infoItemText"
>
{{
detailInfo
.
sumCouponAmount
}}
</p>
<span>
{{
detailInfo
.
lookUserCount
}}
人查看
</span>
<p>
优惠金额
</p>
|
</div>
<span>
{{
detailInfo
.
haveBuyGoodsUserCount
}}
人参与
</span>
<div
class=
"infoItem"
>
</p>
<p
class=
"infoItemText"
>
{{
detailInfo
.
refundAmount
}}
</p>
<p
class=
"endTime"
>
{{
showTimer
}}
</p>
<p>
退款
</p>
</div>
</div>
<!--
<p
class=
"title"
>
拼单商品
</p>
-->
<div
class=
"infoItem"
>
<!--
<div
class=
"images-wrapper"
>
<p
class=
"infoItemText"
>
{{
detailInfo
.
income
}}
</p>
<p>
实际收入
</p>
</div>
</el-card>
</div>
<!-- 商品详情 -->
<div
class=
"activityDetail"
>
<section
class=
"content"
>
<!-- 商品列表 -->
<el-card
class=
"activityGoods box-card"
>
<div
class=
"my-header"
>
<h3>
{{
marketingInfo
.
marketing_name
}}
</h3>
<!-- 查看参与字段待确认 -->
<p>
<span>
{{
detailInfo
.
lookUserCount
}}
人查看
</span>
|
<span
>
{{
detailInfo
.
haveBuyGoodsUserCount
}}
人参与
</span
>
</p>
<p
class=
"endTime"
>
{{
showTimer
}}
</p>
</div>
<!--
<p
class=
"title"
>
拼单商品
</p>
-->
<!--
<div
class=
"images-wrapper"
>
<div
<div
class=
"image-block"
class=
"image-block"
v-for=
"picItem in goodsList"
v-for=
"picItem in goodsList"
...
@@ -66,263 +66,235 @@
...
@@ -66,263 +66,235 @@
<span
class=
"goodsPrice"
>
{{
`¥${picItem.price
}
`
}}
<
/span
>
<span
class=
"goodsPrice"
>
{{
`¥${picItem.price
}
`
}}
<
/span
>
<
/div
>
<
/div
>
<
/div> --
>
<
/div> --
>
<
/el-card
>
<
/el-card
>
<!--
商品描述
-->
<!--
商品描述
-->
<
el
-
card
class
=
"activityIntroduce box-card"
>
<
el
-
card
class
=
"activityIntroduce box-card"
>
<
p
class
=
"introduceText"
>
<
p
class
=
"introduceText"
>
{{
marketingInfo
.
pindan_desc
}}
{{
marketingInfo
.
pindan_desc
}}
<
/p
>
<
/p
>
<
el
-
image
<
el
-
image
v
-
for
=
"(picItem, index) in marketingInfo.pindan_pic_url"
v
-
for
=
"(picItem, index) in marketingInfo.pindan_pic_url"
:
key
=
"index"
:
key
=
"index"
class
=
"activityImage"
class
=
"activityImage"
style
=
"width: 100%; height: 400px"
style
=
"width: 100%; height: 400px"
:
src
=
"picItem"
:
src
=
"picItem"
fit
=
"contain"
fit
=
"contain"
><
/el-image
>
><
/el-image
>
<
/el-card
>
<
/el-card
>
<
el
-
card
class
=
"activities box-card"
>
<
el
-
card
class
=
"activities box-card"
>
<
div
<
div
v
-
for
=
"goodsItem in goodsList"
:
key
=
"goodsItem.goods_sku_id"
class
=
"activityItem"
>
v
-
for
=
"goodsItem in goodsList"
<
el
-
image
:
key
=
"goodsItem.goods_sku_id"
class
=
"activityImage"
class
=
"activityItem"
style
=
"width: 100px; height: 100px"
>
:
src
=
"goodsItem.desc_pic_url_list[0]"
<
el
-
image
fit
=
"fit"
class
=
"activityImage"
><
/el-image
>
style
=
"width: 100px; height: 100px"
<
div
class
=
"itemIntroduce"
>
:
src
=
"goodsItem.desc_pic_url_list[0]"
<
p
>
{{
goodsItem
.
goods_name
}}
<
/p
>
fit
=
"fit"
<
p
class
=
"price"
>
><
/el-image
>
<
span
class
=
"nowPrice"
>
{{
`¥${goodsItem.price
}
`
}}
<
/span
>
<
div
class
=
"itemIntroduce"
>
<
span
class
=
"originPrice"
>
{{
`¥${goodsItem.original_price
}
`
}}
<
/span
>
<
p
>
{{
goodsItem
.
goods_name
}}
<
/p
>
<
span
class
=
"sold"
>
已售
{{
goodsItem
.
all_have_buy_goods_count
}}
<
/span
>
<
p
class
=
"price"
>
<
/p
>
<
span
class
=
"nowPrice"
>
{{
`¥${goodsItem.price
}
`
}}
<
/span
>
<
/div
>
<
span
class
=
"originPrice"
>
{{
<
/div
>
`¥${goodsItem.original_price
}
`
<
/el-card
>
}}
<
/span
>
<
/section
>
<
span
class
=
"sold"
v
-
if
=
"goodsItem.inventory_rest == 0"
<
/div
>
>
抢光了
<
/spa
n
<
div
class
=
"button-close"
>
>
<
el
-
button
class
=
"button-block"
size
=
"medium"
type
=
"primary"
@
click
=
"closePage"
>
关
闭
<
/el-button
>
<
span
class
=
"sold"
v
-
else
<
/div
>
>
已售
{{
goodsItem
.
all_have_buy_goods_count
}}
<
/spa
n
>
<
/p
>
<
/div
>
<
/div
>
<
/el-card
>
<
/section
>
<
/div
>
<
div
class
=
"button-close"
>
<
el
-
button
class
=
"button-block"
size
=
"medium"
type
=
"primary"
@
click
=
"closePage"
>
关
闭
<
/el-butto
n
>
<
/div
>
<
/div
>
<
/div
>
<
/template
>
<
/template
>
<
script
>
<
script
>
import
ActivityService
from
"@/service/Activity/index"
;
import
ActivityService
from
"@/service/Activity/index"
;
import
{
ElMessage
}
from
"element-plus"
;
import
{
ElMessage
}
from
"element-plus"
;
import
dayJs
from
"dayjs"
;
import
dayJs
from
"dayjs"
;
export
default
{
export
default
{
props
:
{
}
,
props
:
{
}
,
data
()
{
data
()
{
return
{
return
{
pageLoading
:
false
,
pageLoading
:
false
,
goodsList
:
[],
goodsList
:
[],
marketingInfo
:
{
}
,
marketingInfo
:
{
}
,
endTime
:
""
,
endTime
:
""
,
showTimer
:
""
,
showTimer
:
""
,
detailInfo
:
{
}
detailInfo
:
{
}
,
}
;
}
;
}
,
}
,
watch
:
{
}
,
watch
:
{
}
,
computed
:
{
}
,
computed
:
{
}
,
methods
:
{
methods
:
{
async
checkActivityDetail
()
{
async
checkActivityDetail
()
{
try
{
try
{
this
.
pageLoading
=
true
;
this
.
pageLoading
=
true
;
let
dataArr
=
await
Promise
.
all
([
let
dataArr
=
await
Promise
.
all
([
ActivityService
.
checkActivityDetail
({
ActivityService
.
checkActivityDetail
({
marketing_id
:
this
.
$route
.
query
.
marketing_id
,
marketing_id
:
this
.
$route
.
query
.
marketing_id
,
marketing_type
:
this
.
$route
.
query
.
marketing_type
marketing_type
:
this
.
$route
.
query
.
marketing_type
,
}
),
}
),
ActivityService
.
checkActivityDetailInfo
({
ActivityService
.
checkActivityDetailInfo
({
marketing_id
:
this
.
$route
.
query
.
marketing_id
marketing_id
:
this
.
$route
.
query
.
marketing_id
,
}
)
}
),
]);
]);
this
.
pageLoading
=
false
;
this
.
pageLoading
=
false
;
this
.
goodsList
=
dataArr
[
0
].
result
.
goods_list
;
this
.
goodsList
=
dataArr
[
0
].
result
.
goods_list
;
this
.
marketingInfo
=
dataArr
[
0
].
result
.
marketing_info
;
this
.
marketingInfo
=
dataArr
[
0
].
result
.
marketing_info
;
this
.
endTime
=
dataArr
[
0
].
result
.
marketing_info
.
end_time
;
this
.
endTime
=
dataArr
[
0
].
result
.
marketing_info
.
end_time
;
this
.
detailInfo
=
dataArr
[
1
].
result
;
this
.
detailInfo
=
dataArr
[
1
].
result
;
}
catch
{
}
catch
{
this
.
pageLoading
=
false
;
this
.
pageLoading
=
false
;
ElMessage
.
error
(
"加载失败"
);
ElMessage
.
error
(
"加载失败"
);
}
}
}
,
}
,
// 时间差转时分秒
// 时间差转时分秒
getTimeout
(
timeCount
)
{
getTimeout
(
timeCount
)
{
if
(
timeCount
>
0
)
{
if
(
timeCount
>
0
)
{
var
days
=
parseInt
(
timeCount
/
(
1000
*
60
*
60
*
24
));
var
days
=
parseInt
(
timeCount
/
(
1000
*
60
*
60
*
24
));
var
hours
=
parseInt
(
var
hours
=
parseInt
((
timeCount
%
(
1000
*
60
*
60
*
24
))
/
(
1000
*
60
*
60
));
(
timeCount
%
(
1000
*
60
*
60
*
24
))
/
(
1000
*
60
*
60
)
var
minutes
=
parseInt
((
timeCount
%
(
1000
*
60
*
60
))
/
(
1000
*
60
));
);
var
seconds
=
parseInt
((
timeCount
%
(
1000
*
60
))
/
1000
);
var
minutes
=
parseInt
((
timeCount
%
(
1000
*
60
*
60
))
/
(
1000
*
60
));
this
.
showTimer
=
"距结束:"
+
days
+
" 天 "
+
hours
+
" 小时 "
+
minutes
+
" 分钟 "
+
seconds
+
" 秒 "
;
var
seconds
=
parseInt
((
timeCount
%
(
1000
*
60
))
/
1000
);
}
else
{
this
.
showTimer
=
this
.
showTimer
=
"已结束"
;
"距结束:"
+
}
days
+
}
,
" 天 "
+
hours
+
" 小时 "
+
minutes
+
" 分钟 "
+
seconds
+
" 秒 "
;
}
else
{
this
.
showTimer
=
"已结束"
;
}
}
,
// 定时器
// 定时器
myTimer
()
{
myTimer
()
{
let
dateNow
=
dayJs
();
let
dateNow
=
dayJs
();
this
.
timer
=
setInterval
(()
=>
{
this
.
timer
=
setInterval
(()
=>
{
dateNow
=
dayJs
().
subtract
(
1
,
"minute"
);
dateNow
=
dayJs
().
subtract
(
1
,
"minute"
);
let
myTime
=
dayJs
(
this
.
endTime
).
diff
(
dateNow
);
// 时间差
let
myTime
=
dayJs
(
this
.
endTime
).
diff
(
dateNow
);
// 时间差
this
.
getTimeout
(
myTime
);
this
.
getTimeout
(
myTime
);
if
(
this
.
myTime
<=
0
)
{
if
(
this
.
myTime
<=
0
)
{
clearInterval
(
this
.
timer
);
clearInterval
(
this
.
timer
);
}
}
}
,
1000
);
}
,
1000
);
}
,
}
,
closePage
()
{
closePage
()
{
this
.
$router
.
go
(
-
1
);
this
.
$router
.
go
(
-
1
);
}
}
,
}
,
}
,
async
created
()
{
async
created
()
{
await
this
.
checkActivityDetail
();
await
this
.
checkActivityDetail
();
this
.
myTimer
();
this
.
myTimer
();
}
,
}
,
beforeUnmount
()
{
beforeUnmount
()
{
clearInterval
(
this
.
timer
);
clearInterval
(
this
.
timer
);
}
}
,
}
;
}
;
<
/script
>
<
/script
>
<
style
lang
=
"less"
scoped
>
<
style
lang
=
"less"
scoped
>
.
wrapper
{
.
wrapper
{
height
:
100
%
;
height
:
100
%
;
display
:
flex
;
display
:
flex
;
overflow
-
y
:
scroll
;
overflow
-
y
:
scroll
;
flex
-
direction
:
column
;
flex
-
direction
:
column
;
justify
-
content
:
flex
-
start
;
justify
-
content
:
flex
-
start
;
align
-
items
:
center
;
align
-
items
:
center
;
padding
:
45
px
10
px
0
;
padding
:
45
px
10
px
0
;
.
activityInfo
{
.
activityInfo
{
width
:
500
px
;
width
:
500
px
;
/deep/
.
el
-
card__body
{
/deep/
.
el
-
card__body
{
width
:
100
%
;
width
:
100
%
;
display
:
flex
;
display
:
flex
;
flex
-
wrap
:
wrap
;
flex
-
wrap
:
wrap
;
}
}
.
infoItem
{
.
infoItem
{
width
:
33
%
;
width
:
33
%
;
text
-
align
:
center
;
text
-
align
:
center
;
margin
-
bottom
:
20
px
;
margin
-
bottom
:
20
px
;
.
infoItemText
{
.
infoItemText
{
font
-
weight
:
bolder
;
font
-
weight
:
bolder
;
}
}
}
}
.
activityDetail
{
width
:
500
px
;
.
content
{
.
my
-
header
{
.
endTime
{
margin
:
5
px
0
;
font
-
size
:
15
px
;
color
:
red
;
}
}
.
box
-
card
{
margin
:
10
px
0
;
}
.
activityGoods
{
.
images
-
wrapper
{
display
:
flex
;
flex
-
wrap
:
wrap
;
.
image
-
block
{
margin
:
0
5
px
0
0
px
;
display
:
flex
;
flex
-
direction
:
column
;
justify
-
content
:
center
;
align
-
items
:
center
;
.
goodsPrice
{
color
:
red
;
font
-
size
:
18
px
;
}
}
}
.
image
-
block
:
nth
-
child
(
4
n
+
0
)
{
margin
-
right
:
0
;
}
}
.
activityImage
{
margin
:
10
px
10
px
0
0
;
}
}
.
activityIntroduce
{
padding
:
5
px
0
;
.
introduceText
{
margin
-
bottom
:
20
px
;
}
}
}
.
activityDetail
{
.
activities
{
width
:
500
px
;
.
activityItem
{
.
content
{
display
:
flex
;
.
my
-
header
{
margin
:
15
px
0
;
.
endTime
{
.
itemIntroduce
{
margin
:
5
px
0
;
position
:
relative
;
font
-
size
:
15
px
;
display
:
flex
;
color
:
red
;
width
:
100
%
;
}
flex
-
direction
:
column
;
}
justify
-
content
:
space
-
around
;
.
box
-
card
{
margin
-
left
:
10
px
;
margin
:
10
px
0
;
>
p
{
}
width
:
200
px
;
.
activityGoods
{
.
images
-
wrapper
{
display
:
flex
;
flex
-
wrap
:
wrap
;
.
image
-
block
{
margin
:
0
5
px
0
0
px
;
display
:
flex
;
flex
-
direction
:
column
;
justify
-
content
:
center
;
align
-
items
:
center
;
.
goodsPrice
{
color
:
red
;
font
-
size
:
18
px
;
}
}
.
image
-
block
:
nth
-
child
(
4
n
+
0
)
{
margin
-
right
:
0
;
}
}
.
activityImage
{
margin
:
10
px
10
px
0
0
;
}
}
.
activityIntroduce
{
padding
:
5
px
0
;
.
introduceText
{
margin
-
bottom
:
20
px
;
}
}
.
activities
{
.
activityItem
{
display
:
flex
;
margin
:
15
px
0
;
.
itemIntroduce
{
position
:
relative
;
display
:
flex
;
width
:
100
%
;
flex
-
direction
:
column
;
justify
-
content
:
space
-
around
;
margin
-
left
:
10
px
;
>
p
{
width
:
200
px
;
}
.
price
{
.
nowPrice
{
color
:
red
;
padding
-
right
:
10
px
;
}
.
originPrice
{
text
-
decoration
:
line
-
through
;
}
}
}
.
sold
{
position
:
absolute
;
right
:
20
px
;
color
:
#
d44549
;
font
-
weight
:
500
;
}
}
}
}
}
.
price
{
}
.
nowPrice
{
.
button
-
close
{
color
:
red
;
margin
:
10
px
0
30
px
;
padding
-
right
:
10
px
;
.
button
-
block
{
}
width
:
200
px
;
.
originPrice
{
text
-
decoration
:
line
-
through
;
}
}
}
}
.
sold
{
position
:
absolute
;
right
:
20
px
;
color
:
#
d44549
;
font
-
weight
:
500
;
}
}
}
}
}
}
.
button
-
close
{
margin
:
10
px
0
30
px
;
.
button
-
block
{
width
:
200
px
;
}
}
}
}
<
/style
>
<
/style
>
src/pages/Activity/releaseProduc/components/addProduc.vue
View file @
4f5f1b64
<
template
>
<
template
>
<div
class=
"addProduc"
>
<div
class=
"addProduc"
>
<!-- 按钮组 -->
<!-- 按钮组 -->
<div
class=
"btnGroup"
>
<div
class=
"btnGroup"
>
<el-button
class=
"addCommodityBtn"
@
click=
"commodity('add', '')"
<el-button
class=
"addCommodityBtn"
@
click=
"commodity('add', '')"
>
添加商品
</el-button>
>
添加商品
</el-button
<!--
<el-button
class=
"commodLibraryAdd"
@
click=
"commodLibraryAdd"
>
<!--
<el-button
class=
"commodLibraryAdd"
@
click=
"commodLibraryAdd"
>
从商品库添加
</el-button
>
从商品库添加
</el-button
>
-->
>
-->
</div>
<!-- Tab -->
<el-table
:data=
"comTableData"
border
style=
"width: 100%;margin-bottom:80px;"
:header-cell-style=
"cellClass"
>
<el-table-column
label=
"显示顺序"
align=
"center"
width=
"50px"
>
<el-table-column
label=
""
align=
"center"
width=
"50px"
>
<template
#
default=
"scope"
>
<i
class=
"el-icon-top"
@
click=
"upMove(scope.$index, scope.row)"
style=
"margin-right:15px;"
></i>
</
template
>
</el-table-column>
<el-table-column
label=
""
align=
"center"
width=
"50px"
>
<
template
#
default=
"scope"
>
<i
class=
"el-icon-bottom"
@
click=
"upDown(scope.$index, scope.row)"
></i>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
prop=
"goods_sku_id"
label=
"商品ID"
width=
"180"
></el-table-column>
<el-table-column
prop=
"goods_name"
label=
"商品标题"
width=
"180"
></el-table-column>
<el-table-column
prop=
"price"
label=
"售价"
>
</el-table-column>
<el-table-column
prop=
"ota_name"
label=
"商家"
>
</el-table-column>
<el-table-column
prop=
"inventory_total"
label=
"库存"
>
</el-table-column>
<el-table-column
prop=
"total_amount_sold"
label=
"已售数量"
>
</el-table-column>
<el-table-column
prop=
"inventory_rest"
label=
"剩余库存"
></el-table-column>
<el-table-column
label=
"操作"
width=
"120"
fixed=
"right"
>
<
template
#
default=
"scope"
>
<div
class=
"buttons_actions"
>
<el-button
type=
"text"
size=
"small"
@
click=
"commodity('update', scope.row)"
>
修改
</el-button
>
<el-button
type=
"text"
size=
"small"
@
click=
"removeCom(scope.row)"
>
移除
</el-button
>
</div>
</
template
>
</el-table-column>
</el-table>
<!-- 添加商品 -->
<el-dialog
:title=
"addCommodityTitle"
v-model=
"addCommodityPopup"
width=
"50%"
custom-class=
"add_goods_dialog"
>
<el-form
:inline=
"true"
:model=
"commodityForm"
ref=
"infoForm"
class=
"demo-form-inline infoForm"
label-width=
"100px"
>
<el-form-item
label=
"图片:"
>
<el-upload
:class=
"{ hide: hideUpload }"
:data=
"{ type: 1 }"
:action=
"uploadUrl"
:on-preview=
"previewImage"
:on-success=
"handleDetailSuccess"
:on-change=
"handleDetailChange"
:before-remove=
"removeDetailFiles"
:file-list=
"picUrlList"
auto-upload
ref=
"picUpload"
:limit=
"limitCount"
list-type=
"picture-card"
multiple
>
<
template
#
default
>
<i
class=
"el-icon-plus"
></i>
</
template
>
</el-upload>
</el-form-item>
<el-form-item
label=
"商品标题:"
prop=
"goods_name"
style=
"width:90%;"
:rules=
"[{ required: true, message: '请输入商品标题' }]"
>
<el-input
v-model=
"commodityForm.goods_name"
maxlength=
"30"
></el-input>
</el-form-item>
<el-form-item
label=
"售价:"
prop=
"price"
:rules=
"[{ required: true, message: '请输入售价' }]"
>
<el-input-number
class=
"price"
v-model=
"commodityForm.price"
:min=
"0"
:controls=
"false"
:precision=
"2"
placeholder=
""
></el-input-number>
</el-form-item>
<el-form-item
label=
"划线价:"
prop=
"original_price"
>
<el-input-number
v-model=
"commodityForm.original_price"
class=
"price"
:min=
"0"
:controls=
"false"
:precision=
"2"
placeholder=
""
></el-input-number>
</el-form-item>
<br
/>
<el-form-item
label=
"库存:"
prop=
"inventory_total"
:rules=
"[{ required: true, message: '请输入库存' }]"
>
<el-input
v-model=
"commodityForm.inventory_total"
placeholder=
""
@
input=
"inventoryIpt"
:rules=
"[{ required: true, message: '请输入库存' }]"
></el-input>
</el-form-item>
<div
style=
"display: inline-block; height: 42px; margin-left: 33px"
>
已售:
<span
style=
"margin-right: 10px"
>
{{
commodityForm.total_amount_sold
}}
</span>
<!-- 剩余库存:<span>{{ commodityForm.inventory_total }}</span> -->
</div>
</div>
<el-form-item
<!-- Tab -->
prop=
"checkedRadio"
<el-table
:data=
"comTableData"
border
style=
"width: 100%; margin-bottom: 80px"
:header-cell-style=
"cellClass"
>
:rules=
"[
<el-table-column
label=
"显示顺序"
align=
"center"
width=
"50px"
>
{
<el-table-column
label=
""
align=
"center"
width=
"50px"
>
required: true,
<template
#
default=
"scope"
>
message: '请选择购买限制',
<i
class=
"el-icon-top"
@
click=
"upMove(scope.$index, scope.row)"
style=
"margin-right: 15px"
></i>
trigger: 'change'
</
template
>
}
</el-table-column>
]"
<el-table-column
label=
""
align=
"center"
width=
"50px"
>
class=
"limit_radio"
<
template
#
default=
"scope"
>
label=
"购买限制"
<i
class=
"el-icon-bottom"
@
click=
"upDown(scope.$index, scope.row)"
></i>
>
</
template
>
<el-radio-group
v-model=
"commodityForm.checkedRadio"
>
</el-table-column>
<el-radio
label=
"不限制"
></el-radio>
</el-table-column>
<el-radio
label=
"每人最多买"
></el-radio>
<el-table-column
prop=
"goods_sku_id"
label=
"商品ID"
width=
"180"
></el-table-column>
</el-radio-group>
<el-table-column
prop=
"goods_name"
label=
"商品标题"
width=
"180"
></el-table-column>
</el-form-item>
<el-table-column
prop=
"price"
label=
"售价"
></el-table-column>
<el-form-item
<el-table-column
prop=
"ota_name"
label=
"商家"
></el-table-column>
prop=
"num_limit"
<el-table-column
prop=
"inventory_total"
label=
"库存"
></el-table-column>
:show-message=
"
<el-table-column
prop=
"total_amount_sold"
label=
"已售数量"
></el-table-column>
commodityForm.checkedRadio === '每人最多买' ? true : false
<el-table-column
prop=
"inventory_rest"
label=
"剩余库存"
></el-table-column>
"
<el-table-column
label=
"操作"
width=
"120"
fixed=
"right"
>
:rules=
"[
<
template
#
default=
"scope"
>
{
<div
class=
"buttons_actions"
>
validator:
<el-button
type=
"text"
size=
"small"
@
click=
"commodity('update', scope.row)"
>
修改
</el-button>
commodityForm.checkedRadio === '每人最多买'
<el-button
type=
"text"
size=
"small"
@
click=
"removeCom(scope.row)"
>
移除
</el-button>
? checkPurseLimit
</div>
: checkPurseLimitNull,
</
template
>
trigger: 'blur'
</el-table-column>
}
</el-table>
]"
<!-- 添加商品 -->
>
<el-dialog
:title=
"addCommodityTitle"
v-model=
"addCommodityPopup"
width=
"50%"
custom-class=
"add_goods_dialog"
>
<el-input
<el-form
:inline=
"true"
:model=
"commodityForm"
ref=
"infoForm"
class=
"demo-form-inline infoForm"
label-width=
"100px"
>
v-model=
"commodityForm.num_limit"
<el-form-item
label=
"图片:"
>
:disabled=
"
<el-upload
commodityForm.checkedRadio === '' ||
:class=
"{ hide: hideUpload }"
commodityForm.checkedRadio === '不限制' ||
:data=
"{ type: 1 }"
commodityForm.checkedRadio === undefined
:action=
"uploadUrl"
? true
:on-preview=
"previewImage"
: false
:on-success=
"handleDetailSuccess"
"
:on-change=
"handleDetailChange"
:min=
"0"
:before-remove=
"removeDetailFiles"
:controls=
"false"
:file-list=
"picUrlList"
></el-input>
auto-upload
</el-form-item>
ref=
"picUpload"
<el-form-item
:limit=
"limitCount"
label=
"商家:"
list-type=
"picture-card"
prop=
"business1"
multiple
:rules=
"[{ required: true, message: '请选择商家' }]"
>
>
<
template
#
default
>
<el-select
v-model=
"commodityForm.business1"
placeholder=
"请选择"
>
<i
class=
"el-icon-plus"
></i>
<el-option
</
template
>
v-for=
"item in businessOpt"
</el-upload>
:key=
"item.ota_id"
</el-form-item>
:label=
"item.ota_name"
<el-form-item
label=
"商品标题:"
prop=
"goods_name"
style=
"width: 90%"
:rules=
"[{ required: true, message: '请输入商品标题' }]"
>
:value=
"item.ota_id"
<el-input
v-model=
"commodityForm.goods_name"
maxlength=
"30"
></el-input>
></el-option>
</el-form-item>
</el-select>
<el-form-item
label=
"售价:"
prop=
"price"
:rules=
"[{ required: true, message: '请输入售价' }]"
>
</el-form-item>
<el-input-number
</el-form>
class=
"price"
<
template
#
footer
>
v-model=
"commodityForm.price"
<span
class=
"dialog-footer"
>
:min=
"0"
<el-button
@
click=
"commodityCancel"
>
取 消
</el-button>
:controls=
"false"
<el-button
type=
"primary"
@
click=
"commoditySave('infoForm')"
:precision=
"2"
>
保存
</el-button
placeholder=
""
>
></el-input-number>
</span>
</el-form-item>
</
template
>
<el-form-item
label=
"划线价:"
prop=
"original_price"
>
</el-dialog>
<el-input-number
<!-- 展示缩略图 -->
v-model=
"commodityForm.original_price"
<el-dialog
width=
"40%"
v-model=
"isShowPopver"
>
class=
"price"
<el-image
:src=
"popoverImage"
fit=
"fill"
style=
"width: 100%"
></el-image>
:min=
"0"
</el-dialog>
:controls=
"false"
<!-- 从商品库添加 -->
:precision=
"2"
<el-dialog
placeholder=
""
title=
"选择商品"
></el-input-number>
v-model=
"selCommodityPopup"
</el-form-item>
width=
"80%"
<br
/>
top=
"2%"
<el-form-item
label=
"库存:"
prop=
"inventory_total"
:rules=
"[{ required: true, message: '请输入库存' }]"
>
>
<el-input
<div>
v-model=
"commodityForm.inventory_total"
<span>
商家:
</span>
placeholder=
""
<el-select
@
input=
"inventoryIpt"
v-model=
"business2"
:rules=
"[{ required: true, message: '请输入库存' }]"
placeholder=
"请选择"
></el-input>
@
change=
"business2Sel"
</el-form-item>
>
<div
style=
"display: inline-block; height: 42px; margin-left: 33px"
>
<el-option
已售:
v-for=
"item in businessOpt"
<span
style=
"margin-right: 10px"
>
{{ commodityForm.total_amount_sold }}
</span>
:key=
"item.ota_id"
<!-- 剩余库存:<span>{{ commodityForm.inventory_total }}</span> -->
:label=
"item.ota_name"
</div>
:value=
"item.ota_id"
<el-form-item
></el-option>
prop=
"checkedRadio"
</el-select>
:rules=
"[
</div>
{
<span
class=
"dioFor"
>
已选:{{ multipleSelection.length }}件
</span>
required: true,
<el-table
message: '请选择购买限制',
:data=
"comLibTableData"
trigger: 'change',
class=
"comLibTableData"
},
@
selection-change=
"selectGoodsChange"
]"
>
class=
"limit_radio"
<el-table-column
type=
"selection"
width=
"55"
>
</el-table-column>
label=
"购买限制"
<el-table-column
>
prop=
"goods_sku_id"
<el-radio-group
v-model=
"commodityForm.checkedRadio"
>
label=
"商品ID"
<el-radio
label=
"不限制"
></el-radio>
width=
"150"
<el-radio
label=
"每人最多买"
></el-radio>
></el-table-column>
</el-radio-group>
<el-table-column
</el-form-item>
prop=
"goods_name"
<el-form-item
label=
"名称"
prop=
"num_limit"
width=
"200"
:show-message=
"commodityForm.checkedRadio === '每人最多买' ? true : false"
></el-table-column>
:rules=
"[
<el-table-column
prop=
"price"
label=
"售价"
></el-table-column>
{
<el-table-column
prop=
"ota_name"
label=
"商家"
></el-table-column>
validator: commodityForm.checkedRadio === '每人最多买' ? checkPurseLimit : checkPurseLimitNull,
<el-table-column
prop=
"inventory_total"
label=
"库存"
></el-table-column>
trigger: 'blur',
<el-table-column
},
prop=
"total_amount_sold"
]"
label=
"已售数量"
>
></el-table-column>
<el-input
<el-table-column
v-model=
"commodityForm.num_limit"
prop=
"inventory_rest"
:disabled=
"
label=
"剩余库存"
commodityForm.checkedRadio === '' || commodityForm.checkedRadio === '不限制' || commodityForm.checkedRadio === undefined
></el-table-column>
? true
<el-table-column
label=
"操作"
fixed=
"right"
>
: false
<
template
#
default=
"scope"
>
"
<el-button
:min=
"0"
@
click=
"commodity('update', scope.row)"
:controls=
"false"
type=
"text"
></el-input>
size=
"small"
</el-form-item>
>
修改
</el-button
<el-form-item
label=
"商家:"
prop=
"business1"
:rules=
"[{ required: true, message: '请选择商家' }]"
>
>
<el-select
v-model=
"commodityForm.business1"
placeholder=
"请选择"
>
</
template
>
<el-option
v-for=
"item in businessOpt"
:key=
"item.ota_id"
:label=
"item.ota_name"
:value=
"item.ota_id"
></el-option>
</el-table-column>
</el-select>
</el-table>
</el-form-item>
<
template
#
footer
>
</el-form>
<span
class=
"dialog-footer"
>
<
template
#
footer
>
<el-button
@
click=
"selCommodityPopup = false"
>
取 消
</el-button>
<span
class=
"dialog-footer"
>
<el-button
type=
"primary"
@
click=
"comLibrarySave"
>
保存
</el-button>
<el-button
@
click=
"commodityCancel"
>
取 消
</el-button>
</span>
<el-button
type=
"primary"
@
click=
"commoditySave('infoForm')"
>
保存
</el-button>
</
template
>
</span>
</el-dialog>
</
template
>
</div>
</el-dialog>
<!-- 展示缩略图 -->
<el-dialog
width=
"40%"
v-model=
"isShowPopver"
>
<el-image
:src=
"popoverImage"
fit=
"fill"
style=
"width: 100%"
></el-image>
</el-dialog>
<!-- 从商品库添加 -->
<el-dialog
title=
"选择商品"
v-model=
"selCommodityPopup"
width=
"80%"
top=
"2%"
>
<div>
<span>
商家:
</span>
<el-select
v-model=
"business2"
placeholder=
"请选择"
@
change=
"business2Sel"
>
<el-option
v-for=
"item in businessOpt"
:key=
"item.ota_id"
:label=
"item.ota_name"
:value=
"item.ota_id"
></el-option>
</el-select>
</div>
<span
class=
"dioFor"
>
已选:{{ multipleSelection.length }}件
</span>
<el-table
:data=
"comLibTableData"
class=
"comLibTableData"
@
selection-change=
"selectGoodsChange"
>
<el-table-column
type=
"selection"
width=
"55"
></el-table-column>
<el-table-column
prop=
"goods_sku_id"
label=
"商品ID"
width=
"150"
></el-table-column>
<el-table-column
prop=
"goods_name"
label=
"名称"
width=
"200"
></el-table-column>
<el-table-column
prop=
"price"
label=
"售价"
></el-table-column>
<el-table-column
prop=
"ota_name"
label=
"商家"
></el-table-column>
<el-table-column
prop=
"inventory_total"
label=
"库存"
></el-table-column>
<el-table-column
prop=
"total_amount_sold"
label=
"已售数量"
></el-table-column>
<el-table-column
prop=
"inventory_rest"
label=
"剩余库存"
></el-table-column>
<el-table-column
label=
"操作"
fixed=
"right"
>
<
template
#
default=
"scope"
>
<el-button
@
click=
"commodity('update', scope.row)"
type=
"text"
size=
"small"
>
修改
</el-button>
</
template
>
</el-table-column>
</el-table>
<
template
#
footer
>
<span
class=
"dialog-footer"
>
<el-button
@
click=
"selCommodityPopup = false"
>
取 消
</el-button>
<el-button
type=
"primary"
@
click=
"comLibrarySave"
>
保存
</el-button>
</span>
</
template
>
</el-dialog>
</div>
</template>
</template>
<
script
>
<
script
>
import
{
GOODS_URI
}
from
"../../../../../server/config"
;
import
{
ElMessage
}
from
"element-plus"
;
import
{
ElMessage
}
from
"element-plus"
;
import
{
getCookie
,
UploadPicUrl
}
from
"@/utils/util"
;
import
{
getCookie
}
from
"@/utils/util"
;
import
{
addGoods
,
getBusinessList
,
pindanGoods
,
markGoodsInfo
,
editGoods
}
from
"../../../../service/Activity/index"
;
import
{
// 当选择(每人最多买时 添加验证(非空))
addGoods
,
let
checkPurseLimit
=
(
rule
,
value
,
callback
)
=>
{
getBusinessList
,
let
str
=
/^
[
1-9
]\d
*$/
;
pindanGoods
,
if
(
value
===
""
||
value
===
undefined
||
value
===
0
)
{
markGoodsInfo
,
return
callback
(
new
Error
(
"请添加限制购买数量"
));
editGoods
}
else
if
(
!
str
.
test
(
value
))
{
}
from
"../../../../service/Activity/index"
;
return
callback
(
new
Error
(
"请输入正确的购买数量"
));
// 当选择(每人最多买时 添加验证(非空))
let
checkPurseLimit
=
(
rule
,
value
,
callback
)
=>
{
let
str
=
/^
[
1-9
]\d
*$/
;
if
(
value
===
""
||
value
===
undefined
||
value
===
0
)
{
return
callback
(
new
Error
(
"请添加限制购买数量"
));
}
else
if
(
!
str
.
test
(
value
))
{
return
callback
(
new
Error
(
"请输入正确的购买数量"
));
}
else
{
callback
();
}
};
let
checkPurseLimitNull
=
(
rule
,
value
,
callback
)
=>
{
callback
();
};
var
addProduct
=
{
props
:
{
editInfo
:
{
type
:
Object
,
required
:
()
=>
{}
},
addProduc
:
{
type
:
Array
,
required
:
()
=>
{}
},
stepTwoTitle
:
{
type
:
String
,
default
:
""
}
},
data
()
{
return
{
// 校验规则函数
checkPurseLimit
:
checkPurseLimit
,
checkPurseLimitNull
:
checkPurseLimitNull
,
// 商品列表
comTableData
:
[],
// 商品库列表
comLibTableData
:
[],
businessOpt
:
[],
// 商家数据
addCommodityPopup
:
false
,
// 添加商品弹窗状态
addCommodityTitle
:
""
,
// 标题
commodityForm
:
{
goods_name
:
""
,
price
:
0
,
original_price
:
0
,
inventory_total
:
""
,
total_amount_order
:
""
,
business1
:
""
,
num_limit
:
""
,
// 购买限制数量
checkedRadio
:
""
// 购买限制radio
},
picStr
:
""
,
picUrlList
:
[],
picUploadList
:
[],
// 上传详情图片列表
isShowPopver
:
false
,
// 是否展示图片框
uploadUrl
:
`
${
GOODS_URI
}
/ksy/ks3apiunencrypt/ks3api_upload`
,
// 金山云上传地址
hideUpload
:
false
,
limitCount
:
1
,
// 商品库添加
selCommodityPopup
:
false
,
// 商品库添加弹窗状态
business2
:
""
,
// 商家
multipleSelection
:
[],
// 勾选的数据
goodsSkuID
:
""
,
inventoryTotal
:
0
,
// 总库存
inventoryRest
:
0
,
// 剩余库存
inventory
:
0
,
// 添加库存
};
},
methods
:
{
cellClass
()
{
if
(
arguments
.
rowIndex
===
1
)
{
return
{
display
:
"none"
};
}
},
// 上移
upMove
(
index
)
{
if
(
index
<=
0
)
{
this
.
$message
.
error
(
"不能继续向上移动"
);
}
else
{
const
upData
=
this
.
comTableData
[
index
-
1
];
this
.
comTableData
.
splice
(
index
-
1
,
1
);
this
.
comTableData
.
splice
(
index
,
0
,
upData
);
}
},
// 下移
upDown
(
index
)
{
if
(
index
===
this
.
comTableData
.
length
-
1
)
{
this
.
$message
.
error
(
"不能继续向下移动"
);
}
else
{
const
downData
=
this
.
comTableData
[
index
+
1
];
this
.
comTableData
.
splice
(
index
+
1
,
1
);
this
.
comTableData
.
splice
(
index
,
0
,
downData
);
}
},
// 库存计算
inventoryIpt
(
val
)
{
if
(
val
<
0
)
return
this
.
commodityForm
.
inventory_total
=
0
;
var
pattern
=
/^-
?[
1-9
]\d
*$|^0$/g
;
if
(
!
pattern
.
test
(
this
.
commodityForm
.
inventory_total
))
{
this
.
commodityForm
.
inventory_total
=
""
;
this
.
inventoryRest
=
this
.
inventoryTotal
-
this
.
commodityForm
.
total_amount_order
;
}
else
{
this
.
inventoryRest
=
Number
(
val
)
+
this
.
inventoryTotal
-
this
.
commodityForm
.
total_amount_order
;
}
},
// 展示商品大图
previewImage
(
file
)
{
this
.
popoverImage
=
file
.
url
;
this
.
isShowPopver
=
true
;
},
handleDetailChange
()
{
this
.
hideUpload
=
this
.
picUploadList
.
length
>=
this
.
limitCount
;
},
// 图片上传成功时
handleDetailSuccess
(
res
)
{
this
.
picStr
=
res
.
result
.
image_id
;
this
.
picUploadList
.
push
(
res
.
result
.
image_id
);
},
// 图片删除后
removeDetailFiles
()
{
this
.
picStr
=
""
;
this
.
picUrlList
=
[];
this
.
picUploadList
=
[];
// this.hideUpload = this.picUploadList.length >= this.limitCount;
},
// 获取商家
async
getBusinessListMet
()
{
let
params
=
{
ota_name
:
""
,
offset
:
""
,
limit
:
""
};
try
{
const
res
=
await
getBusinessList
(
params
);
this
.
businessOpt
=
[
{
ota_id
:
""
,
ota_name
:
"全部"
},
...
res
.
result
.
list
];
}
catch
(
error
)
{
this
.
$message
.
error
(
"发生未知错误,请稍后再试一下吧~~~"
);
console
.
error
(
error
);
}
},
// 查看商品详情(api)
async
markGoodsInfoMet
(
goodSkuID
)
{
let
params
=
{
goods_sku_id
:
goodSkuID
,
marketing_type
:
"4"
};
const
res
=
await
markGoodsInfo
(
params
);
this
.
inventoryRest
=
res
.
result
.
goods_info
.
inventory_rest
;
this
.
inventoryTotal
=
res
.
result
.
goods_info
.
inventory_total
;
this
.
inventory
=
res
.
result
.
goods_info
.
inventory_total
;
this
.
commodityForm
=
res
.
result
.
goods_info
;
this
.
commodityForm
.
num_limit
=
res
.
result
.
goods_info
.
rule_limit
===
0
?
""
:
res
.
result
.
goods_info
.
rule_limit
;
// 购买限制的数量
this
.
commodityForm
.
checkedRadio
=
res
.
result
.
goods_info
.
rule_limit
===
0
||
res
.
result
.
goods_info
.
rule_limit
===
undefined
?
"不限制"
:
"每人最多买"
;
// 购买限制按钮选择
this
.
commodityForm
.
business1
=
res
.
result
.
goods_info
.
ota_id
;
this
.
picUrlList
=
[];
for
(
var
i
in
res
.
result
.
goods_info
.
desc_pic_url_list
)
{
this
.
picUrlList
.
push
({
url
:
res
.
result
.
goods_info
.
desc_pic_url_list
[
i
]
});
}
this
.
picStr
=
this
.
getUrlParms
(
res
.
result
.
goods_info
.
desc_pic_url_list
[
0
],
"url"
);
},
getUrlParms
(
path
,
name
)
{
var
reg
=
new
RegExp
(
"(^|
\\
?|&)"
+
name
+
"=([^&]*)(
\\
s|&|$)"
,
"i"
);
if
(
reg
.
test
(
path
))
return
unescape
(
RegExp
.
$2
.
replace
(
/
\+
/g
,
" "
));
return
""
;
},
// 修改商品详情(api)
async
editGoodsMet
(
goodsSkuID
)
{
const
res
=
await
editGoods
({
goods_name
:
this
.
commodityForm
.
goods_name
,
desc_pic_url
:
this
.
picStr
,
desc
:
""
,
inventory_add
:
this
.
commodityForm
.
inventory_total
-
this
.
inventory
,
original_price
:
this
.
commodityForm
.
original_price
,
price
:
this
.
commodityForm
.
price
,
marketing_name
:
this
.
editInfo
.
marketing_name
,
marketing_type
:
"4"
,
ota_id
:
this
.
commodityForm
.
business1
,
op_cur_user
:
getCookie
(
"username"
),
// op_cur_user: store.state.userInfo.email,
goods_sku_id
:
goodsSkuID
,
rule_limit
:
this
.
commodityForm
.
checkedRadio
===
"不限制"
||
this
.
commodityForm
.
checkedRadio
===
""
||
this
.
commodityForm
.
checkedRadio
===
undefined
?
0
:
this
.
commodityForm
.
num_limit
});
if
(
res
.
code
==
0
)
{
ElMessage
.
success
({
message
:
"修改成功"
,
type
:
"success"
});
await
this
.
pindanGoodsMet
();
let
result
=
null
;
for
(
var
j
in
this
.
comLibTableData
)
{
if
(
this
.
comLibTableData
[
j
].
goods_sku_id
==
goodsSkuID
)
{
result
=
this
.
comLibTableData
[
j
];
}
}
for
(
var
i
in
this
.
comTableData
)
{
if
(
this
.
comTableData
[
i
].
goods_sku_id
==
result
.
goods_sku_id
)
{
this
.
comTableData
.
splice
(
i
,
1
,
result
);
}
}
this
.
addCommodityPopup
=
false
;
}
else
{
ElMessage
.
error
(
res
.
reason
);
}
},
// 获取商品库列表
async
pindanGoodsMet
(
otaID
,
goodsName
)
{
let
params
=
{
ota_id
:
otaID
,
goods_name
:
goodsName
};
const
res
=
await
pindanGoods
(
params
);
this
.
comLibTableData
=
res
.
result
.
list
;
},
// 添加+修改商品
commodity
(
type
,
val
)
{
// 清楚图片
this
.
$refs
.
picUpload
&&
this
.
$refs
.
picUpload
.
clearFiles
&&
this
.
$refs
.
picUpload
.
clearFiles
();
this
.
picUrlList
=
[];
this
.
picStr
=
""
;
this
.
addCommodityPopup
=
true
;
// this.commodityForm = {};
this
.
$nextTick
(()
=>
{
this
.
$refs
.
infoForm
.
resetFields
();
// 清空表单数据
});
if
(
type
==
"add"
)
{
this
.
hideUpload
=
false
;
this
.
inventoryRest
=
0
;
this
.
commodityForm
.
total_amount_order
=
0
;
this
.
addCommodityTitle
=
"商品添加"
;
}
else
{
this
.
addCommodityTitle
=
"商品编辑"
;
this
.
goodsSkuID
=
val
.
goods_sku_id
;
this
.
markGoodsInfoMet
(
this
.
goodsSkuID
);
// 查看商品详情(api)
}
},
// 添加商品(api)
async
addGoodsMet
()
{
const
res
=
await
addGoods
({
marketing_name
:
this
.
stepTwoTitle
,
goods_name
:
this
.
commodityForm
.
goods_name
,
desc_pic_url
:
this
.
picStr
,
desc
:
""
,
inventory
:
this
.
commodityForm
.
inventory_total
-
this
.
inventory
,
original_price
:
this
.
commodityForm
.
original_price
,
marketing_type
:
"4"
,
price
:
this
.
commodityForm
.
price
,
ota_id
:
this
.
commodityForm
.
business1
,
op_cur_user
:
getCookie
(
"username"
),
// op_cur_user: store.state.userInfo.email,
rule_limit
:
this
.
commodityForm
.
checkedRadio
===
"不限制"
||
this
.
commodityForm
.
checkedRadio
===
""
||
this
.
commodityForm
.
checkedRadio
===
undefined
?
0
:
this
.
commodityForm
.
num_limit
});
if
(
res
.
code
==
0
)
{
ElMessage
.
success
({
message
:
"添加商品成功"
,
type
:
"success"
});
this
.
comTableData
.
push
(
res
.
result
.
goods_info
);
this
.
addCommodityPopup
=
false
;
}
else
{
ElMessage
.
error
(
res
.
reason
);
}
},
// 添加商品取消
commodityCancel
()
{
this
.
addCommodityPopup
=
false
;
this
.
$refs
.
infoForm
.
clearValidate
();
},
// 添加商品保存(操作)
commoditySave
(
infoForm
)
{
this
.
$refs
[
infoForm
].
validate
(
valid
=>
{
if
(
valid
)
{
if
(
this
.
addCommodityTitle
==
"商品添加"
)
{
this
.
addGoodsMet
();
}
else
{
this
.
editGoodsMet
(
this
.
goodsSkuID
);
}
}
else
{
}
else
{
return
false
;
callback
();
}
});
},
// commoditySave(infoForm) {
// console.log("baocun");
// this.$refs[infoForm].validate(valid => {
// console.log("00");
// if (valid) {
// console.log("add");
// if (this.addCommodityTitle == "商品添加") {
// this.addGoodsMet();
// } else {
// console.log("xiugai");
// this.editGoodsMet(this.goodsSkuID);
// }
// } else {
// console.log("validate");
// return false;
// }
// });
// },
// 从商品库添加
async
commodLibraryAdd
()
{
this
.
selCommodityPopup
=
true
;
this
.
pindanGoodsMet
();
},
// 商家选择(选择商品)
business2Sel
(
val
)
{
this
.
pindanGoodsMet
(
val
,
""
);
},
// 商品库中选择商品
selectGoodsChange
(
val
)
{
this
.
multipleSelection
=
val
;
},
// 商品库选择商品保存
comLibrarySave
()
{
if
(
this
.
multipleSelection
.
length
==
0
)
{
ElMessage
.
error
(
"请选择商品"
);
return
;
}
this
.
selCommodityPopup
=
false
;
if
(
this
.
comTableData
.
length
==
0
)
{
this
.
comTableData
.
push
(...
this
.
multipleSelection
);
}
else
{
this
.
multipleSelection
.
forEach
(
item
=>
{
let
num
=
0
;
this
.
comTableData
.
some
(
val
=>
{
num
++
;
if
(
val
.
goods_sku_id
===
item
.
goods_sku_id
)
{
val
.
goods_sku_id
=
item
.
goods_sku_id
;
if
(
num
==
1
)
{
ElMessage
.
error
(
"商品添加重复,已过滤掉重复选项"
);
}
return
true
;
}
else
if
(
num
===
this
.
comTableData
.
length
)
{
this
.
comTableData
.
push
(
Object
.
assign
({},
item
));
}
});
});
}
},
// 移除
removeCom
(
val
)
{
for
(
var
i
in
this
.
comTableData
)
{
if
(
this
.
comTableData
[
i
].
goods_sku_id
==
val
.
goods_sku_id
)
{
this
.
comTableData
.
splice
(
i
,
1
);
}
}
}
};
}
let
checkPurseLimitNull
=
(
rule
,
value
,
callback
)
=>
{
},
callback
();
};
watch
:
{
addProduc
:
function
(
newVal
)
{
var
addProduct
=
{
let
marketingId
=
this
.
$route
.
query
.
marketing_id
;
props
:
{
if
(
marketingId
==
undefined
)
{
editInfo
:
{
return
;
type
:
Object
,
}
required
:
()
=>
{},
this
.
comTableData
=
newVal
;
},
},
addProduc
:
{
picUrlList
:
function
()
{
type
:
Array
,
if
(
this
.
picUrlList
.
length
>=
this
.
limitCount
)
{
required
:
()
=>
{},
this
.
hideUpload
=
true
;
},
}
else
{
stepTwoTitle
:
{
this
.
hideUpload
=
false
;
type
:
String
,
}
default
:
""
,
},
},
},
},
created
()
{
data
()
{
this
.
getBusinessListMet
();
return
{
}
// 校验规则函数
};
checkPurseLimit
:
checkPurseLimit
,
export
default
addProduct
;
checkPurseLimitNull
:
checkPurseLimitNull
,
// 商品列表
comTableData
:
[],
// 商品库列表
comLibTableData
:
[],
businessOpt
:
[],
// 商家数据
addCommodityPopup
:
false
,
// 添加商品弹窗状态
addCommodityTitle
:
""
,
// 标题
commodityForm
:
{
goods_name
:
""
,
price
:
0
,
original_price
:
0
,
inventory_total
:
""
,
total_amount_order
:
""
,
business1
:
""
,
num_limit
:
""
,
// 购买限制数量
checkedRadio
:
""
,
// 购买限制radio
},
picStr
:
""
,
picUrlList
:
[],
picUploadList
:
[],
// 上传详情图片列表
isShowPopver
:
false
,
// 是否展示图片框
uploadUrl
:
UploadPicUrl
,
// 金山云上传地址
hideUpload
:
false
,
limitCount
:
1
,
// 商品库添加
selCommodityPopup
:
false
,
// 商品库添加弹窗状态
business2
:
""
,
// 商家
multipleSelection
:
[],
// 勾选的数据
goodsSkuID
:
""
,
inventoryTotal
:
0
,
// 总库存
inventoryRest
:
0
,
// 剩余库存
inventory
:
0
,
// 添加库存
};
},
methods
:
{
cellClass
()
{
if
(
arguments
.
rowIndex
===
1
)
{
return
{
display
:
"none"
};
}
},
// 上移
upMove
(
index
)
{
if
(
index
<=
0
)
{
this
.
$message
.
error
(
"不能继续向上移动"
);
}
else
{
const
upData
=
this
.
comTableData
[
index
-
1
];
this
.
comTableData
.
splice
(
index
-
1
,
1
);
this
.
comTableData
.
splice
(
index
,
0
,
upData
);
}
},
// 下移
upDown
(
index
)
{
if
(
index
===
this
.
comTableData
.
length
-
1
)
{
this
.
$message
.
error
(
"不能继续向下移动"
);
}
else
{
const
downData
=
this
.
comTableData
[
index
+
1
];
this
.
comTableData
.
splice
(
index
+
1
,
1
);
this
.
comTableData
.
splice
(
index
,
0
,
downData
);
}
},
// 库存计算
inventoryIpt
(
val
)
{
if
(
val
<
0
)
return
(
this
.
commodityForm
.
inventory_total
=
0
);
var
pattern
=
/^-
?[
1-9
]\d
*$|^0$/g
;
if
(
!
pattern
.
test
(
this
.
commodityForm
.
inventory_total
))
{
this
.
commodityForm
.
inventory_total
=
""
;
this
.
inventoryRest
=
this
.
inventoryTotal
-
this
.
commodityForm
.
total_amount_order
;
}
else
{
this
.
inventoryRest
=
Number
(
val
)
+
this
.
inventoryTotal
-
this
.
commodityForm
.
total_amount_order
;
}
},
// 展示商品大图
previewImage
(
file
)
{
this
.
popoverImage
=
file
.
url
;
this
.
isShowPopver
=
true
;
},
handleDetailChange
()
{
this
.
hideUpload
=
this
.
picUploadList
.
length
>=
this
.
limitCount
;
},
// 图片上传成功时
handleDetailSuccess
(
res
)
{
this
.
picStr
=
res
.
result
.
image_id
;
this
.
picUploadList
.
push
(
res
.
result
.
image_id
);
},
// 图片删除后
removeDetailFiles
()
{
this
.
picStr
=
""
;
this
.
picUrlList
=
[];
this
.
picUploadList
=
[];
// this.hideUpload = this.picUploadList.length >= this.limitCount;
},
// 获取商家
async
getBusinessListMet
()
{
let
params
=
{
ota_name
:
""
,
offset
:
""
,
limit
:
""
};
try
{
const
res
=
await
getBusinessList
(
params
);
this
.
businessOpt
=
[{
ota_id
:
""
,
ota_name
:
"全部"
},
...
res
.
result
.
list
];
}
catch
(
error
)
{
this
.
$message
.
error
(
"发生未知错误,请稍后再试一下吧~~~"
);
console
.
error
(
error
);
}
},
// 查看商品详情(api)
async
markGoodsInfoMet
(
goodSkuID
)
{
let
params
=
{
goods_sku_id
:
goodSkuID
,
marketing_type
:
"4"
};
const
res
=
await
markGoodsInfo
(
params
);
this
.
inventoryRest
=
res
.
result
.
goods_info
.
inventory_rest
;
this
.
inventoryTotal
=
res
.
result
.
goods_info
.
inventory_total
;
this
.
inventory
=
res
.
result
.
goods_info
.
inventory_total
;
this
.
commodityForm
=
res
.
result
.
goods_info
;
this
.
commodityForm
.
num_limit
=
res
.
result
.
goods_info
.
rule_limit
===
0
?
""
:
res
.
result
.
goods_info
.
rule_limit
;
// 购买限制的数量
this
.
commodityForm
.
checkedRadio
=
res
.
result
.
goods_info
.
rule_limit
===
0
||
res
.
result
.
goods_info
.
rule_limit
===
undefined
?
"不限制"
:
"每人最多买"
;
// 购买限制按钮选择
this
.
commodityForm
.
business1
=
res
.
result
.
goods_info
.
ota_id
;
this
.
picUrlList
=
[];
for
(
var
i
in
res
.
result
.
goods_info
.
desc_pic_url_list
)
{
this
.
picUrlList
.
push
({
url
:
res
.
result
.
goods_info
.
desc_pic_url_list
[
i
],
});
}
this
.
picStr
=
this
.
getUrlParms
(
res
.
result
.
goods_info
.
desc_pic_url_list
[
0
],
"url"
);
},
getUrlParms
(
path
,
name
)
{
var
reg
=
new
RegExp
(
"(^|
\\
?|&)"
+
name
+
"=([^&]*)(
\\
s|&|$)"
,
"i"
);
if
(
reg
.
test
(
path
))
return
unescape
(
RegExp
.
$2
.
replace
(
/
\+
/g
,
" "
));
return
""
;
},
// 修改商品详情(api)
async
editGoodsMet
(
goodsSkuID
)
{
const
res
=
await
editGoods
({
goods_name
:
this
.
commodityForm
.
goods_name
,
desc_pic_url
:
this
.
picStr
,
desc
:
""
,
inventory_add
:
this
.
commodityForm
.
inventory_total
-
this
.
inventory
,
original_price
:
this
.
commodityForm
.
original_price
,
price
:
this
.
commodityForm
.
price
,
marketing_name
:
this
.
editInfo
.
marketing_name
,
marketing_type
:
"4"
,
ota_id
:
this
.
commodityForm
.
business1
,
op_cur_user
:
getCookie
(
"username"
),
// op_cur_user: store.state.userInfo.email,
goods_sku_id
:
goodsSkuID
,
rule_limit
:
this
.
commodityForm
.
checkedRadio
===
"不限制"
||
this
.
commodityForm
.
checkedRadio
===
""
||
this
.
commodityForm
.
checkedRadio
===
undefined
?
0
:
this
.
commodityForm
.
num_limit
,
});
if
(
res
.
code
==
0
)
{
ElMessage
.
success
({
message
:
"修改成功"
,
type
:
"success"
,
});
await
this
.
pindanGoodsMet
();
let
result
=
null
;
for
(
var
j
in
this
.
comLibTableData
)
{
if
(
this
.
comLibTableData
[
j
].
goods_sku_id
==
goodsSkuID
)
{
result
=
this
.
comLibTableData
[
j
];
}
}
for
(
var
i
in
this
.
comTableData
)
{
if
(
this
.
comTableData
[
i
].
goods_sku_id
==
result
.
goods_sku_id
)
{
this
.
comTableData
.
splice
(
i
,
1
,
result
);
}
}
this
.
addCommodityPopup
=
false
;
}
else
{
ElMessage
.
error
(
res
.
reason
);
}
},
// 获取商品库列表
async
pindanGoodsMet
(
otaID
,
goodsName
)
{
let
params
=
{
ota_id
:
otaID
,
goods_name
:
goodsName
};
const
res
=
await
pindanGoods
(
params
);
this
.
comLibTableData
=
res
.
result
.
list
;
},
// 添加+修改商品
commodity
(
type
,
val
)
{
// 清楚图片
this
.
$refs
.
picUpload
&&
this
.
$refs
.
picUpload
.
clearFiles
&&
this
.
$refs
.
picUpload
.
clearFiles
();
this
.
picUrlList
=
[];
this
.
picStr
=
""
;
this
.
addCommodityPopup
=
true
;
// this.commodityForm = {};
this
.
$nextTick
(()
=>
{
this
.
$refs
.
infoForm
.
resetFields
();
// 清空表单数据
});
if
(
type
==
"add"
)
{
this
.
hideUpload
=
false
;
this
.
inventoryRest
=
0
;
this
.
commodityForm
.
total_amount_order
=
0
;
this
.
addCommodityTitle
=
"商品添加"
;
}
else
{
this
.
addCommodityTitle
=
"商品编辑"
;
this
.
goodsSkuID
=
val
.
goods_sku_id
;
this
.
markGoodsInfoMet
(
this
.
goodsSkuID
);
// 查看商品详情(api)
}
},
// 添加商品(api)
async
addGoodsMet
()
{
const
res
=
await
addGoods
({
marketing_name
:
this
.
stepTwoTitle
,
goods_name
:
this
.
commodityForm
.
goods_name
,
desc_pic_url
:
this
.
picStr
,
desc
:
""
,
inventory
:
this
.
commodityForm
.
inventory_total
-
this
.
inventory
,
original_price
:
this
.
commodityForm
.
original_price
,
marketing_type
:
"4"
,
price
:
this
.
commodityForm
.
price
,
ota_id
:
this
.
commodityForm
.
business1
,
op_cur_user
:
getCookie
(
"username"
),
// op_cur_user: store.state.userInfo.email,
rule_limit
:
this
.
commodityForm
.
checkedRadio
===
"不限制"
||
this
.
commodityForm
.
checkedRadio
===
""
||
this
.
commodityForm
.
checkedRadio
===
undefined
?
0
:
this
.
commodityForm
.
num_limit
,
});
if
(
res
.
code
==
0
)
{
ElMessage
.
success
({
message
:
"添加商品成功"
,
type
:
"success"
,
});
this
.
comTableData
.
push
(
res
.
result
.
goods_info
);
this
.
addCommodityPopup
=
false
;
}
else
{
ElMessage
.
error
(
res
.
reason
);
}
},
// 添加商品取消
commodityCancel
()
{
this
.
addCommodityPopup
=
false
;
this
.
$refs
.
infoForm
.
clearValidate
();
},
// 添加商品保存(操作)
commoditySave
(
infoForm
)
{
this
.
$refs
[
infoForm
].
validate
((
valid
)
=>
{
if
(
valid
)
{
if
(
this
.
addCommodityTitle
==
"商品添加"
)
{
this
.
addGoodsMet
();
}
else
{
this
.
editGoodsMet
(
this
.
goodsSkuID
);
}
}
else
{
return
false
;
}
});
},
// commoditySave(infoForm) {
// console.log("baocun");
// this.$refs[infoForm].validate(valid => {
// console.log("00");
// if (valid) {
// console.log("add");
// if (this.addCommodityTitle == "商品添加") {
// this.addGoodsMet();
// } else {
// console.log("xiugai");
// this.editGoodsMet(this.goodsSkuID);
// }
// } else {
// console.log("validate");
// return false;
// }
// });
// },
// 从商品库添加
async
commodLibraryAdd
()
{
this
.
selCommodityPopup
=
true
;
this
.
pindanGoodsMet
();
},
// 商家选择(选择商品)
business2Sel
(
val
)
{
this
.
pindanGoodsMet
(
val
,
""
);
},
// 商品库中选择商品
selectGoodsChange
(
val
)
{
this
.
multipleSelection
=
val
;
},
// 商品库选择商品保存
comLibrarySave
()
{
if
(
this
.
multipleSelection
.
length
==
0
)
{
ElMessage
.
error
(
"请选择商品"
);
return
;
}
this
.
selCommodityPopup
=
false
;
if
(
this
.
comTableData
.
length
==
0
)
{
this
.
comTableData
.
push
(...
this
.
multipleSelection
);
}
else
{
this
.
multipleSelection
.
forEach
((
item
)
=>
{
let
num
=
0
;
this
.
comTableData
.
some
((
val
)
=>
{
num
++
;
if
(
val
.
goods_sku_id
===
item
.
goods_sku_id
)
{
val
.
goods_sku_id
=
item
.
goods_sku_id
;
if
(
num
==
1
)
{
ElMessage
.
error
(
"商品添加重复,已过滤掉重复选项"
);
}
return
true
;
}
else
if
(
num
===
this
.
comTableData
.
length
)
{
this
.
comTableData
.
push
(
Object
.
assign
({},
item
));
}
});
});
}
},
// 移除
removeCom
(
val
)
{
for
(
var
i
in
this
.
comTableData
)
{
if
(
this
.
comTableData
[
i
].
goods_sku_id
==
val
.
goods_sku_id
)
{
this
.
comTableData
.
splice
(
i
,
1
);
}
}
},
},
watch
:
{
addProduc
:
function
(
newVal
)
{
let
marketingId
=
this
.
$route
.
query
.
marketing_id
;
if
(
marketingId
==
undefined
)
{
return
;
}
this
.
comTableData
=
newVal
;
},
picUrlList
:
function
()
{
if
(
this
.
picUrlList
.
length
>=
this
.
limitCount
)
{
this
.
hideUpload
=
true
;
}
else
{
this
.
hideUpload
=
false
;
}
},
},
created
()
{
this
.
getBusinessListMet
();
},
};
export
default
addProduct
;
</
script
>
</
script
>
<
style
scoped
lang=
"less"
>
<
style
scoped
lang=
"less"
>
.addProduc {
.addProduc {
width: 90%;
width: 90%;
margin: 0 auto;
margin: 0 auto;
}
}
.buttons_actions {
.buttons_actions {
display: flex;
display: flex;
justify-content: space-around;
justify-content: space-around;
align-items: center;
align-items: center;
}
}
.btnGroup {
.btnGroup {
margin-bottom: 15px;
margin-bottom: 15px;
}
}
.addCommodityBtn {
.addCommodityBtn {
margin: 0 20px 0 0;
margin: 0 20px 0 0;
}
}
.infoForm /deep/.el-form-item:nth-child(1),
.infoForm /deep/.el-form-item:nth-child(1),
.infoForm /deep/.el-form-item:nth-child(2) {
.infoForm /deep/.el-form-item:nth-child(2) {
width: 100%;
width: 100%;
}
}
.dioFor {
.dioFor {
display: block;
display: block;
margin: 10px 0;
margin: 10px 0;
}
}
.comLibTableData /deep/ .el-table__body-wrapper {
.comLibTableData /deep/ .el-table__body-wrapper {
height: 550px;
height: 550px;
overflow: scroll;
overflow: scroll;
}
}
.price /deep/ .el-input__inner {
.price /deep/ .el-input__inner {
text-align: left;
text-align: left;
}
}
.hide /deep/ .el-upload--picture-card {
.hide /deep/ .el-upload--picture-card {
display: none;
display: none;
}
}
// 商品添加修改dialog-form表单
// 商品添加修改dialog-form表单
/deep/ .add_goods_dialog {
/deep/ .add_goods_dialog {
min-width: 370px;
min-width: 370px;
}
}
</
style
>
</
style
>
src/pages/Activity/releaseProduc/components/infoEditing.vue
View file @
4f5f1b64
<
template
>
<
template
>
<div
class=
"infoEditing"
>
<div
class=
"infoEditing"
>
<el-form
<el-form
ref=
"infoEditForm"
:model=
"infoEditForm"
label-width=
"80px"
@
submit
.
prevent
>
ref=
"infoEditForm"
<el-form-item
label=
"标题:"
>
:model=
"infoEditForm"
<el-input
v-model=
"infoEditForm.title"
maxlength=
"30"
></el-input>
label-width=
"80px"
</el-form-item>
@
submit
.
prevent
<el-form-item
label=
"介绍:"
>
>
<el-input
type=
"textarea"
v-model=
"infoEditForm.desc"
maxlength=
"1000"
rows=
"4"
></el-input>
<el-form-item
label=
"标题:"
>
</el-form-item>
<el-input
v-model=
"infoEditForm.title"
maxlength=
"30"
></el-input>
<el-form-item
label=
"图片:"
>
</el-form-item>
<el-upload
<el-form-item
label=
"介绍:"
>
:class=
"
{ hide: hideUpload }"
<el-input
:data="{ type: 1 }"
type=
"textarea"
:action="uploadUrl"
v-model=
"infoEditForm.desc"
:on-preview="previewImage"
maxlength=
"1000"
:on-success="handleDetailSuccess"
rows=
"4"
:on-change="handleDetailChange"
></el-input>
:before-remove="removeDetailFiles"
</el-form-item>
:file-list="infoEditForm.picUrlList"
<el-form-item
label=
"图片:"
>
auto-upload
<el-upload
ref="picUpload"
:class=
"
{ hide: hideUpload }"
:limit="limitCount"
:data="{ type: 1 }"
list-type="picture-card"
:action="uploadUrl"
multiple
:on-preview="previewImage"
>
:on-success="handleDetailSuccess"
<template
#
default
>
:on-change="handleDetailChange"
<i
class=
"el-icon-plus"
></i>
:before-remove="removeDetailFiles"
</
template
>
:file-list="infoEditForm.picUrlList"
</el-upload>
auto-upload
</el-form-item>
ref="picUpload"
</el-form>
:limit="limitCount"
<!-- 展示缩略图 -->
list-type="picture-card"
<el-dialog
width=
"40%"
v-model=
"isShowPopver"
>
multiple
<el-image
:src=
"popoverImage"
fit=
"fill"
style=
"width: 100%"
></el-image>
>
</el-dialog>
<template
#
default
>
</div>
<i
class=
"el-icon-plus"
></i>
</
template
>
</el-upload>
</el-form-item>
</el-form>
<!-- 展示缩略图 -->
<el-dialog
width=
"40%"
v-model=
"isShowPopver"
>
<el-image
:src=
"popoverImage"
fit=
"fill"
style=
"width: 100%"
></el-image>
</el-dialog>
</div>
</template>
</template>
<
script
>
<
script
>
import
{
GOODS_URI
}
from
"../../../../../server/config"
;
import
{
UploadPicUrl
}
from
"@/utils/util"
;
export
default
{
props
:
{
infoEditArr
:
{
type
:
Object
,
default
:
()
=>
{
return
{
pindan_pic_url
:
[]
};
},
require
:
true
}
},
data
()
{
return
{
infoEditForm
:
{
title
:
""
,
// 标题
desc
:
""
,
// 介绍
picUploadList
:
[],
// 上传详情图片列表
picUrlList
:
[]
// 图片回显列表
},
picSubmitList
:
[],
// 发布功能需要的图片列表
propData
:
{},
isShowPopver
:
false
,
// 是否展示图片框
uploadUrl
:
`
${
GOODS_URI
}
/ksy/ks3apiunencrypt/ks3api_upload`
,
// 金山云上传地址
hideUpload
:
false
,
limitCount
:
9
};
},
watch
:
{
infoEditArr
:
{
// 监听props属性 展示自提点列表
handler
:
function
(
newVal
)
{
if
(
this
.
$route
.
query
.
marketing_id
)
{
this
.
propData
=
newVal
;
this
.
infoEditForm
.
title
=
this
.
propData
.
marketing_name
;
this
.
infoEditForm
.
desc
=
this
.
propData
.
pindan_desc
;
for
(
var
i
in
this
.
propData
.
pindan_pic_url
)
{
this
.
infoEditForm
.
picUrlList
.
push
({
url
:
this
.
propData
.
pindan_pic_url
[
i
]
});
this
.
picSubmitList
.
push
({
url
:
this
.
propData
.
pindan_pic_url
[
i
]
});
}
this
.
hideUpload
=
this
.
picSubmitList
.
length
>=
this
.
limitCount
;
// 大于9 隐藏
}
},
deep
:
true
,
immediate
:
true
}
},
methods
:
{
// 展示商品大图
previewImage
(
file
)
{
this
.
popoverImage
=
file
.
url
;
this
.
isShowPopver
=
true
;
},
handleDetailChange
()
{
export
default
{
this
.
hideUpload
=
this
.
picSubmitList
.
length
>=
this
.
limitCount
;
props
:
{
},
infoEditArr
:
{
type
:
Object
,
default
:
()
=>
{
return
{
pindan_pic_url
:
[],
};
},
require
:
true
,
},
},
data
()
{
return
{
infoEditForm
:
{
title
:
""
,
// 标题
desc
:
""
,
// 介绍
picUploadList
:
[],
// 上传详情图片列表
picUrlList
:
[],
// 图片回显列表
},
picSubmitList
:
[],
// 发布功能需要的图片列表
propData
:
{},
isShowPopver
:
false
,
// 是否展示图片框
uploadUrl
:
UploadPicUrl
,
// 金山云上传地址
hideUpload
:
false
,
limitCount
:
9
,
};
},
watch
:
{
infoEditArr
:
{
// 监听props属性 展示自提点列表
handler
:
function
(
newVal
)
{
if
(
this
.
$route
.
query
.
marketing_id
)
{
this
.
propData
=
newVal
;
this
.
infoEditForm
.
title
=
this
.
propData
.
marketing_name
;
this
.
infoEditForm
.
desc
=
this
.
propData
.
pindan_desc
;
for
(
var
i
in
this
.
propData
.
pindan_pic_url
)
{
this
.
infoEditForm
.
picUrlList
.
push
({
url
:
this
.
propData
.
pindan_pic_url
[
i
],
});
this
.
picSubmitList
.
push
({
url
:
this
.
propData
.
pindan_pic_url
[
i
],
});
}
this
.
hideUpload
=
this
.
picSubmitList
.
length
>=
this
.
limitCount
;
// 大于9 隐藏
}
},
deep
:
true
,
immediate
:
true
,
},
},
methods
:
{
// 展示商品大图
previewImage
(
file
)
{
this
.
popoverImage
=
file
.
url
;
this
.
isShowPopver
=
true
;
},
// 图片上传成功时
handleDetailChange
()
{
handleDetailSuccess
(
res
)
{
this
.
hideUpload
=
this
.
picSubmitList
.
length
>=
this
.
limitCount
;
this
.
infoEditForm
.
picUploadList
.
push
(
res
.
result
.
image_id
);
// 上传成功图片的id
},
this
.
picSubmitList
.
push
({
// 发布功能需要的图片列表
url
:
res
.
result
.
url
});
this
.
hideUpload
=
this
.
picSubmitList
.
length
>=
this
.
limitCount
;
},
// 图片删除后
// 图片上传成功时
removeDetailFiles
(
file
,
fileList
)
{
handleDetailSuccess
(
res
)
{
for
(
let
i
=
0
;
i
<
fileList
.
length
;
i
++
)
{
this
.
infoEditForm
.
picUploadList
.
push
(
res
.
result
.
image_id
);
// 上传成功图片的id
if
(
fileList
[
i
].
uid
==
file
.
uid
)
{
this
.
picSubmitList
.
push
(
{
this
.
picSubmitList
.
splice
(
i
,
1
);
// 发布功能需要的图片列表
}
url
:
res
.
result
.
url
,
}
});
this
.
hideUpload
=
this
.
picSubmitList
.
length
>=
this
.
limitCount
;
this
.
hideUpload
=
this
.
picSubmitList
.
length
>=
this
.
limitCount
;
},
},
// 获取营销活动详情
// 图片删除后
marketingInfoMet
()
{
removeDetailFiles
(
file
,
fileList
)
{
let
marketingId
=
this
.
$route
.
query
.
marketing_id
;
for
(
let
i
=
0
;
i
<
fileList
.
length
;
i
++
)
{
if
(
marketingId
==
undefined
)
{
if
(
fileList
[
i
].
uid
==
file
.
uid
)
{
return
;
this
.
picSubmitList
.
splice
(
i
,
1
);
}
}
this
.
propData
=
JSON
.
parse
(
localStorage
.
getItem
(
"propData"
));
}
this
.
infoEditForm
.
title
=
this
.
propData
.
marketing_name
;
this
.
hideUpload
=
this
.
picSubmitList
.
length
>=
this
.
limitCount
;
this
.
infoEditForm
.
desc
=
this
.
propData
.
pindan_desc
;
},
for
(
var
i
in
this
.
propData
.
pindan_pic_url
)
{
this
.
infoEditForm
.
picUrlList
.
push
({
// 获取营销活动详情
url
:
this
.
propData
.
pindan_pic_url
[
i
]
marketingInfoMet
()
{
});
let
marketingId
=
this
.
$route
.
query
.
marketing_id
;
}
if
(
marketingId
==
undefined
)
{
}
return
;
},
}
created
()
{
this
.
propData
=
JSON
.
parse
(
localStorage
.
getItem
(
"propData"
));
// this.marketingInfoMet();
this
.
infoEditForm
.
title
=
this
.
propData
.
marketing_name
;
}
this
.
infoEditForm
.
desc
=
this
.
propData
.
pindan_desc
;
};
for
(
var
i
in
this
.
propData
.
pindan_pic_url
)
{
this
.
infoEditForm
.
picUrlList
.
push
({
url
:
this
.
propData
.
pindan_pic_url
[
i
],
});
}
},
},
created
()
{
// this.marketingInfoMet();
},
};
</
script
>
</
script
>
<
style
scoped
>
<
style
scoped
>
.infoEditing
{
.infoEditing
{
width
:
64%
;
width
:
64%
;
margin
:
0
auto
;
margin
:
0
auto
;
}
}
.hide
/
deep
/
.el-upload--picture-card
{
.hide
/
deep
/
.el-upload--picture-card
{
display
:
none
;
display
:
none
;
}
}
</
style
>
</
style
>
src/pages/Activity/releaseProduc/components/myMap.vue
View file @
4f5f1b64
<
template
>
<
template
>
<div
id=
"map"
class=
"mapContainer"
>
<div
id=
"map"
class=
"mapContainer"
>
<div
class=
"mapWrapper"
>
<div
class=
"mapWrapper"
>
<div
class=
"search"
>
<div
class=
"search"
>
<el-form
ref=
"form"
@
submit
.
prevent
>
<el-form
ref=
"form"
@
submit
.
prevent
>
<el-form-item
label-position=
"left"
>
<el-form-item
label-position=
"left"
>
<el-button
@
click=
"handleSearch"
>
搜索
</el-button>
<el-button
@
click=
"handleSearch"
>
搜索
</el-button>
<el-input
<el-input
class=
"dialog-input"
v-model=
"searchKey"
placeholder=
"请输入关键字"
autocomplete=
"on"
>
class=
"dialog-input"
<template
#
suffix
>
v-model=
"searchKey"
<i
@
click=
"searchKey = ''"
class=
"el-input__icon el-icon-close"
></i>
placeholder=
"请输入关键字"
</
template
>
autocomplete=
"on"
</el-input>
>
</el-form-item>
<template
#
suffix
>
</el-form>
<i
<div
id=
"js-result"
v-show=
"searchKey"
class=
"result"
></div>
@
click=
"searchKey = ''"
</div>
class=
"el-input__icon el-icon-close"
<div
id=
"js-container"
class=
"myMap"
>
正在加载数据 ...
</div>
></i>
</div>
</
template
>
</el-input>
</el-form-item>
</el-form>
<div
id=
"js-result"
v-show=
"searchKey"
class=
"result"
></div>
</div>
<div
id=
"js-container"
class=
"myMap"
>
正在加载数据 ...
</div>
</div>
<div
class=
"mapInfo"
>
<div
class=
"mapInfo"
>
<div
class=
"infoAll"
>
<div
class=
"infoAll"
>
<h3
class=
"title"
>
拖拽选址
</h3>
<h3
class=
"title"
>
拖拽选址
</h3>
<ul
class=
"info"
>
<ul
class=
"info"
>
<li><span>
经度:
</span>
{{ dragData.lng }}
</li>
<li>
<li><span>
纬度:
</span>
{{ dragData.lat }}
</li>
<span>
经度:
</span>
<li><span>
地址:
</span>
{{ dragData.address }}
</li>
{{ dragData.lng }}
</ul>
</li>
</div>
<li>
<div
class=
"confirmButton"
>
<span>
纬度:
</span>
<el-button
class=
"button_pre"
@
click=
"cancel"
>
取 消
</el-button>
{{ dragData.lat }}
<el-button
class=
"button_next"
type=
"primary"
@
click=
"confirm"
</li>
>
确 定
</el-button
<li>
>
<span>
地址:
</span>
</div>
{{ dragData.address }}
</div>
</li>
<!-- <div class="confirmButton">
</ul>
</div>
<div
class=
"confirmButton"
>
<el-button
class=
"button_pre"
@
click=
"cancel"
>
取 消
</el-button>
<el-button
class=
"button_next"
type=
"primary"
@
click=
"confirm"
>
确 定
</el-button>
</div>
</div>
<!-- <div class="confirmButton">
<el-button @click="cancel">取 消</el-button>
<el-button @click="cancel">取 消</el-button>
<el-button type="primary" @click="confirm">确 定</el-button>
<el-button type="primary" @click="confirm">确 定</el-button>
</div> -->
</div> -->
</div>
</div>
</template>
</template>
<
script
>
<
script
>
import
remoteLoad
from
"@/utils/remoteLoad.js"
;
import
remoteLoad
from
"@/utils/remoteLoad.js"
;
export
default
{
export
default
{
name
:
"app"
,
name
:
"app"
,
data
()
{
data
()
{
return
{
return
{
dialogVisible
:
true
,
dialogVisible
:
true
,
MapCityName
:
"北京"
,
MapCityName
:
"北京"
,
searchKey
:
""
,
searchKey
:
""
,
dragData
:
{
dragData
:
{
lng
:
null
,
lng
:
null
,
lat
:
null
,
lat
:
null
,
address
:
null
,
address
:
null
,
nearestJunction
:
null
,
nearestJunction
:
null
,
nearestRoad
:
null
,
nearestRoad
:
null
,
nearestPOI
:
null
nearestPOI
:
null
,
}
},
};
};
},
},
methods
:
{
methods
:
{
// 取消
// 取消
cancel
()
{
cancel
()
{
this
.
$emit
(
"hideMapDialog"
,
false
);
this
.
$emit
(
"hideMapDialog"
,
false
);
},
},
// 确认
// 确认
confirm
()
{
confirm
()
{
this
.
$emit
(
"getMapInfo"
,
this
.
dragData
);
this
.
$emit
(
"getMapInfo"
,
this
.
dragData
);
this
.
$emit
(
"hideMapDialog"
,
false
);
this
.
$emit
(
"hideMapDialog"
,
false
);
},
},
// 搜索
// 搜索
handleSearch
()
{
handleSearch
()
{
if
(
this
.
searchKey
)
{
if
(
this
.
searchKey
)
{
this
.
placeSearch
.
search
(
this
.
searchKey
);
this
.
placeSearch
.
search
(
this
.
searchKey
);
}
}
},
},
dragMap
(
data
)
{
dragMap
(
data
)
{
this
.
dragData
=
{
this
.
dragData
=
{
lng
:
data
.
position
.
lng
,
lng
:
data
.
position
.
lng
,
lat
:
data
.
position
.
lat
,
lat
:
data
.
position
.
lat
,
address
:
data
.
address
,
address
:
data
.
address
,
province
:
data
.
regeocode
.
addressComponent
.
province
,
province
:
data
.
regeocode
.
addressComponent
.
province
,
city
:
data
.
regeocode
.
addressComponent
.
city
,
city
:
data
.
regeocode
.
addressComponent
.
city
,
area
:
data
.
regeocode
.
addressComponent
.
district
area
:
data
.
regeocode
.
addressComponent
.
district
,
};
};
},
},
// 初始化地图
// 初始化地图
initMap
()
{
initMap
()
{
// 加载PositionPicker,loadUI的路径参数为模块名中 'ui/' 之后的部分
// 加载PositionPicker,loadUI的路径参数为模块名中 'ui/' 之后的部分
let
AMapUI
=
(
this
.
AMapUI
=
window
.
AMapUI
);
let
AMapUI
=
(
this
.
AMapUI
=
window
.
AMapUI
);
let
AMap
=
(
this
.
AMap
=
window
.
AMap
);
let
AMap
=
(
this
.
AMap
=
window
.
AMap
);
AMapUI
.
loadUI
([
"misc/PositionPicker"
],
PositionPicker
=>
{
AMapUI
.
loadUI
([
"misc/PositionPicker"
],
(
PositionPicker
)
=>
{
let
mapConfig
=
{
let
mapConfig
=
{
zoom
:
16
zoom
:
16
,
// cityName: this.MapCityName
// cityName: this.MapCityName
};
};
if
(
this
.
lat
&&
this
.
lng
)
{
if
(
this
.
lat
&&
this
.
lng
)
{
mapConfig
.
center
=
[
this
.
lng
,
this
.
lat
];
mapConfig
.
center
=
[
this
.
lng
,
this
.
lat
];
}
}
let
map
=
new
AMap
.
Map
(
"js-container"
,
mapConfig
);
let
map
=
new
AMap
.
Map
(
"js-container"
,
mapConfig
);
let
_this
=
this
;
// 加载地图搜索插件
// 加载地图搜索插件
AMap
.
service
(
"AMap.PlaceSearch"
,
()
=>
{
AMap
.
service
(
"AMap.PlaceSearch"
,
()
=>
{
this
.
placeSearch
=
new
AMap
.
PlaceSearch
({
this
.
placeSearch
=
new
AMap
.
PlaceSearch
({
pageSize
:
5
,
pageSize
:
5
,
pageIndex
:
1
,
pageIndex
:
1
,
citylimit
:
true
,
citylimit
:
true
,
// city: this.MapCityName,
// city: this.MapCityName,
map
:
map
,
map
:
map
,
panel
:
"js-result"
panel
:
"js-result"
,
});
});
});
// 启用工具条
this
.
placeSearch
.
on
(
"selectChanged"
,
function
({
selected
})
{
AMap
.
plugin
([
"AMap.ToolBar"
],
function
()
{
console
.
log
(
selected
);
map
.
addControl
(
const
{
address
,
location
,
pname
,
cityname
,
adname
}
=
selected
.
data
;
new
AMap
.
ToolBar
({
position
:
"RB"
})
);
});
// 地图地图定位
_this
.
dragData
=
{
AMap
.
plugin
(
"AMap.Geolocation"
,
function
()
{
lng
:
location
.
lng
,
var
geolocation
=
new
AMap
.
Geolocation
({
lat
:
location
.
lat
,
// 是否使用高精度定位,默认:true
address
:
address
,
enableHighAccuracy
:
true
,
province
:
pname
,
// 设置定位超时时间,默认:无穷大
city
:
cityname
,
timeout
:
10000
,
area
:
adname
,
// 定位按钮的停靠位置的偏移量,默认:Pixel(10, 20)
};
buttonOffset
:
new
AMap
.
Pixel
(
10
,
20
),
// 定位成功后调整地图视野范围使定位位置及精度范围视野内可见,默认:false
zoomToAccuracy
:
true
,
// 定位按钮的排放位置, RB表示右下
buttonPosition
:
"RB"
});
map
.
addControl
(
geolocation
);
geolocation
.
getCurrentPosition
();
AMap
.
event
.
addListener
(
geolocation
,
"complete"
,
onComplete
);
AMap
.
event
.
addListener
(
geolocation
,
"error"
,
onError
);
function
onComplete
(
data
)
{
_this
.
searchKey
=
""
;
console
.
log
(
data
);
});
// data是具体的定位信息
});
}
function
onError
(
data
)
{
// 启用工具条
console
.
log
(
data
);
AMap
.
plugin
([
"AMap.ToolBar"
],
function
()
{
// 定位出错
map
.
addControl
(
}
new
AMap
.
ToolBar
({
});
position
:
"RB"
,
}),
);
});
// 创建地图拖拽
// 地图地图定位
let
positionPicker
=
new
PositionPicker
({
AMap
.
plugin
(
"AMap.Geolocation"
,
function
()
{
mode
:
"dragMap"
,
// 设定为拖拽地图模式,可选'dragMap'、'dragMarker',默认为'dragMap'
var
geolocation
=
new
AMap
.
Geolocation
({
map
:
map
,
// 依赖地图对象
// 是否使用高精度定位,默认:true
iconStyle
:
{
enableHighAccuracy
:
true
,
//自定义外观
// 设置定位超时时间,默认:无穷大
url
:
"//webapi.amap.com/ui/1.0/assets/position-picker2.png"
,
//图片地址
timeout
:
10000
,
size
:
[
50
,
50
],
//要显示的点大小,将缩放图片
// 定位按钮的停靠位置的偏移量,默认:Pixel(10, 20)
ancher
:
[
24
,
40
]
//锚点的位置,即被size缩放之后,图片的什么位置作为选中的位置
buttonOffset
:
new
AMap
.
Pixel
(
10
,
20
),
}
// 定位成功后调整地图视野范围使定位位置及精度范围视野内可见,默认:false
});
zoomToAccuracy
:
true
,
// 定位按钮的排放位置, RB表示右下
buttonPosition
:
"RB"
,
});
map
.
addControl
(
geolocation
);
geolocation
.
getCurrentPosition
();
AMap
.
event
.
addListener
(
geolocation
,
"complete"
,
onComplete
);
AMap
.
event
.
addListener
(
geolocation
,
"error"
,
onError
);
// 拖拽完成发送自定义 drag 事件
function
onComplete
(
data
)
{
positionPicker
.
on
(
"success"
,
positionResult
=>
{
console
.
log
(
data
);
this
.
dragMap
(
positionResult
);
// data是具体的定位信息
});
}
// 启动拖放
positionPicker
.
start
();
function
onError
(
data
)
{
});
console
.
log
(
data
);
}
// 定位出错
},
}
async
mounted
()
{
});
// 已载入高德地图API,则直接初始化地图
if
(
window
.
AMap
&&
window
.
AMapUI
)
{
// 创建地图拖拽
this
.
initMap
();
let
positionPicker
=
new
PositionPicker
({
// 未载入高德地图API,则先载入API再初始化
mode
:
"dragMap"
,
// 设定为拖拽地图模式,可选'dragMap'、'dragMarker',默认为'dragMap'
}
else
{
map
:
map
,
// 依赖地图对象
await
remoteLoad
(
iconStyle
:
{
`http://webapi.amap.com/maps?v=1.3&key=bb057625545d8cf77df1379e7aaae0b5`
//自定义外观
);
url
:
"//webapi.amap.com/ui/1.0/assets/position-picker2.png"
,
//图片地址
await
remoteLoad
(
"http://webapi.amap.com/ui/1.0/main.js"
);
size
:
[
50
,
50
],
//要显示的点大小,将缩放图片
this
.
initMap
();
ancher
:
[
24
,
40
],
//锚点的位置,即被size缩放之后,图片的什么位置作为选中的位置
}
},
}
});
};
// 拖拽完成发送自定义 drag 事件
positionPicker
.
on
(
"success"
,
(
positionResult
)
=>
{
this
.
dragMap
(
positionResult
);
});
// 启动拖放
positionPicker
.
start
();
});
},
},
async
mounted
()
{
// 已载入高德地图API,则直接初始化地图
if
(
window
.
AMap
&&
window
.
AMapUI
)
{
this
.
initMap
();
// 未载入高德地图API,则先载入API再初始化
}
else
{
await
remoteLoad
(
`http://webapi.amap.com/maps?v=1.3&key=bb057625545d8cf77df1379e7aaae0b5`
);
await
remoteLoad
(
"http://webapi.amap.com/ui/1.0/main.js"
);
this
.
initMap
();
}
},
};
</
script
>
</
script
>
<
style
lang=
"less"
scoped
>
<
style
lang=
"less"
scoped
>
.mapContainer {
.mapContainer {
height: 100%;
height: 100%;
width: 100%;
width: 100%;
// display: flex;
// display: flex;
// flex-direction: column;
// flex-direction: column;
.mapWrapper {
.mapWrapper {
position: relative;
position: relative;
width: 80%;
width: 80%;
height: 30vh;
height: 30vh;
.search {
.search {
position: absolute;
position: absolute;
top: 10px;
top: 10px;
left: 20px;
left: 20px;
z-index: 100000;
z-index: 100000;
.dialog-input {
.dialog-input {
width: 250px;
width: 250px;
}
}
}
}
.myMap {
.myMap {
height: 100%;
height: 100%;
height: 100%;
height: 100%;
}
}
.mapInfo {
width: 20%;
padding-left: 20px;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: flex-start;
.infoAll {
flex-direction: column;
justify-content: start;
align-items: flex-start;
.info {
text-align: left;
}
}
.confirmButton {
display: flex;
flex-wrap: wrap;
.button_pre {
margin-right: 15px;
}
.button_next {
margin-left: 0;
}
}
}
}
}
}
.m-map .search {
.mapInfo {
position: absolute;
width: 20%;
top: 10px;
padding-left: 20px;
left: 10px;
display: flex;
width: 285px;
flex-direction: column;
z-index: 1;
justify-content: space-between;
align-items: flex-start;
.infoAll {
flex-direction: column;
justify-content: start;
align-items: flex-start;
.info {
text-align: left;
}
}
}
.confirmButton {
.m-map .search input {
display: flex;
width: 180px;
flex-wrap: wrap;
border: 1px solid #ccc;
.button_pre {
line-height: 20px;
margin-right: 15px;
padding: 5px;
}
outline: none;
.button_next {
margin-left: 0;
}
}
}
}
}
.m-map .search {
position: absolute;
top: 10px;
left: 10px;
width: 285px;
z-index: 1;
}
.m-map .search input {
width: 180px;
border: 1px solid #ccc;
line-height: 20px;
padding: 5px;
outline: none;
}
</
style
>
</
style
>
src/pages/Goods/Detail/index.vue
View file @
4f5f1b64
<
template
>
<
template
>
<el-card
class=
"detail"
>
<el-card
class=
"detail"
>
<!-- 状态区域 -->
<!-- 状态区域 -->
<el-card
class=
"state"
>
<el-card
class=
"state"
>
<h2
class=
"some_state"
>
{{
status
}}
</h2>
<h2
class=
"some_state"
>
{{
status
}}
</h2>
<h2
<h2
class=
"some_state"
style=
"margin-left: 20px"
>
{{
onlineStatus
}}
</h2>
class=
"some_state"
<span
class=
"update_time"
>
上次更新时间:
{{
goodsObj
.
update_time
}}
</span>
style=
"margin-left:20px"
<span>
创建时间:
{{
goodsObj
.
create_time
}}
</span>
>
{{
onlineStatus
}}
</h2>
</el-card>
<span
class=
"update_time"
>
上次更新时间:
{{
goodsObj
.
update_time
}}
</span>
<!-- 基本信息 -->
<span>
创建时间:
{{
goodsObj
.
create_time
}}
</span>
<el-card
class=
"message_border"
>
</el-card>
<section
class=
"message"
>
<!-- 基本信息 -->
<!-- 商品列表修改区 -->
<el-card
class=
"message_border"
>
<section
class=
"width50p"
>
<section
class=
"message"
>
<el-form
label-position=
"left"
label-width=
"140px"
>
<!-- 商品列表修改区 -->
<h3>
基本信息
</h3>
<section
class=
"width50p"
>
<el-form-item
label=
"生活号名称:"
>
<el-form
<!--
<el-input
label-position=
"left"
label-width=
"140px"
>
<h3>
基本信息
</h3>
<el-form-item
label=
"生活号名称:"
>
<!--
<el-input
v-if=
"$route.params.operation === 'EDIT'"
v-if=
"$route.params.operation === 'EDIT'"
disabled
disabled
:readonly=
"true"
:readonly=
"true"
v-model=
"goodsObj.life_account_name"
v-model=
"goodsObj.life_account_name"
></el-input>
-->
></el-input>
-->
<span>
{{
goodsObj
.
life_account_name
}}
</span>
<span>
{{
goodsObj
.
life_account_name
}}
</span>
</el-form-item>
</el-form-item>
<el-form-item
label=
"生活号类型:"
>
<el-form-item
label=
"生活号类型:"
>
<!--
<el-select
<!--
<el-select
aria-readonly=
"true"
aria-readonly=
"true"
disabled
disabled
v-if=
"$route.params.operation === 'EDIT'"
v-if=
"$route.params.operation === 'EDIT'"
...
@@ -43,84 +37,84 @@
...
@@ -43,84 +37,84 @@
:value=
"item.value"
:value=
"item.value"
></el-option>
></el-option>
</el-select>
-->
</el-select>
-->
<span
v-if=
"goodsObj.life_account_type === 1"
>
个人生活号
</span>
<span
v-if=
"goodsObj.life_account_type === 1"
>
个人生活号
</span>
<span
v-if=
"goodsObj.life_account_type === 2"
>
企业生活号
</span>
<span
v-if=
"goodsObj.life_account_type === 2"
>
企业生活号
</span>
</el-form-item>
</el-form-item>
<el-form-item
label=
"生活号认证状态:"
>
<el-form-item
label=
"生活号认证状态:"
>
<span
v-if=
"goodsObj.life_account_auth_status === 1"
>
未认证
</span>
<span
v-if=
"goodsObj.life_account_auth_status === 1"
>
未认证
</span>
<span
v-if=
"goodsObj.life_account_auth_status === 2"
>
已认证
</span>
<span
v-if=
"goodsObj.life_account_auth_status === 2"
>
已认证
</span>
</el-form-item>
</el-form-item>
<el-form-item
label=
"商品id:"
>
<el-form-item
label=
"商品id:"
>
<!--
<el-input
<!--
<el-input
v-if=
"$route.params.operation === 'EDIT'"
v-if=
"$route.params.operation === 'EDIT'"
v-model=
"goodsObj.goods_spu_id"
v-model=
"goodsObj.goods_spu_id"
></el-input>
-->
></el-input>
-->
<span>
{{
goodsObj
.
goods_spu_id
}}
</span>
<span>
{{
goodsObj
.
goods_spu_id
}}
</span>
</el-form-item>
</el-form-item>
<el-form-item
label=
"商品名称:"
>
<el-form-item
label=
"商品名称:"
>
<el-input
<el-input
maxlength=
"50"
maxlength=
"50"
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"
@
input=
"checkHaveExpression"
@
blur=
"checkSameName"
@
blur=
"checkSameName"
></el-input>
></el-input>
<span
v-else
>
{{
goodsObj
.
goods_name
}}
</span>
<span
v-else
>
{{
goodsObj
.
goods_name
}}
</span>
</el-form-item>
</el-form-item>
<el-form-item
label=
"分类:"
>
<el-form-item
label=
"分类:"
>
<el-cascader
<el-cascader
:disabled=
"$route.params.operation !== 'EDIT'"
:disabled=
"$route.params.operation !== 'EDIT'"
v-model=
"optionsValue"
v-model=
"optionsValue"
class=
"options"
class=
"options"
:options=
"optionList"
:options=
"optionList"
:props=
"optionsProps"
:props=
"optionsProps"
@
change=
"optionsChange"
@
change=
"optionsChange"
clearable
clearable
></el-cascader>
></el-cascader>
</el-form-item>
</el-form-item>
<el-form-item
label=
"说明:"
>
<el-form-item
label=
"说明:"
>
<el-input
<el-input
v-if=
"$route.params.operation === 'EDIT'"
v-if=
"$route.params.operation === 'EDIT'"
type=
"textarea"
type=
"textarea"
maxlength=
"50"
maxlength=
"50"
show-word-limit
show-word-limit
:autosize=
"
{ minRows: 4 }"
:autosize=
"
{ minRows: 4 }"
v-model="goodsObj.desc"
v-model="goodsObj.desc"
>
</el-input>
>
</el-input>
<span
v-else
>
{{
goodsObj
.
desc
}}
</span>
<span
v-else
>
{{
goodsObj
.
desc
}}
</span>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
</section>
</section>
<!-- 商品详情图 -->
<!-- 商品详情图 -->
<section
class=
"width50p"
>
<section
class=
"width50p"
>
<h4
style=
"margin-bottom:
20px"
>
商品详情图
</h4>
<h4
style=
"margin-bottom:
20px"
>
商品详情图
</h4>
<el-upload
<el-upload
:data=
"
{ type: 1 }"
:data=
"
{ type: 1 }"
:action="uploadUrl"
:action="uploadUrl"
:on-preview="previewImage"
:on-preview="previewImage"
:on-success="handleDetailSuccess"
:on-success="handleDetailSuccess"
:before-remove="removeDetailFiles"
:before-remove="removeDetailFiles"
:file-list="descPicUrlList"
:file-list="descPicUrlList"
auto-upload
auto-upload
:disabled="$route.params.operation !== 'EDIT'"
:disabled="$route.params.operation !== 'EDIT'"
ref="detailUpload"
ref="detailUpload"
:limit="9"
:limit="9"
list-type="picture-card"
list-type="picture-card"
multiple
multiple
>
>
<template
#
default
>
<template
#
default
>
<i
class=
"el-icon-plus"
></i>
<i
class=
"el-icon-plus"
></i>
</
template
>
</
template
>
</el-upload>
</el-upload>
</section>
</section>
</section>
</section>
</el-card>
</el-card>
<!-- 商品详情 -->
<!-- 商品详情 -->
<el-card
class=
"message_border"
>
<el-card
class=
"message_border"
>
<h3>
商品详情
</h3>
<h3>
商品详情
</h3>
<section
class=
"message"
>
<section
class=
"message"
>
<!-- <section class="width50p">
<!-- <section class="width50p">
<h4>套餐商品</h4>
<h4>套餐商品</h4>
<el-table>
<el-table>
<el-table-column
<el-table-column
...
@@ -141,27 +135,27 @@
...
@@ -141,27 +135,27 @@
></el-table-column>
></el-table-column>
</el-table>
</el-table>
</section> -->
</section> -->
<section
class=
"width50p"
>
<section
class=
"width50p"
>
<h4
style=
"margin-bottom:
20px"
>
商品介绍图
</h4>
<h4
style=
"margin-bottom:
20px"
>
商品介绍图
</h4>
<el-upload
<el-upload
:data=
"{ type: 1 }"
:data=
"{ type: 1 }"
:disabled=
"$route.params.operation !== 'EDIT'"
:disabled=
"$route.params.operation !== 'EDIT'"
:action=
"uploadUrl"
:action=
"uploadUrl"
auto-upload
auto-upload
:limit=
"9"
:limit=
"9"
:on-preview=
"previewImage"
:on-preview=
"previewImage"
list-type=
"picture-card"
list-type=
"picture-card"
multiple
multiple
ref=
"intrUpload"
ref=
"intrUpload"
:on-success=
"introduceSuccess"
:on-success=
"introduceSuccess"
:before-remove=
"intrRemove"
:before-remove=
"intrRemove"
:file-list=
"introducePicUrlList"
:file-list=
"introducePicUrlList"
>
>
<
template
#
default
>
<
template
#
default
>
<i
class=
"el-icon-plus"
></i>
<i
class=
"el-icon-plus"
></i>
</
template
>
</
template
>
</el-upload>
</el-upload>
<!-- <h4 style="margin-top:20px">商品介绍:</h4>
<!-- <h4 style="margin-top:20px">商品介绍:</h4>
<el-input
<el-input
v-if="$route.params.operation === 'EDIT'"
v-if="$route.params.operation === 'EDIT'"
type="textarea"
type="textarea"
...
@@ -171,1169 +165,976 @@
...
@@ -171,1169 +165,976 @@
show-word-limit
show-word-limit
></el-input>
></el-input>
<span v-else>{{ goodsObj.introduce }}</span> -->
<span v-else>{{ goodsObj.introduce }}</span> -->
</section>
</section>
</el-card>
<!-- 可用门店 -->
<el-card
class=
"message_border"
>
<section
class=
"message"
>
<section
class=
"width50p"
>
<h3>
可用门店
</h3>
<el-table
:data=
"goodsObj.sub_shop"
>
<el-table-column
label=
"门店名称"
align=
"center"
prop=
"shop_name"
></el-table-column>
<el-table-column
label=
"联系电话"
align=
"center"
prop=
"phone"
></el-table-column>
<el-table-column
label=
"地址"
align=
"center"
prop=
"address"
></el-table-column>
<el-table-column
label=
"地理定位"
align=
"center"
>
<
template
#
default=
"scope"
>
<span>
经度:
{{
scope
.
row
.
longitude
}}
</span>
<br
/>
<span>
纬度:
{{
scope
.
row
.
latitude
}}
</span>
</
template
>
</el-table-column>
<el-table-column
v-if=
"$route.params.operation === 'EDIT'"
label=
"操作"
align=
"center"
fixed=
"right"
>
<
template
#
default=
"scope"
>
<el-button
type=
"text"
@
click=
"deleteShops(scope.row.sub_shop_id)"
>
删除
</el-button>
</
template
>
</el-table-column>
</el-table>
<el-popover
v-if=
"$route.params.operation === 'EDIT'"
placement=
"bottom"
:width=
"800"
trigger=
"click"
v-model:visible=
"shopListShow"
>
<
template
#
reference
>
<el-button
@
click=
"getShops"
type=
"primary"
style=
"border-radius:20px;margin:20px 0 0 50%;transform: translate(-50%,0);"
>
门店列表
</el-button>
</
template
>
<!-- 门店列表 -->
<el-table
ref=
"shopListRef"
:data=
"shopsList"
@
selection-change=
"handleShopsChange"
row-key=
"sub_shop_id"
>
<!-- :selectable="canChooseShop"↓ -->
<el-table-column
type=
"selection"
width=
"55"
aria-checked=
"true"
:reserve-selection=
"true"
>
</el-table-column>
<el-table-column
align=
"center"
prop=
"shop_name"
label=
"门店名称"
></el-table-column>
<el-table-column
align=
"center"
prop=
"phone"
label=
"联系电话"
></el-table-column>
<el-table-column
align=
"center"
prop=
"address"
label=
"地址"
></el-table-column>
<el-table-column
align=
"center"
label=
"地理定位"
>
<
template
#
default=
"scope"
>
<span>
经度:
{{
scope
.
row
.
longitude
}}
</span>
<br
/>
<span>
纬度:
{{
scope
.
row
.
latitude
}}
</span>
</
template
>
</el-table-column>
</el-table>
<!-- 分页 -->
<el-pagination
style=
"margin-top:20px;"
background
@
current-change=
"changeShopListPage"
v-model:currentPage=
"shopCurrentPage"
:page-size=
"5"
layout=
"total, prev, pager, next"
:total=
"shopsCount"
>
</el-pagination>
<section
style=
"display:flex;justify-content:center;"
>
<el-button
type=
"primary"
style=
"border-radius:20px;"
@
click=
"handleChooseShops"
>
确定
</el-button>
<!-- 添加门店弹窗 -->
<el-popover
placement=
"bottom"
:width=
"600"
trigger=
"click"
:visible=
"addShopShow"
>
<
template
#
reference
>
<el-button
@
click=
"addShopShow = true"
type=
"primary"
style=
"border-radius:20px;"
>
添加门店
</el-button>
</
template
>
<!-- 添加门店表单 -->
<el-form
label-position=
"right"
label-width=
"100px"
:model=
"shopForm"
>
<el-form-item
label=
"门店名称:"
>
<el-input
v-model=
"shopForm.shop_name"
maxlength=
"20"
show-word-limit
></el-input>
</el-form-item>
<el-form-item
label=
"联系电话:"
>
<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>
</el-form-item>
<el-form-item
label=
"地理定位:"
class=
"deep_place"
>
<el-input
v-model=
"shopForm.deep_place"
></el-input>
<a
style=
""
target=
"_blank"
href=
"https://lbs.amap.com/tools/picker"
>
高德获取定位
</a>
</el-form-item>
</el-form>
<section
style=
"display:flex;justify-content:center;"
>
<el-button
type=
"primary"
@
click=
"addShop"
>
保存
</el-button>
<el-button
@
click=
"closeAddShops"
>
取消
</el-button>
</section>
</section>
</el-popover>
</section>
</section>
</el-popover>
</el-card>
</section>
<!-- 可用门店 -->
<section
class=
"width50p"
>
<el-card
class=
"message_border"
>
<h4
style=
"margin-bottom:20px"
>
价格信息
</h4>
<section
class=
"message"
>
<el-form
label-width=
"100px"
>
<section
class=
"width50p"
>
<!-- <el-form-item label="秒杀价">
<h3>
可用门店
</h3>
<el-table
:data=
"goodsObj.sub_shop"
>
<el-table-column
label=
"门店名称"
align=
"center"
prop=
"shop_name"
></el-table-column>
<el-table-column
label=
"联系电话"
align=
"center"
prop=
"phone"
></el-table-column>
<el-table-column
label=
"地址"
align=
"center"
prop=
"address"
></el-table-column>
<el-table-column
label=
"地理定位"
align=
"center"
>
<
template
#
default=
"scope"
>
<span>
经度:
{{
scope
.
row
.
longitude
}}
</span>
<br
/>
<span>
纬度:
{{
scope
.
row
.
latitude
}}
</span>
</
template
>
</el-table-column>
<el-table-column
v-if=
"$route.params.operation === 'EDIT'"
label=
"操作"
align=
"center"
fixed=
"right"
>
<
template
#
default=
"scope"
>
<el-button
type=
"text"
@
click=
"deleteShops(scope.row.sub_shop_id)"
>
删除
</el-button>
</
template
>
</el-table-column>
</el-table>
<el-popover
v-if=
"$route.params.operation === 'EDIT'"
placement=
"bottom"
:width=
"800"
trigger=
"click"
v-model:visible=
"shopListShow"
>
<
template
#
reference
>
<el-button
@
click=
"getShops"
type=
"primary"
style=
"border-radius: 20px; margin: 20px 0 0 50%; transform: translate(-50%, 0)"
>
门店列表
</el-button>
</
template
>
<!-- 门店列表 -->
<el-table
ref=
"shopListRef"
:data=
"shopsList"
@
selection-change=
"handleShopsChange"
row-key=
"sub_shop_id"
>
<!-- :selectable="canChooseShop"↓ -->
<el-table-column
type=
"selection"
width=
"55"
aria-checked=
"true"
:reserve-selection=
"true"
></el-table-column>
<el-table-column
align=
"center"
prop=
"shop_name"
label=
"门店名称"
></el-table-column>
<el-table-column
align=
"center"
prop=
"phone"
label=
"联系电话"
></el-table-column>
<el-table-column
align=
"center"
prop=
"address"
label=
"地址"
></el-table-column>
<el-table-column
align=
"center"
label=
"地理定位"
>
<
template
#
default=
"scope"
>
<span>
经度:
{{
scope
.
row
.
longitude
}}
</span>
<br
/>
<span>
纬度:
{{
scope
.
row
.
latitude
}}
</span>
</
template
>
</el-table-column>
</el-table>
<!-- 分页 -->
<el-pagination
style=
"margin-top: 20px"
background
@
current-change=
"changeShopListPage"
v-model:currentPage=
"shopCurrentPage"
:page-size=
"5"
layout=
"total, prev, pager, next"
:total=
"shopsCount"
></el-pagination>
<section
style=
"display: flex; justify-content: center"
>
<el-button
type=
"primary"
style=
"border-radius: 20px"
@
click=
"handleChooseShops"
>
确定
</el-button>
<!-- 添加门店弹窗 -->
<el-popover
placement=
"bottom"
:width=
"600"
trigger=
"click"
:visible=
"addShopShow"
>
<
template
#
reference
>
<el-button
@
click=
"addShopShow = true"
type=
"primary"
style=
"border-radius: 20px"
>
添加门店
</el-button>
</
template
>
<!-- 添加门店表单 -->
<el-form
label-position=
"right"
label-width=
"100px"
:model=
"shopForm"
>
<el-form-item
label=
"门店名称:"
>
<el-input
v-model=
"shopForm.shop_name"
maxlength=
"20"
show-word-limit
></el-input>
</el-form-item>
<el-form-item
label=
"联系电话:"
>
<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>
</el-form-item>
<el-form-item
label=
"地理定位:"
class=
"deep_place"
>
<el-input
v-model=
"shopForm.deep_place"
></el-input>
<a
style=
""
target=
"_blank"
href=
"https://lbs.amap.com/tools/picker"
>
高德获取定位
</a>
</el-form-item>
</el-form>
<section
style=
"display: flex; justify-content: center"
>
<el-button
type=
"primary"
@
click=
"addShop"
>
保存
</el-button>
<el-button
@
click=
"closeAddShops"
>
取消
</el-button>
</section>
</el-popover>
</section>
</el-popover>
</section>
<section
class=
"width50p"
>
<h4
style=
"margin-bottom: 20px"
>
价格信息
</h4>
<el-form
label-width=
"100px"
>
<!-- <el-form-item label="秒杀价">
<el-input
<el-input
:readonly="true"
:readonly="true"
disabled
disabled
></el-input>
></el-input>
</el-form-item> -->
</el-form-item> -->
<el-form-item
label=
"售价"
>
<el-form-item
label=
"售价"
>
<el-input
<el-input
v-if=
"$route.params.operation === 'EDIT'"
v-model=
"goodsObj.price"
@
change=
"salePrice"
></el-input>
v-if=
"$route.params.operation === 'EDIT'"
<span
v-else
>
{{ goodsObj.price }}
</span>
v-model=
"goodsObj.price"
</el-form-item>
@
change=
"salePrice"
<el-form-item
label=
"原价"
>
></el-input>
<el-input
v-if=
"$route.params.operation === 'EDIT'"
v-model=
"goodsObj.original_price"
@
change=
"perPrice"
></el-input>
<span
v-else
>
{{ goodsObj.price }}
</span>
<span
v-else
>
{{ goodsObj.original_price }}
</span>
</el-form-item>
</el-form-item>
<el-form-item
label=
"原价"
>
<el-form-item
label=
"结算价"
>
<el-input
<!-- oninput="value=value.toString().match(/^\d+(?:\.\d{0,2})?/)" -->
v-if=
"$route.params.operation === 'EDIT'"
v-model=
"goodsObj.original_price"
<el-input
@
change=
"perPrice"
oninput=
"value=value.toString().match(/^\d+(?:\.\d{0,2})?/)"
></el-input>
@
input=
"changeValue($event, 'clear_price')"
<span
v-else
>
{{ goodsObj.original_price }}
</span>
v-if=
"$route.params.operation === 'EDIT'"
</el-form-item>
v-model=
"goodsObj.clear_price"
<el-form-item
label=
"结算价"
>
@
change=
"perPrice"
<!-- oninput="value=value.toString().match(/^\d+(?:\.\d{0,2})?/)" -->
></el-input>
<span
v-else
>
{{ goodsObj.clear_price }}
</span>
<el-input
</el-form-item>
oninput=
"value=value.toString().match(/^\d+(?:\.\d{0,2})?/)"
<h4
style=
"margin: 20px 0"
>
库存信息
</h4>
@
input=
"changeValue($event, 'clear_price')"
<el-form-item
label=
"剩余库存量:"
>
v-if=
"$route.params.operation === 'EDIT'"
<span>
{{ goodsObj.inventory_rest }}
</span>
v-model=
"goodsObj.clear_price"
</el-form-item>
@
change=
"perPrice"
<el-form-item
label=
"库存增减:"
>
></el-input>
<el-input-number
<span
v-else
>
{{ goodsObj.clear_price }}
</span>
v-if=
"$route.params.operation === 'EDIT'"
</el-form-item>
v-model=
"inventoryAdd"
<h4
style=
"margin:20px 0"
>
库存信息
</h4>
@
change=
"hasNumberChange"
<el-form-item
label=
"剩余库存量:"
>
:precision=
"0"
<span>
{{ goodsObj.inventory_rest }}
</span>
></el-input-number>
</el-form-item>
<span
v-else
>
{{ goodsObj.inventory_rest }}
</span>
<el-form-item
label=
"库存增减:"
>
</el-form-item>
<el-input-number
<el-form-item
label=
"已下单量:"
>
v-if=
"$route.params.operation === 'EDIT'"
<span>
{{ goodsObj.total_amount_order }}
</span>
v-model=
"inventoryAdd"
</el-form-item>
@
change=
"hasNumberChange"
<el-form-item
label=
"已卖出总数:"
>
:precision=
"0"
<span>
{{ goodsObj.total_amount_sold }}
</span>
></el-input-number>
</el-form-item>
<span
v-else
>
{{ goodsObj.inventory_rest }}
</span>
<el-form-item
label=
"总库存量:"
>
</el-form-item>
<span>
{{ goodsObj.inventory_total }}
</span>
<el-form-item
label=
"已下单量:"
>
</el-form-item>
<span>
{{ goodsObj.total_amount_order }}
</span>
</el-form>
</el-form-item>
</section>
<el-form-item
label=
"已卖出总数:"
>
</section>
<span>
{{ goodsObj.total_amount_sold }}
</span>
</el-card>
</el-form-item>
<!-- 使用规则 -->
<el-form-item
label=
"总库存量:"
>
<el-card
class=
"message_border"
>
<span>
{{ goodsObj.inventory_total }}
</span>
<h3
style=
"margin-bottom: 30px"
>
使用规则
</h3>
</el-form-item>
<el-form
style=
"width: 480px"
:model=
"rulesForm"
label-position=
"left"
label-width=
"120px"
>
</el-form>
<el-form-item
label=
"单人可买上限:"
>
<el-input-number
v-if=
"$route.params.operation === 'EDIT'"
:min=
"0"
:precision=
"0"
v-model=
"goodsObj.rule_limit"
@
change=
"handleLimitChange"
@
blur=
"handleLimitChange"
></el-input-number>
<span
v-else
>
{{ goodsObj.rule_limit }}
</span>
</el-form-item>
<el-form-item
label=
"退款规则:"
>
<el-select
v-if=
"$route.params.operation === 'EDIT'"
v-model=
"goodsObj.rule_refund"
placeholder=
"请选择"
:disabled=
"goodsObj.audit_status === 1"
>
<el-option
v-for=
"item in rulesForm.rulesOptions"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
></el-option>
</el-select>
<span
v-else-if=
"$route.params.operation !== 'EDIT' && goodsObj.rule_refund === 1"
>
到期后自动退款
</span>
<span
v-else-if=
"$route.params.operation !== 'EDIT' && goodsObj.rule_refund === 2"
>
购买后不允许退款
</span>
<span
v-else-if=
"$route.params.operation !== 'EDIT' && goodsObj.rule_refund === 3"
>
到期后不退款
</span>
</el-form-item>
<el-form-item
label=
"使用日期:"
>
<el-radio-group
v-model=
"goodsObj.rule_date_type"
v-if=
"$route.params.operation === 'EDIT'"
>
<el-radio
:label=
"1"
>
周末、节假日通用
</el-radio>
<el-radio
:label=
"2"
>
仅工作日可用
</el-radio>
</el-radio-group>
<span
v-else-if=
"$route.params.operation !== 'EDIT' && goodsObj.rule_date_type === 1"
>
周末、节假日通用
</span>
<span
v-else-if=
"$route.params.operation !== 'EDIT' && goodsObj.rule_date_type === 2"
>
仅工作日可用
</span>
</el-form-item>
<el-form-item
label=
"使用开始时间:"
>
<el-time-picker
arrow-control
v-if=
"$route.params.operation === 'EDIT'"
v-model=
"rulesForm.useStartTime"
@
change=
"pickerStartTime"
></el-time-picker>
<span
v-else
>
{{ goodsObj.rule_start_time }}
</span>
</el-form-item>
<el-form-item
label=
"使用结束时间:"
>
<el-time-picker
arrow-control
v-if=
"$route.params.operation === 'EDIT'"
v-model=
"rulesForm.useEndTime"
@
change=
"pickerEndTime"
></el-time-picker>
<span
v-else
>
{{ goodsObj.rule_end_time }}
</span>
</el-form-item>
<el-form-item
label=
"过期时间"
>
<el-date-picker
v-if=
"$route.params.operation === 'EDIT'"
:disabledDate=
"disableExpirDate"
v-model=
"expirationTime"
type=
"datetime"
@
change=
"expirDateChange"
placeholder=
"选择日期时间"
></el-date-picker>
<span
v-else
>
{{ expirationTime }}
</span>
</el-form-item>
<el-form-item
label=
"使用规则:"
>
<el-input
v-if=
"$route.params.operation === 'EDIT'"
type=
"textarea"
maxlength=
"100"
:autosize=
"{ minRows: 4 }"
show-word-limit
v-model=
"goodsObj.rule_desc"
></el-input>
<span
v-else
>
{{ goodsObj.rule_desc }}
</span>
</el-form-item>
</el-form>
</el-card>
<!-- 操作记录 -->
<el-card
class=
"message_border"
>
<h3
style=
"margin-bottom: 30px"
>
操作记录
</h3>
<el-table
border
stripe
:data=
"recordLits"
>
<el-table-column
label=
"状态"
prop=
"state"
align=
"center"
>
<
template
#
default=
"scope"
>
<span
v-if=
"scope.row.status === 0"
>
待审核
</span>
<span
v-else-if=
"scope.row.status === 1"
>
审核通过
</span>
<span
v-else
>
审核失败
</span>
<span
v-if=
"scope.row.online_status === 0"
>
未上架
</span>
<span
v-else-if=
"scope.row.online_status === 1"
>
已上架
</span>
<span
v-else
>
已下架
</span>
</
template
>
</el-table-column>
<el-table-column
label=
"操作者"
prop=
"operator_name"
align=
"center"
></el-table-column>
<el-table-column
label=
"更新时间"
prop=
"create_time"
align=
"center"
></el-table-column>
<el-table-column
label=
"更新描述"
prop=
"note"
align=
"center"
></el-table-column>
</el-table>
</el-card>
<!-- 审核保存返回 -->
<section
class=
"operationButton"
>
<el-button
type=
"primary"
v-if=
"$route.params.operation === 'AUDIT'"
@
click=
"onSuccess"
>
通过
</el-button>
<el-popover
v-if=
"$route.params.operation === 'AUDIT'"
placement=
"top"
:width=
"600"
trigger=
"click"
v-model:visible=
"rejectVisible"
>
<
template
#
reference
>
<el-button
type=
"danger"
>
驳回
</el-button>
</
template
>
<el-form
:model=
"rejectReason"
>
<el-form-item
label=
"驳回原因:"
>
<el-input
show-word-limit
:maxlength=
"200"
type=
"textarea"
style=
"width: 100%"
v-model
.
trim=
"rejectReason.reason"
></el-input>
</el-form-item>
</el-form>
<section
style=
"display: flex; justify-content: center"
>
<el-button
type=
"danger"
@
click=
"onDefault"
>
驳回
</el-button>
<el-button
type=
"primary"
@
click=
"rejectVisible = false"
>
取消
</el-button>
</section>
</el-popover>
<el-button
v-if=
"$route.params.operation === 'EDIT'"
type=
"primary"
@
click=
"saveDetailMessage"
>
保存
</el-button>
<el-button
@
click=
"backToDetail"
>
返回
</el-button>
</section>
</section>
</section>
</el-card>
<!-- 使用规则 -->
<el-card
class=
"message_border"
>
<h3
style=
"margin-bottom:30px;"
>
使用规则
</h3>
<el-form
style=
"width:480px"
:model=
"rulesForm"
label-position=
"left"
label-width=
"120px"
>
<el-form-item
label=
"单人可买上限:"
>
<el-input-number
v-if=
"$route.params.operation === 'EDIT'"
:min=
"0"
:precision=
"0"
v-model=
"goodsObj.rule_limit"
@
change=
"handleLimitChange"
@
blur=
"handleLimitChange"
></el-input-number>
<span
v-else
>
{{ goodsObj.rule_limit }}
</span>
</el-form-item>
<el-form-item
label=
"退款规则:"
>
<el-select
v-if=
"$route.params.operation === 'EDIT'"
v-model=
"goodsObj.rule_refund"
placeholder=
"请选择"
:disabled=
"goodsObj.audit_status===1"
>
<el-option
v-for=
"item in rulesForm.rulesOptions"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-select>
<span
v-else-if=
"
$route.params.operation !== 'EDIT' && goodsObj.rule_refund === 1
"
>
到期后自动退款
</span>
<span
v-else-if=
"
$route.params.operation !== 'EDIT' && goodsObj.rule_refund === 2
"
>
购买后不允许退款
</span>
<span
v-else-if=
"
$route.params.operation !== 'EDIT' && goodsObj.rule_refund === 3
"
>
到期后不退款
</span>
</el-form-item>
<el-form-item
label=
"使用日期:"
>
<el-radio-group
v-model=
"goodsObj.rule_date_type"
v-if=
"$route.params.operation === 'EDIT'"
>
<el-radio
:label=
"1"
>
周末、节假日通用
</el-radio>
<el-radio
:label=
"2"
>
仅工作日可用
</el-radio>
</el-radio-group>
<span
v-else-if=
"
$route.params.operation !== 'EDIT' &&
goodsObj.rule_date_type === 1
"
>
周末、节假日通用
</span>
<span
v-else-if=
"
$route.params.operation !== 'EDIT' &&
goodsObj.rule_date_type === 2
"
>
仅工作日可用
</span>
</el-form-item>
<el-form-item
label=
"使用开始时间:"
>
<el-time-picker
arrow-control
v-if=
"$route.params.operation === 'EDIT'"
v-model=
"rulesForm.useStartTime"
@
change=
"pickerStartTime"
>
</el-time-picker>
<span
v-else
>
{{ goodsObj.rule_start_time }}
</span>
</el-form-item>
<el-form-item
label=
"使用结束时间:"
>
<el-time-picker
arrow-control
v-if=
"$route.params.operation === 'EDIT'"
v-model=
"rulesForm.useEndTime"
@
change=
"pickerEndTime"
>
</el-time-picker>
<span
v-else
>
{{ goodsObj.rule_end_time }}
</span>
</el-form-item>
<el-form-item
label=
"过期时间"
>
<el-date-picker
v-if=
"$route.params.operation === 'EDIT'"
:disabledDate=
"disableExpirDate"
v-model=
"expirationTime"
type=
"datetime"
@
change=
"expirDateChange"
placeholder=
"选择日期时间"
>
</el-date-picker>
<span
v-else
>
{{ expirationTime }}
</span>
</el-form-item>
<el-form-item
label=
"使用规则:"
>
<el-input
v-if=
"$route.params.operation === 'EDIT'"
type=
"textarea"
maxlength=
"100"
:autosize=
"{ minRows: 4 }"
show-word-limit
v-model=
"goodsObj.rule_desc"
></el-input>
<span
v-else
>
{{ goodsObj.rule_desc }}
</span>
</el-form-item>
</el-form>
</el-card>
</el-card>
<!-- 操作记录 -->
<!-- 展示缩略图 -->
<el-card
class=
"message_border"
>
<el-dialog
width=
"40%"
v-model=
"isShowPopver"
>
<h3
style=
"margin-bottom:30px;"
>
操作记录
</h3>
<el-image
:src=
"popoverImage"
fit=
"fill"
style=
"width: 100%"
></el-image>
<el-table
</el-dialog>
border
stripe
:data=
"recordLits"
>
<el-table-column
label=
"状态"
prop=
"state"
align=
"center"
>
<
template
#
default=
"scope"
>
<span
v-if=
"scope.row.status === 0"
>
待审核
</span>
<span
v-else-if=
"scope.row.status === 1"
>
审核通过
</span>
<span
v-else
>
审核失败
</span>
<span
v-if=
"scope.row.online_status === 0"
>
未上架
</span>
<span
v-else-if=
"scope.row.online_status === 1"
>
已上架
</span>
<span
v-else
>
已下架
</span>
</
template
>
</el-table-column>
<el-table-column
label=
"操作者"
prop=
"operator_name"
align=
"center"
></el-table-column>
<el-table-column
label=
"更新时间"
prop=
"create_time"
align=
"center"
></el-table-column>
<el-table-column
label=
"更新描述"
prop=
"note"
align=
"center"
></el-table-column>
</el-table>
</el-card>
<!-- 审核保存返回 -->
<section
class=
"operationButton"
>
<el-button
type=
"primary"
v-if=
"$route.params.operation === 'AUDIT'"
@
click=
"onSuccess"
>
通过
</el-button>
<el-popover
v-if=
"$route.params.operation === 'AUDIT'"
placement=
"top"
:width=
"600"
trigger=
"click"
v-model:visible=
"rejectVisible"
>
<
template
#
reference
>
<el-button
type=
"danger"
>
驳回
</el-button>
</
template
>
<el-form
:model=
"rejectReason"
>
<el-form-item
label=
"驳回原因:"
>
<el-input
show-word-limit
:maxlength=
"200"
type=
"textarea"
style=
"width:100%"
v-model
.
trim=
"rejectReason.reason"
></el-input>
</el-form-item>
</el-form>
<section
style=
"display:flex;justify-content:center;"
>
<el-button
type=
"danger"
@
click=
"onDefault"
>
驳回
</el-button>
<el-button
type=
"primary"
@
click=
"rejectVisible = false"
>
取消
</el-button>
</section>
</el-popover>
<el-button
v-if=
"$route.params.operation === 'EDIT'"
type=
"primary"
@
click=
"saveDetailMessage"
>
保存
</el-button>
<el-button
@
click=
"backToDetail"
>
返回
</el-button>
</section>
</el-card>
<!-- 展示缩略图 -->
<el-dialog
width=
"40%"
v-model=
"isShowPopver"
>
<el-image
:src=
"popoverImage"
fit=
"fill"
style=
"width:100%"
></el-image>
</el-dialog>
</template>
</template>
<
style
lang=
"less"
src=
"./index.less"
scope
></
style
>
<
style
lang=
"less"
src=
"./index.less"
scope
></
style
>
<
script
>
<
script
>
import
{
import
{
getGoodsInfo
,
getGoodsInfo
,
getGoodsList
,
getGoodsList
,
postSuccess
,
postSuccess
,
auditReject
,
auditReject
,
checkGoodsName
,
checkGoodsName
,
getShopsList
,
getShopsList
,
postAddShop
,
postAddShop
,
editGoods
editGoods
,
}
from
"@/service/Goods/goods"
;
}
from
"@/service/Goods/goods"
;
import
{
GOODS_URI
}
from
"../../../../server/config.js"
;
import
{
UploadPicUrl
}
from
"@/utils/util"
;
import
filterInput
from
"../utils/filterInput"
;
import
filterInput
from
"../utils/filterInput"
;
export
default
{
export
default
{
name
:
"GoodsDetail"
,
name
:
"GoodsDetail"
,
beforeRouteEnter
(
to
,
from
,
next
)
{
beforeRouteEnter
(
to
,
from
,
next
)
{
if
(
!
to
.
params
.
operation
)
{
if
(
!
to
.
params
.
operation
)
{
next
({
name
:
"GoodsList"
});
next
({
name
:
"GoodsList"
});
}
else
if
(
!
to
.
params
.
spuId
)
{
}
else
if
(
!
to
.
params
.
spuId
)
{
next
({
name
:
"GoodsList"
});
next
({
name
:
"GoodsList"
});
}
else
{
}
else
{
next
();
next
();
}
}
},
},
created
()
{
created
()
{
this
.
getOptions
();
this
.
getOptions
();
this
.
getGoodsDetailList
(
this
.
$route
.
params
.
spuId
);
this
.
getGoodsDetailList
(
this
.
$route
.
params
.
spuId
);
},
},
computed
:
{
computed
:
{
// 审核状态
// 审核状态
status
()
{
status
()
{
if
(
this
.
goodsObj
.
audit_status
===
0
)
{
if
(
this
.
goodsObj
.
audit_status
===
0
)
{
return
"待审核"
;
return
"待审核"
;
}
else
if
(
this
.
goodsObj
.
audit_status
===
1
)
{
}
else
if
(
this
.
goodsObj
.
audit_status
===
1
)
{
return
"审核通过"
;
return
"审核通过"
;
}
else
{
}
else
{
return
"审核驳回"
;
return
"审核驳回"
;
}
}
},
},
// 上下架状态
// 上下架状态
onlineStatus
()
{
onlineStatus
()
{
if
(
this
.
goodsObj
.
online_status
===
0
)
{
if
(
this
.
goodsObj
.
online_status
===
0
)
{
return
"未上架"
;
return
"未上架"
;
}
else
if
(
this
.
goodsObj
.
online_status
===
1
)
{
}
else
if
(
this
.
goodsObj
.
online_status
===
1
)
{
return
"已上架"
;
return
"已上架"
;
}
else
{
}
else
{
return
"已下架"
;
return
"已下架"
;
}
}
}
},
},
},
watch
:
{
watch
:
{
goodsObj
(
val
)
{
goodsObj
(
val
)
{
this
.
optionsValue
=
[
val
.
category_1_id
,
val
.
category_2_id
];
this
.
optionsValue
=
[
val
.
category_1_id
,
val
.
category_2_id
];
this
.
rulesForm
.
useStartTime
=
this
.
formatDate
(
val
.
rule_start_time
);
this
.
rulesForm
.
useStartTime
=
this
.
formatDate
(
val
.
rule_start_time
);
this
.
rulesForm
.
useEndTime
=
this
.
formatDate
(
val
.
rule_end_time
);
this
.
rulesForm
.
useEndTime
=
this
.
formatDate
(
val
.
rule_end_time
);
console
.
log
(
val
.
original_price
);
console
.
log
(
val
.
original_price
);
this
.
goodsObj
.
original_price
=
Number
(
val
.
original_price
)
this
.
goodsObj
.
original_price
=
Number
(
val
.
original_price
);
if
(
!
val
.
original_price
)
{
if
(
!
val
.
original_price
)
{
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
this
.
goodsObj
.
original_price
=
""
;
this
.
goodsObj
.
original_price
=
""
;
})
});
}
}
},
},
rejectVisible
(
val
)
{
rejectVisible
(
val
)
{
if
(
!
val
)
{
if
(
!
val
)
{
this
.
rejectReason
.
reason
=
""
;
this
.
rejectReason
.
reason
=
""
;
}
}
},
},
},
},
data
()
{
data
()
{
return
{
return
{
// 商品分类选项
// 商品分类选项
optionsProps
:
{
optionsProps
:
{
value
:
"category_id"
,
value
:
"category_id"
,
label
:
"name"
,
label
:
"name"
,
children
:
"sub_list"
children
:
"sub_list"
,
},
},
lifeList
:
[
lifeList
:
[
{
value
:
1
,
options
:
"个人生活号"
},
{
value
:
1
,
options
:
"个人生活号"
},
{
value
:
2
,
options
:
"企业生活号"
}
{
value
:
2
,
options
:
"企业生活号"
},
],
],
optionList
:
[],
// 商品分类选项
optionList
:
[],
// 商品分类选项
optionsValue
:
[],
// 商品分类的值
optionsValue
:
[],
// 商品分类的值
// 商品回显信息
// 商品回显信息
goodsObj
:
{
goodsObj
:
{
introduce
:
""
// 商品介绍
introduce
:
""
,
// 商品介绍
},
},
inventoryAdd
:
0
,
// 库存增减
inventoryAdd
:
0
,
// 库存增减
originalGoodsName
:
""
,
// 原商品名
originalGoodsName
:
""
,
// 原商品名
isGoodsNameRepeat
:
false
,
// 商品名称是否重复
isGoodsNameRepeat
:
false
,
// 商品名称是否重复
descPicUrlList
:
[],
// 商品详情图回显列表
descPicUrlList
:
[],
// 商品详情图回显列表
introducePicUrlList
:
[],
// 商品介绍图回显列表
introducePicUrlList
:
[],
// 商品介绍图回显列表
recordList
:
[],
// 提交记录
recordList
:
[],
// 提交记录
detailUploadList
:
[],
// 上传详情图片列表
detailUploadList
:
[],
// 上传详情图片列表
introduceUploadList
:
[],
// 上传详情图片列表
introduceUploadList
:
[],
// 上传详情图片列表
inventoryNumber
:
0
,
// 库存数量
inventoryNumber
:
0
,
// 库存数量
isAllowStockChange
:
true
,
// 是否允许更改库存
isAllowStockChange
:
true
,
// 是否允许更改库存
// 使用规则表单
// 使用规则表单
rulesForm
:
{
rulesForm
:
{
// 退款选项
// 退款选项
rulesOptions
:
[
rulesOptions
:
[
{
value
:
1
,
label
:
"到期自动退款"
},
{
value
:
1
,
label
:
"到期自动退款"
},
{
value
:
2
,
label
:
"购买后不允许退款"
},
{
value
:
2
,
label
:
"购买后不允许退款"
},
{
value
:
3
,
label
:
"到期后不退款"
}
{
value
:
3
,
label
:
"到期后不退款"
},
],
],
useStartTime
:
""
,
// 使用开始时间
useStartTime
:
""
,
// 使用开始时间
useEndTime
:
""
,
// 使用结束时间
useEndTime
:
""
,
// 使用结束时间
rule_desc
:
""
// 使用描述
rule_desc
:
""
,
// 使用描述
},
},
// 操作记录列表
// 操作记录列表
recordLits
:
[],
recordLits
:
[],
// 驳回原因表单
// 驳回原因表单
rejectReason
:
{
rejectReason
:
{
reason
:
""
reason
:
""
,
},
},
shopsList
:
[],
// 门店列表
shopsList
:
[],
// 门店列表
shopListShow
:
false
,
// 门店列表是否展示
shopListShow
:
false
,
// 门店列表是否展示
shopId
:
[],
// 门店id数组
shopId
:
[],
// 门店id数组
chooseShopsList
:
[],
// 已选门店列表
chooseShopsList
:
[],
// 已选门店列表
shopsCount
:
0
,
shopsCount
:
0
,
shopCurrentPage
:
1
,
// 门店列表当前页
shopCurrentPage
:
1
,
// 门店列表当前页
// 新增门店表单
// 新增门店表单
shopForm
:
{
shopForm
:
{
shop_name
:
""
,
shop_name
:
""
,
connect_phone
:
""
,
connect_phone
:
""
,
address
:
""
,
address
:
""
,
deep_place
:
""
deep_place
:
""
,
},
},
shopList
:
[],
// 门店列表
shopList
:
[],
// 门店列表
addShopDialog
:
false
,
// 添加门店弹框
addShopDialog
:
false
,
// 添加门店弹框
showShopDialog
:
false
,
// 是否展示门店列表
showShopDialog
:
false
,
// 是否展示门店列表
popoverImage
:
""
,
// 放大显示图
popoverImage
:
""
,
// 放大显示图
rejectVisible
:
false
,
// 驳回原因弹框展示状态
rejectVisible
:
false
,
// 驳回原因弹框展示状态
isShowPopver
:
false
,
// 是否展示图片框
isShowPopver
:
false
,
// 是否展示图片框
activeStartTime
:
""
,
// 活动开始时间
activeStartTime
:
""
,
// 活动开始时间
activeEndTime
:
""
,
// 活动结束时间
activeEndTime
:
""
,
// 活动结束时间
uploadUrl
:
`
${
GOODS_URI
}
/ksy/ks3apiunencrypt/ks3api_upload`
,
// 金山云上传地址
uploadUrl
:
UploadPicUrl
,
// 金山云上传地址
addShopShow
:
false
,
// 添加门店弹框显示
addShopShow
:
false
,
// 添加门店弹框显示
expirationTime
:
""
,
// 过期时间
expirationTime
:
""
,
// 过期时间
shopIds
:
""
// 已选商店id
shopIds
:
""
,
// 已选商店id
};
},
methods
:
{
//结算价两位小数校验
// changeValue(value, level) {
// if (value && value.indexOf(".") !== value.length - 1 && (parseFloat(value)|| value==='0'))
// this.goodsObj[level] = parseFloat(value);
// else if (value && value.indexOf(".") === value.length - 1) return;
// else this.goodsObj[level] = "";
// },
// 获取级联选择商品列表
async
getOptions
()
{
try
{
const
res
=
await
getGoodsList
();
if
(
res
.
code
!==
0
)
return
this
.
$message
.
error
(
res
.
reason
);
this
.
optionList
=
res
.
result
;
}
catch
(
error
)
{
console
.
error
(
error
);
}
},
// 获取详情列表
async
getGoodsDetailList
(
params
)
{
try
{
const
res
=
await
getGoodsInfo
({
goods_spu_id
:
params
});
if
(
res
.
code
!==
0
)
{
return
this
.
$message
.
error
(
res
.
reason
);
}
console
.
log
(
"商品详情列表"
,
res
);
const
{
goods_info
,
record_list
}
=
res
.
result
;
this
.
goodsObj
=
goods_info
;
this
.
recordLits
=
record_list
;
// 初始商品名称
this
.
originalGoodsName
=
goods_info
.
goods_name
;
// 渲染过期时间
this
.
expirationTime
=
goods_info
.
expiration_time
;
// 初始化门店id
this
.
shopId
=
goods_info
.
sub_shop
.
map
((
item
)
=>
{
return
item
.
sub_shop_id
;
});
this
.
shopIds
=
this
.
shopId
.
join
(
","
);
// 初始化规则开始时间
this
.
activeStartTime
=
goods_info
.
rule_start_time
;
// 初始化规则结束时间
this
.
activeEndTime
=
goods_info
.
rule_end_time
;
// 回显图片
this
.
formatInitPicture
(
goods_info
.
desc_pic_url_list
,
this
.
descPicUrlList
);
this
.
formatInitPicture
(
goods_info
.
introduce_pic_url_list
,
this
.
introducePicUrlList
);
this
.
detailUploadList
=
this
.
formatUploadPictureList
(
goods_info
.
desc_pic_url
);
this
.
introduceUploadList
=
this
.
formatUploadPictureList
(
goods_info
.
introduce_pic_url
);
}
catch
(
error
)
{
console
.
error
(
error
);
}
},
// 初始化照片
formatInitPicture
(
pictureList
,
storeList
)
{
pictureList
.
forEach
((
element
)
=>
{
let
obj
=
new
Object
();
obj
.
url
=
element
;
storeList
.
push
(
obj
);
});
},
// 初始化上传照片列表
formatUploadPictureList
(
fileStr
)
{
if
(
!
fileStr
)
{
return
[];
}
else
{
return
fileStr
.
split
(
","
);
}
},
// 上传图片的公共方法
uploadPicture
(
response
,
storageList
)
{
const
responseURL
=
response
.
result
.
image_id
;
storageList
.
push
(
responseURL
);
},
// 删除图片的公共方法
deletePicture
(
file
,
fileList
,
storageList
)
{
for
(
let
i
=
0
;
i
<
fileList
.
length
;
i
++
)
{
if
(
fileList
[
i
].
uid
==
file
.
uid
)
{
storageList
.
splice
(
i
,
1
);
}
}
},
// 格式化日期
formatDate
(
time
)
{
const
nowTime
=
new
Date
();
const
nowYear
=
nowTime
.
getFullYear
();
const
nowMonth
=
nowTime
.
getMonth
()
+
1
;
const
nowDate
=
nowTime
.
getDate
();
const
timeArray
=
time
.
split
(
":"
);
const
Hour
=
parseInt
(
timeArray
[
0
]);
const
Minute
=
parseInt
(
timeArray
[
1
]);
const
Second
=
parseInt
(
timeArray
[
2
]);
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
()
{
const
query
=
{
life_account_id
:
this
.
goodsObj
.
life_account_id
,
page
:
this
.
shopCurrentPage
,
page_size
:
5
,
};
const
res
=
await
getShopsList
(
query
);
if
(
res
.
code
!==
0
)
return
this
.
$message
.
error
(
res
.
reason
);
console
.
log
(
res
);
this
.
shopsList
=
res
.
result
;
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
);
}
else
{
this
.
$refs
.
shopListRef
.
toggleRowSelection
(
row
,
false
);
}
});
});
},
// 删除已选择门店
deleteShops
(
subShopId
)
{
this
.
goodsObj
.
sub_shop
=
this
.
goodsObj
.
sub_shop
.
filter
((
item
)
=>
{
return
item
.
sub_shop_id
!==
subShopId
;
});
this
.
shopId
=
this
.
goodsObj
.
sub_shop
.
map
((
item
)
=>
{
return
item
.
sub_shop_id
;
});
this
.
shopIds
=
this
.
shopId
.
join
(
","
);
},
// 门店列表更改时操作
handleShopsChange
(
value
)
{
this
.
chooseShopsList
=
[];
this
.
chooseShopsList
=
value
;
console
.
log
(
"已选择列表的长度"
,
this
.
chooseShopsList
.
length
);
const
shopList
=
value
.
map
((
item
)
=>
{
return
item
.
sub_shop_id
;
});
this
.
shopIds
=
""
;
this
.
shopIds
=
shopList
.
join
(
","
);
},
// 商品列表换页
changeShopListPage
(
page
)
{
this
.
shopCurrentPage
=
page
;
this
.
getShops
();
},
// 确认选择的店铺
handleChooseShops
()
{
this
.
goodsObj
.
sub_shop
=
this
.
chooseShopsList
;
this
.
shopId
=
this
.
goodsObj
.
sub_shop
.
map
((
item
)
=>
{
return
item
.
sub_shop_id
;
});
this
.
shopListShow
=
false
;
},
// 添加新门店
async
addShop
()
{
const
deepPlace
=
this
.
shopForm
.
deep_place
.
split
(
","
);
const
longitude
=
deepPlace
[
0
];
const
latitude
=
deepPlace
[
1
];
const
query
=
{
life_account_id
:
this
.
goodsObj
.
life_account_id
,
phone
:
this
.
shopForm
.
connect_phone
,
shop_name
:
this
.
shopForm
.
shop_name
,
longitude
,
// 经度
latitude
,
// 纬度
address
:
this
.
shopForm
.
address
,
};
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
))
{
return
this
.
$message
.
error
(
"联系电话格式不正确"
);
}
const
res
=
await
postAddShop
(
query
);
if
(
res
.
code
!==
0
)
return
this
.
$message
.
error
(
res
.
reason
);
this
.
$message
.
success
(
"添加门店成功!"
);
this
.
addShopShow
=
false
;
},
// 是否可选门店
// canChooseShop (row) {
// if (
// this.chooseShopsList.length === 0 ||
// this.shopIds === row.sub_shop_id
// ) {
// return true;
// } else {
// return false;
// }
// },
// 取消新建门店
closeAddShops
()
{
this
.
shopForm
.
shop_name
=
""
;
this
.
shopForm
.
address
=
""
;
this
.
shopForm
.
connect_phone
=
""
;
this
.
shopForm
.
deep_place
=
""
;
this
.
addShopShow
=
false
;
},
// 商品分类列表变化
optionsChange
(
value
)
{
this
.
optionsValue
=
value
;
},
// 检查商品名称是否重复
async
checkSameName
()
{
const
res
=
await
checkGoodsName
({
life_account_id
:
this
.
goodsObj
.
life_account_id
,
goods_name
:
this
.
goodsObj
.
goods_name
,
goods_spu_id
:
this
.
goodsObj
.
goods_spu_id
,
});
if
(
res
.
code
!==
0
)
return
this
.
$message
.
error
(
res
.
reason
);
if
(
res
.
result
.
can_use
)
{
this
.
isGoodsNameRepeat
=
true
;
}
else
if
(
this
.
originalGoodsName
===
this
.
goodsObj
.
goods_name
)
{
this
.
isGoodsNameRepeat
=
true
;
}
else
{
this
.
isGoodsNameRepeat
=
false
;
}
},
// 商品详情图上传成功时
handleDetailSuccess
(
res
)
{
console
.
log
(
res
);
this
.
uploadPicture
(
res
,
this
.
detailUploadList
);
},
// 商品详情图删除完成后的钩子
removeDetailFiles
(
file
,
fileList
)
{
this
.
deletePicture
(
file
,
fileList
,
this
.
detailUploadList
);
},
// 商品介绍图上传成功钩子
introduceSuccess
(
res
)
{
this
.
uploadPicture
(
res
,
this
.
introduceUploadList
);
},
// 商品介绍图删除后的钩子
intrRemove
(
file
,
fileList
)
{
this
.
deletePicture
(
file
,
fileList
,
this
.
introduceUploadList
);
},
// 展示商品大图
previewImage
(
file
)
{
this
.
popoverImage
=
file
.
url
;
this
.
isShowPopver
=
true
;
},
// 库存增减更改
hasNumberChange
()
{
if
(
!
this
.
inventoryAdd
)
{
this
.
$nextTick
(()
=>
{
this
.
inventoryAdd
=
0
;
});
}
if
(
this
.
inventoryAdd
+
this
.
goodsObj
.
inventory_rest
<
1
)
{
this
.
$nextTick
(()
=>
{
this
.
isAllowStockChange
=
false
;
});
return
this
.
$message
.
error
(
"剩余库存量不得小于1"
);
}
else
{
this
.
isAllowStockChange
=
true
;
}
},
// 单人可购买上限的修改
handleLimitChange
()
{
if
(
!
this
.
goodsObj
.
rule_limit
)
{
this
.
$nextTick
(()
=>
{
this
.
goodsObj
.
rule_limit
=
0
;
});
}
},
// 时间校验器
timePicker
(
time
)
{
let
Hours
=
time
.
getHours
()
+
""
;
let
Minutes
=
time
.
getMinutes
()
+
""
;
let
Seconds
=
time
.
getSeconds
()
+
""
;
if
(
Hours
<
10
)
{
Hours
=
"0"
+
Hours
;
}
if
(
Minutes
<
10
)
{
Minutes
=
"0"
+
Minutes
;
}
if
(
Seconds
<
10
)
{
Seconds
=
"0"
+
Seconds
;
}
return
`
${
Hours
}
:
${
Minutes
}
:
${
Seconds
}
`
;
},
// 选择规则开始时间
pickerStartTime
(
time
)
{
this
.
activeStartTime
=
this
.
timePicker
(
time
);
},
// 选择规则结束时间
pickerEndTime
(
time
)
{
this
.
activeEndTime
=
this
.
timePicker
(
time
);
},
// 过期时间更改
expirDateChange
(
time
)
{
let
YYYY
=
time
.
getFullYear
();
let
MM
=
time
.
getMonth
()
+
1
;
let
DD
=
time
.
getDate
();
let
HH
=
time
.
getHours
();
let
mm
=
time
.
getMinutes
();
let
ss
=
time
.
getSeconds
();
if
(
MM
<
10
)
{
MM
=
"0"
+
MM
;
}
if
(
DD
<
10
)
{
DD
=
"0"
+
DD
;
}
if
(
HH
<
10
)
{
HH
=
"0"
+
HH
;
}
if
(
mm
<
10
)
{
mm
=
"0"
+
mm
;
}
if
(
ss
<
10
)
{
ss
=
"0"
+
ss
;
}
this
.
expirationTime
=
`
${
YYYY
}
-
${
MM
}
-
${
DD
}
${
HH
}
:
${
mm
}
:
${
ss
}
`
;
},
// 禁用时间
disableExpirDate
(
time
)
{
const
timeMs
=
time
.
getTime
();
if
(
timeMs
>
Date
.
now
()
-
86400000
)
{
return
false
;
}
else
{
return
true
;
}
},
// 更改售价
salePrice
()
{
if
(
!
this
.
goodsObj
.
price
)
{
this
.
$nextTick
(()
=>
{
this
.
goodsObj
.
price
=
""
;
});
}
const
parseFloatValue
=
Number
(
this
.
goodsObj
.
price
).
toFixed
(
2
);
this
.
goodsObj
.
price
=
Number
(
parseFloatValue
);
if
(
typeof
this
.
goodsObj
.
price
===
"number"
&&
isNaN
(
this
.
goodsObj
.
price
))
{
this
.
goodsObj
.
price
=
""
;
return
this
.
$message
.
error
(
"售价价格必须为数字"
);
}
},
// 更改原价
perPrice
(
val
)
{
let
reg
=
/^
\d
+
(\.\d{1,2})?
$/
;
if
(
!
reg
.
test
(
val
))
{
return
this
.
$message
.
error
(
"请输入两位小数"
);
}
if
(
val
.
length
===
0
)
val
=
0
;
// const parseOriginalPrice = Number(val).toFixed(2);
// val = Number(parseOriginalPrice);
if
(
typeof
val
===
"number"
&&
isNaN
(
val
))
{
val
=
0
;
return
this
.
$message
.
error
(
"原价价格必为数字"
);
}
const
parseOriginalPrice
=
Number
(
this
.
goodsObj
.
original_price
).
toFixed
(
2
);
this
.
goodsObj
.
original_price
=
Number
(
parseOriginalPrice
);
// if (
// typeof this.goodsObj.original_price === "number" &&
// isNaN(this.goodsObj.original_price)
// ) {
// this.goodsObj.original_price = "";
// return this.$message.error("原价价格必为数字");
// }
},
// 审核通过
async
onSuccess
()
{
const
res
=
await
postSuccess
(
this
.
$route
.
params
.
spuId
);
if
(
res
.
code
!==
0
)
return
this
.
$message
.
error
(
res
.
reason
);
this
.
$message
.
success
(
"审核通过"
);
this
.
$router
.
replace
({
name
:
"GoodsList"
});
},
// 审核拒绝
async
onDefault
()
{
const
query
=
{
goods_spu_id
:
this
.
goodsObj
.
goods_spu_id
,
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
);
if
(
res
.
code
!==
0
)
{
return
this
.
$message
.
error
(
res
.
reason
);
}
this
.
$message
.
warning
(
"审核驳回成功!"
);
this
.
$router
.
replace
({
name
:
"GoodsList"
});
},
// 返回主页面
backToDetail
()
{
this
.
$router
.
replace
({
name
:
"GoodsList"
});
},
// 保存修改信息
async
saveDetailMessage
()
{
await
this
.
checkSameName
();
// 检验商品名称是否可用
if
(
!
this
.
optionsValue
)
{
return
this
.
$message
.
error
(
"请选择商品分类"
);
}
const
query
=
{
goods_spu_id
:
this
.
goodsObj
.
goods_spu_id
,
// 商品id
category_1_id
:
this
.
optionsValue
[
0
],
// 商品一级分类id
category_2_id
:
this
.
optionsValue
[
1
],
// 商品二级分类id
goods_name
:
this
.
goodsObj
.
goods_name
,
// 商品名称
desc_pic_url
:
this
.
detailUploadList
.
join
(
","
),
// 商品详情图片
desc
:
this
.
goodsObj
.
desc
,
// 商品详情描述
introduce
:
this
.
goodsObj
.
introduce
,
// 商品介绍
introduce_pic_url
:
this
.
introduceUploadList
.
join
(
","
),
// 商品介绍图片
expiration_time
:
this
.
expirationTime
,
// 过期时间
rule_limit
:
this
.
goodsObj
.
rule_limit
,
// 单人可购买上限
rule_desc
:
this
.
goodsObj
.
rule_desc
,
// 规则描述
rule_refund
:
this
.
goodsObj
.
rule_refund
,
// 退款规则
rule_start_time
:
this
.
activeStartTime
,
// 规则开始时间
rule_end_time
:
this
.
activeEndTime
,
// 规则结束时间
inventory_add
:
this
.
inventoryAdd
,
// 库存增减
original_price
:
this
.
goodsObj
.
original_price
,
// 原价
clear_price
:
+
this
.
goodsObj
.
clear_price
,
// 结算价
price
:
this
.
goodsObj
.
price
,
// 现价
sub_shop_ids
:
this
.
shopIds
,
// 门店id
rule_date_type
:
this
.
goodsObj
.
rule_date_type
,
// 使用日期类型(周末/工作日)
};
console
.
log
(
111222333
,
query
.
original_price
);
// 必填校验
if
(
!
this
.
goodsObj
.
goods_spu_id
)
{
return
this
.
$message
.
error
(
"未传入商品id"
);
}
if
(
!
query
.
goods_name
)
{
return
this
.
$message
.
error
(
"请填写商品名称"
);
}
if
(
!
this
.
isGoodsNameRepeat
)
{
return
this
.
$message
.
error
(
"商品名称被占用,请重新更换商品名称"
);
}
console
.
log
(
this
.
isAllowStockChange
);
if
(
!
this
.
isAllowStockChange
)
{
return
this
.
$message
.
error
(
"剩余库存量不得小于1"
);
}
if
(
!
query
.
expiration_time
)
{
return
this
.
$message
.
error
(
"过期时间未填写,请填写后再提交"
);
}
if
(
query
.
rule_limit
===
""
)
{
return
this
.
$message
.
error
(
"请填写单人可购买上限"
);
}
if
(
typeof
this
.
goodsObj
.
rule_limit
!==
"number"
)
{
return
this
.
$message
.
error
(
"单人可购买上限只能为数字格式"
);
}
if
(
typeof
query
.
rule_limit
!==
"number"
)
{
return
this
.
$message
.
error
(
"单人可购上线只可为数值"
);
}
if
(
!
query
.
rule_refund
)
{
return
this
.
$message
.
error
(
"请填写退款规则"
);
}
if
(
query
.
original_price
===
"0"
)
{
return
this
.
$message
.
error
(
"原价价格不得为0"
);
}
if
(
query
.
price
.
length
===
0
)
{
return
this
.
$message
.
error
(
"请填写售价(保留两位小数)"
);
}
if
(
query
.
price
==
0
)
{
return
this
.
$message
.
error
(
"售价价格不得为0"
);
}
// if (query.original_price && typeof query.original_price !== "number") {
// return this.$message.error("原价价格必须为数字");
// }
if
(
typeof
query
.
price
!==
"number"
)
{
return
this
.
$message
.
error
(
"售价价格必须为数字格式"
);
}
if
(
!
query
.
sub_shop_ids
)
{
return
this
.
$message
.
error
(
"请至少选择一个门店"
);
}
console
.
log
(
query
);
const
res
=
await
editGoods
(
query
);
if
(
res
.
code
!==
0
)
{
return
this
.
$message
.
error
(
res
.
reason
);
}
this
.
$message
.
success
(
"商品编辑成功!"
);
this
.
$router
.
replace
({
name
:
"GoodsList"
});
},
},
};
};
},
methods
:
{
//结算价两位小数校验
// changeValue(value, level) {
// if (value && value.indexOf(".") !== value.length - 1 && (parseFloat(value)|| value==='0'))
// this.goodsObj[level] = parseFloat(value);
// else if (value && value.indexOf(".") === value.length - 1) return;
// else this.goodsObj[level] = "";
// },
// 获取级联选择商品列表
async
getOptions
()
{
try
{
const
res
=
await
getGoodsList
();
if
(
res
.
code
!==
0
)
return
this
.
$message
.
error
(
res
.
reason
);
this
.
optionList
=
res
.
result
;
}
catch
(
error
)
{
console
.
error
(
error
);
}
},
// 获取详情列表
async
getGoodsDetailList
(
params
)
{
try
{
const
res
=
await
getGoodsInfo
({
goods_spu_id
:
params
});
if
(
res
.
code
!==
0
)
{
return
this
.
$message
.
error
(
res
.
reason
);
}
console
.
log
(
"商品详情列表"
,
res
);
const
{
goods_info
,
record_list
}
=
res
.
result
;
this
.
goodsObj
=
goods_info
;
this
.
recordLits
=
record_list
;
// 初始商品名称
this
.
originalGoodsName
=
goods_info
.
goods_name
;
// 渲染过期时间
this
.
expirationTime
=
goods_info
.
expiration_time
;
// 初始化门店id
this
.
shopId
=
goods_info
.
sub_shop
.
map
(
item
=>
{
return
item
.
sub_shop_id
;
});
this
.
shopIds
=
this
.
shopId
.
join
(
","
);
// 初始化规则开始时间
this
.
activeStartTime
=
goods_info
.
rule_start_time
;
// 初始化规则结束时间
this
.
activeEndTime
=
goods_info
.
rule_end_time
;
// 回显图片
this
.
formatInitPicture
(
goods_info
.
desc_pic_url_list
,
this
.
descPicUrlList
);
this
.
formatInitPicture
(
goods_info
.
introduce_pic_url_list
,
this
.
introducePicUrlList
);
this
.
detailUploadList
=
this
.
formatUploadPictureList
(
goods_info
.
desc_pic_url
);
this
.
introduceUploadList
=
this
.
formatUploadPictureList
(
goods_info
.
introduce_pic_url
);
}
catch
(
error
)
{
console
.
error
(
error
);
}
},
// 初始化照片
formatInitPicture
(
pictureList
,
storeList
)
{
pictureList
.
forEach
(
element
=>
{
let
obj
=
new
Object
();
obj
.
url
=
element
;
storeList
.
push
(
obj
);
});
},
// 初始化上传照片列表
formatUploadPictureList
(
fileStr
)
{
if
(
!
fileStr
)
{
return
[];
}
else
{
return
fileStr
.
split
(
","
);
}
},
// 上传图片的公共方法
uploadPicture
(
response
,
storageList
)
{
const
responseURL
=
response
.
result
.
image_id
;
storageList
.
push
(
responseURL
);
},
// 删除图片的公共方法
deletePicture
(
file
,
fileList
,
storageList
)
{
for
(
let
i
=
0
;
i
<
fileList
.
length
;
i
++
)
{
if
(
fileList
[
i
].
uid
==
file
.
uid
)
{
storageList
.
splice
(
i
,
1
);
}
}
},
// 格式化日期
formatDate
(
time
)
{
const
nowTime
=
new
Date
();
const
nowYear
=
nowTime
.
getFullYear
();
const
nowMonth
=
nowTime
.
getMonth
()
+
1
;
const
nowDate
=
nowTime
.
getDate
();
const
timeArray
=
time
.
split
(
":"
);
const
Hour
=
parseInt
(
timeArray
[
0
]);
const
Minute
=
parseInt
(
timeArray
[
1
]);
const
Second
=
parseInt
(
timeArray
[
2
]);
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
()
{
const
query
=
{
life_account_id
:
this
.
goodsObj
.
life_account_id
,
page
:
this
.
shopCurrentPage
,
page_size
:
5
};
const
res
=
await
getShopsList
(
query
);
if
(
res
.
code
!==
0
)
return
this
.
$message
.
error
(
res
.
reason
);
console
.
log
(
res
);
this
.
shopsList
=
res
.
result
;
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
);
}
else
{
this
.
$refs
.
shopListRef
.
toggleRowSelection
(
row
,
false
);
}
});
});
},
// 删除已选择门店
deleteShops
(
subShopId
)
{
this
.
goodsObj
.
sub_shop
=
this
.
goodsObj
.
sub_shop
.
filter
(
item
=>
{
return
item
.
sub_shop_id
!==
subShopId
;
});
this
.
shopId
=
this
.
goodsObj
.
sub_shop
.
map
(
item
=>
{
return
item
.
sub_shop_id
;
});
this
.
shopIds
=
this
.
shopId
.
join
(
","
);
},
// 门店列表更改时操作
handleShopsChange
(
value
)
{
this
.
chooseShopsList
=
[];
this
.
chooseShopsList
=
value
;
console
.
log
(
"已选择列表的长度"
,
this
.
chooseShopsList
.
length
);
const
shopList
=
value
.
map
(
item
=>
{
return
item
.
sub_shop_id
;
});
this
.
shopIds
=
""
;
this
.
shopIds
=
shopList
.
join
(
","
);
},
// 商品列表换页
changeShopListPage
(
page
)
{
this
.
shopCurrentPage
=
page
;
this
.
getShops
();
},
// 确认选择的店铺
handleChooseShops
()
{
this
.
goodsObj
.
sub_shop
=
this
.
chooseShopsList
;
this
.
shopId
=
this
.
goodsObj
.
sub_shop
.
map
(
item
=>
{
return
item
.
sub_shop_id
;
});
this
.
shopListShow
=
false
;
},
// 添加新门店
async
addShop
()
{
const
deepPlace
=
this
.
shopForm
.
deep_place
.
split
(
","
);
const
longitude
=
deepPlace
[
0
];
const
latitude
=
deepPlace
[
1
];
const
query
=
{
life_account_id
:
this
.
goodsObj
.
life_account_id
,
phone
:
this
.
shopForm
.
connect_phone
,
shop_name
:
this
.
shopForm
.
shop_name
,
longitude
,
// 经度
latitude
,
// 纬度
address
:
this
.
shopForm
.
address
};
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
)
)
{
return
this
.
$message
.
error
(
"联系电话格式不正确"
);
}
const
res
=
await
postAddShop
(
query
);
if
(
res
.
code
!==
0
)
return
this
.
$message
.
error
(
res
.
reason
);
this
.
$message
.
success
(
"添加门店成功!"
);
this
.
addShopShow
=
false
;
},
// 是否可选门店
// canChooseShop (row) {
// if (
// this.chooseShopsList.length === 0 ||
// this.shopIds === row.sub_shop_id
// ) {
// return true;
// } else {
// return false;
// }
// },
// 取消新建门店
closeAddShops
()
{
this
.
shopForm
.
shop_name
=
""
;
this
.
shopForm
.
address
=
""
;
this
.
shopForm
.
connect_phone
=
""
;
this
.
shopForm
.
deep_place
=
""
;
this
.
addShopShow
=
false
;
},
// 商品分类列表变化
optionsChange
(
value
)
{
this
.
optionsValue
=
value
;
},
// 检查商品名称是否重复
async
checkSameName
()
{
const
res
=
await
checkGoodsName
({
life_account_id
:
this
.
goodsObj
.
life_account_id
,
goods_name
:
this
.
goodsObj
.
goods_name
,
goods_spu_id
:
this
.
goodsObj
.
goods_spu_id
});
if
(
res
.
code
!==
0
)
return
this
.
$message
.
error
(
res
.
reason
);
if
(
res
.
result
.
can_use
)
{
this
.
isGoodsNameRepeat
=
true
;
}
else
if
(
this
.
originalGoodsName
===
this
.
goodsObj
.
goods_name
)
{
this
.
isGoodsNameRepeat
=
true
;
}
else
{
this
.
isGoodsNameRepeat
=
false
;
}
},
// 商品详情图上传成功时
handleDetailSuccess
(
res
)
{
console
.
log
(
res
);
this
.
uploadPicture
(
res
,
this
.
detailUploadList
);
},
// 商品详情图删除完成后的钩子
removeDetailFiles
(
file
,
fileList
)
{
this
.
deletePicture
(
file
,
fileList
,
this
.
detailUploadList
);
},
// 商品介绍图上传成功钩子
introduceSuccess
(
res
)
{
this
.
uploadPicture
(
res
,
this
.
introduceUploadList
);
},
// 商品介绍图删除后的钩子
intrRemove
(
file
,
fileList
)
{
this
.
deletePicture
(
file
,
fileList
,
this
.
introduceUploadList
);
},
// 展示商品大图
previewImage
(
file
)
{
this
.
popoverImage
=
file
.
url
;
this
.
isShowPopver
=
true
;
},
// 库存增减更改
hasNumberChange
()
{
if
(
!
this
.
inventoryAdd
)
{
this
.
$nextTick
(()
=>
{
this
.
inventoryAdd
=
0
;
});
}
if
(
this
.
inventoryAdd
+
this
.
goodsObj
.
inventory_rest
<
1
)
{
this
.
$nextTick
(()
=>
{
this
.
isAllowStockChange
=
false
;
});
return
this
.
$message
.
error
(
"剩余库存量不得小于1"
);
}
else
{
this
.
isAllowStockChange
=
true
;
}
},
// 单人可购买上限的修改
handleLimitChange
()
{
if
(
!
this
.
goodsObj
.
rule_limit
)
{
this
.
$nextTick
(()
=>
{
this
.
goodsObj
.
rule_limit
=
0
;
});
}
},
// 时间校验器
timePicker
(
time
)
{
let
Hours
=
time
.
getHours
()
+
""
;
let
Minutes
=
time
.
getMinutes
()
+
""
;
let
Seconds
=
time
.
getSeconds
()
+
""
;
if
(
Hours
<
10
)
{
Hours
=
"0"
+
Hours
;
}
if
(
Minutes
<
10
)
{
Minutes
=
"0"
+
Minutes
;
}
if
(
Seconds
<
10
)
{
Seconds
=
"0"
+
Seconds
;
}
return
`
${
Hours
}
:
${
Minutes
}
:
${
Seconds
}
`
;
},
// 选择规则开始时间
pickerStartTime
(
time
)
{
this
.
activeStartTime
=
this
.
timePicker
(
time
);
},
// 选择规则结束时间
pickerEndTime
(
time
)
{
this
.
activeEndTime
=
this
.
timePicker
(
time
);
},
// 过期时间更改
expirDateChange
(
time
)
{
let
YYYY
=
time
.
getFullYear
();
let
MM
=
time
.
getMonth
()
+
1
;
let
DD
=
time
.
getDate
();
let
HH
=
time
.
getHours
();
let
mm
=
time
.
getMinutes
();
let
ss
=
time
.
getSeconds
();
if
(
MM
<
10
)
{
MM
=
"0"
+
MM
;
}
if
(
DD
<
10
)
{
DD
=
"0"
+
DD
;
}
if
(
HH
<
10
)
{
HH
=
"0"
+
HH
;
}
if
(
mm
<
10
)
{
mm
=
"0"
+
mm
;
}
if
(
ss
<
10
)
{
ss
=
"0"
+
ss
;
}
this
.
expirationTime
=
`
${
YYYY
}
-
${
MM
}
-
${
DD
}
${
HH
}
:
${
mm
}
:
${
ss
}
`
;
},
// 禁用时间
disableExpirDate
(
time
)
{
const
timeMs
=
time
.
getTime
();
if
(
timeMs
>
Date
.
now
()
-
86400000
)
{
return
false
;
}
else
{
return
true
;
}
},
// 更改售价
salePrice
()
{
if
(
!
this
.
goodsObj
.
price
)
{
this
.
$nextTick
(()
=>
{
this
.
goodsObj
.
price
=
""
;
})
}
const
parseFloatValue
=
Number
(
this
.
goodsObj
.
price
).
toFixed
(
2
);
this
.
goodsObj
.
price
=
Number
(
parseFloatValue
);
if
(
typeof
this
.
goodsObj
.
price
===
"number"
&&
isNaN
(
this
.
goodsObj
.
price
)
)
{
this
.
goodsObj
.
price
=
""
;
return
this
.
$message
.
error
(
"售价价格必须为数字"
);
}
},
// 更改原价
perPrice
(
val
)
{
let
reg
=
/^
\d
+
(\.\d{1,2})?
$/
;
if
(
!
reg
.
test
(
val
))
{
return
this
.
$message
.
error
(
"请输入两位小数"
);
}
if
(
val
.
length
===
0
)
val
=
0
;
// const parseOriginalPrice = Number(val).toFixed(2);
// val = Number(parseOriginalPrice);
if
(
typeof
val
===
"number"
&&
isNaN
(
val
))
{
val
=
0
;
return
this
.
$message
.
error
(
"原价价格必为数字"
);
}
const
parseOriginalPrice
=
Number
(
this
.
goodsObj
.
original_price
).
toFixed
(
2
);
this
.
goodsObj
.
original_price
=
Number
(
parseOriginalPrice
);
// if (
// typeof this.goodsObj.original_price === "number" &&
// isNaN(this.goodsObj.original_price)
// ) {
// this.goodsObj.original_price = "";
// return this.$message.error("原价价格必为数字");
// }
},
// 审核通过
async
onSuccess
()
{
const
res
=
await
postSuccess
(
this
.
$route
.
params
.
spuId
);
if
(
res
.
code
!==
0
)
return
this
.
$message
.
error
(
res
.
reason
);
this
.
$message
.
success
(
"审核通过"
);
this
.
$router
.
replace
({
name
:
"GoodsList"
});
},
// 审核拒绝
async
onDefault
()
{
const
query
=
{
goods_spu_id
:
this
.
goodsObj
.
goods_spu_id
,
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
);
if
(
res
.
code
!==
0
)
{
return
this
.
$message
.
error
(
res
.
reason
);
}
this
.
$message
.
warning
(
"审核驳回成功!"
);
this
.
$router
.
replace
({
name
:
"GoodsList"
});
},
// 返回主页面
backToDetail
()
{
this
.
$router
.
replace
({
name
:
"GoodsList"
});
},
// 保存修改信息
async
saveDetailMessage
()
{
await
this
.
checkSameName
();
// 检验商品名称是否可用
if
(
!
this
.
optionsValue
)
{
return
this
.
$message
.
error
(
"请选择商品分类"
);
}
const
query
=
{
goods_spu_id
:
this
.
goodsObj
.
goods_spu_id
,
// 商品id
category_1_id
:
this
.
optionsValue
[
0
],
// 商品一级分类id
category_2_id
:
this
.
optionsValue
[
1
],
// 商品二级分类id
goods_name
:
this
.
goodsObj
.
goods_name
,
// 商品名称
desc_pic_url
:
this
.
detailUploadList
.
join
(
","
),
// 商品详情图片
desc
:
this
.
goodsObj
.
desc
,
// 商品详情描述
introduce
:
this
.
goodsObj
.
introduce
,
// 商品介绍
introduce_pic_url
:
this
.
introduceUploadList
.
join
(
","
),
// 商品介绍图片
expiration_time
:
this
.
expirationTime
,
// 过期时间
rule_limit
:
this
.
goodsObj
.
rule_limit
,
// 单人可购买上限
rule_desc
:
this
.
goodsObj
.
rule_desc
,
// 规则描述
rule_refund
:
this
.
goodsObj
.
rule_refund
,
// 退款规则
rule_start_time
:
this
.
activeStartTime
,
// 规则开始时间
rule_end_time
:
this
.
activeEndTime
,
// 规则结束时间
inventory_add
:
this
.
inventoryAdd
,
// 库存增减
original_price
:
this
.
goodsObj
.
original_price
,
// 原价
clear_price
:
+
this
.
goodsObj
.
clear_price
,
// 结算价
price
:
this
.
goodsObj
.
price
,
// 现价
sub_shop_ids
:
this
.
shopIds
,
// 门店id
rule_date_type
:
this
.
goodsObj
.
rule_date_type
// 使用日期类型(周末/工作日)
};
console
.
log
(
111222333
,
query
.
original_price
);
// 必填校验
if
(
!
this
.
goodsObj
.
goods_spu_id
)
{
return
this
.
$message
.
error
(
"未传入商品id"
);
}
if
(
!
query
.
goods_name
)
{
return
this
.
$message
.
error
(
"请填写商品名称"
);
}
if
(
!
this
.
isGoodsNameRepeat
)
{
return
this
.
$message
.
error
(
"商品名称被占用,请重新更换商品名称"
);
}
console
.
log
(
this
.
isAllowStockChange
);
if
(
!
this
.
isAllowStockChange
)
{
return
this
.
$message
.
error
(
"剩余库存量不得小于1"
);
}
if
(
!
query
.
expiration_time
)
{
return
this
.
$message
.
error
(
"过期时间未填写,请填写后再提交"
);
}
if
(
query
.
rule_limit
===
""
)
{
return
this
.
$message
.
error
(
"请填写单人可购买上限"
);
}
if
(
typeof
this
.
goodsObj
.
rule_limit
!==
"number"
)
{
return
this
.
$message
.
error
(
"单人可购买上限只能为数字格式"
);
}
if
(
typeof
query
.
rule_limit
!==
"number"
)
{
return
this
.
$message
.
error
(
"单人可购上线只可为数值"
);
}
if
(
!
query
.
rule_refund
)
{
return
this
.
$message
.
error
(
"请填写退款规则"
);
}
if
(
query
.
original_price
===
"0"
)
{
return
this
.
$message
.
error
(
"原价价格不得为0"
);
}
if
(
query
.
price
.
length
===
0
)
{
return
this
.
$message
.
error
(
"请填写售价(保留两位小数)"
);
}
if
(
query
.
price
==
0
)
{
return
this
.
$message
.
error
(
"售价价格不得为0"
);
}
// if (query.original_price && typeof query.original_price !== "number") {
// return this.$message.error("原价价格必须为数字");
// }
if
(
typeof
query
.
price
!==
"number"
)
{
return
this
.
$message
.
error
(
"售价价格必须为数字格式"
);
}
if
(
!
query
.
sub_shop_ids
)
{
return
this
.
$message
.
error
(
"请至少选择一个门店"
);
}
console
.
log
(
query
);
const
res
=
await
editGoods
(
query
);
if
(
res
.
code
!==
0
)
{
return
this
.
$message
.
error
(
res
.
reason
);
}
this
.
$message
.
success
(
"商品编辑成功!"
);
this
.
$router
.
replace
({
name
:
"GoodsList"
});
}
}
};
</
script
>
</
script
>
src/service/Groupmeal/groupmeal.js
View file @
4f5f1b64
...
@@ -112,15 +112,21 @@ export async function orderRefundReject(params) {
...
@@ -112,15 +112,21 @@ export async function orderRefundReject(params) {
// 导出订单
// 导出订单
export
function
getOrderExportURL
(
eventId
,
type
)
{
export
function
getOrderExportURL
(
eventId
,
type
)
{
var
ENV
;
// var ENV;
if
(
process
.
env
.
NODE_ENV
==
"development"
)
{
// if(process.env.NODE_ENV == "development"){
ENV
=
"http://bp-dev.ini.yidian-inc.com/"
;
// ENV = "http://bp-dev.ini.yidian-inc.com/"
}
else
if
(
process
.
env
.
NODE_ENV
==
"test"
)
{
// }else if(process.env.NODE_ENV == "test"){
ENV
=
"http://bp-test.ini.yidian-inc.com/"
;
// ENV = "http://bp-test.ini.yidian-inc.com/"
// }else{
// ENV = "http://bp.int.yidian-inc.com/"
// }
// return `${ENV}order/oldbackground/order_export?marketing_id=${eventId}&type=${type}`;
if
(
process
.
env
.
NODE_ENV
===
"development"
)
{
return
`http://127.0.0.1:8055/api/v1/relay/old_order_export?marketing_id=
${
eventId
}
&type=
${
type
}
`
;
}
else
{
}
else
{
ENV
=
"http://bp.int.yidian-inc.com/"
;
return
`/api/v1/relay/old_order_export?marketing_id=
${
eventId
}
&type=
${
type
}
`
;
}
}
return
`
${
ENV
}
order/oldbackground/order_export?marketing_id=
${
eventId
}
&type=
${
type
}
`
;
}
}
// 新订单管理
// 新订单管理
...
@@ -191,13 +197,10 @@ export async function newOrderRefundReject(params) {
...
@@ -191,13 +197,10 @@ export async function newOrderRefundReject(params) {
// 导出订单
// 导出订单
export
function
newGetOrderExportURL
(
eventId
,
type
)
{
export
function
newGetOrderExportURL
(
eventId
,
type
)
{
var
ENV
;
if
(
process
.
env
.
NODE_ENV
===
"development"
)
{
if
(
process
.
env
.
NODE_ENV
==
"development"
)
{
return
`http://127.0.0.1:8055/api/v1/relay/order_export?marketing_id=
${
eventId
}
&type=
${
type
}
`
;
ENV
=
"http://bp-dev.ini.yidian-inc.com/"
;
}
else
if
(
process
.
env
.
NODE_ENV
==
"test"
)
{
ENV
=
"http://bp-test.ini.yidian-inc.com/"
;
}
else
{
}
else
{
ENV
=
"http://bp.int.yidian-inc.com/"
;
return
`/api/v1/relay/order_export?marketing_id=
${
eventId
}
&type=
${
type
}
`
;
}
}
return
`
${
ENV
}
order/background
/order_export?marketing_id=
${
eventId
}
&type=
${
type
}
`
;
// return `/api/v1/relay
/order_export?marketing_id=${eventId}&type=${type}`;
}
}
src/utils/util.js
View file @
4f5f1b64
...
@@ -21,49 +21,52 @@ import router from "@/router";
...
@@ -21,49 +21,52 @@ import router from "@/router";
// }
// }
export
function
redirectToLogin
()
{
export
function
redirectToLogin
()
{
let
hasCallback
=
window
.
location
.
href
.
match
(
/
\?
callback/
);
let
hasCallback
=
window
.
location
.
href
.
match
(
/
\?
callback/
);
if
(
hasCallback
)
return
;
if
(
hasCallback
)
return
;
let
isLogin
=
window
.
location
.
pathname
.
match
(
/op
\/
login/
);
let
isLogin
=
window
.
location
.
pathname
.
match
(
/op
\/
login/
);
router
.
push
(
`/op/login
${
!
isLogin
?
'?callback='
+
window
.
encodeURIComponent
(
window
.
location
.
pathname
)
:
''
}
`
)
router
.
push
(
`/op/login
${
!
isLogin
?
"?callback="
+
window
.
encodeURIComponent
(
window
.
location
.
pathname
)
:
""
}
`
);
}
}
export
function
redirectPage
()
{
export
function
redirectPage
()
{
let
url
=
window
.
location
.
search
.
split
(
'?callback='
)[
1
]
||
window
.
location
.
pathname
;
let
url
=
window
.
location
.
search
.
split
(
"?callback="
)[
1
]
||
window
.
location
.
pathname
;
router
.
push
(
window
.
decodeURIComponent
(
url
))
router
.
push
(
window
.
decodeURIComponent
(
url
));
}
}
export
function
isYdUser
(
email
)
{
export
function
isYdUser
(
email
)
{
return
email
.
match
(
/yidian-inc/
)
||
false
return
email
.
match
(
/yidian-inc/
)
||
false
;
}
}
export
function
setCookie
(
name
,
value
)
{
export
function
setCookie
(
name
,
value
)
{
var
hour
=
8
;
var
hour
=
8
;
var
exp
=
new
Date
();
var
exp
=
new
Date
();
exp
.
setTime
(
exp
.
getTime
()
+
hour
*
60
*
60
*
1000
);
exp
.
setTime
(
exp
.
getTime
()
+
hour
*
60
*
60
*
1000
);
document
.
cookie
=
name
+
"="
+
value
+
";expires="
+
exp
.
toGMTString
()
+
";path=/"
;
document
.
cookie
=
name
+
"="
+
value
+
";expires="
+
exp
.
toGMTString
()
+
";path=/"
;
}
}
//获取cookie
//获取cookie
export
function
getCookie
(
NameOfCookie
)
{
export
function
getCookie
(
NameOfCookie
)
{
if
(
document
.
cookie
.
length
>
0
)
{
if
(
document
.
cookie
.
length
>
0
)
{
let
begin
=
document
.
cookie
.
indexOf
(
NameOfCookie
+
"="
);
let
begin
=
document
.
cookie
.
indexOf
(
NameOfCookie
+
"="
);
if
(
begin
!==
-
1
)
{
if
(
begin
!==
-
1
)
{
begin
+=
NameOfCookie
.
length
+
1
;
begin
+=
NameOfCookie
.
length
+
1
;
let
end
=
document
.
cookie
.
indexOf
(
";"
,
begin
);
let
end
=
document
.
cookie
.
indexOf
(
";"
,
begin
);
if
(
end
===
-
1
)
end
=
document
.
cookie
.
length
;
if
(
end
===
-
1
)
end
=
document
.
cookie
.
length
;
return
document
.
cookie
.
substring
(
begin
,
end
);
return
document
.
cookie
.
substring
(
begin
,
end
);
}
}
}
}
return
null
;
return
null
;
}
}
export
function
delCookie
()
{
export
function
delCookie
()
{
var
keys
=
document
.
cookie
.
match
(
/
[^
=;
]
+
(?=
=
)
/g
)
var
keys
=
document
.
cookie
.
match
(
/
[^
=;
]
+
(?=
=
)
/g
);
if
(
keys
)
{
if
(
keys
)
{
for
(
var
i
=
keys
.
length
;
i
--
;)
{
for
(
var
i
=
keys
.
length
;
i
--
;
)
{
document
.
cookie
=
keys
[
i
]
+
'=0;path=/;expires='
+
new
Date
(
0
).
toUTCString
()
document
.
cookie
=
keys
[
i
]
+
"=0;path=/;expires="
+
new
Date
(
0
).
toUTCString
();
document
.
cookie
=
keys
[
i
]
+
'=0;path=/;domain='
+
document
.
domain
+
';expires='
+
new
Date
(
0
).
toUTCString
()
document
.
cookie
=
keys
[
i
]
+
"=0;path=/;domain="
+
document
.
domain
+
";expires="
+
new
Date
(
0
).
toUTCString
();
document
.
cookie
=
keys
[
i
]
+
'=0;path=/;domain=yidian-inc.com;expires='
+
new
Date
(
0
).
toUTCString
()
document
.
cookie
=
keys
[
i
]
+
"=0;path=/;domain=yidian-inc.com;expires="
+
new
Date
(
0
).
toUTCString
();
}
}
}
}
}
}
\ No newline at end of file
export
const
UploadPicUrl
=
process
.
env
.
NODE_ENV
===
"development"
?
`http://127.0.0.1:8055/api/v1/relay/ks3api_upload`
:
"/api/v1/relay/ks3api_upload"
;
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