123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236 |
- <template>
- <view :style="{ minHeight: sys.windowHeight + 'px' }"
- :class="[$tm.vx.state().tmVuetify.black ? 'black' : ' ']">
- <tm-menubars title="添加穿搭" :shadow="0" :showback="true"></tm-menubars>
- <div class="zhuti">
- <!-- 衣橱 -->
- <tm-sheet class="yichu" style="margin-bottom: 40px !important;">
- <!-- <view class="flex-center"><tm-segTabs @change="shifouxuan" :round="24" :margin="[32,10]" font-size="s" :list="list" color="white" activeFontColor="red" bg-color="bg-gradient-red-lighten" v-model="active"></tm-segTabs></view> -->
- <view class="biaoti text-white mt-10 text-size-m"><view class="mr-10"></view>分类</view>
- <tm-tabs @change="fenlei" class="C1b1b1b qiehuan" color="white" align="left" v-model="activeIndexfl" :list="listfl" range-key="title"></tm-tabs>
- <!-- <view class="biaoti text-white mt-30 text-size-m"><view class="mr-10" v-if="yixuanor==0"></view>{{yixuanor==0?'场景':'请选择场景'}}</view> -->
- <!-- <tm-tabs @change="changjing" class="C1b1b1b qiehuan" color="white" align="left" v-model="activeIndexcj" :list="listcj" range-key="title"></tm-tabs> -->
- <!-- 可预约 -->
- <view class="yiguicla black pa-6 ma-4 fl" @click="gaoliang(index,item)" :class="chooseindex==index?'C0178FD':''" v-for="(item,index) in quanbuList">
- <image :src="item.image" mode="widthFix"></image>
- <view class="text-size-m mt-20 mb-20 ml-10">{{item.title}}</view>
- </view>
- <!-- 已预约 -->
- <!-- <view v-if="yixuanor==0" class="yiguicla black pa-6 ma-4 fl" @click="gaoliang(index,item)" :class="chooseindex==index?'C0178FD':''" v-for="(item,index) in yixuanList">
- <image :src="item.image" mode="widthFix"></image>
- <view class="text-size-m mt-20 mb-20 ml-10">{{item.title}}</view>
- </view> -->
- <tm-empty v-if="yixuanor==0 && quanbuList.length ==0" label="暂无数据" color="white" icon="icon-paperplane-fill"></tm-empty>
- <view style="clear: both;"></view>
- <!-- <view style="clear: both;" class="more ma-30 pt-40" @click="gengmore()">
- <image src="/static/img/30.png" mode="widthFix"></image>
- <text class="text-size-s">下拉加载更多~</text>
- </view> -->
- </tm-sheet>
- <!-- <tm-button @click="shanchu" v-if="yixuanor==0 && yixuanList.length !=0" theme="gray" :round="24" class="sao mb-40" block>取消删除</tm-button> -->
- <tm-button @click="yuyue" :round="24" class="sao mb-40" block>保存</tm-button>
- </div>
- <!-- 弹出层消息 -->
- <tm-message ref="toast"></tm-message>
- </view>
- </template>
- <script>
- import{myRequest} from '@/api/request.js'
- export default {
- data() {
- return {
- listflall:[],
- listcjall:[],
- listfl:[],
- yixuanor:0,//0已选
- list:['已预约穿搭','可预约穿搭'],
- listcj:[],
- active:0,
- activeIndexfl:0,
- activeIndexcj:0,
- quanbuList:[],
- yixuanList:[],
- chooseindex:-1
- };
- },
- onLoad(e) {
- this.type=e.type?e.type:'';
- this.id=e.id?e.id:'';
- this.old=e.old?e.old:'';
- },
- created() {
- this.sys = uni.getSystemInfoSync();
- this.getFl();
- },
- methods: {
- yuyue(){
- var that=this;
- if(this.chooseindex==-1){
- that.$refs.toast.show({model:'warn',label:'请选择衣物'})
- return
- }
- var id=this.quanbuList[this.chooseindex].id;
- if(this.old){
- if(this.old==id){
- setTimeout(function(){
- uni.navigateBack();
- },2000)
- that.$refs.toast.show({model:'success',label:'更换成功'})
- return
- }
- // 修改
- myRequest({
- url: "/api/Collocation/updateStyle",
- method:'post',
- data:{id:that.id,dp_id:id}
- }).then(res => {
- if (res.data.code == 200) {
- setTimeout(function(){
- let pages = getCurrentPages(); // 当前页面
- console.log(pages)
- let beforePage = pages[pages.length - 2]; // 前一个页面
- uni.navigateBack({
- delta: 1,
- success: function() {
- beforePage.$vm.shuaxin()
- }
- });
- },2000)
- that.$refs.toast.show({model:'success',label:res.data.msg})
- }else{
- that.$refs.toast.show({model:'error',label:res.data.msg})
- }
- })
- }else{
- myRequest({
- url: "/api/Collocation/addStyle",
- method:'post',
- data:{id:id,type:that.type}
- }).then(res => {
- if (res.data.code == 200) {
- setTimeout(function(){
- let pages = getCurrentPages(); // 当前页面
- console.log(pages)
- let beforePage = pages[pages.length - 2]; // 前一个页面
- uni.navigateBack({
- delta: 1,
- success: function() {
- beforePage.$vm.shuaxin()
- }
- });
- },2000)
- that.$refs.toast.show({model:'success',label:res.data.msg})
- }else{
- that.$refs.toast.show({model:'error',label:res.data.msg})
- }
- })
- }
- },
- fenlei(e){
- var id=this.listflall[e].id;
- this.getKxuan(id)
- },
- getKxuan(id){
- var that=this;
- myRequest({
- url: "/api/Collocation/getPlanTomorrow",
- method:'post',
- data:{id:id}
- }).then(res => {
- if (res.data.code == 200) {
- that.quanbuList=res.data.data;
- for(let i=0;i<that.quanbuList.length;i++){
- if(that.quanbuList[i].id==this.old){
- this.chooseindex=i;
- }
- }
-
- }else{
- that.quanbuList=[];
- }
- })
- },
- getFl(){
- var that=this;
- myRequest({
- url: "/api/Category/getCollocationClassList",
- method:'post',
- data:{}
- }).then(res => {
- if (res.data.code == 200) {
- if(res.data.data.length != 0){
- // that.listfl=['全部'];
- that.listfl=[];
- for(let i=0;i<res.data.data.length;i++){
- that.listfl.push(res.data.data[i].category_name)
- }
- that.listflall=res.data.data;
- that.getKxuan(that.listflall[0].id);
- }
- }else{
- that.listfl=[];
- }
- })
- },
- gengmore(){
-
- },
- gaoliang(index){
- this.chooseindex=index
- }
- },
- }
- </script>
- <style lang="scss">
- /deep/ .tm-menubars .body{
- background-color: #1b1b1b !important;
- }
- /deep/ .qiehuan1 .text-primary{color: white !important;}
- .chuanda{width: 100%;height: 144px;}
- .taiyang{width: 25px;}
- .bianji{border: 1px solid #303440;width: 80px;height: 30px;background: #303440;font-size: 15px;
- text-align: center;line-height: 30px;border-radius: 5px;margin: 0 auto;margin-top: 10px;border:1px solid white;}
- .scroll-view_H {
- white-space: nowrap;
- width: 100%;
- background: #1B1B1B;
- padding-bottom: 15px;
- }
- .scroll-view-item {
- height: 300rpx;
- text-align: center;
- font-size: 36rpx;
- }
- .scroll-view-item_H {
- display: inline-block;
- width: 150px;
- text-align: center;
- font-size: 36rpx;
- margin-left: 10px;
- background: #0D0D0D;
- padding: 6px;
- border-radius: 10px;
- }
- .yichu{margin:0 !important;padding: 4px !important;margin-top: 10px !important;}
- /deep/ .qiehuan .text-white{
- font-size: 14px;
- background: #303440;
- height: 28px;
- vertical-align: middle;
- line-height: 28px;
- border-radius: 20px;
- padding-left: 14px;
- padding-right: 14px;
- margin-top: 17%;
- }
- /deep/ .qiehuan .tm-tabs-con-item-border{display: none;}
- .yiguicla image{width: 95%;display: block;margin: 0 auto;margin-top: 5px;}
- .yiguicla{width: 47%;border-radius: 10px;height: 204px;}
- .more{text-align: center;}
- .more image{margin-right: 10px;vertical-align: middle;width: 30px;}
- .fudong{position:fixed;right:10px;bottom:150px;background: #303030;width: 130px;height: 60px;
- border-radius: 30px 0px 0px 30px;font-size: 14px;text-align: center;}
- .sao{width: 60%;display: block;margin: 0 auto;margin-bottom: 60px;}
- .biaoti view{width:5px;height:19px;background: #0178FD;float: left;border-radius: 10px;}
- </style>
|