|
@@ -28,15 +28,24 @@
|
|
|
<view v-if="active==2">
|
|
|
<image block class="nicheng" mode="widthFix" :src="koutu"></image>
|
|
|
<view class="you black mt-30">
|
|
|
- <tm-input title="衣长" v-model="reqData.username" align="right"></tm-input>
|
|
|
- <tm-input title="上市年份" v-model="reqData.height" align="right"></tm-input>
|
|
|
- <tm-input title="颜色" v-model="reqData.weight" align="right"></tm-input>
|
|
|
- <tm-input title="尺码" v-model="reqData.username" align="right"></tm-input>
|
|
|
- <tm-input title="品牌" v-model="reqData.height" align="right"></tm-input>
|
|
|
- <tm-input title="主材含量" v-model="reqData.weight" align="right"></tm-input>
|
|
|
- <tm-input title="适用对象" v-model="reqData.weight" align="right"></tm-input>
|
|
|
+ <tm-input :required="true" title="商品名称" v-model="reqData.goods_name" align="right"></tm-input>
|
|
|
+ <tm-pickers class="tan" :default-value.sync="category_danarr" rang-key="category_name" :list="category_arr">
|
|
|
+ <tm-input :required="true" title="分类" placeholder="请选择分类" disabled :value="obTstr1(category_danarr,'category_name')" right-icon="icon-angle-right"></tm-input>
|
|
|
+ </tm-pickers>
|
|
|
+ <tm-pickers class="tan" :default-value.sync="role_danarr" rang-key="username" :list="role_arr">
|
|
|
+ <tm-input title="所属成员" :required="true" placeholder="请选择所属成员" disabled :value="obTstr3(role_danarr)" right-icon="icon-angle-right"></tm-input>
|
|
|
+ </tm-pickers>
|
|
|
+ <tm-input title="年份" v-model="reqData.year" align="right"></tm-input>
|
|
|
+ <tm-input title="颜色" v-model="reqData.color" align="right"></tm-input>
|
|
|
+ <tm-pickers class="tan" :default-value.sync="size_danarr" rang-key="title" :list="size_arr">
|
|
|
+ <tm-input title="尺码" placeholder="请选择尺码" disabled :value="obTstr2(size_danarr)" right-icon="icon-angle-right"></tm-input>
|
|
|
+ </tm-pickers>
|
|
|
+ <tm-input title="适用人群" v-model="reqData.type" align="right"></tm-input>
|
|
|
+ <tm-input title="品牌" v-model="reqData.brand" align="right"></tm-input>
|
|
|
+ <tm-input title="材料" v-model="reqData.science" align="right"></tm-input>
|
|
|
+
|
|
|
</view>
|
|
|
- <tm-button :round="24" class="sao mb-40 mt-40" @click="chuangjianFun()" block>下一步</tm-button>
|
|
|
+ <tm-button :round="24" class="sao mb-40 mt-40" @click="chuangjianFun()" block>提交</tm-button>
|
|
|
</view>
|
|
|
<view v-if="active==3">
|
|
|
<tm-translate ref="a_1" :auto="true" animation-name="zoomIn">
|
|
@@ -65,36 +74,34 @@ import { pathToBase64, base64ToPath } from '@/js_sdk/mmmm-image-tools/index.js'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- reqData:{
|
|
|
- username:'1',
|
|
|
- height:'1',
|
|
|
- weight:'1',
|
|
|
- },
|
|
|
koutu:'/static/img/53.png',
|
|
|
- shencaiList:[
|
|
|
- {title:"梨形",id:21},
|
|
|
- {title:"标准",id:31},
|
|
|
- {title:"胖子",id:41},
|
|
|
- {title:"瘦子",id:51},
|
|
|
- {title:"模特",id:61},
|
|
|
- ],
|
|
|
- shenxing:'',
|
|
|
active:1,
|
|
|
- name:'',
|
|
|
- chelianglis:[
|
|
|
- {title:"标准",id:21},
|
|
|
- {title:"偏瘦",id:31},
|
|
|
- {title:"偏胖",id:41},
|
|
|
- {title:"梨形",id:51},
|
|
|
- {title:"S型",id:61},
|
|
|
+ category_arr:[],
|
|
|
+ category_danarr:[],
|
|
|
+ size_arr:[
|
|
|
+ {title:"S",id:1},
|
|
|
+ {title:"M",id:2},
|
|
|
+ {title:"L",id:3},
|
|
|
+ {title:"XL",id:4},
|
|
|
+ {title:"XXL",id:5},
|
|
|
+ {title:"其他",id:6},
|
|
|
],
|
|
|
+ size_danarr:[],
|
|
|
+ role_arr:[],
|
|
|
+ role_danarr:[],
|
|
|
reqData:{
|
|
|
- username:'',
|
|
|
- height:'',
|
|
|
- weight:'',
|
|
|
- shencai:[]
|
|
|
+ goods_name:'',
|
|
|
+ category_id:'',
|
|
|
+ year:'',
|
|
|
+ color:'',
|
|
|
+ image:'',
|
|
|
+ type:'',
|
|
|
+ thumb:'',
|
|
|
+ size:'',
|
|
|
+ brand:'',
|
|
|
+ science:'',
|
|
|
+ role_id:''
|
|
|
},
|
|
|
- renList:[]
|
|
|
};
|
|
|
},
|
|
|
onLoad() {
|
|
@@ -102,42 +109,45 @@ export default {
|
|
|
},
|
|
|
created() {
|
|
|
this.sys = uni.getSystemInfoSync();
|
|
|
- this.add()
|
|
|
+ this.getFl();
|
|
|
+ this.getCY();
|
|
|
},
|
|
|
methods: {
|
|
|
- jixu(){
|
|
|
- this.active=1;
|
|
|
- },
|
|
|
- quindex(){
|
|
|
- // uni.setStorageSync("index",1)
|
|
|
- // this.$emit('fatherMethod', )
|
|
|
- uni.navigateTo({
|
|
|
- url: "/pages/index/index?index=1",
|
|
|
+ getFl(){
|
|
|
+ var that=this;
|
|
|
+ myRequest({
|
|
|
+ url: "/api/Category/list",
|
|
|
+ method:'post',
|
|
|
+ data:{}
|
|
|
+ }).then(res => {
|
|
|
+ console.log(res.data)
|
|
|
+ if (res.data.code == 200) {
|
|
|
+ this.category_arr=res.data.data;
|
|
|
+ }else{
|
|
|
+ that.category_arr=[];
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
- tijiao(){
|
|
|
- // console.log(this.renList)
|
|
|
- // for(let i=0;i<this.renList.length;i++){
|
|
|
- // if(this.renList[i].){}
|
|
|
- // }
|
|
|
- // this.active=4;
|
|
|
+ getCY(){
|
|
|
+ var that=this;
|
|
|
+ myRequest({
|
|
|
+ url: "/api/MemberInfo/getFamilyMember",
|
|
|
+ method:'post',
|
|
|
+ data:{family_id:uni.getStorageSync("family_id")}
|
|
|
+ }).then(res => {
|
|
|
+ if (res.data.code == 200) {
|
|
|
+ that.role_arr=res.data.data;
|
|
|
+ }else{
|
|
|
+ that.role_arr=[];
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
- add(){
|
|
|
- var timestamp = Date.parse(new Date());
|
|
|
- var obj={
|
|
|
- username:'',
|
|
|
- height:'',
|
|
|
- weight:'',
|
|
|
- shencai:[],
|
|
|
- timestamp:timestamp
|
|
|
+ obTstr1(o){
|
|
|
+ if(Array.isArray(o)){
|
|
|
+ if(o.length.length===0) return "";
|
|
|
+ return o[0]?.category_name??""
|
|
|
}
|
|
|
- this.renList.push(obj)
|
|
|
- },
|
|
|
- shanchu(timestamp){
|
|
|
- var index = this.renList.findIndex((item) => {
|
|
|
- return item.timestamp == timestamp;
|
|
|
- });
|
|
|
- this.renList.splice(index, 1);
|
|
|
+ return ''
|
|
|
},
|
|
|
obTstr2(o){
|
|
|
if(Array.isArray(o)){
|
|
@@ -146,6 +156,21 @@ export default {
|
|
|
}
|
|
|
return ''
|
|
|
},
|
|
|
+ obTstr3(o){
|
|
|
+ if(Array.isArray(o)){
|
|
|
+ if(o.length.length===0) return "";
|
|
|
+ return o[0]?.username??""
|
|
|
+ }
|
|
|
+ return ''
|
|
|
+ },
|
|
|
+ jixu(){
|
|
|
+ this.active=1;
|
|
|
+ },
|
|
|
+ quindex(){
|
|
|
+ uni.navigateTo({
|
|
|
+ url: "/pages/index/index?index=1",
|
|
|
+ })
|
|
|
+ },
|
|
|
paizhao(){
|
|
|
var that=this;
|
|
|
uni.chooseImage({ //uni官方api,用于选取本地图片
|
|
@@ -177,29 +202,56 @@ export default {
|
|
|
url: 'https://objseg.market.alicloudapi.com/commonseg/rgba',
|
|
|
method : "post",
|
|
|
header: {
|
|
|
- 'Authorization':'APPCODE e4b9accfb1f246cb8c0766a54efe8730',
|
|
|
+ 'Authorization':'APPCODE a4a922a41afa43a0bbca6c831a13bf43',
|
|
|
"Content-Type":"application/json;charset=UTF-8"
|
|
|
},
|
|
|
data:{
|
|
|
photo:src
|
|
|
},
|
|
|
success : function(data) {
|
|
|
- console.log(data)
|
|
|
- that.koutu=data.data.data.result
|
|
|
+ that.koutu=data.data.data.result;
|
|
|
that.active=2;
|
|
|
},
|
|
|
error : function(e) {
|
|
|
- alert("网络异常,请重试");
|
|
|
+ that.$refs.toast.show({model:'error',label:"网络异常,请重试"})
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
chuangjianFun(){
|
|
|
var that=this;
|
|
|
- // if(that.name==""){
|
|
|
- // that.$refs.toast.show({model:'warn',label:'请输入家庭名称'})
|
|
|
- // return
|
|
|
- // }
|
|
|
- that.active=3;
|
|
|
+ if(that.reqData.goods_name==""){
|
|
|
+ that.$refs.toast.show({model:'warn',label:'请输入商品名称'})
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(that.category_danarr.length==0){
|
|
|
+ that.$refs.toast.show({model:'warn',label:'请选择分类'})
|
|
|
+ return
|
|
|
+ }else{
|
|
|
+ that.reqData.category_id=that.category_danarr[0].id
|
|
|
+ }
|
|
|
+ if(that.role_danarr.length==0){
|
|
|
+ that.$refs.toast.show({model:'warn',label:'请选择成员'})
|
|
|
+ return
|
|
|
+ }else{
|
|
|
+ that.reqData.role_id=that.role_danarr[0].id
|
|
|
+ }
|
|
|
+ if(that.size_danarr.length!=0){
|
|
|
+ that.reqData.size=that.size_danarr[0].id
|
|
|
+ }
|
|
|
+ that.reqData.image=that.koutu;
|
|
|
+ that.reqData.thumb=that.koutu;
|
|
|
+ myRequest({
|
|
|
+ url: "/api/Goods/addGodds",
|
|
|
+ method:'post',
|
|
|
+ data:that.reqData
|
|
|
+ }).then(res => {
|
|
|
+ console.log(res.data)
|
|
|
+ if (res.data.code == 200) {
|
|
|
+ that.active=3;
|
|
|
+ }else{
|
|
|
+ that.$refs.toast.show({model:'error',label:res.data.msg})
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
}
|