index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  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. <view class="C1b1b1b">
  6. <view style="width: 90%;margin:0 auto;">
  7. <tm-tabs align="left" class="qiehuan1" v-model="activeIndex" :list="list" range-key="title"></tm-tabs>
  8. </view>
  9. <image v-if="activeIndex==0 && alldata !=0" class="touxiang" :src="alldata.detail.image" mode="widthFix"></image>
  10. </view>
  11. <div class="zhuti" style="padding-bottom:60px !important;" v-if="activeIndex==0">
  12. <view class="text-align-center text-size-lg" v-if="alldata !=0">{{alldata.detail.brand}}{{alldata.detail.color}}{{alldata.detail.goods_name}}</view>
  13. <view class="text-align-center text-size-s mt-10 text-gray" v-if="alldata !=0">{{alldata.detail.description}}</view>
  14. <tm-sheet class="kuang" style="padding-bottom: 30px !important;">
  15. <view style="width: 98%;margin:0 auto;margin-top:20px !important;position: relative;">
  16. <view class="text-white text-align-center pt-20">衣物参数</view>
  17. <view class="fr mr-20 xiugai" @click="xiugaiFun()">
  18. <image src="/static/img/64.png" mode="widthFix"></image>
  19. <text>{{xianshi?'修改':'保存'}}</text>
  20. </view>
  21. <view class="you black mt-30" v-if="alldata !=0">
  22. <tm-input :disabled="xianshi" :required="true" title="商品名称" v-model="alldata.detail.goods_name" align="right"></tm-input>
  23. <tm-pickers :disabled="xianshi" class="tan" :default-value.sync="category_danarr" rang-key="category_name" :list="category_arr">
  24. <tm-input :required="true" title="分类" placeholder="请选择分类" disabled :value="obTstr1(category_danarr,'category_name')" right-icon="icon-angle-right"></tm-input>
  25. </tm-pickers>
  26. <tm-pickers :disabled="xianshi" class="tan" :default-value.sync="role_danarr" rang-key="username" :list="role_arr">
  27. <tm-input title="所属成员" :required="true" placeholder="请选择所属成员" disabled :value="obTstr3(role_danarr)" right-icon="icon-angle-right"></tm-input>
  28. </tm-pickers>
  29. <tm-input :disabled="xianshi" title="年份" v-model="alldata.detail.year" align="right"></tm-input>
  30. <tm-input :disabled="xianshi" title="颜色" v-model="alldata.detail.color" align="right"></tm-input>
  31. <tm-pickers :disabled="xianshi" class="tan" :default-value.sync="size_danarr" rang-key="title" :list="size_arr">
  32. <tm-input title="尺码" placeholder="请选择尺码" disabled :value="obTstr2(size_danarr)" right-icon="icon-angle-right"></tm-input>
  33. </tm-pickers>
  34. <tm-input :disabled="xianshi" title="适用人群" v-model="alldata.detail.type" align="right"></tm-input>
  35. <tm-input :disabled="xianshi" title="品牌" v-model="alldata.detail.brand" align="right"></tm-input>
  36. <tm-input :disabled="xianshi" title="材料" v-model="alldata.detail.science" align="right"></tm-input>
  37. </view>
  38. </view>
  39. </tm-sheet>
  40. <tm-sheet class="kuang" v-if="alldata !=0 && alldata.data.length !=0">
  41. <view style="width: 98%;margin:0 auto;margin-top:20px !important;">
  42. <view class="text-white text-align-center pt-20">类似衣物</view>
  43. <view class="yiguicla black pa-6 ma-4 fl mb-20" v-for="item in alldata.data" @click="yifu(item.id)">
  44. <image :src="item.image" mode="widthFix"></image>
  45. <view class="text-align-center text-size-m mt-8">{{item.brand}}{{item.color}}</view>
  46. <view class="text-align-center text-size-m mt-6 mb-6">{{item.goods_name}}</view>
  47. </view>
  48. <view style="clear: both;"></view>
  49. </view>
  50. </tm-sheet>
  51. <!-- <tm-sheet class="kuang">
  52. <view style="width: 98%;margin:0 auto;margin-top:20px !important;">
  53. <view class="text-white text-align-center pt-20">品牌信息</view>
  54. <tm-listitem
  55. class="pb-20"
  56. :left-icon-size="100"
  57. value="100件商品"
  58. title="巴黎世家"
  59. label="只此一瞬,狂爱一生"
  60. left-icon="../../static/img/65.png"
  61. show-left-icon
  62. ></tm-listitem>
  63. </view>
  64. </tm-sheet> -->
  65. <tm-button v-if="alldata!=0 && alldata.detail.is_have !=0" :round="24" class="sao mb-40" block @click="chuku()">出库</tm-button>
  66. </div>
  67. <!-- 搭配 -->
  68. <tm-sheet v-if="activeIndex==1" class="yichu" style="margin-bottom: 40px !important;">
  69. <!-- <view class="biaoti text-white mt-30 text-size-m"><view class="mr-10"></view>分类</view> -->
  70. <!-- <tm-tabs class="C1b1b1b qiehuan" color="white" align="left" v-model="activeIndex" :list="list" range-key="title"></tm-tabs> -->
  71. <!-- <view class="biaoti text-white mt-30 text-size-m"><view class="mr-10"></view>场景</view> -->
  72. <!-- <tm-tabs class="C1b1b1b qiehuan" color="white" align="left" v-model="activeIndex1" :list="list1" range-key="title"></tm-tabs> -->
  73. <!-- <tm-tabs class="C1b1b1b qiehuan" color="white" align="left" v-model="activeIndex1" :list="list1" range-key="title"></tm-tabs> -->
  74. <view class="yiguicla1 black pa-6 ma-4 fl" v-for="(item,index) in quanbuList1" @click="yuyue(item.id)">
  75. <image :src="item.image" mode="widthFix"></image>
  76. <view class="text-size-m mt-20 mb-20 ml-10">{{item.title}}</view>
  77. </view>
  78. <tm-empty v-if="quanbuList1.length ==0" label="暂无数据" color="white" icon="icon-paperplane-fill"></tm-empty>
  79. <view style="clear: both;"></view>
  80. <!-- <view style="clear: both;" class="more ma-30 pt-40" @click="gengmore()">
  81. <image src="/static/img/30.png" mode="widthFix"></image>
  82. <text class="text-size-s">下拉加载更多~</text>
  83. </view> -->
  84. </tm-sheet>
  85. <tm-poup v-model="show_1" :position="pos" class="tcc">
  86. <view style="position: relative !important;" v-if="chukudata.length !=0">
  87. <view style="height: 10px;"></view>
  88. <tm-swiper :current="0" :indicator-dots="false" :round="6" :ani3d="190" :autoplay="false" :list="list1"></tm-swiper>
  89. <view class="text-white text-align-center mt-15">{{chukudata[0].brand}}{{chukudata[0].color}}{{chukudata[0].goods_name}}</view>
  90. <view class="text-white text-align-center mt-10 text-size-s">{{chukudata[0].description}}</view>
  91. <image class="guayi" :src="chukudata[0].ygimage" mode="widthFix"></image>
  92. <view class="text-white text-align-center mt-15">衣物位于 {{chukudata[0].ygposition}} {{chukudata[0].is_have}}号衣柜</view>
  93. <view class="text-white text-align-center mt-15">
  94. <image class="aniOn deng" src="/static/img/101.png" mode="widthFix"></image>
  95. <text style="vertical-align: middle;">指示灯已亮,请取出衣柜</text>
  96. </view>
  97. <view class="anniu">
  98. <tm-button @click="quxiao()" theme="gray" size="n">关闭弹框</tm-button>
  99. <tm-button @click="quxchuFun()" class="fr" theme="primary" size="n">取消出库</tm-button>
  100. </view>
  101. </view>
  102. </tm-poup>
  103. <!-- 弹出层消息 -->
  104. <tm-message ref="toast"></tm-message>
  105. </view>
  106. </template>
  107. <script>
  108. import{myRequest} from '@/api/request.js'
  109. export default {
  110. data() {
  111. return {
  112. category_arr:[],
  113. category_danarr:[],
  114. role_arr:[],
  115. role_danarr:[],
  116. size_arr:[
  117. {title:"S",id:1},
  118. {title:"M",id:2},
  119. {title:"L",id:3},
  120. {title:"XL",id:4},
  121. {title:"XXL",id:5},
  122. {title:"其他",id:6},
  123. ],
  124. size_danarr:[],
  125. show_1:false,
  126. pos:'center',
  127. xianshi:true,
  128. list1:[],
  129. list:[ '商品介绍','搭配方案'],
  130. activeIndex:0,
  131. activeIndex5:0,
  132. reqData:{
  133. goods_name:'',
  134. category_id:'',
  135. year:'',
  136. color:'',
  137. type:'',
  138. size:'',
  139. brand:'',
  140. science:'',
  141. role_id:''
  142. },
  143. typeclick1:3,//1加入购物车,2购物车,3前往购买,4,5
  144. typeclick:6,//1加入购物车,2购物车,3前往购买,4,5
  145. list5:[ '搭配内的购物清单'],
  146. quanbuList1:[],
  147. alldata:0,
  148. chukudata:[],
  149. qiuid:''
  150. };
  151. },
  152. onLoad(e) {
  153. this.id=e.id?e.id:'4';
  154. this.getXiangq();
  155. this.getfangan();
  156. },
  157. created() {
  158. this.sys = uni.getSystemInfoSync();
  159. },
  160. methods: {
  161. quxchuFun(){
  162. var that=this;
  163. console.log(that.chukudata[0].id)
  164. myRequest({
  165. url: "/api/Goods/cancelDelivery",
  166. method:'post',
  167. data:{qiu_id:that.qiuid,id:that.chukudata[0].id}
  168. }).then(res => {
  169. console.log(res.data)
  170. if (res.data.code == 200) {
  171. that.show_1=false;
  172. that.$refs.toast.show({model:'success',label:res.data.msg})
  173. }else{
  174. that.$refs.toast.show({model:'error',label:res.data.msg})
  175. }
  176. })
  177. },
  178. getfangan(){
  179. var that=this;
  180. myRequest({
  181. url: "/api/Collocation/matchingScheme",
  182. method:'post',
  183. data:{id:that.id}
  184. }).then(res => {
  185. if (res.data.code == 200) {
  186. that.quanbuList1=res.data.data;
  187. }else{
  188. that.quanbuList1=[];
  189. }
  190. })
  191. },
  192. yifu(id){
  193. this.id=id;
  194. this.getXiangq();
  195. this.getfangan();
  196. },
  197. yuyue(id){
  198. uni.navigateTo({
  199. url: "/pages/zidingyikan/index?id="+id+"&type=1",
  200. })
  201. },
  202. obTstr2(o){
  203. if(Array.isArray(o)){
  204. if(o.length.length===0) return "";
  205. return o[0]?.title??""
  206. }
  207. return ''
  208. },
  209. getCY(){
  210. var that=this;
  211. myRequest({
  212. url: "/api/MemberInfo/getFamilyMember",
  213. method:'post',
  214. data:{family_id:uni.getStorageSync("family_id")}
  215. }).then(res => {
  216. if (res.data.code == 200) {
  217. that.role_arr=res.data.data;
  218. var id=that.alldata.detail.role_id;
  219. for(let i=0;i<res.data.data.length;i++){
  220. if(id==res.data.data[i].id){
  221. this.role_danarr=[{
  222. username:res.data.data[i].username,
  223. id:res.data.data[i].id
  224. }]
  225. }
  226. }
  227. var sid=that.alldata.detail.size;
  228. for(let i=0;i<that.size_arr.length;i++){
  229. if(sid==that.size_arr[i].id){
  230. this.size_danarr.push(that.size_arr[i])
  231. }
  232. }
  233. }else{
  234. that.role_arr=[];
  235. }
  236. })
  237. },
  238. obTstr3(o){
  239. if(Array.isArray(o)){
  240. if(o.length.length===0) return "";
  241. return o[0]?.username??""
  242. }
  243. return ''
  244. },
  245. getFl(){
  246. var that=this;
  247. myRequest({
  248. url: "/api/Category/list",
  249. method:'post',
  250. data:{}
  251. }).then(res => {
  252. if (res.data.code == 200) {
  253. this.category_arr=res.data.data;
  254. var id=that.alldata.detail.category_id;
  255. for(let i=0;i<res.data.data.length;i++){
  256. if(id==res.data.data[i].id){
  257. this.category_danarr=[{
  258. category_name:res.data.data[i].category_name,
  259. id:res.data.data[i].id
  260. }]
  261. }
  262. }
  263. }else{
  264. that.category_arr=[];
  265. }
  266. })
  267. },
  268. obTstr1(o){
  269. if(Array.isArray(o)){
  270. if(o.length.length===0) return "";
  271. return o[0]?.category_name??""
  272. }
  273. return ''
  274. },
  275. getXiangq(){
  276. var that=this;
  277. myRequest({
  278. url: "/api/Goods/getDetail",
  279. method:'post',
  280. data:{id:that.id}
  281. }).then(res => {
  282. if (res.data.code == 200) {
  283. that.alldata=res.data.data;
  284. that.getFl();
  285. that.getCY();
  286. }else{
  287. that.alldata=[];
  288. }
  289. })
  290. },
  291. gengmore(){
  292. },
  293. chuku(){
  294. var that=this;
  295. that.list1=[];
  296. myRequest({
  297. url: "/api/Goods/takeClothes",
  298. method:'post',
  299. data:{id:[that.id]}
  300. }).then(res => {
  301. if (res.data.code == 200) {
  302. that.show_1=true;
  303. that.chukudata=res.data.data;
  304. that.qiuid=res.data.data[0].qiu_id
  305. that.list1.push(res.data.data[0].image)
  306. that.$refs.toast.show({model:'success',label:'出库成功'})
  307. }else{
  308. that.$refs.toast.show({model:'error',label:res.data.msg})
  309. }
  310. })
  311. },
  312. xiugaiFun(){
  313. var that=this;
  314. if(! this.xianshi){
  315. if(that.category_danarr.length==0){
  316. that.$refs.toast.show({model:'warn',label:'请选择分类'})
  317. return
  318. }else{
  319. that.reqData.category_id=that.category_danarr[0].id
  320. }
  321. if(that.role_danarr.length==0){
  322. that.$refs.toast.show({model:'warn',label:'请选择成员'})
  323. return
  324. }else{
  325. that.reqData.role_id=that.role_danarr[0].id
  326. }
  327. if(that.size_danarr.length!=0){
  328. that.reqData.size=that.size_danarr[0].id
  329. }
  330. that.reqData.goods_name=that.alldata.detail.goods_name;
  331. if(that.reqData.goods_name==""){
  332. that.$refs.toast.show({model:'warn',label:'请输入商品名称'})
  333. return
  334. }
  335. that.reqData.year=that.alldata.detail.year;
  336. that.reqData.color=that.alldata.detail.color;
  337. that.reqData.type=that.alldata.detail.type;
  338. that.reqData.brand=that.alldata.detail.brand;
  339. that.reqData.science=that.alldata.detail.science;
  340. that.reqData.id=that.alldata.detail.id;
  341. myRequest({
  342. url: "/api/Goods/updateGoods",
  343. method:'post',
  344. data:that.reqData
  345. }).then(res => {
  346. if (res.data.code == 200) {
  347. that.$refs.toast.show({model:'success',label:res.data.msg})
  348. }else{
  349. that.$refs.toast.show({model:'error',label:res.data.msg})
  350. }
  351. })
  352. console.log(this.reqData)
  353. }
  354. this.xianshi=!this.xianshi;
  355. },
  356. quxiao(){
  357. this.show_1=false;
  358. },
  359. },
  360. }
  361. </script>
  362. <style lang="scss">
  363. /deep/ .tm-menubars .body{
  364. background-color: #1b1b1b !important;
  365. }
  366. /deep/ .zhuti{padding: 10px 10px;}
  367. /deep/ .kuang{margin:0 !important;padding: 0px !important;}
  368. /deep/ .qiehuan1 .text-primary{color: white !important;}
  369. .touxiang{width: 100%;display: block;margin-top: 10px;}
  370. .xiugai image{width: 18px;vertical-align: middle;margin-right:5px;}
  371. .xiugai text{vertical-align: middle;}
  372. .xiugai{position: absolute;right:5px;top:10px;}
  373. .you{border-radius: 10px;padding:10px;width: 88%;margin:0 auto;margin-top:20px;}
  374. /deep/ .you .grey-darken-5{
  375. background-color: #0d0d0d!important;
  376. padding: 0px !important;
  377. }
  378. /deep/ .you .text-red{color: white;}
  379. /deep/ .tan .active{background-color: #AAAAAA !important;}
  380. /deep/ .tan .tm-poups .grey-darken-5{background-color: gray !important;}
  381. /deep/ .tan uni-input{text-align: right;}
  382. /deep/ .you .border-grey-darken-4-b-1 {
  383. border-bottom: solid 1px #313131 !important;
  384. }
  385. .yiguicla image{width: 95%;display: block;margin: 0 auto;margin-top: 5px;}
  386. .yiguicla{width: 30%;border-radius: 10px;}
  387. .sao{width: 88%;margin:0 auto;margin-top:40px;}
  388. /deep/ .mx-32{margin:0px !important;margin-top:15px !important;}
  389. /deep/ .tcc .tm-poup-wk{width: 90% !important;position:relative;height: 580px !important;}
  390. /deep/ .tcc .uni-swiper-slides{width: 100%;}
  391. /deep/ .tcc uni-swiper{width: 100% !important;}
  392. /deep/ .uni-swiper-slides{width: 160px !important;}
  393. /deep/ .tcc uni-image{width: 160px !important;}
  394. .tcc .guayi{width: 60% !important;display: block;margin:0 auto;margin-top:15px !important;}
  395. .tcc .deng{width:25px !important;height:25px !important;vertical-align: middle;margin-right:8px;}
  396. .aniOn{
  397. animation:doudong 0.5s linear infinite;
  398. background:linear-gradient();
  399. background: -webkit-linear-gradient();
  400. }
  401. @keyframes doudong {
  402. 0%{
  403. transform: rotate(-2deg) translateX(2rpx) translateY(2rpx);
  404. }
  405. 25%{
  406. transform: rotate(0deg) translateX(-2rpx) translateY(-2rpx);
  407. }
  408. 50%{
  409. transform: rotate(0deg) translateX(0rpx) translateY(-2rpx);
  410. }
  411. 75%{
  412. transform: rotate(0deg) translateX(0rpx) translateY(2rpx);
  413. }
  414. 100%{
  415. transform: rotate(-2deg) translateX(2rpx) translateY(2rpx);
  416. }
  417. }
  418. .anniu{width: 88%;margin: 0 auto;margin-top: 20px;}
  419. /deep/ .anniu .gray.bk{color: white !important;}
  420. .biaoti view{width:5px;height:19px;background: #0178FD;float: left;border-radius: 10px;}
  421. /deep/ .qiehuan1 .text-primary{color: white !important;}
  422. /deep/ .jiaoxi{margin:0 !important;padding: 8px !important;}
  423. /deep/ .shangpin .white.bk{background-color:#1b1b1b!important;}
  424. /deep/ .shangpin .tm-cartCellListFood{padding: 0px 0px 5px 0px !important;
  425. margin-top: 5px !important;border-bottom: 1px solid #1B1B1B;}
  426. /deep/ .shangpin .border-t-1.bk{border-top:1px solid #1b1b1b!important;}
  427. /deep/ .shangpin .round-3{width:120px !important;height:110px !important;}
  428. /deep/ .shangpin .tm-cartCellListFood-img{width:120px !important;height:110px !important;}
  429. /deep/ .shangpin .title{color: white !important;}
  430. /deep/ .shangpin .text-red{color: white !important;}
  431. .sao{width: 88%;display: block;margin: 0 auto;padding-bottom: 60px;margin-top: 20px;}
  432. .goumai{background: #1B1B1B;margin-bottom: 10px;}
  433. .anniu{width: 80%;margin: 0 auto;margin-top: 20px;padding-bottom: 30px;}
  434. /deep/ .qiehuan1 .text-primary{color: white !important;}
  435. .yiguicla1 image{width: 95%;display: block;margin: 0 auto;margin-top: 5px;}
  436. .yiguicla1{width: 47%;border-radius: 10px;}
  437. .more{text-align: center;}
  438. .more image{margin-right: 10px;vertical-align: middle;width: 30px;}
  439. </style>