Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
freemud.be.toolbox
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陈宁
freemud.be.toolbox
Commits
46ec5aa1
Commit
46ec5aa1
authored
Jul 10, 2020
by
陈宁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
# dev [资源] - 商品
parent
153869cf
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
482 additions
and
20 deletions
+482
-20
Freemud.BE.Toolbox.WebApi/Proxy/FmProductProxy.cs
+2
-2
Freemud.BE.Toolbox.WebApi/Services/IRequestResourceService.cs
+1
-1
Freemud.BE.Toolbox.WebApi/Services/Impl/RequestResourceService.cs
+4
-14
freemud.be.toolboxview/src/views/requestresource/CouponProductSearch.vue
+4
-2
freemud.be.toolboxview/src/views/requestresource/ProductSearch.vue
+471
-1
No files found.
Freemud.BE.Toolbox.WebApi/Proxy/FmProductProxy.cs
View file @
46ec5aa1
...
@@ -40,10 +40,10 @@ namespace Freemud.BE.Toolbox.WebApi.Proxy
...
@@ -40,10 +40,10 @@ namespace Freemud.BE.Toolbox.WebApi.Proxy
/// <param name="env"></param>
/// <param name="env"></param>
/// <param name="productId"></param>
/// <param name="productId"></param>
/// <returns></returns>
/// <returns></returns>
public
async
Task
<
RequestResourceResponse
>
GetProductExtensionInfo
(
string
env
,
int
productId
)
public
async
Task
<
RequestResourceResponse
>
GetProductExtensionInfo
(
string
env
,
List
<
string
>
productId
)
{
{
var
url
=
GetUrl
(
env
,
"FreemudProduct"
,
"getProductExtensionInfo"
);
var
url
=
GetUrl
(
env
,
"FreemudProduct"
,
"getProductExtensionInfo"
);
url
=
string
.
Format
(
url
,
productId
);
url
=
string
.
Format
(
url
,
string
.
Join
(
','
,
productId
)
);
var
response
=
await
HttpHeper
.
Get
(
url
);
var
response
=
await
HttpHeper
.
Get
(
url
);
...
...
Freemud.BE.Toolbox.WebApi/Services/IRequestResourceService.cs
View file @
46ec5aa1
...
@@ -11,7 +11,7 @@ namespace Freemud.BE.Toolbox.WebApi.Services
...
@@ -11,7 +11,7 @@ namespace Freemud.BE.Toolbox.WebApi.Services
{
{
Task
<
List
<
RequestResourceResponse
>>
GetCouponInfo
(
GetCouponInfoRequest
request
);
Task
<
List
<
RequestResourceResponse
>>
GetCouponInfo
(
GetCouponInfoRequest
request
);
Task
<
RequestResourceResponse
>
GetProductInfo
(
GetProductInfoRequest
request
);
Task
<
List
<
RequestResourceResponse
>
>
GetProductInfo
(
GetProductInfoRequest
request
);
Task
<
RequestResourceResponse
>
GetStoreByPosition
(
GetStoreByPositionRequest
request
);
Task
<
RequestResourceResponse
>
GetStoreByPosition
(
GetStoreByPositionRequest
request
);
}
}
...
...
Freemud.BE.Toolbox.WebApi/Services/Impl/RequestResourceService.cs
View file @
46ec5aa1
...
@@ -83,23 +83,13 @@ namespace Freemud.BE.Toolbox.WebApi.Services
...
@@ -83,23 +83,13 @@ namespace Freemud.BE.Toolbox.WebApi.Services
#
region
商品
#
region
商品
public
async
Task
<
RequestResourceResponse
>
GetProductInfo
(
GetProductInfoRequest
request
)
public
async
Task
<
List
<
RequestResourceResponse
>
>
GetProductInfo
(
GetProductInfoRequest
request
)
{
{
throw
new
NotImplementedException
();
//var getProductBaseInfoResponse = await GetProductBaseInfo(request);
//logger.LogInformation($"[GetProductInfo] getProductBaseInfoResponse: {JsonConvert.SerializeObject((object)getProductBaseInfoResponse)}");
//var products = getProductBaseInfoResponse?.Data.data?.products as List<dynamic>;
//if (products?.Any() ?? false)
var
products
=
await
fmProductProxy
.
GetProductBaseInfos
(
request
);
// return null;
var
extendsions
=
await
fmProductProxy
.
GetProductExtensionInfo
(
request
.
Env
,
request
.
ProductId
);
//foreach (var p in products)
//{
// p.extendProps = GetProductExtendProps(request.Env, p.pid);
//}
//return Response("未统计", responseBody: products)
;
return
new
List
<
RequestResourceResponse
>
{
products
,
extendsions
}
;
}
}
#
endregion
#
endregion
...
...
freemud.be.toolboxview/src/views/requestresource/CouponProductSearch.vue
View file @
46ec5aa1
...
@@ -93,7 +93,7 @@
...
@@ -93,7 +93,7 @@
</div>
</div>
</
template
>
</
template
>
</Table>
</Table>
<
strong
v-else
>
{{ item.coupon.data }}
</strong
>
<
Alert
banner
type=
"warning"
v-else
>
{{ item.coupon.data }}
</Alert
>
</Card>
</Card>
</Col>
</Col>
<Col
span=
"12"
>
<Col
span=
"12"
>
...
@@ -132,7 +132,9 @@
...
@@ -132,7 +132,9 @@
</Table>
</Table>
</Card>
</Card>
</div>
</div>
<div
v-else
>
无数据
</div>
<div
v-else
>
<Alert
banner
type=
"warning"
>
无数据
</Alert>
</div>
</Col>
</Col>
</Row>
</Row>
</TabPane>
</TabPane>
...
...
freemud.be.toolboxview/src/views/requestresource/ProductSearch.vue
View file @
46ec5aa1
<
template
>
<
template
>
<div>
<div>
<h1>
product-search
</h1>
<Form
:label-width=
"80"
>
<Row>
<Col
span=
"12"
>
<FormItem
label=
"渠道"
>
<RadioGroup
type=
"button"
v-model=
"channel"
>
<Radio
label=
"delivery"
>
<Icon
type=
"md-bicycle"
/>
麦乐送
</Radio>
<Radio
label=
"mcoffee"
>
<Icon
type=
"md-cafe"
/>
麦咖啡
</Radio>
<Radio
label=
"kiosk"
>
<Icon
type=
"md-ice-cream"
/>
甜品站
</Radio>
</RadioGroup>
</FormItem>
</Col>
<Col
span=
"12"
>
<FormItem
label=
"环境"
>
<RadioGroup
type=
"button"
v-model=
"env"
>
<Radio
label=
"dev"
>
开发环境
</Radio>
<Radio
label=
"prod"
>
生产环境
</Radio>
</RadioGroup>
</FormItem>
</Col>
<Col
span=
"12"
>
<FormItem
label=
"门店号"
>
<AutoComplete
v-model=
"storeId"
:data=
"[1450026, 1450217, 99998, 99995, 99992]"
placeholder=
"门店编号"
></AutoComplete>
</FormItem>
</Col>
<Col
span=
"12"
>
<FormItem
label=
"商品编号"
>
<Input
type=
"text"
v-model=
"productId"
placeholder=
"商品编号"
></Input>
</FormItem>
</Col>
<Col
span=
"12"
>
<FormItem
label=
"时间"
>
<TimePicker
:value=
"time"
format=
"HH:mm:ss"
placeholder=
"时间"
style=
"width: 168px"
></TimePicker>
</FormItem>
</Col>
<Col
span=
"12"
>
<FormItem>
<Button
type=
"primary"
icon=
"ios-search"
:loading=
"loadingSearch"
@
click=
"search()"
>
<span
v-if=
"!loadingSearch"
>
查 询
</span>
<span
v-else
>
查询中
</span>
</Button>
</FormItem>
</Col>
</Row>
</Form>
<div
class=
"resource-result"
>
<Tabs
:animated=
"false"
>
<TabPane
label=
"结果"
icon=
"md-list-box"
>
<Row
v-for=
"item in vData"
:key=
"item.product.id"
class=
"coupon-line"
:gutter=
"16"
>
<Col
span=
"24"
>
<Card
dis-hover
>
<p
slot=
"title"
>
<span
v-if=
"item.product.data"
>
{{
item
.
product
.
data
.
name
}}
</span>
<span>
(
{{
item
.
product
.
id
}}
)
</span>
</p>
<Table
v-if=
"item.product.data"
border
size=
"small"
:columns=
"colCoupons"
:data=
"item.product.data.data"
:show-header=
"false"
>
<template
slot-scope=
"
{ row }" slot="name">
<div
class=
"xxx"
>
<strong>
{{
row
.
name
}}
</strong>
<Tag
color=
"geekblue"
>
{{
row
.
field
}}
</Tag>
</div>
</
template
>
<
template
slot-scope=
"{ row }"
slot=
"val"
>
<div
v-if=
"row.field === 'customizes'"
>
<div
v-for=
"customize in row.val"
:key=
"customize.id"
style=
"margin: 5px 0px;"
>
<List
border
size=
"small"
>
<ListItem>
<Tag
color=
"blue"
>
{{
customize
.
group
}}
</Tag>
</ListItem>
<ListItem
v-for=
"spec in customize.spec"
:key=
"spec.code"
>
<Tag
color=
"geekblue"
>
{{
spec
.
name
}}
-
{{
spec
.
code
}}
</Tag>
<br
/>
<Table
border
size=
"small"
:columns=
"colGrills"
:data=
"spec.grill"
></Table>
</ListItem>
</List>
</div>
</div>
<div
v-else-if=
"row.field === 'productGroupList'"
>
<div
v-for=
"pg in row.val"
:key=
"pg.name"
style=
"margin: 5px 0px;"
>
<List
border
size=
"small"
>
<ListItem>
<Tag
color=
"blue"
>
#商品组名:
{{
pg
.
name
}}
</Tag>
<Tag
color=
"blue"
>
#商品组ID:
{{
pg
.
pgid
}}
</Tag>
<Tag
color=
"blue"
>
#是否必选:
{{
pg
.
must
}}
</Tag>
<Tag
color=
"blue"
>
#最大选择数量:
{{
pg
.
maxNumber
}}
</Tag>
<Tag
color=
"blue"
>
#备注:
{{
pg
.
remark
}}
</Tag>
<Tag
color=
"blue"
>
#类型:
{{
pg
.
type
}}
</Tag>
</ListItem>
<ListItem
v-for=
"product in buildGroupProductData(pg.groupDetail)"
:key=
"product.id"
>
<Table
border
size=
"small"
:columns=
"colCoupons"
:data=
"product.data"
:show-header=
"false"
>
<template
slot-scope=
"
{ row }" slot="name">
<div
class=
"xxx"
>
<strong>
{{
row
.
name
}}
</strong>
<Tag
color=
"geekblue"
>
{{
row
.
field
}}
</Tag>
</div>
</
template
>
<
template
slot-scope=
"{ row }"
slot=
"val"
>
<div
v-if=
"row.field === 'customizes'"
>
<div
v-for=
"customize in row.val"
:key=
"customize.id"
style=
"margin: 5px 0px;"
>
<List
border
size=
"small"
>
<ListItem>
<Tag
color=
"blue"
>
{{
customize
.
group
}}
</Tag>
</ListItem>
<ListItem
v-for=
"spec in customize.spec"
:key=
"spec.code"
>
<Tag
color=
"geekblue"
>
{{
spec
.
name
}}
-
{{
spec
.
code
}}
</Tag>
<br
/>
<Table
border
size=
"small"
:columns=
"colGrills"
:data=
"spec.grill"
></Table>
</ListItem>
</List>
</div>
</div>
<div
v-else
>
{{
row
.
val
}}
<Tooltip
v-if=
"row.descriptor"
max-width=
"200"
placement=
"right"
transfer
>
<span
style=
"color:#ed4014"
>
(
{{
row
.
descriptor
.
memo
}}
)
</span>
<Icon
type=
"md-information-circle"
/>
<div
slot=
"content"
>
{{
row
.
descriptor
.
desc
}}
</div>
</Tooltip>
</div>
</
template
>
</Table>
</ListItem>
</List>
</div>
</div>
<div
v-else
>
{{ row.val }}
<Tooltip
v-if=
"row.descriptor"
max-width=
"200"
placement=
"right"
transfer
>
<span
style=
"color:#ed4014"
>
({{row.descriptor.memo}})
</span>
<Icon
type=
"md-information-circle"
/>
<div
slot=
"content"
>
{{row.descriptor.desc}}
</div>
</Tooltip>
</div>
</template>
</Table>
<Alert
banner
type=
"warning"
v-else
>
无数据
</Alert>
</Card>
</Col>
</Row>
</TabPane>
<TabPane
label=
"元信息"
icon=
"md-code"
>
<div
class=
"resource-result-metadata-panel"
>
<div
v-for=
"item in metaData"
:key=
"item.name"
class=
"resource-result-metadata-item"
>
<span
class=
"resource-result-metadata-item-title"
>
{{item.name}}
</span>
<codemirror
:value=
"buildMetaData(item)"
:options=
"cmOptions"
></codemirror>
</div>
</div>
</TabPane>
</Tabs>
</div>
</div>
</div>
</template>
</template>
<
script
>
// require component And styles And Themes
import
{
codemirror
}
from
'vue-codemirror'
import
'codemirror/mode/javascript/javascript.js'
import
'codemirror/lib/codemirror.css'
import
'codemirror/theme/the-matrix.css'
export
default
{
components
:
{
codemirror
},
data
()
{
return
{
loadingSearch
:
false
,
channel
:
'delivery'
,
env
:
'dev'
,
time
:
'12:34:56'
,
productId
:
'123470098,123472924,123471941,123472439,123470930,123'
,
storeId
:
'1450217'
,
metaData
:
[],
vData
:
[],
cmOptions
:
{
lineNumbers
:
true
,
readOnly
:
true
,
tabSize
:
2
,
model
:
'text/javascript'
,
theme
:
'the-matrix'
},
colCoupons
:
[{
slot
:
'name'
,
maxWidth
:
250
},
{
slot
:
'val'
}],
colGrills
:
[
{
title
:
'des'
,
key
:
'des'
},
{
title
:
'modifier'
,
key
:
'modifier'
},
{
title
:
'pid'
,
key
:
'pid'
},
{
title
:
'price'
,
key
:
'price'
},
{
title
:
'qty'
,
key
:
'qty'
},
{
title
:
'selected'
,
key
:
'selected'
}
]
}
},
created
()
{
this
.
time
=
this
.
_moment
().
format
(
'HH:mm:ss'
)
},
methods
:
{
async
search
()
{
if
(
!
this
.
storeId
)
{
this
.
$Message
.
warning
(
'请输入门店号'
)
return
}
if
(
!
this
.
productId
)
{
this
.
$Message
.
warning
(
'请输入券号'
)
return
}
if
(
!
this
.
time
)
{
this
.
$Message
.
warning
(
'请输入时间'
)
return
}
this
.
loadingSearch
=
true
const
params
=
{
env
:
this
.
env
,
channel
:
this
.
channel
,
productId
:
this
.
productId
.
split
(
','
),
storeId
:
this
.
storeId
,
time
:
this
.
time
}
const
{
data
:
response
}
=
await
this
.
$http
.
post
(
'/requestresource/get-product'
,
params
)
if
(
response
.
code
!==
200
)
{
this
.
$Message
.
error
(
response
.
message
)
}
else
{
this
.
metaData
=
response
.
data
this
.
bindData
(
response
.
data
)
}
this
.
loadingSearch
=
false
},
bindData
(
data
)
{
const
products
=
[]
const
responseProducts
=
JSON
.
parse
(
data
[
0
].
responseContent
)
responseProducts
.
data
.
products
.
forEach
(
p
=>
{
const
data
=
[
{
name
:
'编号'
,
field
:
'pid'
,
val
:
p
.
pid
},
{
name
:
'名称'
,
field
:
'name'
,
val
:
p
.
name
},
{
name
:
'customerCode'
,
field
:
'customerCode'
,
val
:
p
.
customerCode
},
{
name
:
'业务类型'
,
field
:
'businessType'
,
val
:
p
.
businessType
},
{
name
:
'价格'
,
field
:
'finalPrice'
,
val
:
p
.
finalPrice
},
{
name
:
'外带价格'
,
field
:
'finalPriceTakeout'
,
val
:
p
.
finalPriceTakeout
},
{
name
:
'原价'
,
field
:
'originalPrice'
,
val
:
p
.
originalPrice
},
{
name
:
'外带原价'
,
field
:
'originalPriceTakeout'
,
val
:
p
.
originalPriceTakeout
},
{
name
:
'状态'
,
field
:
'status'
,
val
:
p
.
status
},
{
name
:
'菜品类型'
,
field
:
'type'
,
val
:
p
.
type
},
{
name
:
'子品信息'
,
field
:
'productGroupList'
,
val
:
p
.
productGroupList
},
{
name
:
'特制信息'
,
field
:
'customizes'
,
val
:
p
.
customizes
}
]
products
.
push
({
id
:
p
.
pid
,
name
:
p
.
name
,
data
:
data
})
})
products
.
forEach
(
p
=>
{
p
.
data
.
forEach
(
d
=>
{
d
.
descriptor
=
this
.
buildProductDescriptor
(
d
.
field
,
d
.
val
)
})
})
// const extendsions = []
// const responseExendsions = JSON.parse(data[1].responseContent)
// responseExendsions.data.products.forEach(p => {
// const data = [
// { name: '编号', field: 'pid', val: p.pid },
// { name: '名称', field: 'name', val: p.name },
// { name: 'customerCode', field: 'customerCode', val: p.customerCode },
// { name: '业务类型', field: 'businessType', val: p.businessType },
// { name: '价格', field: 'finalPrice', val: p.finalPrice },
// { name: '外带价格', field: 'finalPriceTakeout', val: p.finalPriceTakeout },
// { name: '原价', field: 'originalPrice', val: p.originalPrice },
// { name: '外带原价', field: 'originalPriceTakeout', val: p.originalPriceTakeout },
// { name: '状态', field: 'status', val: p.status },
// { name: '菜品类型', field: 'type', val: p.type }
// ]
// products.push({ id: p.pid, name: p.name, data: data })
// })
// products.forEach(p => {
// p.data.forEach(d => {
// d.descriptor = this.buildProductDescriptor(d.field, d.val)
// })
// })
// 组装数据
const
vdata
=
[]
const
productIds
=
this
.
productId
.
split
(
','
)
productIds
.
forEach
(
pid
=>
{
const
p
=
this
.
_
.
find
(
products
,
{
id
:
parseInt
(
pid
)
})
vdata
.
push
({
product
:
{
id
:
pid
,
data
:
p
}
})
})
this
.
vData
=
vdata
console
.
info
(
this
.
vData
)
},
buildGroupProductData
(
data
)
{
const
products
=
[]
data
.
forEach
(
p
=>
{
const
data
=
[
{
name
:
'编号'
,
field
:
'productId'
,
val
:
p
.
productId
},
{
name
:
'名称'
,
field
:
'productName'
,
val
:
p
.
productName
},
{
name
:
'customerCode'
,
field
:
'customerCode'
,
val
:
p
.
customerCode
},
{
name
:
'价格'
,
field
:
'productFinalPrice'
,
val
:
p
.
productFinalPrice
},
{
name
:
'外带价格'
,
field
:
'productFinalPriceTakeout'
,
val
:
p
.
productFinalPriceTakeout
},
{
name
:
'原价'
,
field
:
'productPrice'
,
val
:
p
.
productPrice
},
{
name
:
'外带原价'
,
field
:
'productPriceTakeout'
,
val
:
p
.
productPriceTakeout
},
{
name
:
'状态'
,
field
:
'status'
,
val
:
p
.
status
},
{
name
:
'特制信息'
,
field
:
'customizes'
,
val
:
p
.
customizes
}
]
products
.
push
({
id
:
p
.
pid
,
name
:
p
.
name
,
data
:
data
})
})
products
.
forEach
(
p
=>
{
p
.
data
.
forEach
(
d
=>
{
d
.
descriptor
=
this
.
buildProductDescriptor
(
d
.
field
,
d
.
val
)
})
})
return
products
},
buildMetaData
(
data
)
{
return
'================ URL ================
\
r
\
n'
+
data
.
url
+
'
\
n
\
n'
+
'================ HEADERS ============
\
r
\
n'
+
JSON
.
stringify
(
data
.
requestHeaders
,
null
,
'
\
t'
)
+
'
\
r
\
n'
+
'================ DATA ===============
\
r
\
n'
+
JSON
.
stringify
(
data
.
requestBody
,
null
,
'
\
t'
)
+
'
\
r
\
n'
+
'================ RESPONSE ===============
\
r
\
n'
+
JSON
.
stringify
(
JSON
.
parse
(
data
.
responseContent
),
null
,
'
\
t'
)
},
buildCouponDescriptor
(
field
,
val
)
{
let
memo
=
''
let
desc
=
''
if
(
field
===
'couponType'
)
{
if
(
val
===
0
)
{
memo
=
'商品券'
}
else
if
(
val
===
1
)
{
memo
=
'代金券'
}
desc
=
'0)商品券, 1)代金券;'
}
if
(
memo
||
desc
)
{
return
{
memo
,
desc
}
}
return
null
},
buildProductDescriptor
(
field
,
val
)
{
let
memo
=
''
let
desc
=
''
if
(
field
===
'businessType'
)
{
if
(
val
===
'1'
)
{
memo
=
'饮品'
}
desc
=
'1)饮品, 2)非饮品'
}
else
if
(
field
===
'status'
)
{
switch
(
val
)
{
case
1
:
memo
=
'下架'
break
case
2
:
memo
=
'上架'
break
case
3
:
memo
=
'售罄'
break
default
:
break
}
desc
=
'1)下架, 2)上架, 3)售罄'
}
else
if
(
field
===
'type'
)
{
switch
(
val
)
{
case
1
:
memo
=
'普通商品'
break
case
2
:
memo
=
'附加商品'
break
case
3
:
memo
=
'组合商品'
break
case
4
:
memo
=
'固定套餐'
break
case
5
:
memo
=
'组合套餐'
break
case
6
:
memo
=
'多规格套餐'
break
default
:
break
}
desc
=
'1)普通商品, 2)附加商品, 3)组合商品, 4)固定套餐, 5)组合套餐, 6)多规格套餐'
}
if
(
memo
||
desc
)
{
return
{
memo
,
desc
}
}
return
null
}
}
}
</
script
>
<
style
lang=
"less"
scope
>
.coupon-line
{
margin-bottom
:
15px
;
.xxx
{
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
}
.ivu-table-cell
{
padding-right
:
0px
;
.ivu-list-item
{
display
:
list-item
;
}
}
}
</
style
>
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