index.vue 14 KB

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