Commit 221fa0bc authored by 李星剑's avatar 李星剑

add 款式委托

parent 6438f955
<template> <template>
<view class="home_con_content_order u-m-t-30" > <view class="home_con_content_order" @click="click">
<image style="width: 100%;height: 160rpx;" src="@/static/images/home/1@2x.png" mode=""></image> <image style="width: 100%;height: 160rpx;" src="@/static/images/home/1@2x.png" mode=""></image>
<view class="order_tit"> <view class="order_tit">
<view class="u-flex justify-between u-font-32"> <view class="u-flex justify-between u-font-32">
...@@ -28,6 +28,11 @@ export default { ...@@ -28,6 +28,11 @@ export default {
}, },
data() { data() {
return {}; return {};
},
methods:{
click(){
this.$emit("click")
}
} }
} }
</script> </script>
......
export default {
colors:{
// 获取颜色组
getColors:{
url: "/gdep-mdm/colour/selectColour",
method: "get",
}
}
}
// 委托单接口列表
let base = "/gdep-plm/orderTicket"
export default {
orderTicket:{
// 委托单详情
detail:{
url: `${base}/detail`,
method: 'get'
},
// 新建委托单
save:{
url: `${base}/save`,
method: 'post'
},
// 编辑委托单
update:{
url: `${base}/update`,
method: 'post'
},
// 拆分委托单
split:{
url: `${base}/split`,
method: 'post'
},
// 删除委托单
del:{
url: `${base}/removeByIds`,
method: 'post'
},
// 取消发布
abolishByIds:{
url: `${base}/abolishByIds`,
method: 'post'
},
// 确认寄样
sendSamplesByIds:{
url: `${base}/sendSamplesByIds`,
method: 'post'
},
// 风格树
styleTreeList:{
url: `${base}/styleTreeList`,
method: 'get'
}
}
}
...@@ -4,11 +4,15 @@ ...@@ -4,11 +4,15 @@
import user from './apiList/user.js' import user from './apiList/user.js'
import auth from './apiList/auth.js' import auth from './apiList/auth.js'
import plm from './apiList/plm.js' import plm from './apiList/plm.js'
import color from './apiList/colors.js'
import orderTicket from './apiList/orderTicket.js'
// import goods from './apiList/goods.js' // import goods from './apiList/goods.js'
// import base from './apiList/base.js' // import base from './apiList/base.js'
export default { export default {
...user, ...user,
...auth, ...auth,
...color,
...orderTicket,
...plm ...plm
}; };
This diff is collapsed.
...@@ -18,15 +18,16 @@ ...@@ -18,15 +18,16 @@
swiperWidth="750"></u-tabs-swiper> swiperWidth="750"></u-tabs-swiper>
</view> </view>
<!--状态栏 tab--> <!--状态栏 tab-->
<view v-if="!status[current].status"> <view v-if="!status[current].close">
<view class="list-tip u-flex u-p-r-30 u-p-l-30" > <view class="list-tip u-flex u-p-r-30 u-p-l-30" >
<text class="u-flex-1">
全部总共 {{totalNum}}
</text>
<text class="u-flex-1" v-if="current === 3"> <text class="u-flex-1" v-if="current === 3">
已选中{{ selectedLength}} 已选中{{ selectedLength}}
</text> </text>
<u-icon name="close"></u-icon> <text class="u-flex-1" v-if="current !== 3">
{{status[current].label}}总共 {{totalNum}}
</text>
<u-icon name="close" @click="closeTip"></u-icon>
</view> </view>
</view> </view>
</view> </view>
...@@ -35,9 +36,7 @@ ...@@ -35,9 +36,7 @@
<view v-for="(item,index) in data"> <view v-for="(item,index) in data">
<view class="u-flex u-p-t-12 u-p-b-12"> <view class="u-flex u-p-t-12 u-p-b-12">
<text class="u-flex-1"> <text class="u-flex-1">
{{ item.label }}(20 款) {{ item.label }}({{item.children.length}} 款)
<!-- {{item.children.length}}-->
<!-- 款)-->
</text> </text>
<text class="" @click="collapse(index)"> <text class="" @click="collapse(index)">
{{ activeIndex === index ? '收起': '展开' }} {{ activeIndex === index ? '收起': '展开' }}
...@@ -92,107 +91,76 @@ ...@@ -92,107 +91,76 @@
<script> <script>
import status from './mixins/status' import status from './mixins/status'
import dom from './mixins/dom'
import HsTipTitle from "../../components/hs-tip-title/hs-tip-title"; import HsTipTitle from "../../components/hs-tip-title/hs-tip-title";
export default { export default {
name: "list", name: "list",
components: {HsTipTitle}, components: {HsTipTitle},
mixins: [status], mixins: [status,dom],
data() { data() {
return { return {
current: 0, // tabs组件的current值,表示当前活动的tab选项 current: 0, // tabs组件的current值,表示当前活动的tab选项
activeIndex: 0, activeIndex: 0,
// data: , // data: ,
res: [] , //列表数据源 res: [
headerHeight: 0, {date: '12月11日', title: '立领夹克',status: 1},
footerHeight: 0 {date: '12月11日', title: '立领夹克',status: 1},
{date: '12月10日', title: '立领夹克1',status: 1},
{date: '12月10日', title: '立领夹克1',status: 1}
] , //列表数据源
}; };
}, },
computed:{ computed:{
data(){ data(){
return [ function arr2Tree(data, id = "colourGroup") {
{ const newList = [],
children: [ map = Array.from(
{ new Set(
title: '立领夹克', data.map((item) => {
status: 1 return item[id];
}, })
{ )
title: '立领夹克', );
status: 1 for (let i = 0; i < data.length; i++) {
}, let item = data[i],
{ name = item[id],
title: '立领夹克', index = map.indexOf(name);
status: 1 if (newList[index]) {
}, newList[index]["children"].push(item);
{ } else {
title: '立领夹克', newList.push({
status: 1 label: name,
}, children: [item]
{ });
title: '立领夹克', }
status: 1
},
],
label: '12月11日'
},
{
children: [
{
title: '立领夹克',
status: 1
},
],
label: '12月10日'
} }
] return newList;
}
return arr2Tree(this.res,"date");
}, },
totalNum(){ totalNum(){
let res = this.data.reduce((total,item) =>{ return this.res.length
return total.concat(item.children)
},[]);
console.log(res)
return 0;
}, },
selectedLength(){ selectedLength(){
return this.data.filter return this.res.filter((item) =>{
return item.status == 1
}).length;
} }
}, },
watch:{ watch:{
current(){ current(){
this.getHeaderHeight();
this.getFooterHeight(); this.getFooterHeight();
} }
}, },
mounted() {
this.uGetRect("#header").then(res =>{
this.headerHeight = res.height;
})
},
methods: { methods: {
getFooterHeight(){ closeTip(){
this.$nextTick(() =>{ this.$set(this.status, this.current,{
this.uGetRect("#footer").then(res =>{ ...this.status[this.current],
this.footerHeight = res.height || 0; close: true
})
})
},
uGetRect(selector, all) {
return new Promise((resolve) => {
uni.createSelectorQuery()
.in(this)[all ? 'selectAll' : 'select'](selector)
.boundingClientRect((rect) => {
if (all && Array.isArray(rect) && rect.length) {
resolve(rect)
}
if (!all && rect) {
resolve(rect)
}
if(rect === null){
resolve({})
}
})
.exec()
}) })
this.getHeaderHeight()
}, },
collapse(index){ collapse(index){
this.activeIndex = this.activeIndex === index ? null : index; this.activeIndex = this.activeIndex === index ? null : index;
......
<!--新增委托--> <!--新增委托-->
<template> <template>
<view> <view>
<!--新增委托navbar--> <view id="header">
<u-navbar title="新增委托"
:border-bottom="false"
:background="{backgroundColor: 'whitesmoke'}">
<template v-slot:right>
新增面料
</template>
</u-navbar>
<view class="title u-p-30">选择面料</view>
<view class="u-p-30 bg-fff">
<!--新增委托navbar--> <!--新增委托navbar-->
<u-search placeholder="请输入面料名称" v-model="keyword" <u-navbar title="新增委托"
border-color="#e1e1e1" height="76" :border-bottom="false"
bg-color="#fff" :show-action="false"></u-search> :background="{backgroundColor: 'whitesmoke'}">
<template v-slot:right>
新增面料
</template>
</u-navbar>
<view class="title u-p-30">选择面料</view>
<view class="u-p-30 bg-fff">
<!--新增委托navbar-->
<u-search placeholder="请输入面料名称" v-model="keyword"
border-color="#e1e1e1" height="76"
bg-color="#fff" :show-action="false"></u-search>
</view>
</view> </view>
<!-- 列表 确定--> <!-- 列表 确定-->
<view class="u-p-30"> <view class="u-p-30 body" :style="{ bottom: footerHeight+ 'px', top: headerHeight + 'px' }">
<radio-group style="width: 100%"> <view v-for="(item, index) in list" :key="item.id" class="u-flex u-m-b-20">
<view v-for="(item, index) in list" :key="item.id" class="u-flex u-m-b-20"> <view class="u-m-r-30">
<view> <u-icon :name="index === selectedIndex ? 'checkmark-circle-fill': 'checkmark-circle'"
<radio :value="item.value" :checked="index === selectedIndex" /> color="#000" size="40"
</view> @click="triggerSelectItem(index)"
<hs-material-thumbnail :item="item"></hs-material-thumbnail> />
</view> </view>
</radio-group> <hs-material-thumbnail :item="item" @click="toMaterialDetail(item)"></hs-material-thumbnail>
</view>
</view> </view>
<!-- 底部按钮 确定--> <!-- 底部按钮 确定-->
<view class="footer" id="footer"> <view class="footer" id="footer">
<view class="footer-btn"> <view class="footer-btn">
<!-- /* 以下形式在微信小程序会无效,APP和H5有效 */--> <!-- /* 以下形式在微信小程序会无效,APP和H5有效 */-->
<u-button class="custom-style" shape="circle"> <u-button :disabled="selectedIndex === -1"
@click="toAddItem"
class="custom-style" shape="circle"
>
确定 确定
</u-button> </u-button>
</view> </view>
...@@ -40,16 +46,17 @@ ...@@ -40,16 +46,17 @@
</template> </template>
<script> <script>
import dom from './mixins/dom'
import HsSelectItem from "../../components/hs-select-item/hs-select-item"; import HsSelectItem from "../../components/hs-select-item/hs-select-item";
import HsMaterialThumbnail from "../../components/hs-material-thumbnail/hs-material-thumbnail"; import HsMaterialThumbnail from "../../components/hs-material-thumbnail/hs-material-thumbnail";
export default { export default {
name: "listSelectToAdd", name: "listSelectToAdd",
components: {HsMaterialThumbnail, HsSelectItem}, components: {HsMaterialThumbnail, HsSelectItem},
mixins:[dom],
data(){ data(){
return { return {
keyword: "", keyword: "",
selectedIndex: "", selectedIndex: -1,
selectedItem: {},
list: [ list: [
{ {
title: '加厚荷兰绒绒布布料', title: '加厚荷兰绒绒布布料',
...@@ -59,12 +66,47 @@ export default { ...@@ -59,12 +66,47 @@ export default {
title: '加厚荷兰绒绒布布料加厚荷兰绒绒布布料', title: '加厚荷兰绒绒布布料加厚荷兰绒绒布布料',
id: 12 id: 12
}, },
{
title: '加厚荷兰绒绒布布料',
id: 221
},
{ {
title: '加厚荷兰绒绒布布料', title: '加厚荷兰绒绒布布料',
id: 22 id: 22
},
{
title: '加厚荷兰绒绒布布料',
id: 224
},
{
title: '加厚荷兰绒绒布布料',
id: 222
} }
] ]
} }
},
methods:{
triggerSelectItem(index){
this.selectedIndex = index === this.selectedIndex ? -1 : index;
},
// 跳转到新增详情页面
toAddItem({id}){
this.$Router.push({
path:"/pages/designCommissioned/addItem",
query:{
id
}
})
},
// 跳转到面料详情
toMaterialDetail({id}){
this.$Router.push({
path:"/pages/home/fabricDetails",
query:{
id
}
})
},
} }
} }
</script> </script>
...@@ -72,6 +114,17 @@ export default { ...@@ -72,6 +114,17 @@ export default {
<style scoped lang="scss"> <style scoped lang="scss">
$h-color: #AF8D66; $h-color: #AF8D66;
$main-color: #fff; $main-color: #fff;
.body{
position: absolute;
width: 100%;
height: auto;
left: 0;
right: 0;
bottom: 0;
top: 0;
overflow-y: auto;
}
.title{ .title{
color: $h-color; color: $h-color;
background-color: whitesmoke; background-color: whitesmoke;
......
export default {
data(){
return{
headerHeight: 0,
footerHeight: 0
}
},
methods:{
getHeaderHeight(){
this.$nextTick(() =>{
this.uGetRect("#header").then(res =>{
this.headerHeight = res.height;
})
})
},
getFooterHeight(){
this.$nextTick(() =>{
this.uGetRect("#footer").then(res =>{
this.footerHeight = res.height;
})
})
},
uGetRect(selector, all) {
return new Promise((resolve) => {
uni.createSelectorQuery()
.in(this)[all ? 'selectAll' : 'select'](selector)
.boundingClientRect((rect) => {
if (all && Array.isArray(rect) && rect.length) {
resolve(rect)
}
if (!all && rect) {
resolve(rect)
}
if(rect === null){
resolve({})
}
})
.exec()
})
},
},
mounted() {
this.getHeaderHeight();
this.getFooterHeight();
},
}
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