Commit 54dd796e authored by Damon's avatar Damon

refactor: 物料选择接口对接

parent 91483a06
......@@ -11,6 +11,6 @@ const UNI_APP = {
qn_base_url: 'https://qn-static.banshouhui.com/self-support/',
qn_asset_url: 'http://deudn.c.pp.cc/',
argoDebugMode: 1,
version: 'v1.3.9'
version: 'v1.5.0'
}
module.exports = UNI_APP;
;(function() {
let NODE_ENV = 'test' // dev:开发环境 | test:测试环境 | prod:生产环境
let ENV_VAR = null
let VERSION_NUMBER = '1.4.0' //版本号
let VERSION_NUMBER = '1.5.0' //版本号
//小程序是否审核通过,参数配置在ucenter库version表,对应版本号的is_audit设置为1,将显示学习视频
if (process.env.NODE_ENV === 'development') {
if (NODE_ENV === 'dev') {
......
......@@ -10,7 +10,7 @@ const UNI_APP = {
qn_base_url: 'https://qn-static.banshouhui.com/self-support/',
qn_asset_url: 'https://qn-static.banshouhui.com',
argoDebugMode: 0,
version: 'v1.3.9'
version: 'v1.5.0'
}
module.exports = UNI_APP;
......@@ -11,6 +11,6 @@ const UNI_APP = {
qn_base_url: 'https://qn-static.banshouhui.com/self-support/',
qn_asset_url: 'https://qn-static.banshouhui.com',
argoDebugMode: 1,
version: 'v1.3.9'
version: 'v1.5.0'
}
module.exports = UNI_APP;
......@@ -19,10 +19,18 @@ let partsApiFun = function (vm) {
* 配件过滤-品类列表
*/
let getCategoryList = async () => await vm.$u.get(base + vm.vuex_token + '/allow/category/list');
/**
* 配件过滤-一级分类
*/
let getClassify = async (params = {}) => await vm.$u.get(parts + vm.vuex_token + '/type/classify/' + params.id);
/**
* 配件过滤-品牌列表
*/
let getBrandList = async (params = {}) => await vm.$u.get(base + vm.vuex_token + '/allow/brand/list', params);
let getBrandList = async (params = {}) => await vm.$u.get(parts + vm.vuex_token + '/type/towLevel/' + params.categoryId + '/' + params.classifyId);
/**
* 配件过滤-三级分类列表
*/
let getThreeLevel = async (params = {}) => await vm.$u.get(parts + vm.vuex_token + '/type/threeLevel/' + params.categoryId + '/' + params.classifyId + '?partnerCompanyId = ' + params.partnerCompanyId + '&speciesId=' + params.speciesId);
/**
* 查询配件列表
*/
......@@ -50,7 +58,9 @@ let partsApiFun = function (vm) {
getSiteAddress,
updateAddress,
getCategoryList,
getClassify,
getBrandList,
getThreeLevel,
getPartsList,
applyParts,
getMyReserve,
......
......@@ -3,10 +3,10 @@
<view class="categary" v-if="type === '2'">
<view class="u-flex u-col-center">
<view
:class="['txt', {'active': categoryId === item.categoryId }]"
v-for="item in categary"
:key="item.categoryId"
@click="changeCategary(item)"
:class="['txt', {'active': classifyId === item.id }]"
v-for="item in classify"
:key="item.id"
@click="changeClassify(item)"
>{{item.label}}</view>
</view>
</view>
......@@ -32,8 +32,8 @@
:scroll-into-view="scrollId"
>
<view
:id="`brand${item.brandId}`"
:class="['label-title', { selected: item.brandId == brandId }]"
:id="`brand${item.id}`"
:class="['label-title', { selected: item.id == brandId }]"
v-for="(item, index) in brand"
:key="index"
@click="selectBrand(item, index)"
......@@ -41,27 +41,25 @@
</scroll-view>
</view>
<view class="more u-flex" @click="handleClick">
<!-- <picker mode="selector" :value="brandIndex" range-key="label" :range="brand" @click="show = true" @change="changeBrand"> -->
<view class="more-text">更多</view>
<!-- </picker> -->
<u-icon class="input-icon" color="#2272FF" name="arrow-right"></u-icon>
</view>
</view>
<view class="model u-flex" v-show="showMore !== true">
<view class="model u-flex" v-if="showMore !== true && model.length > 0">
<view class="label-content u-flex">
<scroll-view
style="width:100%;white-space: nowrap;"
scroll-x="true"
class="u-flex"
:scroll-into-view="scrollId"
:scroll-into-view="scrollModelId"
>
<view
:id="`brand${item.brandId}`"
:class="['label-title', { selected: item.brandId == brandId }]"
v-for="(item, index) in brand"
:id="`model${item.id}`"
:class="['label-title', { selected: item.id == modelId }]"
v-for="(item, index) in model"
:key="index"
@click="selectBrand(item, index)"
@click="selectModel(item, index)"
>{{ item.label }}</view>
</scroll-view>
</view>
......@@ -70,20 +68,20 @@
</view>
</view>
<view class="allModel u-flex" v-show="showMore === true">
<view class="allModel u-flex" v-if="showMore === true && model.length > 0">
<view class="label-content u-flex">
<scroll-view
style="width:100%;height: 320rpx;"
scroll-y="true"
class="u-flex"
:scroll-into-view="scrollId"
:scroll-into-view="scrollModelId"
>
<view
:id="`brand${item.brandId}`"
:class="['label-title', { selected: item.brandId == brandId }]"
v-for="(item, index) in brand"
:id="`model${item.id}`"
:class="['label-title', { selected: item.id == modelId }]"
v-for="(item, index) in model"
:key="index"
@click="selectBrand(item, index)"
@click="selectModel(item, index)"
>{{ item.label }}</view>
</scroll-view>
</view>
......@@ -93,7 +91,7 @@
</view>
<view class="lists">
<view class="mask" v-show="showMore === true" @click="showMore = false"></view>
<view class="mask" v-if="showMore === true" @click="showMore = false"></view>
<scroll-view
style="height:100%;"
:scroll-top="scrollTop"
......@@ -143,13 +141,16 @@ export default {
show: false,
showMore: false,
categary: [],
classify: [],
brand: [],
model: [],
categaryIndex: 0,
categoryId: '',
brandIndex: 0,
classifyId: '',
brandId: 0,
scrollId: '',
scrollModelId: '',
modelId: 0,
loadStatus: 'loadmore',
lists: [],
submitList: [],
......@@ -218,15 +219,25 @@ export default {
if (res.code === 200) {
const data = res.data
if (data.length > 0) {
this.categary = data.map((v) => {
v.label = v.categoryName
this.categoryId = data[0].categoryId
this.getClassify()
} else {
this.getPartsList()
}
}
})
},
// 获取一级分类
getClassify() {
this.$u.api.getClassify({ id: this.categoryId }).then((res) => {
if (res.code === 200) {
const data = res.data
if (data.length > 0) {
this.classify = data.map((v) => {
v.label = v.name
return v
})
this.categary.push({
categoryId: 2,
label: '非桩类',
})
this.categoryId = this.categary[0].categoryId
this.classifyId = this.classify[0].id
this.getBrandList()
} else {
this.getPartsList()
......@@ -234,26 +245,69 @@ export default {
}
})
},
// 获取品牌
// 获取二级分类
getBrandList(id) {
this.$u.api.getBrandList({ categoryId: this.categoryId }).then((res) => {
this.$u.api.getBrandList({ categoryId: this.categoryId, classifyId: this.classifyId }).then((res) => {
if (res.code === 200) {
const data = res.data
let lists
if (this.classifyId === 1) {
lists = data.partnerCompany
} else {
lists = data.classify
}
let item, index
this.brand = data.map((v, i) => {
if (id && parseInt(id) === v.brandId) {
this.brand = lists.map((v, i) => {
if (id && parseInt(id) === v.id) {
item = v
index = i
}
v.label = v.brandName
v.label = v.name
return v
})
if (item && index) {
this.selectBrand(item, index)
this.scrollId = `brand${item.brandId}`
this.scrollId = `brand${item.id}`
} else {
this.brandId = this.brand?.[0]?.id
this.lists = []
this.getThreeLevel()
}
}
})
},
// 获取三级分类
getThreeLevel() {
const params = {
categoryId: this.categoryId,
classifyId: this.classifyId,
partnerCompanyId: '',
speciesId: ''
}
if (this.classifyId === 1) {
params.partnerCompanyId = this.brandId
} else {
params.speciesId = this.brandId
}
this.$u.api.getThreeLevel(params).then(res => {
if (res.code === 200) {
const data = res.data
let item, index
this.model = data.map((v, i) => {
// if (id && parseInt(id) === v.id) {
// item = v
// index = i
// }
v.label = v.name
return v
})
if (item && index) {
this.selectModel(item, index)
this.scrollModelId = `model${item.id}`
} else {
this.brandId = this.brand?.[0]?.brandId
this.modelId = this.model?.[0]?.id
this.lists = []
this.getPartsList()
}
......@@ -268,9 +322,19 @@ export default {
pageNumber: this.pageNumber,
pageSize: this.pageSize,
categoryId: this.categoryId || '',
brandId: this.brandId || '',
keyword: this.keyword,
classifyId: this.classifyId,
brandId: this.modelId,
speciesId: '',
partnerCompanyId: '',
}
if (this.classifyId === 1) {
params.partnerCompanyId = this.brandId
} else {
params.speciesId = this.brandId
}
this.$u.api.getPartsList(params).then((res) => {
if (res.code === 200) {
const data = res.data
......@@ -301,27 +365,26 @@ export default {
this.getPartsList()
},
// 选择品类
changeCategary(data) {
this.categoryId = data.categoryId
this.brandIndex = ''
changeClassify(data) {
this.classifyId = data.id
this.show = false
this.brand = []
this.pageNumber = 1
this.getBrandList()
},
// 下拉选择品牌
changeBrand(data) {
this.brandIndex = data.detail.value
this.brandId = this.brand[this.brandIndex].brandId
this.scrollId = `brand${this.brandId}`
this.lists = []
this.pageNumber = 1
this.getPartsList()
},
// 点击选择品牌
selectBrand(item, index) {
this.scrollId = ''
this.brandIndex = index
this.brandId = item.brandId
this.brandId = item.id
this.model = []
this.lists = []
this.pageNumber = 1
this.getThreeLevel()
},
// 点击选择三级分类
selectModel(item, index) {
this.scrollModelId = ''
this.modelId = item.id
this.lists = []
this.pageNumber = 1
this.getPartsList()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment