Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx-business
/
develop-platform
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 63e6a143
authored
Nov 27, 2020
by
cwq0219
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改
1 parent
a8c82aa6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
104 deletions
src/api/request.js
src/api/sign.js
src/views/goods/product.vue
src/api/request.js
View file @
63e6a14
...
...
@@ -2,7 +2,7 @@
* @Author: limin
* @Date: 2019-08-26 18:02:41
* @Last Modified by: chenwq
* @Last Modified time: 2020-11-27
17:51:03
* @Last Modified time: 2020-11-27
22:22:02
*/
import
axios
from
'@/plugin/axios'
...
...
@@ -11,7 +11,7 @@ import RequestMethods from './request.methods'
import
util
from
'@/libs/util.js'
const
request
=
(
params
=
{},
method
=
RequestMethods
.
GET
,
noSignAttr
=
[])
=>
{
// params.source = 'glsx'
params
.
appKey
=
'd7ffc3346fc9a45bccaaa35300d59022
'
params
.
appKey
=
window
.
location
.
href
.
includes
(
'dj.glsx.com.cn'
)
?
'd7ffc3346fc9a45bccaaa35300d59022'
:
'48e5e13229b82c1b4e6e8c96151f0637
'
params
.
timestamp
=
new
Date
().
getTime
()
params
.
v
=
'1.0.0'
params
.
format
=
'json'
...
...
src/api/sign.js
View file @
63e6a14
...
...
@@ -2,11 +2,11 @@
* @Author: limin
* @Date: 2019-08-26 18:02:49
* @Last Modified by: chenwq
* @Last Modified time: 2020-11-27
17:50:34
* @Last Modified time: 2020-11-27
22:22:25
*/
import
sha1
from
'sha1'
import
qs
from
'qs'
const
secret
=
'4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353
'
const
secret
=
window
.
location
.
href
.
includes
(
'dj.glsx.com.cn'
)
?
'4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353'
:
'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b
'
const
sign
=
(
params
,
noSignAttr
=
[])
=>
{
delete
params
.
sign
var
objStr
=
qs
.
stringify
(
_
.
cloneDeep
(
params
),
{
arrayFormat
:
'indices'
,
encode
:
false
,
allowDots
:
true
})
...
...
src/views/goods/product.vue
View file @
63e6a14
<!--
商
品管理 -->
<!--
产
品管理 -->
<
template
>
<d2-container
class=
"
commodity
"
>
<d2-container
class=
"
product
"
>
<el-form
:inline=
"true"
v-model=
"searchForm"
label-width=
"85px"
slot=
"header"
>
<el-form-item
label=
"
商
品名称"
>
<el-form-item
label=
"
产
品名称"
>
<el-input
v-model=
"searchForm.goodsName"
placeholder=
"请输入
商
品名称"
placeholder=
"请输入
产
品名称"
clearable
></el-input>
</el-form-item>
...
...
@@ -18,13 +18,12 @@
<el-select
v-model=
"searchForm.goodsType"
placeholder=
"请选择产品分类"
clearable
>
<el-option
v-for=
"item in baseData.
goodsType
"
v-for=
"item in baseData.
productTypeList
"
:key=
"item.goodsType"
:label=
"item.goodsTypeName"
:value=
"item.goodsType"
:label=
"item.goodsTypeName"
></el-option>
</el-select>
</el-form-item>
...
...
@@ -57,8 +56,7 @@
></auth-button>
</d2-table-header>
<d2-table
ref=
"commodityTable"
:hasNum=
"false"
ref=
"productTable"
:searchForm=
"searchForm"
:tableParams=
"tableParams"
:getListApi=
"getListApi"
...
...
@@ -68,53 +66,22 @@
slot=
"img"
slot-scope=
"scope"
class=
"pro-img"
:src=
"scope.scope.
goodsInfo.
thumbUrl"
:src=
"scope.scope.thumbUrl"
/>
<auth-button
v-if=
"Object.keys(scope.scope).includes('upgradeGoodsList')"
slot=
"auth-button"
slot-scope=
"scope"
:data=
"scope.scope"
></auth-button>
<!--
<auth-button
v-if=
"Object.keys(scope.scope).includes('upgradeGoodsList')"
slot=
"auth-button"
slot-scope=
"scope"
:data=
"scope.scope"
></auth-button>
<el-button
v-else
slot=
"auth-button"
slot-scope=
"scope"
:data=
"scope.scope"
type=
"text"
@
click=
"handleUpOrDown"
>
{{
scope
.
scope
.
state
?
'上架'
:
'下架'
}}
</el-button>
-->
</d2-table>
<d2-dialog
title=
"门店列表"
:className=
"storeDetail"
:isVisible
.
sync=
"detailVisible"
:showClose=
"showClose"
noCancel=
"true"
@
closeDialog=
"handleDetailClose"
@
confirmDialog=
"handleDetailClose"
>
<store-detail
v-if=
"detailVisible"
:detailData=
"detailData"
></store-detail>
</d2-dialog>
</d2-container>
</
template
>
<
script
>
import
{
getList
,
exportBaseList
}
from
'@api/commodity'
import
_
from
'lodash'
import
{
getList
}
from
'@api/product'
import
{
BaseData
,
brandMerchantList
}
from
'@/common/constants.js'
import
{
export_json_to_excel
}
from
'@/common/Export2Excel.js'
import
{
mapActions
}
from
'vuex'
import
_
from
'lodash'
import
storeDetail
from
'./storeDetail'
export
default
{
name
:
'product'
,
data
()
{
...
...
@@ -130,45 +97,31 @@ export default {
getListApi
:
getList
,
// 表格参数
tableParams
:
{
needUnique
:
true
,
mutiSelectUniqueKey
:
'uniqueVal'
,
btnId
:
new
Date
().
getTime
()
+
parseInt
(
Math
.
random
()
*
1000
),
listName
:
'list'
,
tableOption
:
true
,
tableColumns
:
[{
label
:
'序号'
,
prop
:
'index'
},
{
label
:
'商品ID'
,
prop
:
'goodsCode'
},
{
label
:
'商品图片'
,
prop
:
'img'
,
label
:
'缩略图'
,
prop
:
'thumbUrl'
,
addHtml
:
'img'
},
{
label
:
'商品名称'
,
parentProp
:
'goodsInfo'
,
label
:
'产品名称'
,
prop
:
'goodsName'
},
{
label
:
'产品ID'
,
prop
:
'id'
},
{
label
:
'分类'
,
parentProp
:
'goodsInfo'
,
prop
:
'goodsTypeName'
},
{
label
:
'品牌商'
,
parentProp
:
'goodsInfo'
,
prop
:
'brandMerchantName'
},
{
label
:
'属性'
,
prop
:
'attribute'
},
{
label
:
'关联商品数'
,
prop
:
'upgradeGoodsNum'
},
{
label
:
'关联商户数'
,
prop
:
'merchantNum'
label
:
'创建时间'
,
prop
:
'createDateStr'
},
{
label
:
'产品状态'
,
prop
:
'
goodsStatus
'
,
prop
:
'
state
'
,
formatter
:
(
cellValue
)
=>
{
// return {
// 0: '上架',
...
...
@@ -176,42 +129,46 @@ export default {
// }[cellValue.state]
return
'上架'
}
},
{
label
:
'创建时间'
,
prop
:
'createDateStr'
}]
},
// 查看门店
detailVisible
:
false
,
showClose
:
false
,
// 基本数据
baseData
:
{
goodsType
:
[],
productTypeList
:
[],
brandList
:
[]
}
}
},
components
:
{
storeDetail
},
mounted
()
{
// this.getProductType()
this
.
getBaseData
()
// console.log(storeDetail)
// var allOpt = { confId: '', confKey: '全部' }
// this.baseData.product.unshift(allOpt)
// this.baseData.brandList.unshift(allOpt)
this
.
baseData
.
brandList
=
_
.
cloneDeep
(
brandMerchantList
)
var
allOpt
=
{
confId
:
''
,
confValue
:
'全部'
}
this
.
baseData
.
brandList
.
unshift
(
allOpt
)
},
methods
:
{
// getProductType(){
// let prarms = {}
// getType(prarms).then(res => {
// this.baseData.productTypeList = res || []
// });
// },
...
mapActions
(
'd2admin/base'
,
[
'get'
]),
async
getBaseData
()
{
this
.
baseData
.
goodsType
=
_
.
cloneDeep
(
await
this
.
get
(
BaseData
.
productType
))
this
.
baseData
.
goodsType
.
unshift
({
this
.
baseData
.
productTypeList
=
_
.
cloneDeep
(
await
this
.
get
(
BaseData
.
productType
))
this
.
baseData
.
productTypeList
.
unshift
({
goodsType
:
''
,
goodsTypeName
:
'全部'
})
},
beforeSearchFn
()
{
return
new
Promise
(
resolve
=>
{
console
.
log
(
'搜索前操作--'
)
...
...
@@ -219,45 +176,35 @@ export default {
})
},
handleReset
()
{
var
keys
=
Object
.
keys
(
this
.
searchForm
)
keys
.
forEach
(
item
=>
{
this
.
searchForm
[
item
]
=
''
})
this
.
searchForm
=
{
goodsName
:
''
,
goodsType
:
''
,
brandMerchantCode
:
''
}
},
handleAdd
(
form
)
{
// console.log(form)
this
.
$router
.
push
({
name
:
'edit
Commodity
'
,
name
:
'edit
Product
'
,
params
:
{
addOrEdit
:
'add'
,
form
:
form
}
})
},
handleExport
()
{
const
tHeader
=
[
'序号'
,
'商品ID'
,
'商品名称'
,
'分类'
,
'品牌商'
,
'属性'
,
'关联商品数'
,
'关联商户数'
,
'产品状态'
,
'创建时间'
]
const
fieldVal
=
[
'index'
,
'goodsCode'
,
'goodsName'
,
'goodsTypeName'
,
'brandMerchantName'
,
'attribute'
,
'upgradeGoodsNum'
,
'merchantNum'
,
'goodsStatus'
,
'createdDate'
]
exportBaseList
(
this
.
searchForm
).
then
(
res
=>
{
// console.log(res)
require
.
ensure
([],
()
=>
{
const
data
=
this
.
formatJson
(
fieldVal
,
res
)
export_json_to_excel
(
tHeader
,
data
,
'基础商品列表'
)
})
})
},
formatJson
(
filterVal
,
jsonData
)
{
return
jsonData
.
map
(
v
=>
filterVal
.
map
(
j
=>
v
[
j
]))
},
// handleExport() { },
handleEdit
(
row
)
{
// console.log(row)
this
.
$router
.
push
({
name
:
'edit
Commodity
'
,
name
:
'edit
Product
'
,
params
:
{
addOrEdit
:
'edit'
,
row
:
row
form
:
row
}
})
},
handleDetail
(
row
)
{
this
.
detailData
=
_
.
cloneDeep
(
row
)
this
.
detailData
=
row
this
.
detailVisible
=
true
},
handleDetailClose
()
{
...
...
@@ -268,7 +215,7 @@ export default {
</
script
>
<
style
scoped
>
.
commodity
.pro-img
{
.
product
.pro-img
{
width
:
80px
;
height
:
80px
;
}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment