|
@@ -16,17 +16,21 @@
|
|
|
<image block mode="widthFix" src="/static/img/54.png" @click="add()"></image>
|
|
|
</view>
|
|
|
</view> -->
|
|
|
- <view class="fr you black mt-30" style="width: 92%;" v-for="(item1,index1) in reqData.role" v-if="show==index1">
|
|
|
- <tm-input :required="true" title="用户名" v-model="item1.username" placeholder="你想叫自己什么" align="right"></tm-input>
|
|
|
- <tm-input :required="true" title="身高(cm)" v-model="item1.height" align="right"></tm-input>
|
|
|
- <tm-input :required="true" title="体重(kg)" v-model="item1.weight" align="right"></tm-input>
|
|
|
- <tm-pickers class="tan" :default-value.sync="item1.body_arr" rang-key="title" :list="chelianglis">
|
|
|
- <tm-input name="shencai" title="身材" placeholder="请选择车型" disabled :value="obTstr2(item1.body_arr)" right-icon="icon-angle-right"></tm-input>
|
|
|
+ <view class="fr you black mt-30" style="width: 92%;">
|
|
|
+ <tm-input :required="true" title="用户名" v-model="reqData.username" placeholder="你想叫自己什么" align="right"></tm-input>
|
|
|
+ <tm-input :required="true" title="身高(cm)" v-model="reqData.height" align="right"></tm-input>
|
|
|
+ <tm-input :required="true" title="体重(kg)" v-model="reqData.weight" align="right"></tm-input>
|
|
|
+ <tm-pickers class="tan" :default-value.sync="reqData.body_arr" rang-key="title" :list="chelianglis">
|
|
|
+ <tm-input name="shencai" title="身材" placeholder="请选择身材" disabled :value="obTstr2(reqData.body_arr)" right-icon="icon-angle-right"></tm-input>
|
|
|
</tm-pickers>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view style="clear: both;"></view>
|
|
|
- <tm-button :round="24" class="sao mb-40" style="margin-top: 50px;" @click="tijiao()" block>保存</tm-button>
|
|
|
+ <view class="anniu">
|
|
|
+ <tm-button v-if="id != ''" @click="quxiao()" theme="gray" size="n">删除</tm-button>
|
|
|
+ <tm-button @click="tijiao()" class="fr" theme="primary" size="n">确认</tm-button>
|
|
|
+ </view>
|
|
|
+ <!-- <tm-button :round="24" class="sao mb-40" style="margin-top: 50px;" @click="tijiao()" block>保存</tm-button> -->
|
|
|
</view>
|
|
|
</tm-sheet>
|
|
|
</div>
|
|
@@ -39,13 +43,6 @@ import{myRequest} from '@/api/request.js'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- shencaiList:[
|
|
|
- {title:"梨形",id:21},
|
|
|
- {title:"标准",id:31},
|
|
|
- {title:"胖子",id:41},
|
|
|
- {title:"瘦子",id:51},
|
|
|
- {title:"模特",id:61},
|
|
|
- ],
|
|
|
active:1,
|
|
|
chelianglis:[
|
|
|
{title:"标准",id:1},
|
|
@@ -55,21 +52,27 @@ export default {
|
|
|
],
|
|
|
show:0,
|
|
|
reqData:{
|
|
|
- wardrode_no:'6943819164690',
|
|
|
- familyname:'',
|
|
|
- role:[{
|
|
|
- username:'',
|
|
|
- weight:'',
|
|
|
- height:'',
|
|
|
- body_type:'',
|
|
|
- body_arr:[]
|
|
|
- }]
|
|
|
-
|
|
|
+ family_id:uni.getStorageSync("family_id"),
|
|
|
+ username:'',
|
|
|
+ weight:'',
|
|
|
+ height:'',
|
|
|
+ body_type:'',
|
|
|
+ body_arr:[]
|
|
|
},
|
|
|
+ id:''
|
|
|
};
|
|
|
},
|
|
|
- onLoad() {
|
|
|
+ onLoad(e) {
|
|
|
|
|
|
+ this.reqData.username=e.username;
|
|
|
+ this.reqData.weight=e.weight;
|
|
|
+ this.reqData.height=e.height;
|
|
|
+ this.reqData.body_type=e.body_type;
|
|
|
+ this.id=e.id?e.id:'';
|
|
|
+ if(e.body_type){
|
|
|
+ this.reqData.body_arr.push(this.chelianglis[e.body_type])
|
|
|
+ }
|
|
|
+ console.log(this.id)
|
|
|
},
|
|
|
created() {
|
|
|
this.sys = uni.getSystemInfoSync();
|
|
@@ -90,58 +93,67 @@ export default {
|
|
|
},
|
|
|
tijiao(){
|
|
|
var that=this;
|
|
|
- var arr=this.reqData.role;
|
|
|
- for(let i=0;i<arr.length;i++){
|
|
|
- if(arr[i].username==""){
|
|
|
- that.$refs.toast.show({model:'warn',label:'请将数据填写完整'})
|
|
|
- return;
|
|
|
- }if(arr[i].weight==""){
|
|
|
- that.$refs.toast.show({model:'warn',label:'请将数据填写完整'})
|
|
|
- return;
|
|
|
- }if(arr[i].height==""){
|
|
|
- that.$refs.toast.show({model:'warn',label:'请将数据填写完整'})
|
|
|
- return;
|
|
|
- }
|
|
|
- if(arr[i].body_arr.length !=0){
|
|
|
- arr[i].body_type=arr[i].body_arr[0].id;
|
|
|
- }
|
|
|
+ if(this.reqData.username==""){
|
|
|
+ that.$refs.toast.show({model:'warn',label:'请将数据填写完整'})
|
|
|
+ return;
|
|
|
+ }if(this.reqData.weight==""){
|
|
|
+ that.$refs.toast.show({model:'warn',label:'请将数据填写完整'})
|
|
|
+ return;
|
|
|
+ }if(this.reqData.height==""){
|
|
|
+ that.$refs.toast.show({model:'warn',label:'请将数据填写完整'})
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(this.reqData.body_arr.length !=0){
|
|
|
+ this.reqData.body_type=this.reqData.body_arr[0].id;
|
|
|
+ }
|
|
|
+ if(that.id){
|
|
|
+ this.reqData.id=that.id;
|
|
|
+ var url="/api/MemberInfo/updateMemberInfo";
|
|
|
+ }else{
|
|
|
+ var url="/api/MemberInfo/addOneMemberInfo";
|
|
|
}
|
|
|
- console.log(this.reqData)
|
|
|
myRequest({
|
|
|
- url: "/api/Family/addFamilyMember",
|
|
|
+ url:url ,
|
|
|
method:'post',
|
|
|
data:that.reqData
|
|
|
}).then(res => {
|
|
|
console.log(res.data)
|
|
|
if (res.data.code == 200) {
|
|
|
- uni.setStorageSync("family_id",res.data.data.family_id)
|
|
|
- that.$refs.toast.show({model:'success',label:res.data.msg})
|
|
|
- that.active=4;
|
|
|
+ let pages = getCurrentPages(); // 当前页面
|
|
|
+ let beforePage = pages[pages.length - 2]; // 前一个页面
|
|
|
+ uni.navigateBack({
|
|
|
+ delta: 1,
|
|
|
+ success: function() {
|
|
|
+ beforePage.$vm.getDate()
|
|
|
+ }
|
|
|
+ });
|
|
|
}else{
|
|
|
that.$refs.toast.show({model:'error',label:res.data.msg})
|
|
|
}
|
|
|
})
|
|
|
|
|
|
},
|
|
|
- add(){
|
|
|
- var timestamp = Date.parse(new Date());
|
|
|
- var obj={
|
|
|
- username:'',
|
|
|
- weight:'',
|
|
|
- height:'',
|
|
|
- body_type:'',
|
|
|
- body_arr:[],
|
|
|
- timestamp:timestamp
|
|
|
- }
|
|
|
- this.reqData.role.push(obj);
|
|
|
- this.show=this.reqData.role.length-1;
|
|
|
- },
|
|
|
- shanchu(timestamp){
|
|
|
- var index = this.reqData.role.findIndex((item) => {
|
|
|
- return item.timestamp == timestamp;
|
|
|
- });
|
|
|
- this.reqData.role.splice(index, 1);
|
|
|
- this.show=this.reqData.role.length-1;
|
|
|
+ quxiao(){
|
|
|
+ var that=this;
|
|
|
+ myRequest({
|
|
|
+ url: "/api/MemberInfo/deleteMemberInfo",
|
|
|
+ method:'post',
|
|
|
+ data:{id:that.id}
|
|
|
+ }).then(res => {
|
|
|
+ console.log(res.data)
|
|
|
+ if (res.data.code == 200) {
|
|
|
+ let pages = getCurrentPages(); // 当前页面
|
|
|
+ let beforePage = pages[pages.length - 2]; // 前一个页面
|
|
|
+ uni.navigateBack({
|
|
|
+ delta: 1,
|
|
|
+ success: function() {
|
|
|
+ beforePage.$vm.getDate()
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ that.$refs.toast.show({model:'error',label:res.data.msg})
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
obTstr2(o){
|
|
|
if(Array.isArray(o)){
|
|
@@ -188,7 +200,6 @@ export default {
|
|
|
background-color: #1b1b1b !important;
|
|
|
}
|
|
|
/deep/ .kuang{margin:0 !important;padding: 14px !important;margin-bottom: 40px !important;}
|
|
|
- /deep/ .kuang uni-button{background-color: #303440 !important;}
|
|
|
.jindu{width: 90%;margin: 0 auto;display: block;}
|
|
|
.wenzi{width: 94%;margin: 0 auto;}
|
|
|
.nicheng{width: 130px;height:132px;display: block;margin:0 auto;margin-top: 50px;}
|
|
@@ -215,4 +226,6 @@ export default {
|
|
|
/deep/ .tm--badges{position: absolute;top: 0px;right:6px}
|
|
|
.logincla{margin-top: 100px;}
|
|
|
/deep/ .quindex uni-button{background-color: #0A84FF !important;}
|
|
|
+ .anniu{width: 80%;margin: 0 auto;margin-top: 20px;}
|
|
|
+ /deep/ .anniu .gray.bk{color: white !important;}
|
|
|
</style>
|