Commit a2d58854 authored by Facius's avatar Facius

首页接口调试

parent a69beaee
...@@ -100,11 +100,11 @@ ...@@ -100,11 +100,11 @@
} }
if(e && e.current_count){ if(e && e.current_count){
this.done_count = e.current_count this.done_count = Math.max(e.current_count - 1, 0)
} }
if(e && e.current_count){ if(e && e.current_count){
this.current_count = Math.max(e.current_count - 1, 0) this.current_count = e.current_count
} }
if(e && e.images){ if(e && e.images){
......
This diff is collapsed.
...@@ -3,9 +3,10 @@ ...@@ -3,9 +3,10 @@
<view class="ph-pr-arr" v-for="(dataItem, index) in list" :key="index"> <view class="ph-pr-arr" v-for="(dataItem, index) in list" :key="index">
<template v-if="dataItem.data.length > 0"> <template v-if="dataItem.data.length > 0">
<view class="topTitle"><text>{{ dataItem.title }}</text></view> <view class="topTitle"><text>{{ dataItem.title }}</text></view>
<view class="ph-pr-content" > <view class="ph-pr-content">
<view :class="param[item.type + '_code'] === item.code ? 'select-item-view' : 'item-view'" <view v-for="(item,ikey) in dataItem.data"
@click="itemClick(item)" v-for="(item,ikey) in dataItem.data" :key="item.code"> :class="param[dataItem.type] === item._id ? 'select-item-view' : 'item-view'"
@click="itemClick(dataItem.type, item)" :key="item._id">
<text class="itemTitle">{{item.name}}</text> <text class="itemTitle">{{item.name}}</text>
</view> </view>
</view> </view>
...@@ -20,32 +21,33 @@ ...@@ -20,32 +21,33 @@
export default { export default {
data() { data() {
return { return {
productList: [], classifyList: [],
sysList: [], systemList: [],
brandList: [], brandList: [],
product_code: '',
product: '',
param: { param: {
brand_code: '', classifyId: '',
brand: '', systemId: '',
product_code: '', brandId: '',
product: ''
}, },
selectedAll: false, brandName: '',
selectedAll: false,
} }
}, },
computed: { computed: {
list() { list() {
return [{ return [{
title: '请选择类别', title: '请选择类别',
data: this.productList type: 'classifyId',
data: this.classifyList
}, },
{ {
title: '请选择系统', title: '请选择系统',
data: this.sysList type: 'systemId',
data: this.systemList
}, },
{ {
title: '请选择品牌', title: '请选择品牌',
type: 'brandId',
data: this.brandList data: this.brandList
} }
] ]
...@@ -53,7 +55,7 @@ ...@@ -53,7 +55,7 @@
}, },
onLoad(e) { onLoad(e) {
getApp().trackPage('选择产品页') getApp().trackPage('选择产品页')
this.getProductList() this.getclassifyList()
}, },
onShareAppMessage(res) { onShareAppMessage(res) {
...@@ -68,89 +70,84 @@ ...@@ -68,89 +70,84 @@
}, },
methods: { methods: {
getProductList: function() { getclassifyList: function() {
let that = this let that = this
this.$u.cloudApi.getAllProduct().then(res => { this.$u.cloudApi.getClassifyDictionary().then(res => {
console.log('获取产品数据:') console.log('获取产品数据:')
console.log(res) console.log(res)
if (res.result && res.result.data) { if (res.result && res.result.data) {
that.productList = res.result.data that.classifyList = res.result.data
that.param.classifyId = that.classifyList[0]._id
that.$u.cloudApi.getRelationDictionary({
"classify_id": that.param.classifyId,
"field": "system_id"
}).then(res1 => {
that.systemList = res1.result
})
} }
}) })
}, },
//选择 点击 //选择 点击
itemClick: function(item) { itemClick: function(type, item) {
switch (item.type) { switch (type) {
case 'product': case 'classifyId':
this.initSelect() this.param = {
this.param.product_code = item.code classifyId: item._id,
this.param.product = item.name systemId: '',
brandId: ''
this.$u.cloudApi.getBrand({ }
product_code: this.param.product_code this.selectedAll = false
this.systemList = []
this.brandList = []
this.$u.cloudApi.getRelationDictionary({
"classify_id": this.param.classifyId,
"field": "system_id"
}).then(res => {
this.systemList = res.result
})
break
case 'systemId':
this.param = {
classifyId: this.param.classifyId,
systemId: item._id,
brandId: ''
}
this.selectedAll = false
this.brandList = []
this.$u.cloudApi.getRelationDictionary({
"classify_id": this.param.classifyId,
"system_id": this.param.systemId,
"field": "brand_id"
}).then(res => { }).then(res => {
console.log('获取品牌数据:', res) console.log('获取品牌数据:', res)
this.brandList = res.result
if (res.result.data) {
res.result.data.filter((value) => {
value.type = 'brand'
})
this.brandList = res.result.data
this.changeSelectedAll()
}
}) })
break break
case 'brandId':
this.param.brandId = item._id
this.selectedAll = true
this.brandName = item.name
break
default: default:
this.param.brand_code = item.code break
this.param.brand = item.name
this.changeSelectedAll()
} }
// uni.navigateTo({
// url: '/pages/photo/brand' +
// '?product_code=' + this.param.product_code +
// '&product=' + this.param.product,
// })
}, },
// 点击下一步 // 点击下一步
handleClick() { handleClick() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/photo/list' + url: '/pages/photo/list' +
'?brand_code=' + this.param.brand_code + '?brandId=' + this.param.brandId +
'&brand=' + this.param.brand + '&brand=' + this.brandName +
'&product_code=' + this.param.product_code + '&classifyId=' + this.param.systemId +
'&product=' + this.param.product, '&systemId=' + this.param.systemId,
}) })
},
// 修改下一步按钮是否可以点击
changeSelectedAll() {
for (var item in this.param) {
if (!this.param[item]) {
this.selectedAll = false
return
}
}
this.selectedAll = true
},
// 初始化选择
initSelect() {
this.param = {
brand_code: '',
brand: '',
product_code: '',
product: ''
}
this.brandList = []
this.selectedAll = false
} }
} }
} }
......
{
"name": "getGroupStandardV2",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"user-common": {
"version": "file:../common/user-common"
}
}
}
{
"name": "saveImage",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"user-common": {
"version": "file:../common/user-common"
}
}
}
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