index.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <view :style="{ minHeight: sys.windowHeight + 'px' }"
  3. :class="[$tm.vx.state().tmVuetify.black ? 'black' : ' ']">
  4. <tm-menubars title="添加穿搭" :shadow="0" :showback="true"></tm-menubars>
  5. <div class="zhuti">
  6. <!-- 衣橱 -->
  7. <tm-sheet class="yichu" style="margin-bottom: 40px !important;">
  8. <!-- <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> -->
  9. <view class="biaoti text-white mt-10 text-size-m"><view class="mr-10"></view>分类</view>
  10. <tm-tabs @change="fenlei" class="C1b1b1b qiehuan" color="white" align="left" v-model="activeIndexfl" :list="listfl" range-key="title"></tm-tabs>
  11. <!-- <view class="biaoti text-white mt-30 text-size-m"><view class="mr-10" v-if="yixuanor==0"></view>{{yixuanor==0?'场景':'请选择场景'}}</view> -->
  12. <!-- <tm-tabs @change="changjing" class="C1b1b1b qiehuan" color="white" align="left" v-model="activeIndexcj" :list="listcj" range-key="title"></tm-tabs> -->
  13. <!-- 可预约 -->
  14. <view class="yiguicla black pa-6 ma-4 fl" @click="gaoliang(index,item)" :class="chooseindex==index?'C0178FD':''" v-for="(item,index) in quanbuList">
  15. <image :src="item.image" mode="widthFix"></image>
  16. <view class="text-size-m mt-20 mb-20 ml-10">{{item.title}}</view>
  17. </view>
  18. <!-- 已预约 -->
  19. <!-- <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">
  20. <image :src="item.image" mode="widthFix"></image>
  21. <view class="text-size-m mt-20 mb-20 ml-10">{{item.title}}</view>
  22. </view> -->
  23. <tm-empty v-if="yixuanor==0 && quanbuList.length ==0" label="暂无数据" color="white" icon="icon-paperplane-fill"></tm-empty>
  24. <view style="clear: both;"></view>
  25. <!-- <view style="clear: both;" class="more ma-30 pt-40" @click="gengmore()">
  26. <image src="/static/img/30.png" mode="widthFix"></image>
  27. <text class="text-size-s">下拉加载更多~</text>
  28. </view> -->
  29. </tm-sheet>
  30. <!-- <tm-button @click="shanchu" v-if="yixuanor==0 && yixuanList.length !=0" theme="gray" :round="24" class="sao mb-40" block>取消删除</tm-button> -->
  31. <tm-button @click="yuyue" :round="24" class="sao mb-40" block>保存</tm-button>
  32. </div>
  33. <!-- 弹出层消息 -->
  34. <tm-message ref="toast"></tm-message>
  35. </view>
  36. </template>
  37. <script>
  38. import{myRequest} from '@/api/request.js'
  39. export default {
  40. data() {
  41. return {
  42. listflall:[],
  43. listcjall:[],
  44. listfl:[],
  45. yixuanor:0,//0已选
  46. list:['已预约穿搭','可预约穿搭'],
  47. listcj:[],
  48. active:0,
  49. activeIndexfl:0,
  50. activeIndexcj:0,
  51. quanbuList:[],
  52. yixuanList:[],
  53. chooseindex:-1
  54. };
  55. },
  56. onLoad(e) {
  57. this.type=e.type?e.type:'';
  58. this.id=e.id?e.id:'';
  59. this.old=e.old?e.old:'';
  60. },
  61. created() {
  62. this.sys = uni.getSystemInfoSync();
  63. this.getFl();
  64. },
  65. methods: {
  66. yuyue(){
  67. var that=this;
  68. if(this.chooseindex==-1){
  69. that.$refs.toast.show({model:'warn',label:'请选择衣物'})
  70. return
  71. }
  72. var id=this.quanbuList[this.chooseindex].id;
  73. if(this.old){
  74. // 修改
  75. myRequest({
  76. url: "/api/Collocation/updateStyle",
  77. method:'post',
  78. data:{id:that.id,dp_id:id}
  79. }).then(res => {
  80. if (res.data.code == 200) {
  81. setTimeout(function(){
  82. let pages = getCurrentPages(); // 当前页面
  83. let beforePage = pages[pages.length - 2]; // 前一个页面
  84. uni.navigateBack({
  85. delta: 1,
  86. success: function() {
  87. beforePage.$vm.initshow()
  88. }
  89. });
  90. },2000)
  91. that.$refs.toast.show({model:'success',label:res.data.msg})
  92. }else{
  93. that.$refs.toast.show({model:'error',label:res.data.msg})
  94. }
  95. })
  96. }else{
  97. myRequest({
  98. url: "/api/Collocation/addStyle",
  99. method:'post',
  100. data:{id:id,type:that.type}
  101. }).then(res => {
  102. if (res.data.code == 200) {
  103. setTimeout(function(){
  104. let pages = getCurrentPages(); // 当前页面
  105. let beforePage = pages[pages.length - 2]; // 前一个页面
  106. uni.navigateBack({
  107. delta: 1,
  108. success: function() {
  109. beforePage.$vm.initshow()
  110. }
  111. });
  112. },2000)
  113. that.$refs.toast.show({model:'success',label:res.data.msg})
  114. }else{
  115. that.$refs.toast.show({model:'error',label:res.data.msg})
  116. }
  117. })
  118. }
  119. },
  120. fenlei(e){
  121. var id=this.listflall[e].id;
  122. this.getKxuan(id)
  123. },
  124. getKxuan(id){
  125. var that=this;
  126. myRequest({
  127. url: "/api/Collocation/getPlanTomorrow",
  128. method:'post',
  129. data:{id:id}
  130. }).then(res => {
  131. if (res.data.code == 200) {
  132. that.quanbuList=res.data.data;
  133. for(let i=0;i<that.quanbuList.length;i++){
  134. if(that.quanbuList[i].id==this.old){
  135. this.chooseindex=i;
  136. }
  137. }
  138. }else{
  139. that.quanbuList=[];
  140. }
  141. })
  142. },
  143. getFl(){
  144. var that=this;
  145. myRequest({
  146. url: "/api/Category/getCollocationClassList",
  147. method:'post',
  148. data:{}
  149. }).then(res => {
  150. if (res.data.code == 200) {
  151. if(res.data.data.length != 0){
  152. // that.listfl=['全部'];
  153. that.listfl=[];
  154. for(let i=0;i<res.data.data.length;i++){
  155. that.listfl.push(res.data.data[i].category_name)
  156. }
  157. that.listflall=res.data.data;
  158. that.getKxuan(that.listflall[0].id);
  159. }
  160. }else{
  161. that.listfl=[];
  162. }
  163. })
  164. },
  165. gengmore(){
  166. },
  167. gaoliang(index){
  168. this.chooseindex=index
  169. }
  170. },
  171. }
  172. </script>
  173. <style lang="scss">
  174. /deep/ .tm-menubars .body{
  175. background-color: #1b1b1b !important;
  176. }
  177. /deep/ .qiehuan1 .text-primary{color: white !important;}
  178. .chuanda{width: 100%;height: 144px;}
  179. .taiyang{width: 25px;}
  180. .bianji{border: 1px solid #303440;width: 80px;height: 30px;background: #303440;font-size: 15px;
  181. text-align: center;line-height: 30px;border-radius: 5px;margin: 0 auto;margin-top: 10px;border:1px solid white;}
  182. .scroll-view_H {
  183. white-space: nowrap;
  184. width: 100%;
  185. background: #1B1B1B;
  186. padding-bottom: 15px;
  187. }
  188. .scroll-view-item {
  189. height: 300rpx;
  190. text-align: center;
  191. font-size: 36rpx;
  192. }
  193. .scroll-view-item_H {
  194. display: inline-block;
  195. width: 150px;
  196. text-align: center;
  197. font-size: 36rpx;
  198. margin-left: 10px;
  199. background: #0D0D0D;
  200. padding: 6px;
  201. border-radius: 10px;
  202. }
  203. .yichu{margin:0 !important;padding: 4px !important;margin-top: 10px !important;}
  204. /deep/ .qiehuan .text-white{
  205. font-size: 14px;
  206. background: #303440;
  207. height: 28px;
  208. vertical-align: middle;
  209. line-height: 28px;
  210. border-radius: 20px;
  211. padding-left: 14px;
  212. padding-right: 14px;
  213. margin-top: 17%;
  214. }
  215. /deep/ .qiehuan .tm-tabs-con-item-border{display: none;}
  216. .yiguicla image{width: 95%;display: block;margin: 0 auto;margin-top: 5px;}
  217. .yiguicla{width: 47%;border-radius: 10px;height: 204px;}
  218. .more{text-align: center;}
  219. .more image{margin-right: 10px;vertical-align: middle;width: 30px;}
  220. .fudong{position:fixed;right:10px;bottom:150px;background: #303030;width: 130px;height: 60px;
  221. border-radius: 30px 0px 0px 30px;font-size: 14px;text-align: center;}
  222. .sao{width: 60%;display: block;margin: 0 auto;margin-bottom: 60px;}
  223. .biaoti view{width:5px;height:19px;background: #0178FD;float: left;border-radius: 10px;}
  224. </style>