Commit 8dffc547 authored by 李俊赕's avatar 李俊赕

Merge branch 'dev-photo-v2' of https://git.banshouhui.com/heyinchen/take_order into dev-photo-v2

parents 97c7a265 61e9bd92
<template> <template>
<view class="backView"> <view class="backView">
<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 v-for="(item,ikey) in dataItem.data" <view v-for="(item,ikey) in dataItem.data"
:class="param[dataItem.type] === item.id ? 'select-item-view' : 'item-view'" :class="param[dataItem.type] === item.id ? 'select-item-view' : 'item-view'"
@click="itemClick(dataItem.type, item, ikey)" :key="item.id"> @click="itemClick(dataItem.type, item, ikey)" :key="item.id">
<text class="itemTitle">{{item.name}}</text> <text class="itemTitle">{{item.name}}</text>
</view> </view>
</view> </view>
</template> </template>
</view> </view>
<button class="ph-pr-button" type="primary" @click="handleClick" :disabled="!selectedAll" <u-button class="ph-pr-button" type="primary" shape="circle" @click="handleClick"
:style="buttonStyle">下一步</button> :hover-class="selectedAll ? '' : 'none'" :custom-style="buttonStyle">下一步</u-button>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
classifyList: [], classifyList: [],
systemList: [], systemList: [],
brandList: [], brandList: [],
param: { param: {
classifyId: '', classifyId: '',
systemId: '', systemId: '',
brandId: '', brandId: '',
}, },
brandName: '', brandName: '',
selectedAll: false, selectedAll: false,
} }
}, },
computed: { computed: {
list() { list() {
return [{ return [{
title: '请选择类别', title: '请选择类别',
type: 'classifyId', type: 'classifyId',
data: this.classifyList data: this.classifyList
}, },
{ {
title: '请选择系统', title: '请选择系统',
type: 'systemId', type: 'systemId',
data: this.systemList data: this.systemList
}, },
{ {
title: '请选择品牌', title: '请选择品牌',
type: 'brandId', type: 'brandId',
data: this.brandList data: this.brandList
} }
] ]
}, },
buttonStyle() { buttonStyle() {
return this.selectedAll ? 'color: #FFFFFF;background-color: #2272FF;' : return this.selectedAll ? {
'color: #FFFFFF;background-color: #D1D4D4;' 'color': '#FFFFFF',
} 'background-color': '#2272FF;',
}, 'width': '600rpx',
onLoad(e) { 'height': '104rpx'
getApp().trackPage('选择产品页') } : {
this.getRelationDictionaryV2() 'color': '#FFFFFF',
}, 'background-color': '#D1D4D4;',
onShareAppMessage(res) { 'width': '600rpx',
let shareObj = { 'height': '104rpx'
title: '', }
path: '/pages/photo/product', }
imageUrl: '', },
success() {}, onLoad(e) {
fail() {} getApp().trackPage('选择产品页')
} this.getRelationDictionaryV2()
return shareObj },
}, onShareAppMessage(res) {
methods: { let shareObj = {
getRelationDictionaryV2: function() { title: '',
this.$u.cloudApi.getRelationDictionaryV2().then(res => { path: '/pages/photo/product',
if (res && res.result) { imageUrl: '',
this.classifyList = res.result success() {},
this.param.classifyId = res.result[0].id fail() {}
this.systemList = res.result[0].child }
} return shareObj
}) },
}, methods: {
getRelationDictionaryV2: function() {
//选择 点击 this.$u.cloudApi.getRelationDictionaryV2().then(res => {
itemClick: function(type, item, ikey) { if (res && res.result) {
this.classifyList = res.result
switch (type) { this.param.classifyId = res.result[0].id
case 'classifyId': this.systemList = res.result[0].child
this.param = { }
classifyId: item.id, })
systemId: '', },
brandId: ''
} //选择 点击
this.selectedAll = false itemClick: function(type, item, ikey) {
this.systemList = this.classifyList[ikey].child
this.brandList = [] switch (type) {
break case 'classifyId':
case 'systemId': this.param = {
this.param = { classifyId: item.id,
classifyId: this.param.classifyId, systemId: '',
systemId: item.id, brandId: ''
brandId: '' }
} this.selectedAll = false
this.systemList = this.classifyList[ikey].child
this.selectedAll = false this.brandList = []
this.brandList = this.systemList[ikey].child break
case 'systemId':
break this.param = {
case 'brandId': classifyId: this.param.classifyId,
this.param.brandId = item.id systemId: item.id,
this.selectedAll = true brandId: ''
this.brandName = item.name }
break
default: this.selectedAll = false
break this.brandList = this.systemList[ikey].child
}
}, break
case 'brandId':
// 点击下一步 this.param.brandId = item.id
handleClick() { this.selectedAll = true
// 点击下一步设置全局拍照品牌品类 this.brandName = item.name
const globalData = getApp().globalData break
if (!globalData.token) { default:
uni.navigateTo({ break
url:'/pages/login/wxlogin' }
}) },
return
} // 点击下一步
let keys = ['brandId', 'brandName', 'classifyId', 'systemId'] handleClick() {
keys.map(key => { // 点击下一步设置全局拍照品牌品类
globalData.photo.product[key] = this[key] || this.param[key] if (!this.selectedAll) {
}) return
uni.navigateTo({ }
url: '/pages/photo/list' + const globalData = getApp().globalData
'?brandId=' + this.param.brandId + if (!globalData.token) {
'&brand=' + this.brandName + uni.navigateTo({
'&classifyId=' + this.param.classifyId + url: '/pages/login/wxlogin'
'&systemId=' + this.param.systemId, })
}) return
} }
} let keys = ['brandId', 'brandName', 'classifyId', 'systemId']
} keys.map(key => {
</script> globalData.photo.product[key] = this[key] || this.param[key]
})
<style> uni.navigateTo({
.backView { url: '/pages/photo/list' +
background-color: #FAFAFA; '?brandId=' + this.param.brandId +
position: absolute; '&brand=' + this.brandName +
top: 0; '&classifyId=' + this.param.classifyId +
left: 0; '&systemId=' + this.param.systemId,
width: 100%; })
display: flex; }
flex-direction: column; }
align-items: center; }
height: 100%; </script>
}
<style>
.topTitle { .backView {
margin-top: 50rpx; background-color: #FAFAFA;
padding-left: 30rpx; position: absolute;
font-size: 36rpx; top: 0;
font-weight: bold; left: 0;
color: #333333; width: 100%;
} display: flex;
flex-direction: column;
.ph-pr-content { align-items: center;
display: flex; height: 100%;
flex-wrap: wrap; }
justify-content: flex-start;
width: 100%; .topTitle {
padding: 22rpx 22rpx; margin-top: 50rpx;
} padding-left: 30rpx;
font-size: 36rpx;
.ph-pr-arr { font-weight: bold;
width: 100%; color: #333333;
} }
.item-view { .ph-pr-content {
background-color: #FFFFFF; display: flex;
/* width: 548rpx; */ flex-wrap: wrap;
margin: 0rpx 8rpx 24rpx 8rpx; justify-content: flex-start;
/* flex: 1 1 0%; width: 100%;
max-width: 33%; */ padding: 22rpx 22rpx;
width: 222rpx; }
height: 76rpx;
display: flex; .ph-pr-arr {
align-items: center; width: 100%;
justify-content: center; }
border-style: solid;
box-shadow: 0px 2px 7px 0px rgba(0, 0, 0, 0.05); .item-view {
border-width: 0rpx; background-color: #FFFFFF;
border-radius: 12rpx; /* width: 548rpx; */
font-size: 26rpx; margin: 0rpx 8rpx 24rpx 8rpx;
color: #666666; /* flex: 1 1 0%;
} max-width: 33%; */
width: 222rpx;
.select-item-view { height: 76rpx;
background-color: #2272FF; display: flex;
margin: 0rpx 8rpx 24rpx 8rpx; align-items: center;
/* flex: 1 1 0%; justify-content: center;
max-width: 33%; */ border-style: solid;
width: 222rpx; box-shadow: 0px 2px 7px 0px rgba(0, 0, 0, 0.05);
height: 76rpx; border-width: 0rpx;
display: flex; border-radius: 12rpx;
align-items: center; font-size: 26rpx;
justify-content: center; color: #666666;
border-style: solid; }
box-shadow: 0px 2px 7px 0px rgba(0, 0, 0, 0.05);
border-width: 0rpx; .select-item-view {
border-radius: 12rpx; background-color: #2272FF;
font-size: 26rpx; margin: 0rpx 8rpx 24rpx 8rpx;
color: #FFFFFF; /* flex: 1 1 0%;
} max-width: 33%; */
width: 222rpx;
.ph-pr-button { height: 76rpx;
position: absolute; display: flex;
bottom: 76rpx; align-items: center;
border-radius: 52rpx; justify-content: center;
height: 104rpx; border-style: solid;
font-size: 32rpx; box-shadow: 0px 2px 7px 0px rgba(0, 0, 0, 0.05);
width: 600rpx; border-width: 0rpx;
line-height: 104rpx; border-radius: 12rpx;
} font-size: 26rpx;
color: #FFFFFF;
}
.ph-pr-button {
position: absolute;
bottom: 76rpx;
font-size: 32rpx;
}
</style> </style>
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