Commit a2d58854 authored by Facius's avatar Facius

首页接口调试

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