Commit 4c028b62 authored by 李星剑's avatar 李星剑

提交

parent 9dfa8a2a
......@@ -9,7 +9,7 @@ export const BASE_URL = process.env.NODE_ENV === 'development' ? '/dev':'/prod-a
export const BASE_URL = "http://octopus-dev.textile-saas.huansi.net/dev-api/"
// export const BASE_URL = "http://10.10.10.31/"
// #endif
export const UPLOAD_URL = `${BASE_URL}/gdep-system/virtualfile/uploadFile`
export const API_URL = `${BASE_URL}` //后台接口域名
export const IMG_URL = `${BASE_URL}/gdep-system/virtualfile/downloadFile?fileCode=` //全局网络图片地址变量,css背景图片地址变量在uni.scss
export const IMG_URL = `https://huansi-gdep-dev.oss-cn-hangzhou.aliyuncs.com/` //全局网络图片地址变量,css背景图片地址变量在uni.scss
<script>
// import nativeEventReceive from "./mixins/nativeEventReceive";
export default {
// mixins:[nativeEventReceive],
data(){
return{
appVersion: ''
}
},
onLaunch: function() {
// // #ifdef APP-PLUS
// #ifdef APP-PLUS
// this.getAppVersion();
// // #endif
// this.initEvent();
// #endif
},
onShow: function() {
console.log('App Show')
......@@ -21,7 +24,7 @@
//获取App版本号
getAppVersion() {
let that = this;
console.log(plus.runtime.appid)
// console.log(plus.runtime.appid)
plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
that.appVersion = wgtinfo.version;
// that.update(this.appVersion)
......
// 挂载变量
import {
API_URL,
IMG_URL
IMG_URL,
UPLOAD_URL
} from '../../env.js';
// import store from '@/config/store';
import http from '@/config/request';
......@@ -22,6 +23,7 @@ import wechat from '@/config/wechat/wechat';
const install = Vue => {
Vue.prototype.$API_URL = API_URL;
Vue.prototype.$IMG_URL = IMG_URL;
Vue.prototype.$UPLOAD_URL = UPLOAD_URL;
// 挂载请求
Vue.prototype.$http = http;
// 平台判断
......
......@@ -5,15 +5,15 @@ export default {
method: "POST",
},
register:{
url: "gdep-enterprise/basics/basicsSaveAndroid",
url: "/gdep-enterprise/basics/basicsSaveAndroid",
method: "post"
},
checkMagStatus:{
url: "gdep-enterprise/basics/basicsWhetherOrNotPerfectAndroid",
url: "/gdep-enterprise/basics/basicsWhetherOrNotPerfectAndroid",
method: "post"
},
getItemMsg:{
url: "gdep-enterprise/basics/basicsDetailAndroid",
url: "/gdep-enterprise/basics/basicsDetailAndroid",
method: "post"
}
}
......
......@@ -5,6 +5,7 @@ import user from './apiList/user.js'
import auth from './apiList/auth.js'
import color from './apiList/colors.js'
import orderTicket from './apiList/orderTicket.js'
import modeling from './apiList/modeling.js'
// import goods from './apiList/goods.js'
// import base from './apiList/base.js'
......@@ -12,5 +13,6 @@ export default {
...user,
...auth,
...color,
...orderTicket
...orderTicket,
...modeling
};
......@@ -47,8 +47,8 @@ export default function http(
// token过期注销
if (response.code === 401) {
store.dispatch('logout');
router.push("/pages/user/login/login")
// store.dispatch('logout');
// router.push("/pages/user/login/login")
throw (`登录已过期或注销,已阻止此次API请求: '${api.url}'`);
}
return response
......
......@@ -9,6 +9,7 @@ import {
API_URL
} from '../../../env'
import platform from '@/config/platform/index';
import { sha256 } from 'js-sha256'
export default class Request {
constructor() {
// 默认配置
......@@ -105,11 +106,16 @@ export default class Request {
let query = Request.addQueryString(options.params);
mergeUrl += mergeUrl.indexOf('?') === -1 ? `?${query}` : `&${query}`
}
// fix this.$http('detail',1) get => /detail/1
if(typeof options.data !== 'object' && options.method === 'get'){
mergeUrl = mergeUrl + '/' +options.data;
options.data = {};
}
// fix 后台鉴权
if(options.url.startsWith("/gdep")||options.url.startsWith("gdep")){
// 让每个请求携带自定义hs-auth 请根据实际情况自行修改
options.header["hs-auth"] = sha256(options.url.substring(options.url.indexOf("/",1)) + " " +options.method.toLowerCase());
}
options.url = mergeUrl
options.success = res => {
......
......@@ -55,7 +55,7 @@ const router = createRouter({
router.beforeEach((to, from, next) => {
// 权限控制登录
if (to.meta && to.meta.auth && !store.getters.isLogin) {
next('/login');
// next('/login');
} else {
next()
}
......
......@@ -5,12 +5,18 @@ const state = {
token: uni.getStorageSync("token") || "",
isLogin: uni.getStorageSync("isLogin") || false, // 是否登陆
userInfo: uni.getStorageSync("userInfo") || {}, // 用户信息
tenanList: [
// {
// globalId: "1375592964957573120", tenantId: "1442659610786926593", subId: "1442659610786926600"
// }
] // 租户列表
}
const getters = {
token: state => state.token,
isLogin: state => state.isLogin,
userInfo: state => state.userInfo,
tenanList: state => state.tenanList,
}
const actions = {
......@@ -51,7 +57,10 @@ const mutations = {
userInfo(state, data) {
state.userInfo = data;
uni.setStorageSync("userInfo", data);
}
},
tenanList(state, payload) {
state.tenanList = payload
},
}
export default {
state,
......
export default {
methods:{
initEvent() {
// #ifdef APP-PLUS
uni.onNativeEventReceive((event, data)=>{
if(event === 'getTenantList'){
this.$store.commit("tenanList",JSON.parse(data))
// this.$store.tenanList = JSON.parse(data);
}else if(event === 'encryptToken'){
// this.token = data;
uni.setStorageSync('encryptToken', data);
this.login()
}
})
// #endif
},
getTenanList(){
// 向宿主App发送事件
uni.sendNativeEvent('getTenantList', {}, ret => {})
},
encryptToken(){
const active = this.list[this.selectedIndex];
uni.sendNativeEvent('encryptToken',JSON.stringify(
{
globalId: active.globalUserId,
tenantId: active.tenantId,
subId: active.id,
}
), ret => {})
},
triggerSelectItem(item){
this.selectedIndex = item;
},
login(){
// 核对
this.$http(
"auth.checkSecretKey",
uni.getStorageSync('encryptToken')
).then(res =>{
let {
code, data
} = res;
if(code === 200){
let {
userId, // 用户id
enterpriseId // 企业id
} = data;
this.userData = data;
uni.setStorageSync('tenantId', data.tenantId);
if(userId && enterpriseId){
this.createToken(data);
}else{
this.toRegister();
}
}
})
},
// 跳转到注册
toRegister(){
let {userId,enterpriseId,subId,tenantId} = this.userData;
this.$Router.push({
path: "/pages/user/register/stepSelectType",
query:{
pcUserId: userId || "",
pcBasicsId: enterpriseId || "",
tenantUserId:subId,
tenantId,
}
})
},
// 跳转到首页
toIndexPage(){
this.$Router.push({
path: "/pages/home/index"
})
},
checkStatus(data){
this.$http(
"user.checkMagStatus",{
pcUserId: data.userId,
pcBasicsId: data.enterpriseId,
}).then(res =>{
let { code ,data} = res;
if(code === 200){
// 1-面料供应商, 2-品牌商, 3-设计机构, 4-检测机构
let { identityType} = data.userLastIdentity;
if(identityType){
this.assignType = identityType;
this.filterStatus(data)
}
}
})
},
filterStatus(data){
// 0-未完善 1-已完善
let{
isBrandOwner, // 我要选款
isDesignAgency, // 完善设计机构信息
isFabricSupplier, //完善面料供应商信息
isTestingFacility, // 完善检测机构信息
} = data;
let { assignType} = this;
switch (assignType){
case "1":
isFabricSupplier ? this.toIndexPage() : this.toRegister();
return ;
case "2":
isBrandOwner ? this.toIndexPage() : this.toRegister();
return ;
case "3":
isDesignAgency ? this.toIndexPage() : this.toRegister();
return ;
case "4":
isTestingFacility ? this.toIndexPage() : this.toRegister();
return ;
default:
this.toRegister();
return;
}
},
createToken(data){
this.$http("auth.createTokenByApp" ,{
...{
identityType: uni.getStorageSync("identityType")
},
...data,
}).then(res =>{
let {
code, data
} = res;
if(code === 200){
uni.setStorageSync('token', data.accessToken);
uni.setStorageSync('pcUserId', data.userId);
uni.setStorageSync('pcBasicsId', data.enterpriseId);
// uni.setStorageSync('tenantId', this.userData.tenantId);
this.checkStatus(data);
}
})
},
next(){
this.encryptToken();
}
}
}
......@@ -5,20 +5,57 @@
},
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/user/tenanList/index",
"path": "pages/home/tenantSelection",
"style": {
"navigationBarTitleText": "选择租户",
"enablePullDownRefresh": false
"navigationBarTitleText": "租户选择",
"navigationBarTextStyle": "white",
"enablePullDownRefresh": false,
"navigationStyle": "custom",
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"allowsBounceVertical": "NO"
}
}
},
{
"path": "pages/user/register",
"path": "pages/user/register/stepSelectType",
"style": {
"navigationBarTitleText": "完善信息",
"enablePullDownRefresh": false
// "navigationBarTextStyle": "white",
"enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"allowsBounceVertical": "NO"
}
}
},
{
"path": "pages/user/register/perfectInformation",
"style": {
"navigationBarTitleText": "完善信息",
// "navigationBarTextStyle": "white",
"enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"allowsBounceVertical": "NO"
}
}
},
{
"path": "pages/user/register/success",
"style": {
"navigationBarTitleText": "完善信息",
// "navigationBarTextStyle": "white",
"enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"allowsBounceVertical": "NO"
}
}
},
{
"path": "pages/index/index",
......@@ -114,7 +151,8 @@
"allowsBounceVertical": "NO"
}
}
}, {
},
{
"path": "pages/home/fabricList",
"style": {
"navigationBarTitleText": "我的面料",
......@@ -127,7 +165,8 @@
"allowsBounceVertical": "NO"
}
}
}, {
},
{
"path": "pages/home/fabricDetails",
"style": {
"navigationBarTitleText": "面料详情",
......@@ -140,7 +179,8 @@
"allowsBounceVertical": "NO"
}
}
}, {
},
{
"path": "pages/home/styleDetails",
"style": {
"navigationBarTitleText": "款式详情",
......@@ -153,7 +193,8 @@
"allowsBounceVertical": "NO"
}
}
}, {
},
{
"path": "pages/home/sampleConfirmation",
"style": {
"navigationBarTitleText": "寄样确认",
......@@ -166,7 +207,8 @@
"allowsBounceVertical": "NO"
}
}
}, {
},
{
"path": "pages/home/styleEntrustment",
"style": {
"navigationBarTitleText": "款式委托",
......@@ -179,6 +221,48 @@
"allowsBounceVertical": "NO"
}
}
},
{
"path": "pages/modeling/listSelectToAdd",
"style": {
"navigationBarTitleText": "面料建模",
"navigationBarTextStyle": "white",
"enablePullDownRefresh": false,
"navigationStyle": "custom",
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"allowsBounceVertical": "NO"
}
}
},
{
"path": "pages/modeling/addItem",
"style": {
"navigationBarTitleText": "面料建模",
"navigationBarTextStyle": "white",
"enablePullDownRefresh": false,
"navigationStyle": "custom",
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"allowsBounceVertical": "NO"
}
}
},
{
"path": "pages/modeling/item",
"style": {
"navigationBarTitleText": "建模详情",
"navigationBarTextStyle": "white",
"enablePullDownRefresh": false,
"navigationStyle": "custom",
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"allowsBounceVertical": "NO"
}
}
}
],
"globalStyle": {
......
......@@ -21,7 +21,8 @@
<view class="u-border-bottom">
<view class="u-font-28 u-m-t-18 u-m-b-8">已指定颜色</view>
<view class="u-flex" @click="colorDialog.show = true;">
<view class="u-line-1 u-flex-1 u-font-32 u-l-height-32">
<view class="u-line-1 u-flex-1 u-font-28 u-l-height-32"
:class="[activeColorIds.length > 0 ? '': 'color-placeholder']">
{{activeColorText}}
</view>
<u-icon name="arrow-right"></u-icon>
......@@ -61,8 +62,8 @@
<view>
<view class="u-font-28 u-m-t-18 u-m-b-8"></view>
<view class="u-flex">
<view class="u-line-1 u-flex-1 u-font-32">
<input v-model="detail.expirationDate" @click="timePickerShow = true" readonly disabled/>
<view class="u-line-1 u-flex-1 u-font-28" :class="[detail.expirationDate ? '': 'color-placeholder']">
<view @click="timePickerShow = true">{{detail.expirationDate ? detail.expirationDate : '请选择日期'}}</view>
</view>
<u-icon name="arrow-right"></u-icon>
</view>
......@@ -300,14 +301,14 @@ export default {
},
// 选中的颜色id List
activeColorText(){
return this.detail.colourList
let List = this.detail.colourList
.filter((item) =>{
return item.isDeleted === false
})
.map((item) =>{
return item.colour
})
.join("|");
});
return List.length > 0 ? List.join("|"): "请选择指定颜色";
},
// 最小颜色长度
minColorsLength(){
......
......@@ -24,7 +24,9 @@
</view>
<u-number-box v-model="item.quantity"></u-number-box>
</view>
<u-button plain @click="addBrandList" type="primary">+添加风格</u-button>
<view class="button-plain" @click="addBrandList">
+添加风格
</view>
</view>
<u-select
......@@ -213,6 +215,11 @@ export default {
flex-direction: $direction;
/* #endif */
}
.button-plain{
text-align: center;
color: #DDA973;
line-height: 88rpx;
}
.del{
color: #FA5353;
}
......
......@@ -155,10 +155,7 @@ export default {
};
},
onLoad() {
this.entrustmentPage();
this.toBeSelectedQuantity();
this.orderTicketExceptionNum();
this.noSampleOrder();
},
onShow() {
// 获取查询条件
......@@ -172,6 +169,10 @@ export default {
// #ifdef APP-PLUS
this.setOffestTop();
// #endif
this.entrustmentPage();
this.toBeSelectedQuantity();
this.orderTicketExceptionNum();
this.noSampleOrder();
},
onHide() {
this.enable = false;
......
<!--新增委托-->
<template>
<view>
<view id="header"><u-navbar title="租户选择" :border-bottom="false" :background="{ backgroundColor: 'whitesmoke' }"></u-navbar></view>
<view id="header"><u-navbar :is-back="false" title="租户选择" :border-bottom="false" :background="{ backgroundColor: 'whitesmoke' }"></u-navbar></view>
<!-- 列表 确定-->
<view class="u-p-30 body" :style="{ bottom: footerHeight + 'px', top: headerHeight + 'px' }">
<view v-for="(item, index) in list" :key="item.id" class="u-flex u-m-b-20">
<view class="u-p-30 body" :style="{ bottom: footerHeight + 'px', top: headerHeight + 'px' }" v-if="list.length > 0">
<view v-for="(item, index) in list" :key="item.id" class="u-flex u-m-b-20 s--item" @click="triggerSelectItem(index)">
<view class="u-m-r-30">
<u-icon :name="index === selectedIndex ? 'checkmark-circle-fill' : 'checkmark-circle'" color="#000" size="40" @click="triggerSelectItem(index)" />
<u-icon :name="index === selectedIndex ? 'checkmark-circle-fill' : 'checkmark-circle'" color="#000" size="40" />
</view>
<view :class="{ tenant_list: true, border_000: index === selectedIndex }">租户{{ index }}</view>
<view :class="{ tenant_list: true, border_000: index === selectedIndex }">{{ item.userName }}</view>
</view>
</view>
<view v-if="list.length === 0">
<u-empty text="没有数据" mode="list"></u-empty>
</view>
<!-- 底部按钮 确定-->
<view class="footer" id="footer">
<view class="footer-btn">
<!-- /* 以下形式在微信小程序会无效,APP和H5有效 */-->
<u-button :disabled="selectedIndex === -1" @click="toAddItem" class="custom-style" shape="circle">确定</u-button>
<u-button :disabled="selectedIndex === -1" @click="next" class="custom-style" shape="circle">确定</u-button>
<!-- <u-button @click="testLogin" class="custom-style" shape="circle">确定</u-button> -->
</view>
</view>
</view>
......@@ -23,82 +27,186 @@
<script>
import dom from '@/mixins/dom';
import HsSelectItem from '../../components/hs-select-item/hs-select-item';
import HsMaterialThumbnail from '../../components/hs-material-thumbnail/hs-material-thumbnail';
export default {
name: 'listSelectToAdd',
components: { HsMaterialThumbnail, HsSelectItem },
mixins: [dom],
data() {
return {
keyword: '',
selectedIndex: -1,
list: [
{
title: '加厚荷兰绒绒布布料',
id: 2
},
{
title: '加厚荷兰绒绒布布料加厚荷兰绒绒布布料',
id: 12
},
{
title: '加厚荷兰绒绒布布料',
id: 221
},
{
title: '加厚荷兰绒绒布布料',
id: 22
},
{
title: '加厚荷兰绒绒布布料',
id: 224
},
{
title: '加厚荷兰绒绒布布料',
id: 222
}
]
selectedIndex: -1,
list: []
};
},
onLoad() {
this.getList();
created() {
this.getTenanList();
},
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() {
uni.setStorageSync('_item', this.list[this.selectedIndex]);
this.$Router.push({
path: '/pages/designCommissioned/addItem'
// query:{
// id: this.list[this.selectedIndex].id
// }
});
},
// 跳转到面料详情
toMaterialDetail({ id }) {
this.$Router.push({
path: '/pages/home/fabricDetails',
query: {
id
}
});
}
mounted() {
},
methods: {
getTenanList(){
// #ifdef APP-PLUS
// 向宿主App发送事件
uni.sendNativeEvent('getTenantList', {}, ret => {
this.list = JSON.parse(ret).filter((item) =>{
return item.tenantPlat === 'sass'
});
})
// #endif
},
encryptToken(){
// #ifdef APP-PLUS
const active = this.list[this.selectedIndex];
uni.sendNativeEvent('encryptToken',JSON.stringify(
{
globalId: active.globalUserId,
tenantId: active.tenantId,
subId: active.id,
}
), ret => {
uni.setStorageSync('encryptToken', ret);
this.login()
})
// #endif
},
initEvent() {
// #ifdef APP-PLUS
uni.onNativeEventReceive((event, data)=>{
this.err = JSON.stringify(event);
this.err1 = true;
if(event === 'getTenantList'){
this.list = JSON.parse(data);
}else if(event === 'encryptToken'){
// this.token = data;
uni.setStorageSync('encryptToken', data);
this.login()
}
})
this.getTenanList();
// #endif
},
testLogin(){
uni.setStorageSync('encryptToken',"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJpc3N1c2VyIiwiYXVkIjoiYXVkaWVuY2UiLCJ0ZW5hbnRfaWQiOiIwMDAwMDAiLCJyb2xlX25hbWUiOiJST0xFX0FETUlOIiwidXNlcl9pZCI6IjE0NzM1ODI0NDI5MTEwMjMxMDUiLCJyb2xlX2lkIjoiMTEyMzU5ODgxNjczODY3NTIwMSIsInVzZXJfbmFtZSI6IiIsIm9hdXRoX2lkIjoiIiwidG9rZW5fdHlwZSI6ImFjY2Vzc190b2tlbiIsImFjY291bnQiOiIiLCJjbGllbnRfaWQiOiJzd29yZCIsImV4cCI6MTY0MDIwMDQwNywibmJmIjoxNjQwMTY0NDA3fQ.b2lDYtf8huuxRSfp0YKAHXgcsx59AEo2omgrE8V1tJQNwFIOTD7GzS-iAbpCalj6QXqw-OnNP9HKbsBEuloAMA")// uni.setStorageSync("encryptToken","11")
this.login()
},
triggerSelectItem(item){
this.selectedIndex = item;
},
login(){
// uni.showToast({
// title: "login"
// })
// 核对
this.$http(
"auth.checkSecretKey",
uni.getStorageSync('encryptToken')
).then(res =>{
let {
code, data
} = res;
if(code === 200){
let {
userId, // 用户id
enterpriseId // 企业id
} = data;
this.userData = data;
uni.setStorageSync('tenantId', data.tenantId);
if(userId && enterpriseId){
this.createToken(data);
}else{
this.toRegister();
}
}
})
},
// 跳转到注册
toRegister(){
let {userId,enterpriseId,subId,tenantId} = this.userData;
this.$Router.push({
path: "/pages/user/register/stepSelectType",
query:{
pcUserId: userId || "",
pcBasicsId: enterpriseId || "",
tenantUserId:subId,
tenantId,
}
})
},
// 跳转到首页
toIndexPage(){
this.$Router.push({
path: "/pages/home/index"
})
},
checkStatus(data){
this.$http(
"user.checkMagStatus",{
pcUserId: data.userId,
pcBasicsId: data.enterpriseId,
}).then(res =>{
let { code ,data} = res;
if(code === 200){
// 1-面料供应商, 2-品牌商, 3-设计机构, 4-检测机构
let { identityType} = data.userLastIdentity;
if(identityType){
this.assignType = identityType;
this.filterStatus(data)
}
}
})
},
filterStatus(data){
// 0-未完善 1-已完善
let{
isBrandOwner, // 我要选款
isDesignAgency, // 完善设计机构信息
isFabricSupplier, //完善面料供应商信息
isTestingFacility, // 完善检测机构信息
} = data;
let { assignType} = this;
switch (assignType){
case "1":
isFabricSupplier ? this.toIndexPage() : this.toRegister();
return ;
case "2":
isBrandOwner ? this.toIndexPage() : this.toRegister();
return ;
case "3":
isDesignAgency ? this.toIndexPage() : this.toRegister();
return ;
case "4":
isTestingFacility ? this.toIndexPage() : this.toRegister();
return ;
default:
this.toRegister();
return;
}
},
createToken(data){
this.$http("auth.createTokenByApp" ,{
...data,
...{
identityType: uni.getStorageSync("identityType")
}
}).then(res =>{
let {
code, data
} = res;
if(code === 200){
uni.setStorageSync('token', data.accessToken);
uni.setStorageSync('pcUserId', data.userId);
uni.setStorageSync('pcBasicsId', data.enterpriseId);
// uni.setStorageSync('tenantId', this.userData.tenantId);
this.checkStatus(data);
}
})
},
next(){
this.encryptToken();
}
}
};
</script>
......
<template>
<!--面料建模-->
<view>
<!--导航栏 navbar-->
<view id="header">
<u-navbar title="面料建模"
:border-bottom="false"
:background="{backgroundColor: 'whitesmoke'}">
</u-navbar>
</view>
<!--主题内容-->
<view class="body" :style="{ bottom: footerHeight + 'px', top: headerHeight+ 'px'}">
<u-form :model="detail" label-position="top" ref="uForm">
<view class="u-p-30 bg-fff u-m-b-20">
<hs-tip-title title="面料建模"></hs-tip-title>
<u-form-item label="面料名称" prop="materialName" required>
<u-input v-model="detail.materialName" placeholder="请输入面料名称" />
</u-form-item>
<u-form-item label="建模品类" prop="modelingCategoryText" required>
<u-input v-model="detail.modelingCategoryText" placeholder="请输入建模品类" type="select" :select-open="show" @click="show = true;"/>
</u-form-item>
<view class="brandList-tips u-p-t-24 u-p-r-30 u-p-b-24 u-p-l-30" >
<view>
项目价格<text class="u-p-l-40">{{detail.price}}</text>
</view>
</view>
<u-form-item label="面料门幅" prop="clothWidth">
<u-number-box v-model="detail.clothWidth"></u-number-box>cm
</u-form-item>
<u-form-item label="面料成分" prop="component" required>
<u-input v-model="detail.component" placeholder="请输入面料成分" />
</u-form-item>
<u-form-item label="面料图片" prop="modelingTaskPictureDTOList" required>
<view class="wrap">
<view>
<view v-for="(item, index) in detail.modelingTaskPictureDTOList" :key="index" class="float-left ">
<view class="pre-item pre-item--80 u-relative" v-if="item.pictureCode" >
<image class="pre-item-image" :src="`${imgUrl}${item.pictureCode}`" mode="aspectFill"></image>
<text class="u-absolute pre-item-text text-center">{{ item.pictureType === 1 ? '正面': '反面'}}</text>
<view class="u-absolute pre-item-del" @click="triggerDel(index)">
<u-icon name="close" size="28" color="#fff"></u-icon>
</view>
</view>
<u-upload :custom-btn="true" :ref="`upload${index}`" :disabled="!!item.pictureCode"
@on-success="(data) => { uploadSuccess(data,index)}" width="160" height="160"
class="pre-item--80 float-left" :header="header"
:show-upload-list="true" :action="action" :max-count="1">
<view slot="addBtn" class=" slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
<u-icon name="plus" size="60" color="#c0c4cc"></u-icon>
</view>
</u-upload>
</view>
</view>
</view>
</u-form-item>
</view>
<!--委托建模信息-->
<view class="u-p-30 bg-fff u-m-b-20">
<hs-tip-title title="委托建模信息"></hs-tip-title>
<u-form-item label="完成期限" prop="expirationDate" required>
<u-input v-model="detail.expirationDate" readonly @click="timePickerShow = true"/>
</u-form-item>
<!--指定面料颜色数量-->
<u-form-item label="指定面料颜色数量" prop="component" required>
<u-number-box v-model="detail.clothRowColourQuantity" @blur="addModelingTaskColourDTOList"></u-number-box>
</u-form-item>
<view class="brandList-tips u-p-t-24 u-p-r-30 u-p-b-24 u-p-l-30" >
<view class="u-border-bottom u-flex u-p-b-8 ">
<view class="u-flex-1">
<view class="u-flex" @click="showAddColorListDialog">
<view class="label u-flex-1">指定面料颜色名称</view>
<view class="value u-width-100" >
{{colorListNames}}
</view>
</view>
</view>
<u-icon name="arrow-right"></u-icon>
</view>
<view class="u-border-bottom u-flex u-p-b-8 ">
<view class="label u-flex-1">设计机构提供颜色数量</view>
<view class="value">{{designAgencyColourQuantity}}</view>
</view>
<view class="u-border-bottom u-p-b-8"></view>
</view>
</view>
</u-form>
</view>
<!--底部按钮-->
<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="saveData">保存</view>
<view class="custom-style-right submit" @click="submitData">
<view class="title">立即发布</view>
</view>
</view>
</view>
</view>
<!--提示-->
<u-toast ref="uToast" />
<!--日期选择-->
<u-picker v-model="timePickerShow" mode="time" @confirm="timePickerCallback"></u-picker>
<!--面料颜色-->
<u-popup v-model="colorListDialogOptions.show" mode="bottom" height="100%">
<!--导航栏 navbar-->
<u-navbar title="填写面料颜色"
:border-bottom="false" :custom-back="() => {colorListDialogOptions.show = false}"
:background="{backgroundColor: 'whitesmoke'}">
<template v-slot:right>
<view class="u-p-40">
<u-icon name="close" @click="colorListDialogOptions.show = false;"></u-icon>
</view>
</template>
</u-navbar>
<view class="body" :style="{ bottom: footerHeight + 'px', top: headerHeight+ 'px'}">
<view class="u-p-t-26 u-p-r-30 u-p-l-30">
<hs-tip-title title="面料颜色名称"></hs-tip-title>
<view v-for="(color,index) in modelingTaskColourDTOList" :key="index">
<view class="u-font-28 u-m-t-18 u-m-b-8 required">颜色{{index+1}}</view>
<view class="u-flex">
<u-input v-model="color.colourName" placeholder="请输入面料颜色名称"></u-input>
</view>
</view>
</view>
</view>
<!--底部按钮-->
<view class="footer">
<view class="u-p-t-18 u-p-r-30 u-p-b-18 u-p-l-30">
<view class="u-flex">
<view class="u-flex-1">共填写{{detail.clothRowColourQuantity}}种颜色名称,请不要重名</view>
<view class="custom-style-round-circle custom-style-btn custom-style dialog-btn">
<view class="custom-style-right" @click="submitColors">确定</view>
</view>
</view>
</view>
</view>
</u-popup>
<!--建模品类选择-->
<u-select mode="single-column" :list="modelingTaskCategory" v-model="show" @confirm="confirm">
</u-select>
<u-modal v-model="modal.show" :content="modal.content" @confirm="modelConfirm"></u-modal>
</view>
</template>
<script>
import dom from "../../mixins/dom";
export default {
name: "addItem",
mixins: [dom],
data(){
return {
detail:{
clothRowColourQuantity: 0, // 布行指定面料颜色数量
clothWidth: 0, // 门幅
clothWidthUnit: 'cm', // 门幅单位
component: '', // 成分
// designAgencyColourQuantity: '', // 设计机构提供的颜色数量
expirationDate: '', // 截止日期
materialName: '', // 面料名称
modelingCategoryId: '', // 建模品类id
modelingCategoryText: '', // 建模品类文本
modelingTaskColourDTOList: [], // 布行指定面料颜色名称集合
modelingTaskPictureDTOList: [
{pictureType: 1},
{pictureType: 2},
], // 建模单 图片信息
price: 0,
},
timePickerShow: false,
action: this.$UPLOAD_URL, // 上传地址
imgUrl: this.$IMG_URL, // 上传地址
header:{
'blade-auth':"Bearer " + uni.getStorageSync("token"),
'Authorization-Basic': "Basic c3dvcmQ6c3dvcmRfc2VjcmV0"
},
// 如果将某个ref的组件实例赋值给data中的变量,在小程序中会因为循环引用而报错
colorListDialogOptions:{
show: false
},
// 表单验证逻辑
rules: {
materialName: [
{
required: true,
message: '请输入面料名称',
// 可以单个或者同时写两个触发验证方式
trigger: ['change','blur'],
},
{
max: 20,
message: '文字字数不能超过20字',
// 可以单个或者同时写两个触发验证方式
trigger: ['change','blur'],
},
// {
// rule: '',
// message: '请不要输入特殊符号',
// trigger: ['change','blur'],
// }
],
modelingCategoryText: [
{
required: true,
message: '请选择面料品类',
trigger: 'change'
}
],
component:{
required: true,
message: '请输入面料成分',
// 可以单个或者同时写两个触发验证方式
trigger: ['change','blur'],
},
modelingTaskPictureDTOList: {
validator: (rule,value) =>{
return value.filter((item) => {
return item.pictureCode
}).length === value.length
},
required: true,
message: '请输入上传图片',
},
expirationDate:{
required: true,
message: '请选择完成期限',
}
},
// 暂存用的颜色组
modelingTaskColourDTOList: [],
// 物料建模品类
modelingTaskCategory: [],
show: false,
delModelingTaskPictureDTOList: [],
modal:{
show: false,
content: '是否删除图片',
index: '',
}
}
},
computed:{
modelingTaskPictureDTOList(){
return this.detail.modelingTaskPictureDTOList.filter((item) =>{
return item.isDeleted !== true
})
},
// 设计机构提供的颜色数量
designAgencyColourQuantity(){
return 10 - this.detail.clothRowColourQuantity
},
activeColors(){
return this.detail.modelingTaskColourDTOList
.filter((item) => item.isDeleted === false)
},
colorListNames(){
return this.activeColors
.map((item) => item.colourName).join("|")
},
},
methods:{
triggerDel(index){
this.modal.show = true;
this.modal.activeIndex = index;
},
modelConfirm(){
this.uploadRemove(this.modal.activeIndex)
},
uploadRemove(index){
let item = this.detail.modelingTaskPictureDTOList[index];
if(item.id){
this.delModelingTaskPictureDTOList.push(
Object.assign({},item,{
isDeleted: true
})
)
}
this.$set(this.detail.modelingTaskPictureDTOList,index,{pictureType: index+1});
},
uploadSuccess(data, index, lists, name){
if(data.code === 200){
let item = this.detail.modelingTaskPictureDTOList[index];
this.$set(this.detail.modelingTaskPictureDTOList,index,{
...item,
pictureCode: data.data.fileCode,
pictureId: data.data.id,
})
this.$refs[`upload${index}`][0].remove(0)
}
},
confirm(data){
let { value,extra, label} = data[0];
this.detail.modelingCategoryId = value;
this.detail.modelingCategoryText = label;
this.detail.price = extra;
},
init(){
this.$http("modeling.category",{
"current": 1,
"size": 10
})
.then(res =>{
let {
code,data
} = res;
if(code === 200){
this.modelingTaskCategory = data.records.map((item) =>{
return {
label: item.name,
value: item.id,
extra: item.price,
}
});
// console.log(data)
}
})
},
validate(callback){
this.$refs['uForm'].validate((res) =>{
if (res) {
callback()
}
})
},
saveData(){
this.submit(0)
},
submitData(){
this.validate(() =>{
this.submit(1)
})
},
submit(type){
let {modelingTaskPictureDTOList, ...onther} = this.detail;
this.$http("modeling.submit",Object.assign({},
onther,
{ operationType:type, modelingTaskPictureDTOList: modelingTaskPictureDTOList.concat(this.delModelingTaskPictureDTOList)})
).then(res =>{
})
},
getDefaultColor(){
return { colourName: '',isDeleted: false}
},
addModelingTaskColourDTOList(item){
let res = [];
for (let i = 0; i < item.value; i++) {
res.push(this.getDefaultColor())
}
this.modelingTaskColourDTOList = res;
},
validateColors(){
let res = this.modelingTaskColourDTOList.map((item) => {
return item.colourName
});
let diff = new Set(res)
return diff.size === res.length;
},
submitColors(){
if(this.validateColors()){
this.detail.modelingTaskColourDTOList = this.modelingTaskColourDTOList;
this.colorListDialogOptions.show = false;
}else{
this.$refs.uToast.show({
title: '颜色名称请不要重名'
});
}
},
showAddColorListDialog(){
this.colorListDialogOptions.show = true;
},
timePickerCallback(e){
let {
day,
month,
year,
} = e;
this.detail.expirationDate = [year,month,day].join("-")
},
getDetail(id){
this.$http("modeling.detail",{ modelingTaskId:id })
.then(res => {
let {
code, data
} = res;
if(code === 200){
this.detail = Object.assign({},data,{
modelingCategoryText: data['modelingCategory']['name'],
modelingTaskColourDTOList: data['modelingTaskColourList'],
modelingTaskPictureDTOList: data['modelingTaskPictureList']
});
console.log(data['modelingTaskPictureList'])
this.modelingTaskColourList = data['modelingTaskColourList']
}
})
},
},
onLoad(options) {
let id = options.id;
this.init();
if(id){
this.getDetail(id)
}
},
mounted() {
// 得到整个组件对象,内部图片列表变量为"lists"
// this.lists = this.$refs.uUpload.lists;
this.$refs.uForm.setRules(this.rules);
}
}
</script>
<style scoped lang="scss">
.u-width-100{
width: 200rpx;
}
.dialog-btn{
width: 160rpx;
height: 64rpx;
}
.required::before{
//position: absolute;
//left: 8px;
color: #ee0a24;
font-size: 14px;
content: '*';
margin-right: 4px;
}
.float-left{
float: left;
margin-right: 10rpx;
}
.wrap {
padding: 24rpx;
}
.slot-btn {
width: 160rpx;
height: 160rpx;
display: flex;
justify-content: center;
align-items: center;
background: rgb(244, 245, 246);
border-radius: 10rpx;
}
.slot-btn__hover {
background-color: rgb(235, 236, 238);
}
.pre-box {
display: flex;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
}
.pre-item {
border-radius: 10rpx;
//overflow: hidden;
position: relative;
margin-right: 30rpx;
&-text{
bottom: 0;
left: 0;
font-size: 24rpx;
color: #333;
width: 100%;
background: rgba(255,255,255,.7);
}
&-image {
width: 100%;
height: 160rpx;
}
&--80{
width: 160rpx;
height: 160rpx;
display: inline-block;
}
&-del{
right: -20rpx;
top: -20rpx;
background: red;
width: 40rpx;
height: 40rpx;
text-align: center;
border-radius: 50%;
line-height: 40rpx;
}
}
@mixin vue-flex($direction: row) {
/* #ifndef APP-NVUE */
display: flex;
flex-direction: $direction;
/* #endif */
}
.brandList-tips{
background: #fcfaf7;
border: 1px solid rgba(68,53,37,0.10);
border-radius: 8rpx;
min-height: 88rpx;
line-height: 44rpx;
.brandList-tip{
}
}
.bg-fff{
background: #fafafa;
}
.body{
position: absolute;
width: 100%;
height: auto;
left: 0;
right: 0;
bottom: 0;
top: 0;
overflow-y: auto;
}
.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>
<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">
待寄样
</view>
<text class="item-status u-flex-1 text-right">
完工日期:2020-11-11
</text>
</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">
光泽度要高,90%以上
</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">
213.12元
</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">
213.12元
</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>
<u-image url="https://huansi-gdep-dev.oss-cn-hangzhou.aliyuncs.com/2dc07ee4-3b1c-45be-ae79-2bbdb61571af" width="150" height="150"></u-image>
<u-image url="https://huansi-gdep-dev.oss-cn-hangzhou.aliyuncs.com/2dc07ee4-3b1c-45be-ae79-2bbdb61571af" width="150" height="150"></u-image>
</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">
光泽度要高,90%以上
</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">
213.12元
</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 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">
加厚荷兰绒绒布布料
</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">
牛仔面料
</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">
牛仔面料
</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">
牛仔面料
</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">
牛仔面料
</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 class="u-flex u-m-t-18 u-m-b-8">
<view class="u-m-r-40 label">标准1</view>
<view class="u-line-1 u-flex-1 content">
光泽度要高,90%以上
</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">
213.12元
</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">
2021-12-12 21:21
</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">
2021-12-12 21:21
</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">
2021-12-12
</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">
213.12元
</view>
</view>
</view>
</view>
<!--底部按钮-->
<view class="footer" id="footer">
<view class="footer-btn">
<!---->
<view class="custom-style-round-circle custom-style-btn custom-style">
<view class="custom-style-right submit">
<view class="title">选款</view>
</view>
</view>
</view>
</view>
<!--提示-->
<u-toast ref="uToast" />
</view>
</template>
<script>
import dom from "../../mixins/dom"
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],
data(){
return {}
},
onLoad({id}){
},
mounted() {
},
methods:{
}
}
</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>
<!--新增委托-->
<template>
<view>
<view id="header">
<!--新增委托navbar-->
<u-navbar title="面料建模"
:border-bottom="false"
:background="{backgroundColor: 'whitesmoke'}">
</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 class="u-p-30 body" :style="{ bottom: footerHeight+ 'px', top: headerHeight + 'px' }">
<view v-for="(item, index) in list" :key="item.id" class="u-flex u-m-b-20">
<view class="u-m-r-30">
<u-icon :name="index === selectedIndex ? 'checkmark-circle-fill': 'checkmark-circle'"
color="#000" size="40"
@click="triggerSelectItem(index)"
/>
</view>
<hs-material-thumbnail :item="item" @click="toMaterialDetail(item)"></hs-material-thumbnail>
</view>
</view>
<!-- 底部按钮 确定-->
<view class="footer" id="footer">
<view class="footer-btn">
<!-- /* 以下形式在微信小程序会无效,APP和H5有效 */-->
<u-button :disabled="selectedIndex === -1"
@click="toAddItem"
class="custom-style" shape="circle"
>
确定
</u-button>
</view>
</view>
</view>
</template>
<script>
import dom from '../../mixins/dom'
import HsSelectItem from "../../components/hs-select-item/hs-select-item";
import HsMaterialThumbnail from "../../components/hs-material-thumbnail/hs-material-thumbnail";
export default {
name: "listSelectToAdd",
components: {HsMaterialThumbnail, HsSelectItem},
mixins:[dom],
data(){
return {
keyword: "",
selectedIndex: -1,
list: [
{
title: '加厚荷兰绒绒布布料',
id: 2
},
{
title: '加厚荷兰绒绒布布料加厚荷兰绒绒布布料',
id: 12
},
{
title: '加厚荷兰绒绒布布料',
id: 221
},
{
title: '加厚荷兰绒绒布布料',
id: 22
},
{
title: '加厚荷兰绒绒布布料',
id: 224
},
{
title: '加厚荷兰绒绒布布料',
id: 222
}
]
}
},
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(){
uni.setStorageSync("_item", this.list[this.selectedIndex]);
this.$Router.push({
path:"/pages/modeling/addItem",
// query:{
// id: this.list[this.selectedIndex].id
// }
})
},
// 跳转到面料详情
toMaterialDetail({id}){
this.$Router.push({
path:"/pages/home/fabricDetails",
query:{
id
}
})
},
}
}
</script>
<style scoped lang="scss">
$h-color: #AF8D66;
$main-color: #fff;
.body{
position: absolute;
width: 100%;
height: auto;
left: 0;
right: 0;
bottom: 0;
top: 0;
overflow-y: auto;
}
.title{
color: $h-color;
background-color: whitesmoke;
}
.bg-fff{
background: $main-color;
}
.item{
border-radius: 8rpx;
border: 1px solid #bd4848;
height: 160rpx; width: 100%;
overflow: hidden;
background-size: contain;
.active{
border: 1px solid #000;
}
}
.custom-style{
color: #fff;
background: #000;
}
.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 30rpx;
}
}
</style>
......@@ -24,34 +24,40 @@
<u-form-item label="企业联系人" class="u-border-bottom u-p-t-24 u-p-r-30 u-p-b-24 u-p-l-30" :style="style">
<u-input v-model="formData.corporateContactName" :border="false" placeholder="请输入企业联系人" />
</u-form-item>
<!-- <u-form-item label="档口地址" class="u-border-bottom u-p-t-24 u-p-r-30 u-p-b-24 u-p-l-30" :style="style">-->
<!-- <u-input v-model="formData.institutionAddress" :border="false" placeholder="请输入档口地址" />-->
<!-- </u-form-item>-->
</u-form>
<view class="u-p-t-24 u-p-r-30 u-p-b-24 u-p-l-30 u-m-b-30 u-m-t-30 bg-fff">
<u-collapse accordion>
<u-collapse-item v-for="(item,index) in subsidiaryInfo" :key="index">
<view slot="title">
<text class="u-page__item__title__slot-title">档口{{ index + 1 }}</text>
<text @click.stop="delSubsidiaryInfoRow(item,index)">删除</text>
<view v-for="(item,index) in subsidiaryInfo" :key="index">
<view class="u-flex">
<view class="u-flex-1">
<view class="title u-m-r-22">
<view class="line"></view>
档口{{ index + 1 }}
</view>
<text class="button--delete" @click.stop="delBrandRow(item)">删除</text>
</view>
<view class="u-collapse-content">
<u-form labelWidth="100" labelPosition="top" >
<u-form-item label="档口名称" :style="style">
<u-input v-model="item.stallName" :border="false" placeholder="请输入档口名称" />
</u-form-item>
<u-form-item label="档口地址" :style="style">
<u-input v-model="item.stallAddress" :border="false" placeholder="请输入档口地址"
/>
</u-form-item>
</u-form>
<view @click="delSubsidiaryInfoRow(index)">
{{
brandActive === index ? "收起":"展开"
}}
</view>
</u-collapse-item>
</u-collapse>
</view>
</view>
<view class="collapse-body" :style="[{
height: brandActive === index ? 'auto' : '0'
}]">
<u-form labelWidth="100" labelPosition="top" >
<u-form-item label="档口名称" :style="style">
<u-input v-model="item.stallName" :border="false" placeholder="请输入档口名称" />
</u-form-item>
<u-form-item label="档口地址" :style="style">
<u-input v-model="item.stallAddress" :border="false" placeholder="请输入档口地址"
/>
</u-form-item>
</u-form>
</view>
<u-button plain @click="addSubsidiaryInfoRow" type="primary">+添加档口</u-button>
</view>
</view>
<view class="button-plain" @click="addSubsidiaryInfoRow">+添加档口</view>
</template>
<!-- 我要选款 -->
<template v-if="assignType === 2">
......@@ -69,31 +75,41 @@
</u-form-item>
</u-form>
<view class="u-p-t-24 u-p-r-30 u-p-b-24 u-p-l-30 u-m-b-30 u-m-t-30 bg-fff">
<u-collapse accordion>
<u-collapse-item v-for="(item,index) in brandInfo" :key="index">
<view slot="title">
<text class="u-page__item__title__slot-title">品牌{{ index + 1 }}</text>
<text @click.stop="delBrandRow(item)">删除</text>
<view v-for="(item,index) in brandInfo" :key="index">
<view class="u-flex">
<view class="u-flex-1">
<view class="title u-m-r-22">
<view class="line"></view>
品牌{{ index + 1 }}
</view>
<text class="button--delete" @click.stop="delBrandRow(item)">删除</text>
</view>
<view class="u-collapse-content">
<u-form labelWidth="100" labelPosition="top" >
<u-form-item label="品牌名称" :style="style">
<u-input v-model="item.brandName" :border="false" placeholder="请输入品牌名称" />
</u-form-item>
<u-form-item label="品牌定位" :style="style">
<u-input v-model="item.brandFixedText" :border="false" placeholder="请输入品牌定位"
:select-open="show"
type="select" @click="() => { show = true; rowIndex = index}"
readonly/>
</u-form-item>
</u-form>
<view @click="brandCollapseChange(index)">
{{
brandActive === index ? "收起":"展开"
}}
</view>
</u-collapse-item>
</u-collapse>
</view>
<view class="collapse-body" :style="[{
height: brandActive === index ? 'auto' : '0'
}]">
<u-form labelWidth="100" labelPosition="top" >
<u-form-item label="品牌名称" :style="style">
<u-input v-model="item.brandName" :border="false" placeholder="请输入品牌名称" />
</u-form-item>
<u-form-item label="品牌定位" :style="style">
<u-input v-model="item.brandFixedText" :border="false" placeholder="请输入品牌定位"
:select-open="show"
type="select" @click="() => { show = true; rowIndex = index}"
readonly/>
</u-form-item>
</u-form>
</view>
</view>
</view>
<u-button plain @click="addBrandRow" type="primary">+添加品牌</u-button>
<view class="button-plain" @click="addBrandRow">+添加品牌</view>
<u-select v-model="show" mode="single-column" :list="column" @confirm="selectConfirm"></u-select>
</template>
<!-- 设计机构 -->
......@@ -160,7 +176,7 @@
</view>
<!-- 删除模态框 -->
<u-modal v-model="modal.show" :content="modal.content" @confirm="modalConfirm" ></u-modal>
<!-- <u-modal v-model="modal.show" :content="modal.content" @confirm="modalConfirm" ></u-modal>-->
</view>
<!-- 底部按钮 -->
<view class="footer" id="footer">
......@@ -171,13 +187,15 @@
<u-button type="primary" @click="back" shape="circle" v-if="current === 2 && error">返回</u-button>
</view>
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>
import UserSelect from "./components/UserSelect";
import Steps from "./components/Steps";
import UserSelect from "./register/components/UserSelect";
import Steps from "./register/components/Steps";
export default {
name: "register",
......@@ -233,10 +251,10 @@ export default {
},
error: true,
time: 3,
modal:{
show: false,
content: "确认删除?"
},
// modal:{
// show: false,
// content: "确认删除?"
// },
show: false,
rowIndex: null,
row: {},
......@@ -300,7 +318,9 @@ export default {
isDesignAgency: 0, // 完善设计机构信息
isFabricSupplier: 0, //完善面料供应商信息
isTestingFacility: 0, // 完善检测机构信息
}
},
brandActive: 0,
infoActive: 0,
}
},
computed:{
......@@ -311,13 +331,25 @@ export default {
}else if(this.assignType === 3){
return this.formData.corporateContactName && this.formData.enterpriseName && this.formData.institutionAddress && this.form3.cooperationMethodList.length > 0;
}else if(this.assignType === 2){
return this.formData.corporateContactName && this.formData.enterpriseName && this.form2.subsidiaryInfoDTOList.length > 0 && this.form2.brandInfoDTOList.filter((item) =>{
return item.isDeleted === false
}).length > 0;
return this.formData.corporateContactName && this.formData.enterpriseName && (
this.form2.brandInfoDTOList.length === 0 ||
this.validateBrandItem(
this.form2.brandInfoDTOList.filter((item) =>{
return item.isDeleted === false
})
)
)
}else {
return this.formData.corporateContactName && this.formData.enterpriseName && this.form1.subsidiaryInfoDTOList.filter((item) =>{
return item.isDeleted === false
}).length > 0;
return (
this.formData.corporateContactName && this.formData.enterpriseName && (
this.form1.subsidiaryInfoDTOList.length === 0 ||
this.validateInfoItem(
this.form1.subsidiaryInfoDTOList.filter((item) =>{
return item.isDeleted === false
})
)
)
)
}
},
checkbox(){
......@@ -345,10 +377,10 @@ export default {
},
onLoad(options) {
let {
pcUserId,
pcBasicsId,
tenantUserId,
tenantId,
// pcUserId,
// pcBasicsId,
// tenantUserId,
// tenantId,
redirect
} = options;
this.comData = {
......@@ -368,6 +400,36 @@ export default {
})
},
methods:{
validateInfoItem(data){
let res = true;
for (let i = 0; i < data.length; i++) {
let item = data[i];
if(item.stallAddress && item.stallName){
}else{
res = false
}
}
return res;
},
validateBrandItem(data){
let res = true;
for (let i = 0; i < data.length; i++) {
let item = data[i];
if(item.brandName && item.brandFixed){
}else{
res = false
}
}
return res;
},
brandCollapseChange(index){
this.brandActive = this.brandActive === index ? null: index;
},
InfoCollapseChange(index){
this.infoActive = this.infoActive === index ? null: index;
},
// 注册成功 跳转到首页
goIndex(){
this.$Router.replace({
......@@ -606,12 +668,22 @@ export default {
}
},
addSubsidiaryInfoRow() {
this.form1.subsidiaryInfoDTOList.push(this.defaultSubsidiaryInfoRow())
let list = this.form1.subsidiaryInfoDTOList.filter((item) =>{
return item.isDeleted === false
});
if(list.length < 10){
this.form1.subsidiaryInfoDTOList.push(this.defaultSubsidiaryInfoRow())
}else{
this.$refs.uToast.show({
title: '最多添加10条',
})
}
},
delSubsidiaryInfoRow(item,index) {
this.row = item;
this.rowIndex = index;
this.modal.show = true;
this.delModal();
// this.modal.show = true;
},
defaultBrandInfoRow() {
return {
......@@ -622,12 +694,37 @@ export default {
}
},
addBrandRow() {
this.form2.brandInfoDTOList.push(this.defaultBrandInfoRow())
let list = this.form2.brandInfoDTOList.filter((item) =>{
return item.isDeleted === false
});
if(list.length < 10){
this.form2.brandInfoDTOList.push(this.defaultBrandInfoRow())
}else{
this.$refs.uToast.show({
title: '最多添加10条',
})
}
},
delModal(){
uni.showModal({
title: '提示',
content: '是否删除数据',
success: (res) =>{
if (res.confirm) {
this.modalConfirm();
// console.log('用户点击确定');
} else if (res.cancel) {
// console.log('用户点击取消');
}
}
});
},
delBrandRow(item,index) {
this.row = item;
this.rowIndex = index;
this.modal.show = true;
this.delModal();
// this.modal.show = true;
},
selectConfirm(e,index){
let item = e[0];
......@@ -704,6 +801,38 @@ export default {
</script>
<style scoped lang="scss">
.collapse-body{
overflow: hidden;
transition: all 0.3s;
}
.title {
font-size: 28rpx;
font-weight: 600;
position: relative;
padding-left: 20rpx;
display: inline-block;
.line{
position: absolute;
width: 8rpx;
height: 28rpx;
background-color: #AF8D66;
border-radius: 4rpx;
left: 0;
top: 50%;
margin-top: -14rpx;
}
}
.button--delete{
color: red;
display: inline-block;
}
.button-plain{
text-align: center;
//color: #DDA973;
color: rgb(60, 156, 255);
background: #fff;
line-height: 88rpx;
}
.circle {
border-radius: 50%;
width: 96rpx;
......
......@@ -87,10 +87,10 @@ export default {
<style scoped lang="scss">
.active{
background: #1677FF !important;
background: #D5AA7A !important;
}
.active-color{
color: #1677FF !important;
color: #D5AA7A !important;
}
.step{
display: flex;
......
.collapse-body{
overflow: hidden;
transition: all 0.3s;
}
.title {
font-size: 28rpx;
font-weight: 600;
position: relative;
padding-left: 20rpx;
display: inline-block;
.line{
position: absolute;
width: 8rpx;
height: 28rpx;
background-color: #AF8D66;
border-radius: 4rpx;
left: 0;
top: 50%;
margin-top: -14rpx;
}
}
.button--delete{
color: red;
display: inline-block;
}
.button-plain{
text-align: center;
//color: #DDA973;
color: #DDA973;
background: #fff;
line-height: 88rpx;
}
.circle {
border-radius: 50%;
width: 96rpx;
height: 96rpx;
background-color: rgb(60, 156, 255);
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto;
&--error{
background: #f95253;
}
}
.bg-fff{
background-color: #fff;
}
.body{
background: #fafafa;
position: absolute;
width: 100%;
height: auto;
left: 0;
right: 0;
bottom: 0;
top: 0;
overflow-y: auto;
}
.displayNone{
display: none;
}
.status {
padding-top: 96rpx;
height: 500rpx;
background: #fff;
.status-text {
font-size: 36rpx;
margin-bottom: 16rpx;
}
.status-desc {
color: #999999;
font-size: 26rpx;
line-height: 36rpx;
}
}
.footer {
position: fixed;
width: 100%;
bottom: 0;
z-index: 998;
background: #fff;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
.footer-btn {
// padding: 12rpx 60rpx;
}
}
.button--submit{
background: #333 !important;
&--disabled{
background: #b5b5b5 !important;
}
}
<!-- 完善信息 -->
<template>
<view>
<view class="body" :style="{ bottom: footerHeight + 'px'}">
<!-- 操作step -->
<view class="u-p-30">
<steps :list="steps" :current="current"></steps>
</view>
<!-- 完善信息 -->
<view v-if="current === 1">
<!-- 面料供应商 -->
<template v-if="assignType === 1">
<u-form labelWidth="100" labelPosition="top" class="bg-fff">
<u-form-item label="企业名称" class="u-border-bottom u-p-t-24 u-p-r-30 u-p-b-24 u-p-l-30" :style="style">
<u-input v-model="formData.enterpriseName" :border="false" placeholder="请输入企业名称" />
</u-form-item>
<u-form-item label="企业联系人" class="u-border-bottom u-p-t-24 u-p-r-30 u-p-b-24 u-p-l-30" :style="style">
<u-input v-model="formData.corporateContactName" :border="false" placeholder="请输入企业联系人" />
</u-form-item>
</u-form>
<view class="u-p-t-24 u-p-r-30 u-p-b-24 u-p-l-30 u-m-b-30 u-m-t-30 bg-fff">
<view v-for="(item,index) in subsidiaryInfo" :key="index">
<view class="u-flex">
<view class="u-flex-1">
<view class="title u-m-r-22">
<view class="line"></view>
档口{{ index + 1 }}
</view>
<text class="button--delete" @click.stop="delBrandRow(item)">删除</text>
</view>
<view @click="brandCollapseChange(index)">
{{
brandActive === index ? "收起":"展开"
}}
</view>
</view>
<view class="collapse-body" :style="[{
height: brandActive === index ? 'auto' : '0'
}]">
<u-form labelWidth="100" labelPosition="top" >
<u-form-item label="档口名称" :style="style">
<u-input v-model="item.stallName" :border="false" placeholder="请输入档口名称" />
</u-form-item>
<u-form-item label="档口地址" :style="style">
<u-input v-model="item.stallAddress" :border="false" placeholder="请输入档口地址"
/>
</u-form-item>
</u-form>
</view>
</view>
</view>
<view class="button-plain" @click="addSubsidiaryInfoRow">+添加档口</view>
</template>
<!-- 我要选款 -->
<template v-if="assignType === 2">
<u-form labelWidth="100" labelPosition="top" class="bg-fff">
<u-form-item label="企业名称" class="u-border-bottom u-p-t-24 u-p-r-30 u-p-b-24 u-p-l-30" :style="style">
<u-input v-model="formData.enterpriseName" :border="false" placeholder="请输入企业名称" />
</u-form-item>
<u-form-item label="企业联系人" class="u-border-bottom u-p-t-24 u-p-r-30 u-p-b-24 u-p-l-30" :style="style">
<u-input v-model="formData.corporateContactName" :border="false" placeholder="请输入企业联系人" />
</u-form-item>
<u-form-item label="档口地址" class="u-border-bottom u-p-t-24 u-p-r-30 u-p-b-24 u-p-l-30" :style="style">
<u-input :border="false" placeholder="请输入档口地址"
v-model="form2.subsidiaryInfoDTOList[form2.subsidiaryInfoDTOList.length - 1].stallAddress"
/>
</u-form-item>
</u-form>
<view class="u-p-t-24 u-p-r-30 u-p-b-24 u-p-l-30 u-m-b-30 u-m-t-30 bg-fff">
<view v-for="(item,index) in brandInfo" :key="index">
<view class="u-flex">
<view class="u-flex-1">
<view class="title u-m-r-22">
<view class="line"></view>
品牌{{ index + 1 }}
</view>
<text class="button--delete" @click.stop.self="delBrandRow(item)">删除</text>
</view>
<view @click="InfoCollapseChange(index)">
{{
brandActive === index ? "收起":"展开"
}}
</view>
</view>
<view class="collapse-body" :style="[{
height: brandActive === index ? 'auto' : '0'
}]">
<u-form labelWidth="100" labelPosition="top" >
<u-form-item label="品牌名称" :style="style">
<u-input v-model="item.brandName" :border="false" placeholder="请输入品牌名称" />
</u-form-item>
<u-form-item label="品牌定位" :style="style">
<u-input v-model="item.brandFixedText" :border="false" placeholder="请输入品牌定位"
:select-open="show"
type="select" @click="() => { show = true; rowIndex = index}"
readonly/>
</u-form-item>
</u-form>
</view>
</view>
</view>
<view class="button-plain" @click="addBrandRow">+添加品牌</view>
<u-select v-model="show" mode="single-column" :list="column" @confirm="selectConfirm"></u-select>
</template>
<!-- 设计机构 -->
<template v-if="assignType === 3">
<u-form labelWidth="150" labelPosition="top">
<u-form-item label="机构名称" class="u-border-bottom u-p-t-24 u-p-r-30 u-p-b-24 u-p-l-30" :style="style">
<u-input v-model="formData.enterpriseName" :border="false" placeholder="请输入机构名称" />
</u-form-item>
<u-form-item label="机构联系人" class="u-border-bottom u-p-t-24 u-p-r-30 u-p-b-24 u-p-l-30" :style="style">
<u-input v-model="formData.corporateContactName" :border="false" placeholder="请输入机构联系人" />
</u-form-item>
<u-form-item label="机构地址" class="u-border-bottom u-p-t-24 u-p-r-30 u-p-b-24 u-p-l-30" :style="style">
<u-input v-model="formData.institutionAddress" :border="false" placeholder="请输入机构地址" />
</u-form-item>
<u-form-item label="合作方式(可多选)" class="u-border-bottom u-p-t-24 u-p-r-30 u-p-b-24 u-p-l-30" :style="style">
<u-checkbox-group>
<view class="u-tag u-size-default u-shape-circle u-mode-plain-primary"
:key="index"
v-for="(item, index) in checkbox">
<u-checkbox iconClass="displayNone" @change="checkChange"
v-model="item.checked"
:name="item.value"
>{{item.label}}</u-checkbox>
</view>
</u-checkbox-group>
</u-form-item>
</u-form>
</template>
<!-- 检测结构 -->
<template v-if="assignType === 4">
<u-form labelWidth="100" labelPosition="top">
<u-form-item label="机构名称" class="u-border-bottom u-p-t-24 u-p-r-30 u-p-b-24 u-p-l-30" :style="style">
<u-input v-model="formData.enterpriseName" :border="false" placeholder="请输入机构名称" />
</u-form-item>
<u-form-item label="机构联系人" class="u-border-bottom u-p-t-24 u-p-r-30 u-p-b-24 u-p-l-30" :style="style">
<u-input v-model="formData.corporateContactName" :border="false" placeholder="请输入机构联系人" />
</u-form-item>
<u-form-item label="机构地址" class="u-border-bottom u-p-t-24 u-p-r-30 u-p-b-24 u-p-l-30" :style="style">
<u-input v-model="formData.institutionAddress" :border="false" placeholder="请输入机构地址" />
</u-form-item>
</u-form>
</template>
</view>
</view>
<!-- 底部按钮 -->
<view class="footer" id="footer">
<view class="footer-btn u-p-t-12 u-p-r-60 u-p-b-12 u-p-l-60">
<!-- :class="[!canSubmit ? 'button&#45;&#45;submit&#45;&#45;disabled' : '' ]"-->
<u-button type="primary" @click="submit" shape="circle"
v-if="current === 1" class="button--submit"
:custom-style=" assignType === -1 ? {background: '#b5b5b5 !important'} : {background: '#333 !important'}"
:disabled="!canSubmit">下一步</u-button>
</view>
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>
import UserSelect from "./components/UserSelect";
import Steps from "./components/Steps";
import dom from '@/mixins/dom'
export default {
name: "register",
components: {Steps, UserSelect},
mixins: [dom],
data(){
return{
current: 1,
userSelect: [
{
title: "我是面料供应商",
desc: "Fabric supplier",
imgSrc: "/static/images/index/userSelect/type_1.png",
activeImgSrc: "/static/images/index/userSelect/type_1_active.png",
},
{
title: "我要选款",
desc: "I want to choose",
imgSrc: "/static/images/index/userSelect/type_2.png",
activeImgSrc: "/static/images/index/userSelect/type_2_active.png",
},
{
title: "我是设计机构",
desc: "Design agency",
imgSrc: "/static/images/index/userSelect/type_3.png",
activeImgSrc: "/static/images/index/userSelect/type_3_active.png",
},
{
title: "我是检测机构",
desc: "Testing institutions",
imgSrc: "/static/images/index/userSelect/type_4.png",
activeImgSrc: "/static/images/index/userSelect/type_4_active.png",
}
],
assignType: -1, //身份类型: 1-我是面料供应商 2-我要选款 3-我是设计机构 4-我是检测机构
steps: [
{
title: '第一步',
desc: '选择身份'
},
{
title: '第二步',
desc: '完善信息'
},
{
title: '第三步',
desc: '完成'
}
],
formData:{
"enterpriseName": "", //企业名称
"corporateContactName": "", //企业联系人姓名
"institutionAddress": "" //企业/机构地址
},
error: true,
time: 3,
show: false,
rowIndex: null,
row: {},
column: [
{
value: '1',
label: '高端'
},
{
value: '2',
label: '终端'
}
],
typeDir: [
{
label: "承接面料建模",
value: 1,
},
{
label: "承接款式开发",
value: 2
},
],
style: {lineHeight: 'inherit'},
comData:{
pcBasicsId: '', //PC端注册的企业id
pcUserId: '', //PC端注册的企业id
corporateContactId: '', //企业联系人id
institutionAddressId: '',//企业/机构地址id
// "pcBasicsId": 5,
// "pcUserId": "1422769059341709341"
},
form1:{
subsidiaryInfoDTOList: [
// {
// "stallAddress": "档口地址", //档口地址
// "stallName": "档口名称" //档口名称
// }
]
},
form2:{
subsidiaryInfoDTOList:[
{stallAddress: ''}
],
brandInfoDTOList: [
// {
// "brandName": "品牌名称", //品牌名称
// "brandFixed": "品牌定位" //品牌定位
// }
]
},
form3:{
cooperationMethodList: [] // 合作方式
},
form4:{},
footerHeight: 0,
isInit: true,
status:{
isBrandOwner: 0, // 我要选款
isDesignAgency: 0, // 完善设计机构信息
isFabricSupplier: 0, //完善面料供应商信息
isTestingFacility: 0, // 完善检测机构信息
},
brandActive: 0,
infoActive: 0,
}
},
computed:{
canSubmit(){
if(this.assignType === 4){
return this.formData.corporateContactName && this.formData.enterpriseName && this.formData.institutionAddress;
}else if(this.assignType === 3){
return this.formData.corporateContactName && this.formData.enterpriseName && this.formData.institutionAddress && this.form3.cooperationMethodList.length > 0;
}else if(this.assignType === 2){
return this.formData.corporateContactName && this.formData.enterpriseName && (
this.form2.brandInfoDTOList.length === 0 ||
this.validateBrandItem(
this.form2.brandInfoDTOList.filter((item) =>{
return item.isDeleted === false
})
)
)
}else {
return (
this.formData.corporateContactName && this.formData.enterpriseName && (
this.form1.subsidiaryInfoDTOList.length === 0 ||
this.validateInfoItem(
this.form1.subsidiaryInfoDTOList.filter((item) =>{
return item.isDeleted === false
})
)
)
)
}
},
checkbox(){
let value = this.form3.cooperationMethodList,
{typeDir} = this,
res = [];
for (let i = 0; i < typeDir.length; i++) {
res.push({
...typeDir[i],
checked: value.indexOf(typeDir[i].value) > -1
})
}
return res;
},
subsidiaryInfo(){
return this.form1.subsidiaryInfoDTOList.filter((item) =>{
return item.isDeleted === false
})
},
brandInfo(){
return this.form2.brandInfoDTOList.filter((item) =>{
return item.isDeleted === false
})
}
},
onLoad(options) {
let {
// pcUserId,
// pcBasicsId,
// tenantUserId,
// tenantId,
redirect
} = options;
this.comData = {
...options,
...{
pcUserId: uni.getStorageSync("pcUserId") || options.pcUserId,
pcBasicsId: uni.getStorageSync("pcBasicsId") || options.pcBasicsId,
tenantId: uni.getStorageSync("tenantId") || options.tenantId,
}
};
this.assignType = Number(options.type)
if(options.pcBasicsId && options.pcUserId){
this.getItem();
}
},
mounted() {
this.uGetRect("#footer").then(res =>{
this.footerHeight = res.height;
})
},
methods:{
validateInfoItem(data){
let res = true;
for (let i = 0; i < data.length; i++) {
let item = data[i];
if(item.stallAddress && item.stallName){
}else{
res = false
}
}
return res;
},
validateBrandItem(data){
let res = true;
for (let i = 0; i < data.length; i++) {
let item = data[i];
if(item.brandName && item.brandFixed){
}else{
res = false
}
}
return res;
},
brandCollapseChange(index){
this.brandActive = this.brandActive === index ? null: index;
},
InfoCollapseChange(index){
this.infoActive = this.infoActive === index ? null: index;
},
// 注册成功 跳转到首页
goIndex(){
this.$Router.replace({
path: '/pages/home/index'
})
},
getItem(){
this.$http(
"user.getItemMsg",
{
...this.comData,
assignType: this.assignType
}
).then(res =>{
let { code ,data} = res;
if(code === 200){
let {identityType,
supplierStudioCooperationMethodList,
addressList,
brandInfoList,
basics,
contact
} = data;
if(identityType !== -1){
this.assignType = identityType;
}
this.form3.cooperationMethodList = supplierStudioCooperationMethodList['cooperationMethod'] || [];
this.form1.subsidiaryInfoDTOList = addressList.length > 0 ? addressList.map((item) =>{
return {
...item,
stallAddress: item.detailedAddress
}
}) : [
{stallAddress: '',isDeleted: false}
]
this.form2.brandInfoDTOList = brandInfoList.map((item) => {
return{
...item,
brandFixedText: this.column.find(($item) => {
return $item.value === item.brandFixed
})?.label || ''
}
}) || [];
this.form2.subsidiaryInfoDTOList = addressList.length > 0 ? addressList.map((item) =>{
return {
...item,
stallAddress: item.detailedAddress,
}
}): [
{stallAddress:'' ,isDeleted: false}
]
this.formData = {
enterpriseName: basics.fullName,
corporateContactName: contact[contact.length - 1]?.name || '',
institutionAddress: addressList[addressList.length - 1]?.detailedAddress || '',
corporateContactId: contact[contact.length - 1]?.id || '', //企业联系人id
institutionAddressId: addressList[addressList.length - 1]?.id || '',//企业/机构地址id
}
}
})
},
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)
}
})
.exec()
})
},
userSelectCallback(type){
this.assignType = type;
let {
pcUserId,
pcBasicsId
} = this.comData;
if(pcUserId && pcBasicsId){
this.getItem();
}
},
// 重新选择时 核对当前选中状态
checkStatusByType(assignType){
let{
isBrandOwner, // 我要选款
isDesignAgency, // 完善设计机构信息
isFabricSupplier, //完善面料供应商信息
isTestingFacility, // 完善检测机构信息
} = this.status;
switch (assignType){
case 1:
isFabricSupplier ? this.goIndex() : '';
return ;
case 2:
isBrandOwner ? this.goIndex() : '';
return ;
case 3:
isDesignAgency ? this.goIndex() : '';
return ;
case 4:
isTestingFacility ? this.goIndex() : "";
return ;
}
},
goEndPage(isSuccess){
this.$Router.push({
path: '/pages/user/register/success',
query:{
status: isSuccess ? 'success':'error'
}
})
},
filterData(type){
switch (type){
case 1:
return this.form1;
case 2:
return this.form2
case 3:
return this.form3
case 4:
return this.form4
}
},
getData(){
return {
...this.comData,
...this.formData,
assignType: this.assignType,
...this.filterData(this.assignType),
}
},
submit() {
this.$http(
"user.register",
this.getData()
).then(res =>{
let { code ,data} = res;
if(code === 200){
uni.setStorageSync("identityType", this.assignType);
this.createToken(data,()=>{
this.goEndPage(true)
})
}else{
// this.error = true;
this.goEndPage(false)
}
})
},
createToken(data,callback){
this.$http("auth.createTokenByApp" ,data).then(res =>{
let {
code, data
} = res;
if(code === 200){
uni.setStorageSync('token', data.accessToken);
uni.setStorageSync('pcUserId', data.userId);
uni.setStorageSync('pcBasicsId', data.enterpriseId);
callback();
}
})
},
defaultSubsidiaryInfoRow() {
return {
"stallAddress": "", //品牌名称
"stallName": "", //品牌定位
"isDeleted": false
}
},
addSubsidiaryInfoRow() {
let list = this.form1.subsidiaryInfoDTOList.filter((item) =>{
return item.isDeleted === false
});
if(list.length < 10){
this.form1.subsidiaryInfoDTOList.push(this.defaultSubsidiaryInfoRow())
}else{
this.$refs.uToast.show({
title: '最多添加10条',
})
}
},
delSubsidiaryInfoRow(item,index) {
this.row = item;
this.rowIndex = index;
this.delModal();
// this.modal.show = true;
},
defaultBrandInfoRow() {
return {
"brandName": "", //品牌名称
"brandFixed": "", //品牌定位
"brandFixedText": "", //品牌定位站位文本
"isDeleted": false
}
},
addBrandRow() {
let list = this.form2.brandInfoDTOList.filter((item) =>{
return item.isDeleted === false
});
if(list.length < 10){
this.form2.brandInfoDTOList.push(this.defaultBrandInfoRow())
}else{
this.$refs.uToast.show({
title: '最多添加10条',
})
}
},
delModal(){
uni.showModal({
title: '提示',
content: '是否删除数据',
success: (res) =>{
if (res.confirm) {
this.modalConfirm();
// console.log('用户点击确定');
} else if (res.cancel) {
// console.log('用户点击取消');
}
}
});
},
delBrandRow(item,index) {
this.row = item;
this.rowIndex = index;
this.delModal();
// this.modal.show = true;
},
selectConfirm(e,index){
let item = e[0];
if(this.assignType === 1){
}else{
this.$set(
this.form2.brandInfoDTOList,
this.rowIndex,
{
...this.form2.brandInfoDTOList[this.rowIndex],
brandFixedText: item.label,
brandFixed: item.value
},
)
}
},
modalConfirm(){
if(this.assignType === 2){
let {row} = this, data = this.form2.brandInfoDTOList;
if(row.id){
let index = data.findIndex((item) =>{
return item.id === row.id
});
if(index > -1){
this.$set(data,index,{
...this.row,
isDeleted: true
})
}
}else{
data.splice(
data.findIndex((item) =>{
return item === row;
}),
1);
}
}else{
let {row} = this, data = this.form1.subsidiaryInfoDTOList;
if(row.id){
let index = data.findIndex((item) =>{
return item.id === row.id
});
if(index > -1){
this.$set(this.form1.subsidiaryInfoDTOList,index,{
...this.row,
isDeleted: true
})
}
}else{
data.splice(
data.findIndex((item) =>{
return item === row;
}),
1);
}
}
},
checkChange(e){
let { name, value} = e;
if(value){
this.form3.cooperationMethodList.push(name)
}else{
let index = this.form3.cooperationMethodList.findIndex((item) => {
return item === name
});
this.form3.cooperationMethodList.splice(index,1);
}
}
}
}
</script>
<style scoped lang="scss">
@import './css/index';
</style>
<!--todo 页面逻辑重新过滤-->
<!-- 完善信息 -->
<template>
<view>
<view class="body" :style="{ bottom: footerHeight + 'px'}">
<!-- 操作step -->
<view class="u-p-30">
<steps :list="steps" :current="current"></steps>
</view>
<!-- 身份选择 -->
<view v-if="current === 0">
<view class="u-p-30">
<user-select :list="userSelect" @change="userSelectCallback"></user-select>
</view>
</view>
</view>
<!-- 底部按钮 -->
<view class="footer" id="footer">
<view class="footer-btn u-p-t-12 u-p-r-60 u-p-b-12 u-p-l-60">
<!-- :class="[assignType === -1 ? 'button&#45;&#45;submit&#45;&#45;disabled' : '' ]"-->
<u-button type="primary" @click="next" shape="circle"
class="button--submit"
:custom-style=" assignType === -1 ? {background: '#b5b5b5 !important'} : {background: '#333 !important'}"
:disabled="assignType === -1"
v-if="current === 0">下一步
</u-button>
</view>
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>
import dom from "@/mixins/dom";
import UserSelect from "./components/UserSelect";
import Steps from "./components/Steps";
export default {
name: "register",
components: {Steps, UserSelect},
mixins: [dom],
data(){
return{
current: 0,
userSelect: [
{
title: "我是面料供应商",
desc: "Fabric supplier",
imgSrc: "/static/images/index/userSelect/type_1.png",
activeImgSrc: "/static/images/index/userSelect/type_1_active.png",
},
{
title: "我要选款",
desc: "I want to choose",
imgSrc: "/static/images/index/userSelect/type_2.png",
activeImgSrc: "/static/images/index/userSelect/type_2_active.png",
},
{
title: "我是设计机构",
desc: "Design agency",
imgSrc: "/static/images/index/userSelect/type_3.png",
activeImgSrc: "/static/images/index/userSelect/type_3_active.png",
},
{
title: "我是检测机构",
desc: "Testing institutions",
imgSrc: "/static/images/index/userSelect/type_4.png",
activeImgSrc: "/static/images/index/userSelect/type_4_active.png",
}
],
assignType: -1, //身份类型: 1-我是面料供应商 2-我要选款 3-我是设计机构 4-我是检测机构
steps: [
{
title: '第一步',
desc: '选择身份'
},
{
title: '第二步',
desc: '完善信息'
},
{
title: '第三步',
desc: '完成'
}
],
status:{
isBrandOwner: 0, // 我要选款
isDesignAgency: 0, // 完善设计机构信息
isFabricSupplier: 0, //完善面料供应商信息
isTestingFacility: 0, // 完善检测机构信息
},
comData:{
pcBasicsId: '', //PC端注册的企业id
pcUserId: '', //PC端注册的企业id
corporateContactId: '', //企业联系人id
institutionAddressId: '',//企业/机构地址id
},
}
},
onLoad(options) {
// let {
// redirect
// } = options;
this.comData = {
...options,
...{
pcUserId: uni.getStorageSync("pcUserId") || options.pcUserId,
pcBasicsId: uni.getStorageSync("pcBasicsId") || options.pcBasicsId,
tenantId: uni.getStorageSync("tenantId") || options.tenantId,
}
};
let {
pcBasicsId,pcUserId
} = this.comData;
if(pcBasicsId && pcUserId){
this.checkStatus();
}
},
mounted() {
this.uGetRect("#footer").then(res =>{
this.footerHeight = res.height;
})
},
methods:{
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)
}
})
.exec()
})
},
userSelectCallback(type){
this.assignType = type;
// let {
// pcUserId,
// pcBasicsId
// } = this.comData;
// if(pcUserId && pcBasicsId){
// this.getItem();
// }
},
// 重新选择时 核对当前选中状态
checkStatusByType(assignType){
let{
isBrandOwner, // 我要选款
isDesignAgency, // 完善设计机构信息
isFabricSupplier, //完善面料供应商信息
isTestingFacility, // 完善检测机构信息
} = this.status;
switch (assignType){
case 1:
isFabricSupplier ? this.goIndex() : '';
return ;
case 2:
isBrandOwner ? this.goIndex() : '';
return ;
case 3:
isDesignAgency ? this.goIndex() : '';
return ;
case 4:
isTestingFacility ? this.goIndex() : "";
return ;
}
},
goIndex(){
this.$Router.replace({
path: '/pages/home/index'
})
},
next(){
this.checkStatusByType(this.assignType);
this.$Router.push({
path: '/pages/user/register/perfectInformation',
query:{
...this.comData,
type: this.assignType
}
})
},
checkStatus(){
this.$http(
"user.checkMagStatus",
this.comData
).then(res =>{
let { code ,data} = res;
if(code === 200){
// 1-面料供应商, 2-品牌商, 3-设计机构, 4-检测机构
let { identityType} = data.userLastIdentity;
if(identityType){
this.assignType = identityType;
}
}
})
}
}
}
</script>
<style scoped lang="scss">
@import './css/index';
</style>
<!-- 完善信息 -->
<template>
<view>
<view class="body" :style="{ bottom: footerHeight + 'px'}">
<!-- 操作step -->
<view class="u-p-30">
<steps :list="steps" :current="current"></steps>
</view>
<!-- 完成 -->
<view v-if="current === 2">
<view class="status u-text-center">
<view class="circle" :class="[error ? 'circle--error':'']">
<u-icon size="36"
color="#fff"
:name="error ? 'close':'checkbox-mark'"
></u-icon>
</view>
<view class="u-m-t-40">
<view class="status-text">
{{
error ? "提交失败" : "提交成功"
}}
</view>
<view v-if="error" class="status-desc">请返回上一步重新提交</view>
<view v-if="!error" class="status-desc">
<view>确认后立刻跳转首页</view>
<view>{{time}}秒)后自动跳转</view>
</view>
</view>
</view>
</view>
<!-- 删除模态框 -->
<!-- <u-modal v-model="modal.show" :content="modal.content" @confirm="modalConfirm" ></u-modal>-->
</view>
<!-- 底部按钮 -->
<view class="footer" id="footer">
<view class="footer-btn u-p-t-12 u-p-r-60 u-p-b-12 u-p-l-60">
<u-button type="primary" @click="back" shape="circle"
v-if="current === 2 && error" class="button--submit">返回</u-button>
</view>
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>
import dom from "@/mixins/dom";
import UserSelect from "./components/UserSelect";
import Steps from "./components/Steps";
export default {
name: "register",
components: {Steps, UserSelect},
mixins: [dom],
data(){
return{
current: 2,
userSelect: [
{
title: "我是面料供应商",
desc: "Fabric supplier",
imgSrc: "/static/images/index/userSelect/type_1.png",
activeImgSrc: "/static/images/index/userSelect/type_1_active.png",
},
{
title: "我要选款",
desc: "I want to choose",
imgSrc: "/static/images/index/userSelect/type_2.png",
activeImgSrc: "/static/images/index/userSelect/type_2_active.png",
},
{
title: "我是设计机构",
desc: "Design agency",
imgSrc: "/static/images/index/userSelect/type_3.png",
activeImgSrc: "/static/images/index/userSelect/type_3_active.png",
},
{
title: "我是检测机构",
desc: "Testing institutions",
imgSrc: "/static/images/index/userSelect/type_4.png",
activeImgSrc: "/static/images/index/userSelect/type_4_active.png",
}
],
steps: [
{
title: '第一步',
desc: '选择身份'
},
{
title: '第二步',
desc: '完善信息'
},
{
title: '第三步',
desc: '完成'
}
],
error: true,
time: 3
}
},
onLoad(options) {
this.error = options.status === 'error';
if(!this.error){
this.success();
}
},
onShow(){
this.time = 3;
},
methods:{
back(){
this.$Router.back();
},
goIndex(){
this.$Router.replace({
path: '/pages/home/index'
})
},
success() {
let timer = setInterval(() => {
this.time--;
if (this.time === 0) {
clearInterval(timer);
this.goIndex();
}
}, 1000);
},
}
}
</script>
<style scoped lang="scss">
@import './css/index';
</style>
......@@ -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>
......
......@@ -41,4 +41,8 @@
width: $i + rpx;
height: $i + rpx;
}
}
\ No newline at end of file
}
.color-placeholder{
color: #c5c9cf;
}
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