index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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 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. <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" v-if="yixuanor==1" :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() {
  57. },
  58. created() {
  59. this.sys = uni.getSystemInfoSync();
  60. this.getFl();
  61. this.getCj();
  62. },
  63. methods: {
  64. shanchu(){
  65. var that=this;
  66. if(this.chooseindex==-1){
  67. that.$refs.toast.show({model:'warn',label:'请选择要删除的衣物'})
  68. return
  69. }
  70. var id=this.yixuanList[this.chooseindex].id;
  71. myRequest({
  72. url: "/api/Collocation/deleteTomorrowAppointment",
  73. method:'post',
  74. data:{id:id}
  75. }).then(res => {
  76. if (res.data.code == 200) {
  77. that.$refs.toast.show({model:'success',label:res.data.msg})
  78. that.chooseindex=-1;
  79. that.getCj();
  80. }else{
  81. that.$refs.toast.show({model:'error',label:res.data.msg})
  82. }
  83. })
  84. },
  85. yuyue(){
  86. var that=this;
  87. var scene_id=this.listcjall[this.activeIndexcj].id;
  88. if(this.chooseindex==-1){
  89. that.$refs.toast.show({model:'warn',label:'请选择衣物'})
  90. return
  91. }
  92. var id=this.quanbuList[this.chooseindex].id;
  93. myRequest({
  94. url: "/api/Collocation/makeAppointmentTomorrow",
  95. method:'post',
  96. data:{id:id,scene_id:scene_id}
  97. }).then(res => {
  98. if (res.data.code == 200) {
  99. that.$refs.toast.show({model:'success',label:'预约成功'})
  100. that.chooseindex=-1;
  101. that.getFl();
  102. }else{
  103. that.$refs.toast.show({model:'error',label:res.data.msg})
  104. }
  105. })
  106. },
  107. fenlei(e){
  108. var id=this.listflall[e].id;
  109. this.getKxuan(id)
  110. },
  111. changjing(e){
  112. var id=this.listcjall[e].id;
  113. this.getYxuan(id)
  114. },
  115. shifouxuan(e){
  116. this.activeIndexcj=0;
  117. this.chooseindex=-1;
  118. this.yixuanor=e;
  119. if(e==0){
  120. var id=this.listcjall[0].id;
  121. this.getYxuan(id)
  122. }else{
  123. var id=this.listflall[0].id;
  124. this.getKxuan(id)
  125. }
  126. },
  127. getYxuan(id){
  128. var that=this;
  129. that.yixuanList=[];
  130. myRequest({
  131. url: "/api/Collocation/getAppointmentMatching",
  132. method:'post',
  133. data:{scene_id:id}
  134. }).then(res => {
  135. if (res.data.code == 200) {
  136. if(res.data.data.length != 0){
  137. that.yixuanList=res.data.data;
  138. }
  139. }else{
  140. that.yixuanList=[];
  141. }
  142. })
  143. },
  144. getKxuan(id){
  145. var that=this;
  146. myRequest({
  147. url: "/api/Collocation/getPlanTomorrow",
  148. method:'post',
  149. data:{id:id}
  150. }).then(res => {
  151. if (res.data.code == 200) {
  152. if(res.data.data.length != 0){
  153. that.quanbuList=res.data.data;
  154. }else{
  155. that.quanbuList=[]
  156. }
  157. }else{
  158. that.quanbuList=[];
  159. }
  160. })
  161. },
  162. getCj(){
  163. var that=this;
  164. myRequest({
  165. url: "/api/Scene/sceneList",
  166. method:'post',
  167. data:{}
  168. }).then(res => {
  169. if (res.data.code == 200) {
  170. if(res.data.data.length != 0){
  171. // that.listfl=['全部'];
  172. that.listcj=[];
  173. for(let i=0;i<res.data.data.length;i++){
  174. that.listcj.push(res.data.data[i].scene_name)
  175. }
  176. that.listcjall=res.data.data;
  177. that.getYxuan(that.listcjall[0].id)
  178. }
  179. }else{
  180. that.listcj=[];
  181. }
  182. })
  183. },
  184. getFl(){
  185. var that=this;
  186. myRequest({
  187. url: "/api/Category/getCollocationClassList",
  188. method:'post',
  189. data:{}
  190. }).then(res => {
  191. if (res.data.code == 200) {
  192. if(res.data.data.length != 0){
  193. // that.listfl=['全部'];
  194. that.listfl=[];
  195. for(let i=0;i<res.data.data.length;i++){
  196. that.listfl.push(res.data.data[i].category_name)
  197. }
  198. that.listflall=res.data.data;
  199. that.getKxuan(that.listflall[0].id);
  200. }
  201. }else{
  202. that.listfl=[];
  203. }
  204. })
  205. },
  206. gengmore(){
  207. },
  208. gaoliang(index){
  209. this.chooseindex=index
  210. }
  211. },
  212. }
  213. </script>
  214. <style lang="scss">
  215. /deep/ .tm-menubars .body{
  216. background-color: #1b1b1b !important;
  217. }
  218. /deep/ .qiehuan1 .text-primary{color: white !important;}
  219. .chuanda{width: 100%;height: 144px;}
  220. .taiyang{width: 25px;}
  221. .bianji{border: 1px solid #303440;width: 80px;height: 30px;background: #303440;font-size: 15px;
  222. text-align: center;line-height: 30px;border-radius: 5px;margin: 0 auto;margin-top: 10px;border:1px solid white;}
  223. .scroll-view_H {
  224. white-space: nowrap;
  225. width: 100%;
  226. background: #1B1B1B;
  227. padding-bottom: 15px;
  228. }
  229. .scroll-view-item {
  230. height: 300rpx;
  231. text-align: center;
  232. font-size: 36rpx;
  233. }
  234. .scroll-view-item_H {
  235. display: inline-block;
  236. width: 150px;
  237. text-align: center;
  238. font-size: 36rpx;
  239. margin-left: 10px;
  240. background: #0D0D0D;
  241. padding: 6px;
  242. border-radius: 10px;
  243. }
  244. .yichu{margin:0 !important;padding: 4px !important;margin-top: 10px !important;}
  245. /deep/ .qiehuan .text-white{
  246. font-size: 14px;
  247. background: #303440;
  248. height: 28px;
  249. vertical-align: middle;
  250. line-height: 28px;
  251. border-radius: 20px;
  252. padding-left: 14px;
  253. padding-right: 14px;
  254. margin-top: 17%;
  255. }
  256. /deep/ .qiehuan .tm-tabs-con-item-border{display: none;}
  257. .yiguicla image{width: 95%;display: block;margin: 0 auto;margin-top: 5px;}
  258. .yiguicla{width: 47%;border-radius: 10px;height: 204px;}
  259. .more{text-align: center;}
  260. .more image{margin-right: 10px;vertical-align: middle;width: 30px;}
  261. .fudong{position:fixed;right:10px;bottom:150px;background: #303030;width: 130px;height: 60px;
  262. border-radius: 30px 0px 0px 30px;font-size: 14px;text-align: center;}
  263. .sao{width: 60%;display: block;margin: 0 auto;margin-bottom: 60px;}
  264. .biaoti view{width:5px;height:19px;background: #0178FD;float: left;border-radius: 10px;}
  265. </style>