index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536
  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. <tm-swiper :list="swipList" :autoplay="true" :indicator-dots="true" height="288px" circular></tm-swiper>
  6. <view style="padding: 10px 20px;">
  7. <view class="del_title">
  8. <view>{{details.goods_name}}</view>
  9. <view class="de_tag">运动休闲</view>
  10. </view>
  11. <view style="display: flex;justify-content: space-between;">
  12. <view>
  13. <text class="sale_price">¥{{details.sale_price}}</text>
  14. <text class="original_price" v-if="details.market_price">原价:{{details.market_price}}</text>
  15. </view>
  16. <view style="font-size: 14px;color:#ababab;">销量:{{details.sale_num}}</view>
  17. </view>
  18. </view>
  19. </view>
  20. <div class="zhuti" style="padding-bottom:60px !important;">
  21. <tm-sheet class="kuang" style="padding-bottom: 30px !important;">
  22. <view style="width: 98%;margin:0 auto;margin-top:20px !important;position: relative;">
  23. <view style="padding: 10px 10px 0px;">
  24. <view class="line_bottom" style="font-size: 15px;">商品参数:</view>
  25. <view class="line_bottom">
  26. <view class="" v-for="(item,index) in showList" :key="index">
  27. <view class="line_my text-white">
  28. <view style="width: 100px;">{{item}}:</view>
  29. <view>
  30. {{index==0?paramList.name:''}}
  31. {{index==1?paramList.style:''}}
  32. {{index==2?paramList.goodNo:''}}
  33. {{index==3?paramList.size:''}}
  34. {{index==4?paramList.artNo:''}}
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="" style="padding: 10px 0px 0px;">
  41. <text v-html="explain"></text>
  42. </view>
  43. </view>
  44. </tm-sheet>
  45. <view class="" style="text-align: center;margin: 20px 0;font-size: 15px;">
  46. - 猜你喜欢 -
  47. </view>
  48. <view style="width: 94%;margin:0 auto;" class="remen">
  49. <view v-for="(item,index) in listdata" class="round-5 contone mt-20" :class="index%2==0?'fl':'fr'"
  50. @click.stop="goDetail(item)" style="background-color: #1B1B1B;">
  51. <image class="logo" :src="item.image" mode="widthFix"></image>
  52. <view class="pa-15 text-size-s">
  53. <view class="fr biaoqian">运动休闲</view>
  54. <view class="">
  55. <text class="text-size-lg" style="box-sizing: border-box;">{{item.text}}</text>
  56. <view class="text-gray mt-6">销量:{{item.xiaol}}</view>
  57. </view>
  58. <view class="mt-2 flex-between flex-center">
  59. <view class="touxiang mt-30">
  60. <text class="text-white text-size-m text-weight-b">{{item.jiage}}</text>
  61. </view>
  62. <view>
  63. <image @click.stop="jiarufuFun(item)" class="remenzan" src="/static/img/86.png"
  64. mode="widthFix"></image>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. <view style="clear: both;"></view>
  70. <view class="bottom-end" v-if="isEnd || listdata.length==0">
  71. 没有更多~</view>
  72. <view v-else style="clear: both;" class="more ma-40 pt-40" @click="gengmore()">
  73. <image src="/static/img/30.png" mode="widthFix"></image>
  74. <text class="text-size-s">下拉加载更多~</text>
  75. </view>
  76. </view>
  77. </div>
  78. <view class="bottom_btn">
  79. <view class="btn_col" style="background: #1c1c1c;" @click="goCollect">
  80. <image style="width: 18px;height: 16px;" src="/static/img/98.png" mode="widthFix"></image>
  81. <text style="margin-left: 10px;">收藏</text>
  82. </view>
  83. <view class="btn_gouwu" style="background:#303030;" @click="jiarufuFun()">
  84. <image src="/static/img/97.png" mode="widthFix" style="width: 15px;height: 16px;"></image>
  85. <text style="margin-left: 10px;">添加购物车</text>
  86. </view>
  87. <view class="btn_buy" style="background: #0178fd;" @click="goBuy">立即购买</view>
  88. </view>
  89. <!-- 弹出层消息 -->
  90. <tm-message ref="toast"></tm-message>
  91. </view>
  92. </template>
  93. <script>
  94. import {
  95. myRequest
  96. } from '@/api/request.js'
  97. export default {
  98. data() {
  99. return {
  100. isEnd: false,
  101. // 商品的id
  102. ids: '',
  103. // 分类id
  104. cartId: '',
  105. page: 1,
  106. showList: ['名称', '款式', '商品编号', '尺寸', '货号'],
  107. xianshi: true,
  108. swipList: [],
  109. // 商品数据详情
  110. details: {},
  111. // 参数列表
  112. paramList: {
  113. name: '黑色公文包',
  114. style: '黑色 QD2334664 L',
  115. goodNo: '19862088811',
  116. size: 'S/M/L',
  117. artNo: 'QD2334664'
  118. },
  119. // 说明
  120. explain: "<ul style='font-size: 14px;text-indent: 0.5em;'><li style='margin-bottom: 10px;'>划线价格,商品的专柜价、吊牌价、正品零售价、厂商指导价或该商品的曾经展示过的销售价等,并非原价,仅供参考。</li><li> 未划线价格,商品的实时标价,不因表述的差异改变性质。具体成交价格根据商品参加活动,或会员使用优惠券、积分等发生变化,最终以订单结算页价格为准。</li></ul>",
  121. listdata: []
  122. };
  123. },
  124. onLoad(ops) {
  125. console.log(ops);
  126. this.ids = ops.id;
  127. this.cartId = ops.classId;
  128. },
  129. created() {
  130. this.sys = uni.getSystemInfoSync();
  131. // this.randouh()
  132. // 获取详情数据
  133. this.getDetail()
  134. // 获取猜你喜欢数据
  135. this.getLike()
  136. },
  137. methods: {
  138. // 详情数据
  139. getDetail() {
  140. let that = this;
  141. myRequest({
  142. url: "/api/ShopGoods/getShopGoodsDetail",
  143. method: 'get',
  144. data: {
  145. id: that.ids,
  146. }
  147. }).then(res => {
  148. if (res.data.code == 200) {
  149. console.log(res.data.data, '详情');
  150. that.details = res.data.data[0];
  151. that.swipList = that.swipList.concat(res.data.data[0].atlas_thumb)
  152. } else {
  153. that.$refs.toast.show({
  154. model: 'error',
  155. label: res.data.msg
  156. })
  157. }
  158. })
  159. },
  160. // 猜你喜欢
  161. getLike() {
  162. this.page = 1;
  163. let that = this;
  164. that.listdata = [];
  165. myRequest({
  166. url: "/api/ShopGoods/getRecommendGoods",
  167. method: 'get',
  168. data: {
  169. goods_id: that.ids,
  170. category_id: that.cartId,
  171. page: that.page
  172. }
  173. }).then(res => {
  174. if (res.data.code == 200) {
  175. console.log(res.data.data, '喜欢');
  176. res.data.data.list.forEach(item => {
  177. that.listdata.push({
  178. image: item.image,
  179. text: item.goods_name,
  180. xiaol: item.sale_num,
  181. jiage: item.sale_price,
  182. id: item.id,
  183. category_id: item.category_id
  184. })
  185. })
  186. } else {
  187. that.$refs.toast.show({
  188. model: 'error',
  189. label: res.data.msg
  190. })
  191. }
  192. })
  193. },
  194. // 点击加载更多
  195. gengmore() {
  196. if (this.isEnd) return;
  197. this.page++;
  198. let that = this;
  199. myRequest({
  200. url: "/api/ShopGoods/getRecommendGoods",
  201. method: 'get',
  202. data: {
  203. goods_id: that.ids,
  204. category_id: that.cartId,
  205. page: that.page
  206. }
  207. }).then(res => {
  208. if (res.data.code == 200) {
  209. console.log(res.data.data, '更多');
  210. console.log(that.listdata, '33');
  211. if (that.listdata.length < res.data.data.count) {
  212. res.data.data.list.forEach(item => {
  213. that.listdata.push({
  214. image: item.image,
  215. text: item.goods_name,
  216. xiaol: item.sale_num,
  217. jiage: item.sale_price,
  218. id: item.id,
  219. category_id: item.category_id
  220. })
  221. })
  222. } else {
  223. that.page--;
  224. that.isEnd = true;
  225. }
  226. } else {
  227. that.$refs.toast.show({
  228. model: 'error',
  229. label: res.data.msg
  230. })
  231. }
  232. })
  233. },
  234. // 喜欢的详情
  235. goDetail(data) {
  236. console.log(data);
  237. uni.navigateTo({
  238. url: "/pages/shopdetail/index?id=" + data.id + '&classId=' + data.category_id,
  239. })
  240. },
  241. xiugaiFun() {
  242. this.xianshi = false;
  243. },
  244. // 收藏
  245. goCollect() {
  246. console.log('收藏');
  247. },
  248. // 加入购物车
  249. jiarufuFun(item) {
  250. console.log(item);
  251. var that = this;
  252. myRequest({
  253. url: "/api/ShopCart/addShopCart",
  254. method: 'post',
  255. data: {
  256. goods_id: item ? item.id : that.details.id,
  257. goods_name: item ? item.text : that.details.goods_name,
  258. goods_image: item ? item.image : that.details.image,
  259. goods_price: item ? item.jiage : that.details.sale_price,
  260. goods_num: 1
  261. }
  262. }).then(res => {
  263. if (res.data.code == 200) {
  264. that.$refs.toast.show({
  265. model: 'success',
  266. label: res.data.msg
  267. })
  268. // that.getGwc()
  269. } else {
  270. that.$refs.toast.show({
  271. model: 'error',
  272. label: res.data.msg
  273. })
  274. }
  275. })
  276. },
  277. //加入购物车
  278. goBar() {
  279. var that = this;
  280. // console.log(data)
  281. // if (data.type == 2) {
  282. myRequest({
  283. url: "/api/ShopCart/addShopCart",
  284. method: 'post',
  285. data: {
  286. goods_id: that.details.id,
  287. goods_name: that.details.title,
  288. goods_image: that.details.img,
  289. goods_price: that.details.price,
  290. goods_num: 1
  291. }
  292. }).then(res => {
  293. if (res.data.code == 200) {
  294. that.$refs.toast.show({
  295. model: 'success',
  296. label: res.data.msg
  297. })
  298. that.getGwc()
  299. } else {
  300. that.$refs.toast.show({
  301. model: 'error',
  302. label: res.data.msg
  303. })
  304. }
  305. })
  306. // }
  307. // else {
  308. // uni.navigateTo({
  309. // url: "/pages/shopdetail/index?id=" + data.id,
  310. // })
  311. // }
  312. },
  313. // 立即购买
  314. goBuy() {
  315. console.log('购买');
  316. }
  317. },
  318. }
  319. </script>
  320. <style lang="scss">
  321. .bottom-end {
  322. width: 100%;
  323. display: flex;
  324. justify-content: center;
  325. align-items: center;
  326. font-size: 12px;
  327. padding: 25px 0px;
  328. }
  329. /deep/ .tm-menubars .body {
  330. background-color: #1b1b1b !important;
  331. }
  332. .del_title {
  333. display: flex;
  334. justify-content: space-between;
  335. margin: 0 0 15px;
  336. font-size: 16px;
  337. }
  338. .sale_price {
  339. color: #0E68CF;
  340. margin-right: 12px;
  341. font-weight: bold;
  342. font-size: 17px;
  343. }
  344. .de_tag {
  345. border-radius: 20px;
  346. background: rgba(156, 156, 156, 0.3);
  347. padding: 5px 14px;
  348. font-size: 13px;
  349. }
  350. .original_price {
  351. text-decoration: line-through;
  352. color: #ababab;
  353. font-size: 13px;
  354. }
  355. /deep/ .zhuti {
  356. padding: 0px 5px 10px;
  357. }
  358. /deep/ .kuang {
  359. margin: 0 !important;
  360. padding: 0px !important;
  361. }
  362. /deep/ .round-4 {
  363. border-radius: 0px !important;
  364. }
  365. .kuang .line_bottom {
  366. padding: 10px;
  367. border-bottom: 2px solid rgba(129, 129, 129, 0.2);
  368. }
  369. .line_my {
  370. margin: 10px 0;
  371. display: flex;
  372. font-size: 14px;
  373. }
  374. /deep/ .qiehuan1 .text-primary {
  375. color: white !important;
  376. }
  377. .touxiang {
  378. width: 100%;
  379. display: block;
  380. margin-top: 10px;
  381. }
  382. .xiugai image {
  383. width: 18px;
  384. vertical-align: middle;
  385. margin-right: 5px;
  386. }
  387. .xiugai text {
  388. vertical-align: middle;
  389. }
  390. .xiugai {
  391. position: absolute;
  392. right: 5px;
  393. top: 10px;
  394. }
  395. .you {
  396. border-radius: 10px;
  397. padding: 10px;
  398. width: 88%;
  399. margin: 0 auto;
  400. margin-top: 20px;
  401. }
  402. /deep/ .you .grey-darken-5 {
  403. background-color: #0d0d0d !important;
  404. padding: 0px !important;
  405. }
  406. /deep/ .you .text-red {
  407. color: white;
  408. }
  409. /deep/ .tan .active {
  410. background-color: #AAAAAA !important;
  411. }
  412. /deep/ .tan .tm-poups .grey-darken-5 {
  413. background-color: gray !important;
  414. }
  415. /deep/ .tan uni-input {
  416. text-align: right;
  417. }
  418. /deep/ .you .border-grey-darken-4-b-1 {
  419. border-bottom: solid 1px #313131 !important;
  420. }
  421. .yiguicla image {
  422. width: 95%;
  423. display: block;
  424. margin: 0 auto;
  425. margin-top: 5px;
  426. }
  427. .yiguicla {
  428. width: 30%;
  429. border-radius: 10px;
  430. }
  431. .sao {
  432. width: 88%;
  433. margin: 0 auto;
  434. margin-top: 40px;
  435. }
  436. /deep/ .mx-32 {
  437. margin: 0px !important;
  438. margin-top: 15px !important;
  439. }
  440. .bottom_btn {
  441. left: 0;
  442. bottom: 0;
  443. width: 100%;
  444. height: 50px;
  445. display: flex;
  446. position: fixed;
  447. font-size: 15px;
  448. justify-content: space-between;
  449. box-sizing: border-box;
  450. .btn_col,
  451. .btn_gouwu,
  452. .btn_buy {
  453. height: 100%;
  454. width: 33.3%;
  455. display: flex;
  456. align-items: center;
  457. justify-content: center;
  458. box-sizing: border-box;
  459. }
  460. }
  461. .logo {
  462. width: 100%;
  463. }
  464. .dingwei {
  465. width: 21%;
  466. margin-top: 3%;
  467. }
  468. .contone {
  469. width: 48%;
  470. }
  471. .remenzan {
  472. width: 18px !important;
  473. margin-top: 10px;
  474. }
  475. .more {
  476. text-align: center;
  477. }
  478. .more image {
  479. margin-right: 10px;
  480. vertical-align: middle;
  481. width: 30px;
  482. }
  483. .biaoqian {
  484. background: #303440;
  485. padding: 4px 15px;
  486. border-radius: 30px;
  487. }
  488. </style>