Commit 7dc00c29 authored by 李星剑's avatar 李星剑

款式委托 新增

parent 0959a22f
......@@ -3,7 +3,7 @@
<image class="width_100 hs-height-160" src="@/static/images/home/1@2x.png" mode=""></image>
<view class="order_tit">
<view class="u-flex justify-between u-font-32">
<span class="color_DDA973 u-line-1">{{ item.name }}</span>
<span class="color_DDA973 u-line-1">{{ item.materialName }}</span>
<span><u-icon size="24" color="#fff" name="arrow-right"></u-icon></span>
</view>
<view class="u-font-24 u-m-t-20 color_6F6F72">
......
......@@ -15,12 +15,12 @@ export default {
// 编辑委托单
update:{
url: `${base}/update`,
method: 'post'
method: 'put'
},
// 拆分委托单
split:{
url: `${base}/split`,
method: 'post'
method: 'put'
},
// 删除委托单
del:{
......
<template>
<view>
<!--导航栏 navbar-->
<u-navbar title="新增委托" id="header"
<u-navbar :title="detail.id ? '修改委托':'新增委托'" id="header"
:border-bottom="false"
:background="{backgroundColor: 'whitesmoke'}">
</u-navbar>
......@@ -11,7 +11,7 @@
<view class="u-p-30 bg-fff u-m-b-20">
<hs-tip-title title="所选面料"></hs-tip-title>
<view >
<!-- <hs-material-thumbnail></hs-material-thumbnail>-->
<hs-material-thumbnail :item="item"></hs-material-thumbnail>
</view>
</view>
<!--面料颜色要求-->
......@@ -36,22 +36,22 @@
</view>
</view>
<!--风格款数要求-->
<view class="u-p-30 u-m-b-20 bg-fff">
<view class="u-p-t-30 u-p-r-30 u-p-l-30 u-m-b-20 bg-fff">
<hs-tip-title title="风格款数要求"></hs-tip-title>
<view v-for="(item,index) in detail.designRequirementsDTOList" :key="index" class="u-p-t-16 u-p-b-30 u-border-bottom">
<view v-for="(item,index) in brandList" :key="item.id" class="u-p-t-16 u-p-b-30 u-border-bottom">
<view class="u-flex u-p-b-16">
<view class="u-line-1 u-flex-1">
{{item.name}}
</view>
<text class="del" @click="showDelModal(index)">删除</text>
<text class="del" @click="showDelModal(item)">删除</text>
</view>
<u-number-box v-model="item.quantity"></u-number-box>
</view>
<view class="brandList-tip u-m-t-20 " v-if="total>0">
需求款式总数 {{total}}
<view class="brandList-tip u-m-t-20 u-m-b-20">
需求款式总数 <text class="u-m-l-40">{{total}}</text>
</view>
<view class="u-m-t-20">
<u-button plain @click="addBrandList" type="primary">+添加风格</u-button>
<view class="u-border-top">
<view @click="addBrandList" class="button-plain">+添加风格</view>
</view>
</view>
......@@ -159,6 +159,9 @@
</view>
</view>
</u-popup>
<!--提示-->
<u-toast ref="uToast" />
</view>
</template>
......@@ -205,9 +208,16 @@ export default {
},
footerHeight: 0,
headerHeight: 0,
item :{}
}
},
computed:{
// 风格款数
brandList(){
return this.detail.designRequirementsDTOList.filter((item) => {
return item.isDeleted === false
})
},
// 总的颜色数据源
colorTree(){
function arr2Tree(data, id = "colourGroup") {
......@@ -258,7 +268,7 @@ export default {
f(data,levels,0)
}
return active;
};
}
let data = filter([{children:this.colorTree}] || [],levels);
return data.map((item) => {
return {
......@@ -266,7 +276,10 @@ export default {
...{
selectLength: this.setLength(item,this.activeColorIds),
selectText: this.setText(item,this.activeColorIds),
checked: (this.detail.colourList || [])
checked: this.detail.colourList
.filter((item) =>{
return item.isDeleted === false
})
.map(($item) => {
return $item.mdmColourId
})
......@@ -277,15 +290,24 @@ export default {
},
// 选中的颜色id List
activeColorIds(){
return this.detail.colourList.map((item) =>{
return item.mdmColourId
});
return this.detail.colourList
.filter((item) =>{
return item.isDeleted === false
})
.map((item) =>{
return item.mdmColourId
});
},
// 选中的颜色id List
activeColorText(){
return this.detail.colourList.map((item) =>{
return item.colour
}).join("|");
return this.detail.colourList
.filter((item) =>{
return item.isDeleted === false
})
.map((item) =>{
return item.colour
})
.join("|");
},
// 最小颜色长度
minColorsLength(){
......@@ -302,11 +324,23 @@ export default {
},0)
}
},
created() {
async onLoad({id,_id}) {
// 获取颜色组
this.getColors();
// 获取风格数据
this.getStyleTreeList();
await this.getStyleTreeList();
// 获取详情
this.item = uni.getStorageSync("_item") || {};
if(id && id !== 'undefined'){
this.getItemMsg(id);
}else{
this.detail.materialId = this.item.materialId;
this.detail.fileCode = this.item.materialCode;
}
// if(_id && _id !== 'undefined'){
// this.getMaterialDetail(id);
// }
},
mounted() {
this.uGetRect("#footer").then(res =>{
......@@ -317,6 +351,76 @@ export default {
})
},
methods:{
getMaterialDetail(){
// this.$http('orderTicket.materialList', this.id).then(res => {
// let { code, data } = res;
// if (code == 200) {
// this.item = data.data;
// }
// });
},
filterStyleNameById(id){
/**
* 回填品类 显示 string => []
* @param data
* @param value
* @return [Array]
* */
function filterCategory(data,value){
let res = [];
function filters(data,value,parent = []){
for (let i = 0; i < data.length; i++) {
if(data[i].id == value){
res = [].concat(parent,data[i])
}else{
if(data[i].children && data[i].children.length > 0){
filters(
data[i].children,
value,
parent.concat(data[i])
)
}
}
}
}
filters(data,value)
return res;
}
return filterCategory(this.brandSelectList,id).map((item) =>{
return item.name
}).join("|")
},
getItemMsg(id){
this.detail.id = id;
this.$http("orderTicket.detail", id).then(res =>{
let {
code, data
} = res;
if(code === 200){
this.detail = {
designRequirementsDTOList: data.orderTicketStyleRequirementsVOList.map((item) =>{
return {
...item,
name: this.filterStyleNameById(item.styleId)
}
}),
colourList: data.orderTicketColourVOList.map((item) =>{
return {
...item,
...{
colour : item.mdmColourName
}
}
}),
id: data.id,
materialId: data.mdmMaterialId,
expirationDate: data.expirationDate,
referToBrand: data.referToBrand,
otherDescribe: data.otherDescribe
}
}
})
},
getColors(){
this.$http("colors.getColors").then(res =>{
let {
......@@ -324,10 +428,12 @@ export default {
} = res;
if(code === 200){
this.colors = data.map((item) =>{
return {
let res = {
...item,
mdmColourId: item.id
}
};
delete res.id;
return res;
});
}
})
......@@ -337,7 +443,7 @@ export default {
setLength(item,target){
if(item.children){
return item.children.filter($item =>{
return target.indexOf($item.id) > -1
return target.indexOf($item.mdmColourId) > -1
}).length
}else{
return 0
......@@ -346,7 +452,7 @@ export default {
setText(item,target){
if(item.children){
return item.children.filter($item =>{
return target.indexOf($item.id) > -1
return target.indexOf($item.mdmColourId) > -1
}).map(($item) =>{
return $item.colour
}).join(" | ")
......@@ -367,13 +473,26 @@ export default {
// 层级选择
treeClick(treeItem,index) {
if(this.colorDialog.levels.length > 1){
let index = this.detail.colourList.findIndex((item) => {
return item.id === treeItem.id
let $list = this.detail.colourList;
let $index = $list.findIndex(($item) => {
return $item.mdmColourId === treeItem.mdmColourId
});
if(index > -1){
this.detail.colourList.splice(index,1)
}else {
this.detail.colourList.push(treeItem);
if($index > -1){
let item = $list[$index];
if(item.id){
this.$set($list,$index,{
...item,
isDeleted: !item.isDeleted,
})
}else{
$list.splice($index,1)
}
}else{
this.detail.colourList.push({
...treeItem,
isDeleted: false
})
}
this.detail.colourQuantity = this.detail.colourList.length
}else{
......@@ -387,6 +506,7 @@ export default {
addBrandList(){
this.brandSelectShow = true;
},
// 风格款数新增
brandSelectCallback(e){
this.detail.designRequirementsDTOList.push({
quantity: 0,
......@@ -398,16 +518,33 @@ export default {
})
},
// 显示删除模态框
showDelModal(index){
showDelModal(item){
this.modal.show = true;
this.activeIndex = index;
this.activeIndex = item;
},
// 显示删除模态框
modalConfirm(){
this.delBrandRow(this.activeIndex);
this.delBrandRow();
},
delBrandRow(index) {
this.detail.designRequirementsDTOList.splice(index,1)
delBrandRow() {
let { id } = this.activeIndex;
if(id){
let $data = this.detail.designRequirementsDTOList;
let index = $data.findIndex((item) => {
return item === this.activeIndex
});
this.$set($data,index,{
...$data[index],
isDeleted: true
})
}else{
let index = this.brandList.findIndex((item) => {
return item === this.activeIndex
})
if(index > -1){
this.detail.designRequirementsDTOList.splice(index,1)
}
}
},
timePickerCallback(e){
let {
......@@ -417,12 +554,59 @@ export default {
} = e;
this.detail.expirationDate = [year,month,day].join("-")
},
toBack(){
this.$Router.back();
},
toast(msg,callback){
this.$refs.uToast.show({
title: msg,
callback: ()=>{
callback && callback();
}
});
},
validate(){
let {colourList,designRequirementsDTOList,expirationDate} = this.detail;
if(!expirationDate){
this.toast("截止日期不能为空");
return false;
}
if(
designRequirementsDTOList.filter((item) =>{
return item.isDeleted === false
}).length === 0
){
this.toast("风格款数要求不能为空");
return false;
}
if(
colourList.filter((item) =>{
return item.isDeleted === false
}).length === 0
){
this.toast("指定颜色数量不能为空");
return false;
}
},
submit(data){
this.$http("orderTicket.save",{
if(this.validate() === false) return;
let submitStatus = this.detail.id ? "orderTicket.update":"orderTicket.save"
this.$http(submitStatus,{
...data,
...this.detail
}).then(res => {
let {
code, msg
} = res;
if(code === 200){
this.toast(msg,()=>{
this.back();
})
}else{
this.toast(msg)
}
})
},
saveData(){
......@@ -458,6 +642,11 @@ export default {
.bg-fff{
background: #fff;
}
.button-plain{
text-align: center;
color: #DDA973;
line-height: 88rpx;
}
.body{
background: #fafafa;
position: absolute;
......
<template>
</template>
<script>
export default {
name: "editItem"
}
</script>
<style scoped>
</style>
<template>
<view>
<!--导航栏 navbar-->
<u-navbar title="委托详情" id="header"
:border-bottom="false"
:background="{backgroundColor: 'whitesmoke'}">
</u-navbar>
<!--主体内容-->
<view class="body u-p-30" :style="{ bottom: footerHeight + 'px', top: headerHeight+ 'px'}">
<view class="u-flex u-p-b-20">
<view class="item-status">
{{
this.statusList[this.detail.status]
}}
</view>
<text class="item-status u-flex-1 text-right">
截止日期: {{this.detail.expirationDate }}
</text>
</view>
<!--所选面料-->
<view class="u-p-r-30 u-p-b-30 u-p-l-30 bg-fff u-m-b-20">
<view class="u-l-height-44">所选面料</view>
<view >
<hs-material-thumbnail :item="detail"></hs-material-thumbnail>
</view>
</view>
<!--面料颜色要求-->
<view class="bg-fff u-p-r-30 u-p-b-30 u-p-l-30 u-m-b-20">
<view class="u-border-bottom u-l-height-44">面料颜色要求</view>
<view class="u-flex u-m-t-18 u-m-b-8">
<view class="u-m-r-40 label">已指定颜色</view>
<view class="u-line-1 u-flex-1 content">
{{
activeColorText
}}
</view>
</view>
<view class="u-flex u-m-t-18 u-m-b-8">
<view class="u-m-r-40 label">可用颜色数</view>
<view class="u-line-1 u-flex-1 content">
{{detail.colourQuantity}}
</view>
</view>
</view>
<!--风格款数要求-->
<view class="bg-fff u-p-r-30 u-p-b-30 u-p-l-30 u-m-b-20">
<view class="u-border-bottom u-l-height-44">风格款数要求</view>
<view v-for="(item,index) in brandList" :key="item.id">
<view class="u-flex u-m-t-18 u-m-b-8">
<view class="u-m-r-40 label">风格{{index+1}}</view>
<view class="u-line-1 u-flex-1 content">
{{item.name}}
</view>
</view>
<view class="u-flex u-m-t-18 u-m-b-8">
<view class="u-m-r-40 label">风格{{index+1}}款数</view>
<view class="u-line-1 u-flex-1 content">
{{item.quantity}}
</view>
</view>
</view>
</view>
<!--其他要求-->
<view class="bg-fff u-p-r-30 u-p-b-30 u-p-l-30 ">
<view class="u-border-bottom u-l-height-44">其他要求</view>
<view class="u-flex u-m-t-18 u-m-b-8">
<view class="u-m-r-40 label">参考品牌</view>
<view class="u-line-1 u-flex-1 content">
{{
detail.referToBrand
}}
</view>
</view>
<view class="u-flex u-m-t-18 u-m-b-8">
<view class="u-m-r-40 label">其他描述</view>
<view class="u-line-1 u-flex-1 content">
{{
detail.otherDescribe
}}
</view>
</view>
</view>
</view>
<!--底部按钮-->
<view class="footer" id="footer" v-if="footerShow">
<view class="footer-btn">
<!--待选款 显示选款按钮 状态9 -->
<view class="custom-style-round-circle custom-style-btn custom-style"
v-if="this.detail.status === 9">
<view class="custom-style-right submit" @click="submitData">
<view class="title">选款</view>
<view class="desc">已完成数量:<text class="color">11</text></view>
</view>
</view>
<!--拆单 拆单按钮 状态 1 5 6 -->
<view class="custom-style-round-circle custom-style-btn custom-style"
v-if="this.detail.status === 1 || this.detail.status === 5 || this.detail.status === 6">
<view class="custom-style-left save" @click="toBack">返回</view>
<view class="custom-style-right submit" @click="toSplitItem">
拆单
</view>
</view>
</view>
<!--待发布 立即按钮 状态 4 -->
<view class="custom-style-round-circle custom-style-btn custom-style"
v-if="this.detail.status === 4">
<view class="custom-style-left save" @click="toEditItem">编辑</view>
<view class="custom-style-right submit" @click="submitData">
立即发布
</view>
</view>
</view>
<!--提示-->
<u-toast ref="uToast" />
</view>
</template>
<script>
import dom from "./mixins/dom"
import styleTree from "./mixins/styleTree"
import HsTipTitle from "../../components/hs-tip-title/hs-tip-title";
import HsMaterialThumbnail from "../../components/hs-material-thumbnail/hs-material-thumbnail";
export default {
name: "index",
components: {HsMaterialThumbnail, HsTipTitle},
mixins:[dom,styleTree],
data(){
return{
// 1-无人接单、2-延误、3-待定超过、4-待发布、5-审核中、6-待接单、7-已接单、8-已寄样、9-待选款、10-已结束
// 拆单 [无人接单 1、]
// 延误 [延误 2]
// 选款 [待定超过 3]
// 撤回 编辑 [待发布 4]
// 取消 拆单 [审核中 5]
// 撤回 拆单 [待接单 6]
// 寄样 已接单 7
// 没有按钮 已寄样 8
// 选款 待选款 9
// 没有按钮 已结束 10
statusList: ["","无人接单","延误","待定超过","待发布","审核中","待接单","已接单","已寄样","待选款","已结束"],
timePickerShow: false,
brandSelectShow: false,
colorPickerShow: false,
modal:{
show: false,
content: "确认删除?"
},
activeIndex: -1,
detail:{
materialId: 1, // todo 主数据面料id
fileCode: '', // 面料主图code
colourQuantity: 0, //可用颜色数量
designRequirementsDTOList: [
// {
// "styleId": 1, //风格要求id
// "quantity": 20 //风格要求款数
// }
],
status: 1,
colourList: [], //选中颜色
expirationDate: "", //截止日期
referToBrand: "", // 参考品牌
otherDescribe: "", //其他描述
},
brandSelectList: [], // 风格 tree
colors: [], //颜色组
colorDialog:{
show: false,
levels: [0],
selectList: [],
},
footerHeight: 0,
headerHeight: 0,
}
},
computed:{
footerShow(){
let status = this.detail.status;
return status !== 8 || status !== 10
},
// 风格款数
brandList(){
return this.detail.designRequirementsDTOList.filter((item) => {
return item.isDeleted === false
})
},
// 总的颜色数据源
colorTree(){
function arr2Tree(data, id = "colourGroup") {
const newList = [],
map = Array.from(
new Set(
data.map((item) => {
return item["colourGroup"];
})
)
);
for (let i = 0; i < data.length; i++) {
let item = data[i],
name = item[id],
index = map.indexOf(name);
if (newList[index]) {
newList[index]["children"].push(item);
} else {
newList.push({
colour: name,
children: [item]
});
}
}
return newList;
};
return arr2Tree(this.colors);
},
// 当前页选择颜色显示的内容
activeColorTree(){
let {
levels
} = this.colorDialog;
function filter(data,levels){
let active = [];
function f(data,level,index){
let {children} = data[level[index]];
if(index === level.length - 1){
active = children
return;
}else{
index++;
f(children,level,index)
}
}
if(data.length > 0){
f(data,levels,0)
}
return active;
}
let data = filter([{children:this.colorTree}] || [],levels);
return data.map((item) => {
return {
...item,
...{
selectLength: this.setLength(item,this.activeColorIds),
selectText: this.setText(item,this.activeColorIds),
checked: this.detail.colourList
.filter((item) =>{
return item.isDeleted === false
})
.map(($item) => {
return $item.mdmColourId
})
.indexOf(item.mdmColourId) > -1
}
}
})
},
// 选中的颜色id List
activeColorIds(){
return this.detail.colourList
.filter((item) =>{
return item.isDeleted === false
})
.map((item) =>{
return item.mdmColourId
});
},
// 选中的颜色id List
activeColorText(){
return this.detail.colourList
.filter((item) =>{
return item.isDeleted === false
})
.map((item) =>{
return item.colour
})
.join("|");
},
// 最小颜色长度
minColorsLength(){
return this.detail.colourList.length
},
// 风格款数 总数
total(){
return this.detail.designRequirementsDTOList
.filter((item) =>{
return item.isDeleted !== true
})
.reduce((total,currentValue) =>{
return total + currentValue.quantity;
},0)
}
},
async onLoad({id}) {
// 获取颜色组
this.getColors();
// 获取风格数据
await this.getStyleTreeList();
// 获取详情
if(id){
this.getItemMsg(id);
}
},
mounted() {
this.uGetRect("#footer").then(res =>{
this.footerHeight = res.height;
})
this.uGetRect("#header").then(res =>{
this.headerHeight = res.height;
})
},
methods:{
filterStyleNameById(id){
/**
* 回填品类 显示 string => []
* @param data
* @param value
* @return [Array]
* */
function filterCategory(data,value){
let res = [];
function filters(data,value,parent = []){
for (let i = 0; i < data.length; i++) {
if(data[i].id == value){
res = [].concat(parent,data[i])
}else{
if(data[i].children && data[i].children.length > 0){
filters(
data[i].children,
value,
parent.concat(data[i])
)
}
}
}
}
filters(data,value)
return res;
}
return filterCategory(this.brandSelectList,id).map((item) =>{
return item.name
}).join("|")
},
getItemMsg(id){
this.detail.id = id;
this.$http("orderTicket.detail", id).then(res =>{
let {
code, data
} = res;
if(code === 200){
if(Object.keys(data).length > 0){
this.detail = {
designRequirementsDTOList: data.orderTicketStyleRequirementsVOList.map((item) =>{
return {
...item,
name: this.filterStyleNameById(item.styleId)
}
}),
colourList: data.orderTicketColourVOList.map((item) =>{
return {
...item,
...{
colour : item.mdmColourName
}
}
}),
id: data.id,
materialId: data.mdmMaterialId,
expirationDate: data.expirationDate,
referToBrand: data.referToBrand,
otherDescribe: data.otherDescribe,
colourQuantity: data.colourQuantity,
status: data.status
}
}else{
this.$refs.uToast.show({
title: res.msg,
callback: ()=>{
this.toBack();
}
});
}
}
})
},
getColors(){
this.$http("colors.getColors").then(res =>{
let {
code, data
} = res;
if(code === 200){
this.colors = data.map((item) =>{
let res = {
...item,
mdmColourId: item.id
};
delete res.id;
return res;
});
}
})
},
// !----
// 返回
toBack(){
this.$Router.back();
},
// 取消发布
cancel(){
this.$http('orderTicket.abolishByIds', [this.detail.id]).then(res => {
let { code, data } = res;
if (code === 200) {
this.$refs.uToast.show({
title: '取消成功'
});
this.toBack();
}
});
},
// 删除
toDel(){
this.$http('orderTicket.del', [this.detail.id]).then(res => {
let { code, data } = res;
if (code === 200) {
this.$refs.uToast.show({
title: '删除成功'
});
this.toBack();
}
});
},
// 跳转到拆单
toSplitItem(){
this.$Router.push({
path: '/pages/designCommissioned/splitItem',
query: {
id: this.detail.id
}
})
},
// 跳转到详情 编辑
toEditItem(){
this.$Router.push({
path: '/pages/designCommissioned/addItem',
query: {
id: this.detail.id
}
})
},
// 跳转到选款
toSelectItem(){
},
// ----!
setLength(item,target){
if(item.children){
return item.children.filter($item =>{
return target.indexOf($item.mdmColourId) > -1
}).length
}else{
return 0
}
},
setText(item,target){
if(item.children){
return item.children.filter($item =>{
return target.indexOf($item.mdmColourId) > -1
}).map(($item) =>{
return $item.colour
}).join(" | ")
}else{
return ""
}
},
colorsReset(){
this.detail.colourList = []
},
colorsConfirm(){
if(this.colorDialog.levels.length > 1){
this.colorDialogLevelPop()
}else{
this.colorDialog.show = false;
}
},
// 层级选择
treeClick(treeItem,index) {
if(this.colorDialog.levels.length > 1){
let $list = this.detail.colourList;
let $index = $list.findIndex(($item) => {
return $item.mdmColourId === treeItem.mdmColourId
});
if($index > -1){
let item = $list[$index];
if(item.id){
this.$set($list,$index,{
...item,
isDeleted: !item.isDeleted,
})
}else{
$list.splice($index,1)
}
}else{
this.detail.colourList.push({
...treeItem,
isDeleted: false
})
}
this.detail.colourQuantity = this.detail.colourList.length
}else{
this.colorDialog.levels.push(index);
}
},
colorDialogLevelPop(){
this.colorDialog.levels.pop();
},
addBrandList(){
this.brandSelectShow = true;
},
// 风格款数新增
brandSelectCallback(e){
this.detail.designRequirementsDTOList.push({
quantity: 0,
styleId: e[e.length - 1].value,
isDeleted: false,
name: e.map((item) => {
return item.label
}).join("|")
})
},
// 显示删除模态框
showDelModal(item){
this.modal.show = true;
this.activeIndex = item;
},
// 显示删除模态框
modalConfirm(){
this.delBrandRow();
},
delBrandRow() {
let { id } = this.activeIndex;
if(id){
let $data = this.detail.designRequirementsDTOList;
let index = $data.findIndex((item) => {
return item === this.activeIndex
});
this.$set($data,index,{
...$data[index],
isDeleted: true
})
}else{
let index = this.brandList.findIndex((item) => {
return item === this.activeIndex
})
if(index > -1){
this.detail.designRequirementsDTOList.splice(index,1)
}
}
},
timePickerCallback(e){
let {
day,
month,
year,
} = e;
this.detail.expirationDate = [year,month,day].join("-")
},
submit(data){
let submitStatus = this.detail.id ? "orderTicket.update":"orderTicket.save"
this.$http(submitStatus,{
...data,
...this.detail
}).then(res => {
})
},
saveData(){
this.submit({
operationType: 1
})
},
submitData(){
this.submit({
operationType: 2
})
}
}
}
</script>
<style scoped lang="scss">
@mixin vue-flex($direction: row) {
/* #ifndef APP-NVUE */
display: flex;
flex-direction: $direction;
/* #endif */
}
.label{
color: rgba(0,0,0,0.40);
font-size: 28rpx;
min-width: 140rpx;
}
.context{
color: #000;
font-size: 28rpx;
}
.u-l-height-32{
height: 64rpx;
line-height: 64rpx;
}
.u-l-height-44{
height: 88rpx;
line-height: 88rpx;
}
.u-m-l-75{ margin-left: 150rpx;}
.u-m-l-53{ margin-left: 108rpx;}
.del{
color: #FA5353;
}
.bg-fff{
background: #fff;
}
.body{
background: #fafafa;
position: absolute;
width: 100%;
height: auto;
left: 0;
right: 0;
bottom: 0;
top: 0;
overflow-y: auto;
}
.tree {
@include vue-flex;
flex-wrap: wrap;
.tree-level {
@include vue-flex;
width: 100%;
font-size: 32rpx;
.active-text{
color: #DDA973;
}
.tree-level-text {
flex: 1;
overflow: hidden;
.tree-level-text--selected {
font-size: 28rpx;
color: red;
}
}
}
}
.brandList-tip{
height: 88rpx;
background: #fcfaf7;
border: 1px solid rgba(68,53,37,0.10);
border-radius: 8rpx;
line-height: 88rpx;
padding-left: 30rpx;
}
.custom-style{
color: #fff; height: 88rpx; line-height: 88rpx;
@include vue-flex;
&-btn{
overflow: hidden;
}
&-round-circle{
border-radius: 100rpx;
}
/*background: #000;*/
.custom-style-left{ width: 240rpx; background: #d6d6d6; text-align: center }
.custom-style-right{ flex: 1; background: rgba(0,0,0,0.80);text-align: center}
.save{
font-size: 34rpx;
color: #000000;
}
.submit{
font-weight: 500;
font-size: 34rpx;
//line-height: 100%;
.title{
//margin: 8rpx 0;
}
.desc{
font-size: 20rpx;
.color{
color: #DDA973;
}
}
}
}
.footer {
position: fixed;
width: 100%;
bottom: 0;
z-index: 998;
background: #fff;
box-shadow: 0px -4rpx 6rpx 0px rgba(178,182,214,0.10);
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
.footer-btn{
padding: 20rpx 60rpx;
}
}
</style>
......@@ -7,7 +7,7 @@
:border-bottom="false"
:background="{backgroundColor: 'whitesmoke'}">
<template v-slot:right>
新增面料
<!-- 新增面料-->
</template>
</u-navbar>
<view class="title u-p-30">选择面料</view>
......@@ -85,17 +85,33 @@ export default {
]
}
},
onLoad(){
this.getList();
},
methods:{
getList(){
this.$http('orderTicket.materialList', {
size: 4,
materialCode: '',
materialName: ''
}).then(res => {
let { code, data } = res;
if (code == 200) {
this.list = data.data;
}
});
},
triggerSelectItem(index){
this.selectedIndex = index === this.selectedIndex ? -1 : index;
},
// 跳转到新增详情页面
toAddItem({id}){
toAddItem(){
uni.setStorageSync("_item", this.list[this.selectedIndex]);
this.$Router.push({
path:"/pages/designCommissioned/addItem",
query:{
id
}
// query:{
// id: this.list[this.selectedIndex].id
// }
})
},
// 跳转到面料详情
......
......@@ -12,14 +12,20 @@ export default {
}
return data
}
this.$http("orderTicket.styleTreeList").then(res =>{
let {
code, data
} = res;
if(code === 200){
this.brandSelectList = filterArray(data);
}
return new Promise((resolve, reject) =>{
this.$http("orderTicket.styleTreeList").then(res =>{
let {
code, data
} = res;
if(code === 200){
this.brandSelectList = filterArray(data);
resolve();
}
}).catch(err =>{
reject(err);
})
})
},
}
}
......@@ -15,7 +15,7 @@
</view>
<view class="u-p-30 bg-fff">
<hs-tip-title title="风格款数要求"></hs-tip-title>
<view v-for="(item,index) in detail.orderTicketStyleRequirementsVOList" :key="index" class="u-p-t-16 u-p-b-30 u-border-bottom">
<view v-for="(item,index) in detail.designRequirementsDTOList" :key="index" class="u-p-t-16 u-p-b-30 u-border-bottom">
<view class="u-flex u-p-b-16">
<view class="u-line-1 u-flex-1">
{{item.name}}
......@@ -28,16 +28,19 @@
</view>
<u-select
label-name="name"
value-name="id"
@confirm="brandSelectCallback"
safe-area-inset-bottom v-model="brandSelectShow" :list="brandSelectList" mode="mutil-column-auto"></u-select>
<!-- 删除风格款数模态框 -->
<u-modal v-model="modal.show" :content="modal.content" @confirm="modalConfirm" ></u-modal>
<!--提示-->
<u-toast ref="uToast" />
<view class="footer" id="footer">
<view class="footer-btn">
<view class="custom-style-round-circle custom-style-btn custom-style">
<view class="custom-style-left save" @click="save">保存</view>
<view class="custom-style-right submit" @click="submit">
<view class="custom-style-left save" @click="saveData">保存</view>
<view class="custom-style-right submit" @click="submitData">
<view class="title">立即发布</view>
<view class="desc">将被拆分为<text class="color">2个委托</text></view>
</view>
......@@ -48,6 +51,7 @@
</template>
<script>
import styleTree from "./mixins/styleTree"
import HsTipTitle from "../../components/hs-tip-title/hs-tip-title";
export default {
......@@ -66,23 +70,23 @@ export default {
activeIndex: -1,
brandSelectList: [],
detail: {
orderTicketStyleRequirementsVOList: [
// "id": 1, //委托单id
// "materialId": 1, //面料id
// "fileCode": "", //面料主图code
designRequirementsDTOList: [
],
},
}
},
onLoad({id}) {
async onLoad({id}) {
await this.getStyleTreeList();
this.getItemMsg(id);
this.getStyleTreeList();
},
computed:{
mdmMaterial(){
return {
name: this.detail.mdmMaterialName,
...this.detail,
// name: item.mdmMaterialName,
}
return this.detail
}
},
methods:{
......@@ -98,12 +102,55 @@ export default {
delItem(index){
this.detail.orderTicketStyleRequirementsVOList.splice(index,1);
},
filterStyleNameById(id){
/**
* 回填品类 显示 string => []
* @param data
* @param value
* @return [Array]
* */
function filterCategory(data,value){
let res = [];
function filters(data,value,parent = []){
for (let i = 0; i < data.length; i++) {
if(data[i].id == value){
res = [].concat(parent,data[i])
}else{
if(data[i].children && data[i].children.length > 0){
filters(
data[i].children,
value,
parent.concat(data[i])
)
}
}
}
}
filters(data,value)
return res;
}
return filterCategory(this.brandSelectList,id).map((item) =>{
return item.name
}).join("|")
},
getItemMsg(id){
this.$http("orderTicket.detail",1).then(res =>{
this.detail.id = id;
this.$http("orderTicket.detail", id).then(res =>{
let {
code, data
} = res;
if(code === 200){
this.detail = {
designRequirementsDTOList: data.orderTicketStyleRequirementsVOList.map((item) =>{
return {
...item,
name: this.filterStyleNameById(item.styleId)
}
}),
id: data.id,
materialId: data.mdmMaterialId,
}
}
})
},
addBrandList(){
......@@ -111,18 +158,49 @@ export default {
},
brandSelectCallback(e){
this.brandList.push({
num: 0,
this.detail.designRequirementsDTOList.push({
quantity: 0,
styleId: e[e.length - 1].value,
isDeleted: false,
name: e.map((item) => {
return item.label
}).join("|")
})
},
submit(){
toBack(){
this.$Router.back();
},
save(){
toast(msg,callback){
this.$refs.uToast.show({
title: msg,
callback: ()=>{
callback && callback();
}
});
},
submit(operationType){
this.$http("orderTicket.split",{
...this.detail,
operationType
}).then(res => {
// this.$Router.back();
let {
code, msg
} = res;
if(code === 200){
this.toast(msg,()=>{
this.back();
})
}else{
this.toast(msg)
}
})
},
submitData(){
this.submit(2)
},
saveData(){
this.submit(1)
},
}
}
......
......@@ -371,7 +371,7 @@ export default {
// 注册成功 跳转到首页
goIndex(){
this.$Router.replace({
path: '/pages/index/index'
path: '/pages/home/index'
})
},
// 获取详情 过滤状态 如果完善就跳转首页
......@@ -540,7 +540,7 @@ export default {
if (this.time === 0) {
clearInterval(timer);
this.$Router.replace({
path: '/pages/index/index'
path: '/pages/home/index'
})
}
}, 1000);
......
......@@ -7,7 +7,7 @@
</view>
<!-- <button @click="getTenanList">getTenanList</button>-->
<button @click="next" :disabled="active === -1">下一步</button>
<button @click="login">下一步</button>
<!-- <button @click="login">下一步</button>-->
<!-- <view>encryptToken结果:{{token}}</view>-->
</view>
</template>
......@@ -30,6 +30,7 @@ export default {
// "tenantPlat": "string",
// "globalUserId": "string"
// }
// {globalId: "1375592964957573120", tenantId: "1442659610786926593", subId: "1442659610786926600"}
],
active: -1,
token: "",
......@@ -84,7 +85,7 @@ export default {
uni.setStorageSync('encryptToken',"")
},
login(){
uni.setStorageSync('encryptToken',"MBN9Om00MUE9CEcnizCOwinwRe5NJNdZb4JyDT3/ze+vyyv5QNXVoo0Sb65Gptgdy9BZZFX36tEge08iDEzLHIYsLS95bnrcwUOh1tp9pMiJ0XYNBFnFcHFXP9AgeAmYe9EXW+akUkx4Zr7PGiG7eqhuabLlPisHhoQOBfFFTwQ=")
// uni.setStorageSync('encryptToken',"MBN9Om00MUE9CEcnizCOwinwRe5NJNdZb4JyDT3/ze+vyyv5QNXVoo0Sb65Gptgdy9BZZFX36tEge08iDEzLHIYsLS95bnrcwUOh1tp9pMiJ0XYNBFnFcHFXP9AgeAmYe9EXW+akUkx4Zr7PGiG7eqhuabLlPisHhoQOBfFFTwQ=")
// 核对
this.$http(
"auth.checkSecretKey",
......@@ -124,7 +125,7 @@ export default {
// 跳转到首页
toIndexPage(){
this.$Router.push({
path: "/pages/index/index"
path: "/pages/home/index"
})
},
checkStatus(data){
......
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