index.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  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. <tm-sheet class="kuang" style="padding-bottom: 10px !important;">
  7. <view style="width: 94%;margin:0 auto;">
  8. <image class="chuanda" src="/static/img/108.png" mode="widthFix"></image>
  9. <view class="shuru">
  10. <tm-form>
  11. <view class="text-size-m text-white">请输入搭配名称</view>
  12. <tm-input v-model="familyname" name="title" clear placeholder="出席重要场合" clear></tm-input>
  13. </tm-form>
  14. </view>
  15. <view>
  16. <view class="biaoti text-white mt-30 text-size-m"><view class="mr-10"></view>分类</view>
  17. <tm-tabs @change="fenlei" class="C1b1b1b qiehuan" color="white" align="left" v-model="activeIndex" :list="listfl" range-key="title"></tm-tabs>
  18. <!-- <view class="biaoti text-white mt-30 text-size-m"><view class="mr-10"></view>场景</view> -->
  19. <!-- <tm-tabs class="C1b1b1b qiehuan" color="white" align="left" v-model="activeIndex1" :list="list1" range-key="title"></tm-tabs> -->
  20. </view>
  21. <!-- <view v-if="off==1" class="text-align-center mt-20 text-white">丝缎质感纹理风衣</view> -->
  22. <!-- <view v-if="off==1" class="text-align-center mt-10 text-size-s">丝滑如肌肤</view> -->
  23. </view>
  24. </tm-sheet>
  25. </div>
  26. <!-- <view class="goumai shangpin" v-if="off==1" >
  27. <view class="pt-20"><text class="ml-20">衣物名</text><text class="fr mr-20 text-gray text-size-s">丝缎质感纹理风衣</text></view>
  28. <view class="pa-20"><tm-cartCellListFood v-on:jiaruFun="jiarufuFun" v-for="item in test1" :typeclick="typeclick1" :mdata="item" :cart-num.sync="item.buy"></tm-cartCellListFood></view>
  29. </view> -->
  30. <tm-sheet :shadow="24" class="jiaoxi xiao">
  31. <tm-tabs align="center" class="qiehuan1" v-model="activeIndex" :list="list5" range-key="title"></tm-tabs>
  32. </tm-sheet>
  33. <!-- 单品 -->
  34. <view class="zhuti shangpin">
  35. <tm-sheet :padding="[0, 0]" class="jiaoxi xiao">
  36. <tm-cartCellListFood v-on:genghuan="genghuan" v-for="item in test" :typeclick="typeclick" :mdata="item" :cart-num.sync="item.buy"></tm-cartCellListFood>
  37. </tm-sheet>
  38. </view>
  39. <!-- <tm-button :round="24" class="sao mb-40 mt-40" block>保存</tm-button> -->
  40. <view class="anniu">
  41. <tm-button @click="shanchu()" v-if="off==2" :round="24" theme="gray" size="n">删除</tm-button>
  42. <tm-button @click="baocun()" :round="24" class="fr" theme="primary" size="n">保存</tm-button>
  43. </view>
  44. <view style="clear: both;"></view>
  45. <!-- 弹出层消息 -->
  46. <tm-message ref="toast"></tm-message>
  47. </view>
  48. </template>
  49. <script>
  50. import{myRequest} from '@/api/request.js'
  51. export default {
  52. data() {
  53. return {
  54. listfl:[],
  55. listflall:[],
  56. familyname:'',
  57. off:1,
  58. activeIndex:0,
  59. list1:['开会','聚餐'],
  60. activeIndex1:0,
  61. list5:[ '搭配内的购物清单'],
  62. test: [],
  63. test1: [{
  64. img: '../../static/img/83.png',
  65. title: '丝缎质感纹理风衣',
  66. label: '黑色 - 6518/320',
  67. id: 3,
  68. buy: 0,
  69. itemId: 0
  70. }],
  71. typeclick1:6,//1加入购物车,2购物车,3前往购买,4,5
  72. typeclick:7,//1加入购物车,2购物车,3前往购买,4,5
  73. ids:[]
  74. };
  75. },
  76. onLoad(e) {
  77. this.off=e.type?e.type:1;//1保存2是修改
  78. this.id=e.id?e.id:13;
  79. if(this.off==1){
  80. this.huancun();
  81. }else{
  82. this.getDate();
  83. }
  84. },
  85. created() {
  86. this.sys = uni.getSystemInfoSync();
  87. this.getFl();
  88. this.fenleichange();
  89. },
  90. methods: {
  91. huancun(){
  92. var ids=[];
  93. console.log(11111111111)
  94. console.log(uni.getStorageSync("datalist"))
  95. if(uni.getStorageSync("datalist")){
  96. var datalist=uni.getStorageSync("datalist");
  97. this.test=[];
  98. for(let i=0;i<datalist.length;i++){
  99. this.test.push({
  100. img: datalist[i].image,
  101. title: datalist[i].goods_name,
  102. label: datalist[i].description,
  103. price: '',
  104. id: datalist[i].id,
  105. buy: 0,
  106. itemId: 0
  107. })
  108. ids.push(datalist[i].id)
  109. }
  110. this.ids=ids;
  111. }
  112. },
  113. genghuan(data){
  114. var that=this;
  115. console.log(data)
  116. uni.navigateTo({
  117. url: "/pages/genghuan/index?type=tihuan&id="+data.data.id,
  118. })
  119. },
  120. getDate(){
  121. var that=this;
  122. myRequest({
  123. url: "/api/Collocation/matchingSchemeDetails",
  124. method:'post',
  125. data:{type:2,id:that.id}
  126. }).then(res => {
  127. if (res.data.code == 200) {
  128. that.familyname=res.data.data.data.title;
  129. var datalist=res.data.data.details,datalist1=[];
  130. for(let i=0;i<datalist.length;i++){
  131. datalist1.push(datalist[i].goods)
  132. }
  133. uni.setStorageSync("datalist",datalist1)
  134. that.huancun();
  135. }else{
  136. }
  137. })
  138. },
  139. shanchu(){
  140. var that=this;
  141. myRequest({
  142. url: "/api/Collocation/customizedDeleteCollocation",
  143. method:'post',
  144. data:{id:that.id}
  145. }).then(res => {
  146. console.log(res.data)
  147. if (res.data.code == 200) {
  148. let pages = getCurrentPages(); // 当前页面
  149. let beforePage = pages[pages.length - 2]; // 前一个页面
  150. uni.navigateBack({
  151. delta: 1,
  152. success: function() {
  153. beforePage.$vm.initshow()
  154. }
  155. });
  156. that.$refs.toast.show({model:'success',label:res.data.msg})
  157. }else{
  158. that.$refs.toast.show({model:'error',label:res.data.msg})
  159. }
  160. })
  161. },
  162. fenleichange(){
  163. var that=this;
  164. myRequest({
  165. url: "/api/MemberInfo/getFamilyMember",
  166. method:'post',
  167. data:{family_id:uni.getStorageSync("family_id")}
  168. }).then(res => {
  169. if (res.data.code == 200) {
  170. if(res.data.data.length != 0){
  171. var wu=0;
  172. for(let i=0;i<res.data.data.length;i++){
  173. if(res.data.data[i].checked==1){
  174. wu=1;
  175. that.itemuser=res.data.data[i];
  176. }
  177. }
  178. if(wu==0){
  179. that.itemuser=res.data.data[0];
  180. }
  181. }else{
  182. that.itemuser=0;
  183. }
  184. }else{
  185. that.itemuser=0;
  186. }
  187. })
  188. },
  189. fenlei(e){
  190. this.activeIndex=e;
  191. },
  192. getFl(){
  193. var that=this;
  194. myRequest({
  195. url: "/api/Category/getCollocationClassList",
  196. method:'post',
  197. data:{}
  198. }).then(res => {
  199. if (res.data.code == 200) {
  200. if(res.data.data.length != 0){
  201. // that.listfl=['全部'];
  202. that.listfl=[];
  203. for(let i=0;i<res.data.data.length;i++){
  204. that.listfl.push(res.data.data[i].category_name)
  205. }
  206. that.listflall=res.data.data;
  207. }
  208. }else{
  209. that.listfl=[];
  210. }
  211. })
  212. },
  213. baocun(){
  214. var that=this;
  215. if(that.familyname==""){
  216. that.$refs.toast.show({model:'error',label:'请输入搭配名称'})
  217. return
  218. }
  219. var obj={
  220. title:that.familyname,
  221. category_id:that.listflall[that.activeIndex].id,
  222. memberinfo_id:that.itemuser.id,
  223. ids:this.ids,
  224. scene_id:''
  225. }
  226. if(this.off==1){
  227. // 保存
  228. var url="/api/Collocation/customizedCollocation"
  229. }else{
  230. obj['id']=that.id;
  231. var url="/api/Collocation/customizedUpdateCollocation"
  232. }
  233. myRequest({
  234. url: url,
  235. method:'post',
  236. data:obj
  237. }).then(res => {
  238. console.log(res.data)
  239. if (res.data.code == 200) {
  240. setTimeout(function(){
  241. uni.navigateTo({
  242. url: "/pages/index/index?index=2",
  243. })
  244. },2000)
  245. that.$refs.toast.show({model:'success',label:res.data.msg})
  246. }else{
  247. that.$refs.toast.show({model:'error',label:res.data.msg})
  248. }
  249. })
  250. console.log(obj)
  251. },
  252. jiarufuFun(data){
  253. // uni.navigateTo({
  254. // url: "/pages/shopdetail/index",
  255. // })
  256. console.log(data)
  257. },
  258. },
  259. }
  260. </script>
  261. <style lang="scss">
  262. /deep/ .tm-menubars .body{
  263. background-color: #1b1b1b !important;
  264. }
  265. /deep/ .zhuti{padding: 10px 10px;}
  266. /deep/ .kuang{margin:0 !important;padding: 0px !important;}
  267. .chuanda{width: 100%;margin-top:10px;}
  268. .shuru{background: #0D0D0D;padding: 10px;margin-top: 20px;}
  269. /deep/ .shuru .grey-darken-5{
  270. background-color: #0d0d0d!important;
  271. padding: 0px !important;
  272. }
  273. .shuru{border:1px solid #303030;border-radius: 10px;}
  274. /deep/ .shuru .text-primary.bk{color:#303030 !important;}
  275. /deep/ .shuru .border-grey-darken-4-b-1{border-bottom:none !important;}
  276. /deep/ .qiehuan .tm-tabs-con-item-border{display: none;}
  277. /deep/ .qiehuan .tm-tabs-con-item-text{background: #303440;height: 26px;line-height: 26px;
  278. padding-left: 14px;padding-right: 14px;margin-top: 17%;border-radius: 20px;margin-left: 10px;}
  279. /deep/ .qiehuan .text-white{
  280. font-size: 14px;
  281. background: #0178FD;
  282. height: 26px;
  283. vertical-align: middle;
  284. line-height: 26px;
  285. border-radius: 20px;
  286. padding-left: 14px;
  287. padding-right: 14px;
  288. margin-top: 17%;
  289. }
  290. .biaoti view{width:5px;height:19px;background: #0178FD;float: left;border-radius: 10px;}
  291. /deep/ .qiehuan1 .text-primary{color: white !important;}
  292. /deep/ .jiaoxi{margin:0 !important;padding: 8px !important;}
  293. /deep/ .shangpin .white.bk{background-color:#1b1b1b!important;}
  294. /deep/ .shangpin .tm-cartCellListFood{padding: 0px 0px 5px 0px !important;
  295. margin-top: 5px !important;border-bottom: 1px solid #1B1B1B;}
  296. /deep/ .shangpin .border-t-1.bk{border-top:1px solid #1b1b1b!important;}
  297. /deep/ .shangpin .round-3{width:120px !important;height:110px !important;}
  298. /deep/ .shangpin .tm-cartCellListFood-img{width:120px !important;height:110px !important;}
  299. /deep/ .shangpin .title{color: white !important;}
  300. /deep/ .shangpin .text-red{color: white !important;}
  301. .sao{width: 88%;display: block;margin: 0 auto;padding-bottom: 60px;margin-top: 20px;}
  302. .goumai{background: #1B1B1B;margin-bottom: 10px;}
  303. .anniu{width: 70%;margin: 0 auto;margin-top: 20px;padding-bottom: 30px;}
  304. </style>