index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. <template>
  2. <view :style="{ minHeight: sys.windowHeight + 'px' }" :class="[$tm.vx.state().tmVuetify.black ? 'black' : ' ']">
  3. <tm-menubars title="衣柜" :shadow="0" :showback="true"></tm-menubars>
  4. <view class="C1b1b1b">
  5. <view class="dingwei ml-20" v-if="itemuser!=0">
  6. <image class="touxiang" style="vertical-align: middle;" src="/static/img/41.png" mode="widthFix"></image>
  7. <text style="vertical-align: middle;" class="text-size-m mr-20">{{itemuser.username}}的衣橱</text>
  8. <!-- <image @click="qiehuanFun" style="vertical-align: middle;" src="/static/img/42.png" mode="widthFix"></image> -->
  9. <!-- <text @click="qiehuanFun" style="vertical-align: middle;" class="text-size-m">切换</text> -->
  10. </view>
  11. <view class="dingwei" v-if="itemuser==0">
  12. <text style="vertical-align: middle;" class="text-size-m mr-20">暂无家庭成员去添加</text>
  13. <image @click="tianjia" style="vertical-align: middle;" src="/static/img/42.png" mode="widthFix"></image>
  14. </view>
  15. </view>
  16. <!-- 推荐 -->
  17. <view class="zhuti">
  18. <!-- 衣橱 -->
  19. <tm-sheet class="yichu" style="margin-bottom: 70px !important;">
  20. <tm-tabs class="C1b1b1b qiehuan" @change="fenleichangeFun" color="white" align="left" v-model="activeIndex" :list="list" range-key="title"></tm-tabs>
  21. <view style="position: relative;" class="yiguicla black pa-6 ma-4 fl" :class="itemoff==index?'C0178FD':''" v-for="(item,index) in quanbuList" @click="yifu(index)">
  22. <image :src="item.image" mode="widthFix"></image>
  23. <view class="text-align-center text-size-m mt-8">{{item.brand}}</view>
  24. <view :class="item.is_have==0?'text-gray':''" class="text-align-center text-size-m mt-6 mb-6">{{item.goods_name}}</view>
  25. <view v-if="item.is_have==0" class="hui"></view>
  26. </view>
  27. <view style="clear: both;"></view>
  28. <view v-if="quanbuList.length<total" class="more ma-30 pt-40" @click="gengmore()">
  29. <image src="/static/img/30.png" mode="widthFix"></image>
  30. <text class="text-size-s">下拉加载更多~</text>
  31. </view>
  32. </tm-sheet>
  33. <view class="">
  34. <!-- <tm-button @click="quxiao1" :round="24" class="fl" theme="gray" size="n">取消</tm-button> -->
  35. <!-- <tm-button :round="24" @click="shanchu" class="fl" theme="red" size="n">删除</tm-button> -->
  36. <!-- <tm-button :round="24" @click="chuku" class="fl" theme="primary" size="n">出库</tm-button> -->
  37. <tm-button :round="24" @click="baocun" theme="primary" size="n">确定</tm-button>
  38. </view>
  39. <tm-poup v-model="show_1" :position="pos" class="tcc">
  40. <view style="position: relative !important;" v-if="chukudata.length !=0">
  41. <view style="height: 10px;"></view>
  42. <tm-swiper @change="qiehuanLb" :current="current" :indicator-dots="false" :round="6" :ani3d="190" :autoplay="false" :list="list1"></tm-swiper>
  43. <view class="text-white text-align-center mt-15">{{chukudata[current].brand}}{{chukudata[current].color}}{{chukudata[current].goods_name}}</view>
  44. <view class="text-white text-align-center mt-10 text-size-s">{{chukudata[current].description}}</view>
  45. <image class="guayi" :src="chukudata[current].ygimage" mode="widthFix"></image>
  46. <view class="text-white text-align-center mt-15">衣物位于 {{chukudata[current].ygposition}} {{chukudata[current].is_have}}号衣柜</view>
  47. <view class="text-white text-align-center mt-15">
  48. <image class="aniOn deng" src="/static/img/101.png" mode="widthFix"></image>
  49. <text style="vertical-align: middle;">指示灯已亮,请取出衣柜</text>
  50. </view>
  51. <view class="anniu">
  52. <tm-button @click="quxiao()" theme="gray" size="n">关闭弹框</tm-button>
  53. <tm-button @click="chuFun()" class="fr" theme="primary" size="n">取消出库</tm-button>
  54. </view>
  55. </view>
  56. </tm-poup>
  57. <!-- 弹出层消息 -->
  58. <tm-message ref="toast"></tm-message>
  59. <tm-dialog v-model="show" :content="content" @confirm="queren"></tm-dialog>
  60. </view>
  61. </view>
  62. </template>
  63. <script>
  64. import{myRequest} from '@/api/request.js'
  65. export default {
  66. data() {
  67. return {
  68. itemuser:0,
  69. soso:'',
  70. activeIndex:0,
  71. list:[],
  72. list1:[],
  73. listlx:[],
  74. quanbuList:[],
  75. itemoff:-1,
  76. pagesize:6,
  77. page:1,
  78. total:0,
  79. count:0,
  80. have:0,
  81. show:false,
  82. content:'',
  83. show_1:false,
  84. pos:'center',
  85. chukudata:[],
  86. ids:[],
  87. current:0
  88. };
  89. },
  90. onLoad(e) {
  91. this.goods_id=e.goods_id?e.goods_id:'';//是自己的
  92. this.id=e.id?e.id:'';//是自己的
  93. this.type=e.type?e.type:"";//是自己的
  94. },
  95. created() {
  96. this.sys = uni.getSystemInfoSync();
  97. this.getfenltext()
  98. this.fenleichange();
  99. },
  100. methods: {
  101. baocun(){
  102. var that=this;
  103. if(this.itemoff==-1){
  104. that.$refs.toast.show({model:'error',label:'请选择衣物'})
  105. return
  106. }
  107. var id=this.quanbuList[this.itemoff].id;
  108. // if(that.id==id){
  109. // uni.navigateBack();
  110. // that.$refs.toast.show({model:'success',label:'修改成功'})
  111. // return
  112. // }
  113. if(this.type=="tihuan"){
  114. var datalist=uni.getStorageSync("datalist");
  115. for(let i=0;i<datalist.length;i++){
  116. if(datalist[i].id==this.id){
  117. datalist[i]=this.quanbuList[this.itemoff];
  118. uni.setStorageSync("datalist",datalist)
  119. uni.navigateBack();
  120. }
  121. }
  122. return
  123. }
  124. myRequest({
  125. url: "/api/Collocation/changeClothes",
  126. method:'post',
  127. data:{y_id:that.id,g_id:id}
  128. }).then(res => {
  129. if (res.data.code == 200) {
  130. setTimeout(function(){
  131. uni.navigateBack();
  132. },2000)
  133. that.$refs.toast.show({model:'success',label:res.data.msg})
  134. }else{
  135. that.$refs.toast.show({model:'error',label:res.data.msg})
  136. }
  137. })
  138. },
  139. qiehuanLb(e){
  140. var that=this;
  141. this.current=e;
  142. },
  143. queren(){
  144. var that=this;
  145. this.list1=[]
  146. myRequest({
  147. url: "/api/Goods/takeClothes",
  148. method:'post',
  149. data:{id:that.ids}
  150. }).then(res => {
  151. if (res.data.code == 200) {
  152. that.show_1=true;
  153. that.chukudata=res.data.data;
  154. for(let i=0;i<res.data.data.length;i++){
  155. that.list1.push(res.data.data[i].image)
  156. }
  157. that.$refs.toast.show({model:'success',label:'出库成功'})
  158. }else{
  159. that.$refs.toast.show({model:'error',label:res.data.msg})
  160. }
  161. })
  162. },
  163. quxiao1(){
  164. for(let i=0;i<this.quanbuList.length;i++){
  165. this.quanbuList[i].off=false;
  166. this.$forceUpdate()
  167. }
  168. },
  169. chuku(){
  170. var id=[],a=0;
  171. var that=this;
  172. if(this.quanbuList.length==0){
  173. that.$refs.toast.show({model:'error',label:'请选择衣物'})
  174. return
  175. }
  176. for(let i=0;i<this.quanbuList.length;i++){
  177. if(this.quanbuList[i].off){
  178. a=a+1;
  179. if(this.quanbuList[i].off && this.quanbuList[i].is_have !=0){
  180. id.push(this.quanbuList[i].id)
  181. }
  182. }
  183. }
  184. if(id.length==0){
  185. that.$refs.toast.show({model:'error',label:'请选择在库衣物'})
  186. return
  187. }
  188. this.content="有"+(a-id.length)+"衣物已经出库,在库衣物将添加至出库清单"
  189. this.ids=id;
  190. this.show=true;
  191. },
  192. sosoFun(){
  193. uni.navigateTo({
  194. url: "/pages/shopsoso/index",
  195. })
  196. },
  197. getfenltext(){
  198. var that=this;
  199. myRequest({
  200. url: "/api/Category/list",
  201. method:'post',
  202. data:{}
  203. }).then(res => {
  204. if (res.data.code == 200) {
  205. if(res.data.data.length != 0){
  206. that.list=['全部'];
  207. for(let i=0;i<res.data.data.length;i++){
  208. that.list.push(res.data.data[i].category_name)
  209. }
  210. that.listlx=res.data.data;
  211. }
  212. }else{
  213. that.list=[];
  214. that.listlx=[];
  215. }
  216. })
  217. },
  218. getList(){
  219. var that=this;
  220. myRequest({
  221. url: "/api/Goods/classificationData",
  222. method:'post',
  223. data:{role_id:that.itemuser.id,id:that.activeIndex,page:that.page,pagesize:that.pagesize}
  224. }).then(res => {
  225. if (res.data.code == 200) {
  226. if(res.data.data.length != 0){
  227. that.quanbuList=that.quanbuList.concat(res.data.data.data);
  228. for(let i=0;i<that.quanbuList.length;i++){
  229. that.quanbuList[i].off=false;
  230. }
  231. that.total=res.data.data.total;
  232. that.count=res.data.data.count;
  233. that.have=res.data.data.have;
  234. }
  235. }else{
  236. that.quanbuList=[];
  237. }
  238. })
  239. },
  240. fenleichangeFun(){
  241. this.page=1;
  242. this.quanbuList=[]
  243. this.getList()
  244. },
  245. fenleichange(){
  246. var that=this;
  247. myRequest({
  248. url: "/api/MemberInfo/getFamilyMember",
  249. method:'post',
  250. data:{family_id:uni.getStorageSync("family_id")}
  251. }).then(res => {
  252. if (res.data.code == 200) {
  253. if(res.data.data.length != 0){
  254. var wu=0;
  255. for(let i=0;i<res.data.data.length;i++){
  256. if(res.data.data[i].checked==1){
  257. wu=1;
  258. that.itemuser=res.data.data[i];
  259. }
  260. }
  261. if(wu==0){
  262. that.itemuser=res.data.data[0];
  263. }
  264. that.getList();
  265. }else{
  266. that.itemuser=0;
  267. }
  268. }else{
  269. that.itemuser=0;
  270. }
  271. })
  272. },
  273. yifu(index){
  274. this.itemoff=index;
  275. },
  276. qiehuanFun(){
  277. uni.navigateTo({
  278. url: "/pages/qiehuan/index",
  279. })
  280. },
  281. randouh(){
  282. let list2 = [],that=this;
  283. for(let i=0;i<6;i++){
  284. list2.push({
  285. src:'/static/img/47.png',
  286. text:'大号版型夹克',
  287. type:'新品',
  288. off:false
  289. })
  290. }
  291. this.quanbuList=this.quanbuList.concat(list2)
  292. },
  293. ruku(){
  294. uni.navigateTo({
  295. url: "/pages/putstorage/index",
  296. })
  297. },
  298. quxiao(){
  299. this.show_1=false;
  300. },
  301. },
  302. }
  303. </script>
  304. <style lang="scss">
  305. /deep/ uni-scroll-view{
  306. height: auto !important;
  307. }
  308. /deep/ .tm-menubars .body{
  309. background-color: #1b1b1b !important;
  310. }
  311. .shangright{
  312. padding: 10px;
  313. }
  314. //
  315. .xiangji image{
  316. width: 30px;
  317. height: 22px;
  318. }
  319. .suosou image{
  320. width: 40px;
  321. }
  322. /deep/ .icon-search{
  323. font-size: 23px !important;
  324. color: #8E8E93 !important;
  325. }
  326. /deep/ .tm-search{
  327. width: 94%;
  328. margin: 0 auto;
  329. background-color: #414141 !important;
  330. border-radius: 10px;
  331. }
  332. /deep/ .tm-search .grey-darken-5{
  333. background-color: #414141 !important;
  334. }
  335. .dingwei{padding-bottom: 20px;}
  336. .dingwei image{width: 25px;margin-right: 10px; }
  337. .dingwei .touxiang{width: 50px;margin-right: 3px; }
  338. /deep/ .lunbo1{margin:0 !important;padding: 4px !important;margin-top: 5px !important;width: 46.6% !important;}
  339. .tuijiantp{width: 100%;}
  340. .tuijiantp image{width: 97% !important;}
  341. .yichu{margin:0 !important;padding: 4px !important;margin-top: 10px !important;}
  342. /deep/ .qiehuan .text-white{
  343. font-size: 14px;
  344. background: #303440;
  345. height: 28px;
  346. vertical-align: middle;
  347. line-height: 28px;
  348. border-radius: 20px;
  349. padding-left: 14px;
  350. padding-right: 14px;
  351. margin-top: 17%;
  352. }
  353. /deep/ .qiehuan .tm-tabs-con-item-border{display: none;}
  354. .yiguicla image{width: 95%;display: block;margin: 0 auto;margin-top: 5px;}
  355. .yiguicla{width: 30%;border-radius: 10px;}
  356. .more{text-align: center;}
  357. .more image{margin-right: 10px;vertical-align: middle;width: 30px;}
  358. .fudong{position:fixed;right:10px;bottom:150px;background: #303030;width: 130px;height: 60px;
  359. border-radius: 30px 0px 0px 30px;font-size: 14px;text-align: center;}
  360. .fudimg{width: 60px;height:60px}
  361. // .anniu{width: 100%;margin: 0 auto;padding-bottom: 30px;text-align: center;}
  362. // /deep/ .tm-button .tm-button-btn uni-button{min-width: 77px !important;}
  363. /deep/ .tm-button .red{color: white !important;}
  364. /deep/ .tcc .tm-poup-wk{width: 90% !important;position:relative;height: 580px !important;}
  365. /deep/ .tcc .uni-swiper-slides{width: 100%;}
  366. /deep/ .tcc uni-swiper{width: 100% !important;}
  367. /deep/ .uni-swiper-slides{width: 160px !important;}
  368. /deep/ .tcc uni-image{width: 160px !important;}
  369. .tcc .guayi{width: 70% !important;display: block;margin:0 auto;margin-top:15px !important;}
  370. .tcc .deng{width:25px !important;height:25px !important;vertical-align: middle;margin-right:8px;}
  371. .aniOn{
  372. animation:doudong 0.5s linear infinite;
  373. background:linear-gradient();
  374. background: -webkit-linear-gradient();
  375. }
  376. @keyframes doudong {
  377. 0%{
  378. transform: rotate(-2deg) translateX(2rpx) translateY(2rpx);
  379. }
  380. 25%{
  381. transform: rotate(0deg) translateX(-2rpx) translateY(-2rpx);
  382. }
  383. 50%{
  384. transform: rotate(0deg) translateX(0rpx) translateY(-2rpx);
  385. }
  386. 75%{
  387. transform: rotate(0deg) translateX(0rpx) translateY(2rpx);
  388. }
  389. 100%{
  390. transform: rotate(-2deg) translateX(2rpx) translateY(2rpx);
  391. }
  392. }
  393. /deep/ .tcc .anniu .gray.bk{color: white !important;}
  394. // .tcc .anniu{width: 88%;margin: 0 auto;margin-top: 20px;}
  395. /deep/ .tm-button{width: 80%;margin: 0 auto;margin-top: 20px;display: block;}
  396. /deep/ .tm-button-btn{width: 100% !important;}
  397. /deep/ .hui{position: absolute;background: rgba(0,0,0,0.4);z-index: 1;top: 0;left: 0;width: 100%;height: 100%;}
  398. </style>