Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx-business
/
aiot-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
Show 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 @@
...
@@ -2,7 +2,7 @@
* @Author: limin
* @Author: limin
* @Date: 2019-08-26 18:02:41
* @Date: 2019-08-26 18:02:41
* @Last Modified by: chenwq
* @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'
import
axios
from
'@/plugin/axios'
...
@@ -11,7 +11,7 @@ import RequestMethods from './request.methods'
...
@@ -11,7 +11,7 @@ import RequestMethods from './request.methods'
import
util
from
'@/libs/util.js'
import
util
from
'@/libs/util.js'
const
request
=
(
params
=
{},
method
=
RequestMethods
.
GET
,
noSignAttr
=
[])
=>
{
const
request
=
(
params
=
{},
method
=
RequestMethods
.
GET
,
noSignAttr
=
[])
=>
{
// params.source = 'glsx'
// params.source = 'glsx'
params
.
appKey
=
'd7ffc3346fc9a45bccaaa35300d59022
'
params
.
appKey
=
window
.
location
.
href
.
includes
(
'dj.glsx.com.cn'
)
?
'd7ffc3346fc9a45bccaaa35300d59022'
:
'48e5e13229b82c1b4e6e8c96151f0637
'
params
.
timestamp
=
new
Date
().
getTime
()
params
.
timestamp
=
new
Date
().
getTime
()
params
.
v
=
'1.0.0'
params
.
v
=
'1.0.0'
params
.
format
=
'json'
params
.
format
=
'json'
...
...
src/api/sign.js
View file @
63e6a14
...
@@ -2,11 +2,11 @@
...
@@ -2,11 +2,11 @@
* @Author: limin
* @Author: limin
* @Date: 2019-08-26 18:02:49
* @Date: 2019-08-26 18:02:49
* @Last Modified by: chenwq
* @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
sha1
from
'sha1'
import
qs
from
'qs'
import
qs
from
'qs'
const
secret
=
'4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353
'
const
secret
=
window
.
location
.
href
.
includes
(
'dj.glsx.com.cn'
)
?
'4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353'
:
'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b
'
const
sign
=
(
params
,
noSignAttr
=
[])
=>
{
const
sign
=
(
params
,
noSignAttr
=
[])
=>
{
delete
params
.
sign
delete
params
.
sign
var
objStr
=
qs
.
stringify
(
_
.
cloneDeep
(
params
),
{
arrayFormat
:
'indices'
,
encode
:
false
,
allowDots
:
true
})
var
objStr
=
qs
.
stringify
(
_
.
cloneDeep
(
params
),
{
arrayFormat
:
'indices'
,
encode
:
false
,
allowDots
:
true
})
...
...
src/views/goods/product.vue
View file @
63e6a14
<!--
商
品管理 -->
<!--
产
品管理 -->
<
template
>
<
template
>
<d2-container
class=
"
commodity
"
>
<d2-container
class=
"
product
"
>
<el-form
<el-form
:inline=
"true"
:inline=
"true"
v-model=
"searchForm"
v-model=
"searchForm"
label-width=
"85px"
label-width=
"85px"
slot=
"header"
slot=
"header"
>
>
<el-form-item
label=
"
商
品名称"
>
<el-form-item
label=
"
产
品名称"
>
<el-input
<el-input
v-model=
"searchForm.goodsName"
v-model=
"searchForm.goodsName"
placeholder=
"请输入
商
品名称"
placeholder=
"请输入
产
品名称"
clearable
clearable
></el-input>
></el-input>
</el-form-item>
</el-form-item>
...
@@ -18,13 +18,12 @@
...
@@ -18,13 +18,12 @@
<el-select
<el-select
v-model=
"searchForm.goodsType"
v-model=
"searchForm.goodsType"
placeholder=
"请选择产品分类"
placeholder=
"请选择产品分类"
clearable
>
>
<el-option
<el-option
v-for=
"item in baseData.
goodsType
"
v-for=
"item in baseData.
productTypeList
"
:key=
"item.goodsType"
:key=
"item.goodsType"
:label=
"item.goodsTypeName"
:value=
"item.goodsType"
:value=
"item.goodsType"
:label=
"item.goodsTypeName"
></el-option>
></el-option>
</el-select>
</el-select>
</el-form-item>
</el-form-item>
...
@@ -57,8 +56,7 @@
...
@@ -57,8 +56,7 @@
></auth-button>
></auth-button>
</d2-table-header>
</d2-table-header>
<d2-table
<d2-table
ref=
"commodityTable"
ref=
"productTable"
:hasNum=
"false"
:searchForm=
"searchForm"
:searchForm=
"searchForm"
:tableParams=
"tableParams"
:tableParams=
"tableParams"
:getListApi=
"getListApi"
:getListApi=
"getListApi"
...
@@ -68,53 +66,22 @@
...
@@ -68,53 +66,22 @@
slot=
"img"
slot=
"img"
slot-scope=
"scope"
slot-scope=
"scope"
class=
"pro-img"
class=
"pro-img"
:src=
"scope.scope.
goodsInfo.
thumbUrl"
:src=
"scope.scope.thumbUrl"
/>
/>
<auth-button
<auth-button
v-if=
"Object.keys(scope.scope).includes('upgradeGoodsList')"
slot=
"auth-button"
slot=
"auth-button"
slot-scope=
"scope"
slot-scope=
"scope"
:data=
"scope.scope"
:data=
"scope.scope"
></auth-button>
></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-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>
</d2-container>
</
template
>
</
template
>
<
script
>
<
script
>
import
{
getList
,
exportBaseList
}
from
'@api/commodity'
import
_
from
'lodash'
import
{
getList
}
from
'@api/product'
import
{
BaseData
,
brandMerchantList
}
from
'@/common/constants.js'
import
{
BaseData
,
brandMerchantList
}
from
'@/common/constants.js'
import
{
export_json_to_excel
}
from
'@/common/Export2Excel.js'
import
{
mapActions
}
from
'vuex'
import
{
mapActions
}
from
'vuex'
import
_
from
'lodash'
import
storeDetail
from
'./storeDetail'
export
default
{
export
default
{
name
:
'product'
,
name
:
'product'
,
data
()
{
data
()
{
...
@@ -130,45 +97,31 @@ export default {
...
@@ -130,45 +97,31 @@ export default {
getListApi
:
getList
,
getListApi
:
getList
,
// 表格参数
// 表格参数
tableParams
:
{
tableParams
:
{
needUnique
:
true
,
mutiSelectUniqueKey
:
'uniqueVal'
,
btnId
:
new
Date
().
getTime
()
+
parseInt
(
Math
.
random
()
*
1000
),
btnId
:
new
Date
().
getTime
()
+
parseInt
(
Math
.
random
()
*
1000
),
listName
:
'list'
,
listName
:
'list'
,
tableOption
:
true
,
tableOption
:
true
,
tableColumns
:
[{
tableColumns
:
[{
label
:
'序号'
,
label
:
'缩略图'
,
prop
:
'index'
prop
:
'thumbUrl'
,
},
{
label
:
'商品ID'
,
prop
:
'goodsCode'
},
{
label
:
'商品图片'
,
prop
:
'img'
,
addHtml
:
'img'
addHtml
:
'img'
},
{
},
{
label
:
'商品名称'
,
label
:
'产品名称'
,
parentProp
:
'goodsInfo'
,
prop
:
'goodsName'
prop
:
'goodsName'
},
{
},
{
label
:
'产品ID'
,
prop
:
'id'
},
{
label
:
'分类'
,
label
:
'分类'
,
parentProp
:
'goodsInfo'
,
prop
:
'goodsTypeName'
prop
:
'goodsTypeName'
},
{
},
{
label
:
'品牌商'
,
label
:
'品牌商'
,
parentProp
:
'goodsInfo'
,
prop
:
'brandMerchantName'
prop
:
'brandMerchantName'
},
{
},
{
label
:
'属性'
,
label
:
'创建时间'
,
prop
:
'attribute'
prop
:
'createDateStr'
},
{
label
:
'关联商品数'
,
prop
:
'upgradeGoodsNum'
},
{
label
:
'关联商户数'
,
prop
:
'merchantNum'
},
{
},
{
label
:
'产品状态'
,
label
:
'产品状态'
,
prop
:
'
goodsStatus
'
,
prop
:
'
state
'
,
formatter
:
(
cellValue
)
=>
{
formatter
:
(
cellValue
)
=>
{
// return {
// return {
// 0: '上架',
// 0: '上架',
...
@@ -176,42 +129,46 @@ export default {
...
@@ -176,42 +129,46 @@ export default {
// }[cellValue.state]
// }[cellValue.state]
return
'上架'
return
'上架'
}
}
},
{
label
:
'创建时间'
,
prop
:
'createDateStr'
}]
}]
},
},
// 查看门店
// 查看门店
detailVisible
:
false
,
detailVisible
:
false
,
showClose
:
false
,
// 基本数据
// 基本数据
baseData
:
{
baseData
:
{
goodsType
:
[],
productTypeList
:
[],
brandList
:
[]
brandList
:
[]
}
}
}
}
},
},
components
:
{
storeDetail
},
mounted
()
{
mounted
()
{
// this.getProductType()
this
.
getBaseData
()
this
.
getBaseData
()
// console.log(storeDetail)
// var allOpt = { confId: '', confKey: '全部' }
// this.baseData.product.unshift(allOpt)
// this.baseData.brandList.unshift(allOpt)
this
.
baseData
.
brandList
=
_
.
cloneDeep
(
brandMerchantList
)
this
.
baseData
.
brandList
=
_
.
cloneDeep
(
brandMerchantList
)
var
allOpt
=
{
confId
:
''
,
confValue
:
'全部'
}
var
allOpt
=
{
confId
:
''
,
confValue
:
'全部'
}
this
.
baseData
.
brandList
.
unshift
(
allOpt
)
this
.
baseData
.
brandList
.
unshift
(
allOpt
)
},
},
methods
:
{
methods
:
{
// getProductType(){
// let prarms = {}
// getType(prarms).then(res => {
// this.baseData.productTypeList = res || []
// });
// },
...
mapActions
(
'd2admin/base'
,
[
'get'
]),
...
mapActions
(
'd2admin/base'
,
[
'get'
]),
async
getBaseData
()
{
async
getBaseData
()
{
this
.
baseData
.
goodsType
=
_
.
cloneDeep
(
await
this
.
get
(
BaseData
.
productType
))
this
.
baseData
.
productTypeList
=
_
.
cloneDeep
(
await
this
.
get
(
BaseData
.
productType
))
this
.
baseData
.
goodsType
.
unshift
({
this
.
baseData
.
productTypeList
.
unshift
({
goodsType
:
''
,
goodsType
:
''
,
goodsTypeName
:
'全部'
goodsTypeName
:
'全部'
})
})
},
},
beforeSearchFn
()
{
beforeSearchFn
()
{
return
new
Promise
(
resolve
=>
{
return
new
Promise
(
resolve
=>
{
console
.
log
(
'搜索前操作--'
)
console
.
log
(
'搜索前操作--'
)
...
@@ -219,45 +176,35 @@ export default {
...
@@ -219,45 +176,35 @@ export default {
})
})
},
},
handleReset
()
{
handleReset
()
{
var
keys
=
Object
.
keys
(
this
.
searchForm
)
this
.
searchForm
=
{
keys
.
forEach
(
item
=>
{
goodsName
:
''
,
this
.
searchForm
[
item
]
=
''
goodsType
:
''
,
})
brandMerchantCode
:
''
}
},
},
handleAdd
(
form
)
{
handleAdd
(
form
)
{
// console.log(form)
this
.
$router
.
push
({
this
.
$router
.
push
({
name
:
'edit
Commodity
'
,
name
:
'edit
Product
'
,
params
:
{
params
:
{
addOrEdit
:
'add'
,
addOrEdit
:
'add'
,
form
:
form
form
:
form
}
}
})
})
},
},
handleExport
()
{
// 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
]))
},
handleEdit
(
row
)
{
handleEdit
(
row
)
{
// console.log(row)
this
.
$router
.
push
({
this
.
$router
.
push
({
name
:
'edit
Commodity
'
,
name
:
'edit
Product
'
,
params
:
{
params
:
{
addOrEdit
:
'edit'
,
addOrEdit
:
'edit'
,
row
:
row
form
:
row
}
}
})
})
},
},
handleDetail
(
row
)
{
handleDetail
(
row
)
{
this
.
detailData
=
_
.
cloneDeep
(
row
)
this
.
detailData
=
row
this
.
detailVisible
=
true
this
.
detailVisible
=
true
},
},
handleDetailClose
()
{
handleDetailClose
()
{
...
@@ -268,7 +215,7 @@ export default {
...
@@ -268,7 +215,7 @@ export default {
</
script
>
</
script
>
<
style
scoped
>
<
style
scoped
>
.
commodity
.pro-img
{
.
product
.pro-img
{
width
:
80px
;
width
:
80px
;
height
:
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