index.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <template>
  2. <view :style="{ minHeight: sys.windowHeight + 'px' }"
  3. :class="[$tm.vx.state().tmVuetify.black ? 'black' : ' ']">
  4. <tm-menubars :title="name" :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 v-if="yixuanor==1" class="biaoti text-white mt-10 text-size-m"><view class="mr-10"></view>分类</view>
  10. <tm-tabs @change="fenlei" v-if="yixuanor==1" 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 v-if="yixuanor==1" 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 && yixuanList.length ==0" label="暂无数据" color="white" icon="icon-paperplane-fill"></tm-empty>
  24. <tm-empty v-if="yixuanor==1 && quanbuList.length ==0" label="暂无数据" color="white" icon="icon-paperplane-fill"></tm-empty>
  25. <view style="clear: both;"></view>
  26. <!-- <view style="clear: both;" class="more ma-30 pt-40" @click="gengmore()">
  27. <image src="/static/img/30.png" mode="widthFix"></image>
  28. <text class="text-size-s">下拉加载更多~</text>
  29. </view> -->
  30. </tm-sheet>
  31. <tm-button @click="shanchu" v-if="yixuanor==0 && yixuanList.length !=0" theme="gray" :round="24" class="sao mb-40" block>取消预约</tm-button>
  32. <tm-button @click="yuyue" v-if="yixuanor==1" :round="24" class="sao mb-40" block>预约</tm-button>
  33. </div>
  34. <!-- 弹出层消息 -->
  35. <tm-message ref="toast"></tm-message>
  36. </view>
  37. </template>
  38. <script>
  39. import{myRequest} from '@/api/request.js'
  40. export default {
  41. data() {
  42. return {
  43. listflall:[],
  44. listcjall:[],
  45. listfl:[],
  46. yixuanor:0,//0已选
  47. list:['已预约穿搭','可预约穿搭'],
  48. listcj:[],
  49. active:0,
  50. activeIndexfl:0,
  51. activeIndexcj:0,
  52. quanbuList:[],
  53. yixuanList:[],
  54. chooseindex:-1,
  55. type:1,
  56. name:'添加穿搭'
  57. };
  58. },
  59. onLoad(e) {
  60. console.log()
  61. this.name=e.name?'明日计划':'添加穿搭'
  62. this.type=e.type?e.type:1;//1今天2明天
  63. },
  64. created() {
  65. this.sys = uni.getSystemInfoSync();
  66. this.getCj();
  67. this.getFl();
  68. },
  69. methods: {
  70. shanchu(){
  71. var that=this;
  72. if(this.chooseindex==-1){
  73. that.$refs.toast.show({model:'warn',label:'请选择要删除的衣物'})
  74. return
  75. }
  76. var id=this.yixuanList[this.chooseindex].id;
  77. myRequest({
  78. url: "/api/Collocation/deleteTomorrowAppointment",
  79. method:'post',
  80. data:{id:id}
  81. }).then(res => {
  82. if (res.data.code == 200) {
  83. that.$refs.toast.show({model:'success',label:res.data.msg})
  84. that.chooseindex=-1;
  85. that.getFl();
  86. this.getCj();
  87. }else{
  88. that.$refs.toast.show({model:'error',label:res.data.msg})
  89. }
  90. })
  91. },
  92. yuyue(){
  93. var that=this;
  94. var scene_id=this.listcjall[this.activeIndexcj].id;
  95. if(this.chooseindex==-1){
  96. that.$refs.toast.show({model:'warn',label:'请选择衣物'})
  97. return
  98. }
  99. var id=this.quanbuList[this.chooseindex].id;
  100. myRequest({
  101. url: "/api/Collocation/makeAppointmentTomorrow",
  102. method:'post',
  103. data:{id:id,scene_id:scene_id}
  104. }).then(res => {
  105. if (res.data.code == 200) {
  106. that.$refs.toast.show({model:'success',label:'预约成功'})
  107. that.chooseindex=-1;
  108. that.getFl();
  109. this.getCj();
  110. }else{
  111. that.$refs.toast.show({model:'error',label:res.data.msg})
  112. }
  113. })
  114. },
  115. fenlei(e){
  116. var id=this.listflall[e].id;
  117. this.getKxuan(id)
  118. },
  119. changjing(e){
  120. var id=this.listcjall[e].id;
  121. this.getYxuan(id)
  122. },
  123. shifouxuan(e){
  124. this.activeIndexcj=0;
  125. this.chooseindex=-1;
  126. this.yixuanor=e;
  127. this.activeIndexfl=0;
  128. // if(e==0){
  129. // // var id=this.listcjall[0].id;
  130. // this.getCj();
  131. // }else{
  132. // // var id=this.listflall[0].id;
  133. // this.getCj();
  134. // this.getFl();
  135. // }
  136. },
  137. getYxuan(id){
  138. var that=this;
  139. that.yixuanList=[];
  140. myRequest({
  141. url: "/api/Collocation/getAppointmentMatching",
  142. method:'post',
  143. data:{scene_id:id}
  144. }).then(res => {
  145. if (res.data.code == 200) {
  146. if(res.data.data.length != 0){
  147. that.yixuanList=res.data.data;
  148. }
  149. }else{
  150. that.yixuanList=[];
  151. }
  152. })
  153. },
  154. getKxuan(id){
  155. var that=this;
  156. myRequest({
  157. url: "/api/Collocation/getPlanTomorrow",
  158. method:'post',
  159. data:{id:id}
  160. }).then(res => {
  161. if (res.data.code == 200) {
  162. if(res.data.data.length != 0){
  163. that.quanbuList=res.data.data;
  164. }else{
  165. that.quanbuList=[]
  166. }
  167. }else{
  168. that.quanbuList=[];
  169. }
  170. })
  171. },
  172. getCj(){
  173. var that=this;
  174. myRequest({
  175. url: "/api/Scene/sceneList",
  176. method:'post',
  177. data:{}
  178. }).then(res => {
  179. if (res.data.code == 200) {
  180. if(res.data.data.length != 0){
  181. // that.listfl=['全部'];
  182. that.listcj=[];
  183. for(let i=0;i<res.data.data.length;i++){
  184. that.listcj.push(res.data.data[i].scene_name)
  185. }
  186. that.listcjall=res.data.data;
  187. that.getYxuan(that.listcjall[that.activeIndexcj].id)
  188. }
  189. }else{
  190. that.listcj=[];
  191. }
  192. })
  193. },
  194. getFl(){
  195. var that=this;
  196. myRequest({
  197. url: "/api/Category/getCollocationClassList",
  198. method:'post',
  199. data:{}
  200. }).then(res => {
  201. if (res.data.code == 200) {
  202. if(res.data.data.length != 0){
  203. // that.listfl=['全部'];
  204. that.listfl=[];
  205. for(let i=0;i<res.data.data.length;i++){
  206. that.listfl.push(res.data.data[i].category_name)
  207. }
  208. that.listflall=res.data.data;
  209. that.getKxuan(that.listflall[that.activeIndexfl].id);
  210. }
  211. }else{
  212. that.listfl=[];
  213. }
  214. })
  215. },
  216. gengmore(){
  217. },
  218. gaoliang(index){
  219. this.chooseindex=index
  220. }
  221. },
  222. }
  223. </script>
  224. <style lang="scss">
  225. /deep/ .tm-menubars .body{
  226. background-color: #1b1b1b !important;
  227. }
  228. /deep/ .qiehuan1 .text-primary{color: white !important;}
  229. .chuanda{width: 100%;height: 144px;}
  230. .taiyang{width: 25px;}
  231. .bianji{border: 1px solid #303440;width: 80px;height: 30px;background: #303440;font-size: 15px;
  232. text-align: center;line-height: 30px;border-radius: 5px;margin: 0 auto;margin-top: 10px;border:1px solid white;}
  233. .scroll-view_H {
  234. white-space: nowrap;
  235. width: 100%;
  236. background: #1B1B1B;
  237. padding-bottom: 15px;
  238. }
  239. .scroll-view-item {
  240. height: 300rpx;
  241. text-align: center;
  242. font-size: 36rpx;
  243. }
  244. .scroll-view-item_H {
  245. display: inline-block;
  246. width: 150px;
  247. text-align: center;
  248. font-size: 36rpx;
  249. margin-left: 10px;
  250. background: #0D0D0D;
  251. padding: 6px;
  252. border-radius: 10px;
  253. }
  254. .yichu{margin:0 !important;padding: 4px !important;margin-top: 10px !important;}
  255. /deep/ .qiehuan .text-white{
  256. font-size: 14px;
  257. background: #303440;
  258. height: 28px;
  259. vertical-align: middle;
  260. line-height: 28px;
  261. border-radius: 20px;
  262. padding-left: 14px;
  263. padding-right: 14px;
  264. margin-top: 17%;
  265. }
  266. /deep/ .qiehuan .tm-tabs-con-item-border{display: none;}
  267. .yiguicla image{width: 95%;display: block;margin: 0 auto;margin-top: 5px;}
  268. .yiguicla{width: 47%;border-radius: 10px;height: 204px;}
  269. .more{text-align: center;}
  270. .more image{margin-right: 10px;vertical-align: middle;width: 30px;}
  271. .fudong{position:fixed;right:10px;bottom:150px;background: #303030;width: 130px;height: 60px;
  272. border-radius: 30px 0px 0px 30px;font-size: 14px;text-align: center;}
  273. .sao{width: 60%;display: block;margin: 0 auto;margin-bottom: 60px;}
  274. .biaoti view{width:5px;height:19px;background: #0178FD;float: left;border-radius: 10px;}
  275. </style>