index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  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">没有更多~</view>
  71. <view v-else style="clear: both;" class="more ma-40 pt-40" @click="gengmore()">
  72. <image src="/static/img/30.png" mode="widthFix"></image>
  73. <text class="text-size-s">下拉加载更多~</text>
  74. </view>
  75. </view>
  76. </div>
  77. <view class="bottom_btn">
  78. <!-- <view class="btn_col" style="background: #1c1c1c;" @click="goCollect">
  79. <image style="width: 18px;height: 16px;" src="/static/img/98.png" mode="widthFix"></image>
  80. <text style="margin-left: 10px;">收藏</text>
  81. </view> -->
  82. <view class="btn_gouwu" style="background:#303030;" @click="jiarufuFun()">
  83. <image src="/static/img/97.png" mode="widthFix" style="width: 15px;height: 16px;"></image>
  84. <text style="margin-left: 10px;">添加购物车</text>
  85. </view>
  86. <view class="btn_buy" style="background: #0178fd;" @click="goBuy">立即购买</view>
  87. </view>
  88. <!-- 弹出层消息 -->
  89. <tm-message ref="toast"></tm-message>
  90. </view>
  91. </template>
  92. <script>
  93. import {
  94. myRequest
  95. } from '@/api/request.js'
  96. export default {
  97. data() {
  98. return {
  99. isEnd: false,
  100. // id
  101. ids: '',
  102. // 分类id
  103. classId: '',
  104. page: 1,
  105. total: 0,
  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.cartId;
  127. this.classId = 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. console.log(this.ids, 'ids');
  141. let that = this;
  142. myRequest({
  143. url: "/api/ShopGoods/getShopGoodsDetail",
  144. method: 'get',
  145. data: {
  146. id: that.ids,
  147. }
  148. }).then(res => {
  149. if (res.data.code == 200) {
  150. console.log(res.data.data, '详情');
  151. that.details = res.data.data[0];
  152. that.swipList = that.swipList.concat(res.data.data[0].atlas_thumb)
  153. } else {
  154. that.$refs.toast.show({
  155. model: 'error',
  156. label: res.data.msg
  157. })
  158. }
  159. })
  160. },
  161. // 猜你喜欢
  162. getLike() {
  163. let that = this;
  164. myRequest({
  165. url: "/api/ShopGoods/getRecommendGoods",
  166. method: 'get',
  167. data: {
  168. goods_id: that.ids,
  169. category_id: that.classId,
  170. page: that.page
  171. }
  172. }).then(res => {
  173. if (res.data.code == 200) {
  174. console.log(res.data.data, '喜欢');
  175. res.data.data.list.forEach(item => {
  176. that.listdata.push({
  177. image: item.image,
  178. text: item.goods_name,
  179. xiaol: item.sale_num,
  180. jiage: item.sale_price,
  181. id: item.id,
  182. category_id: item.category_id
  183. })
  184. })
  185. that.total = res.data.data.count;
  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.listdata.length < this.total) {
  197. this.isEnd = false;
  198. this.page++;
  199. this.getLike()
  200. } else {
  201. this.isEnd = true;
  202. }
  203. },
  204. // 喜欢内容点击去详情
  205. goDetail(data) {
  206. uni.navigateTo({
  207. url: "/pages/shopdetail/index?cartId=" + data.id + '&classId=' + data.category_id,
  208. })
  209. },
  210. xiugaiFun() {
  211. this.xianshi = false;
  212. },
  213. // 收藏
  214. goCollect() {
  215. console.log('收藏');
  216. },
  217. // 加入购物车
  218. jiarufuFun(item) {
  219. console.log(item);
  220. var that = this;
  221. myRequest({
  222. url: "/api/ShopCart/addShopCart",
  223. method: 'post',
  224. data: {
  225. goods_id: item ? item.id : that.details.id,
  226. // goods_name: item ? item.text : that.details.goods_name,
  227. // goods_image: item ? item.image : that.details.image,
  228. // goods_price: item ? item.jiage : that.details.sale_price,
  229. goods_num: 1
  230. }
  231. }).then(res => {
  232. if (res.data.code == 200) {
  233. that.$refs.toast.show({
  234. model: 'success',
  235. label: res.data.msg
  236. })
  237. // that.getGwc()
  238. } else {
  239. that.$refs.toast.show({
  240. model: 'error',
  241. label: res.data.msg
  242. })
  243. }
  244. })
  245. },
  246. // 立即购买
  247. goBuy() {
  248. console.log('购买');
  249. }
  250. },
  251. }
  252. </script>
  253. <style lang="scss">
  254. .bottom-end {
  255. width: 100%;
  256. display: flex;
  257. justify-content: center;
  258. align-items: center;
  259. font-size: 12px;
  260. padding: 25px 0px;
  261. }
  262. /deep/ .tm-menubars .body {
  263. background-color: #1b1b1b !important;
  264. }
  265. .del_title {
  266. display: flex;
  267. justify-content: space-between;
  268. margin: 0 0 15px;
  269. font-size: 16px;
  270. }
  271. .sale_price {
  272. color: #0E68CF;
  273. margin-right: 12px;
  274. font-weight: bold;
  275. font-size: 17px;
  276. }
  277. .de_tag {
  278. border-radius: 20px;
  279. background: rgba(156, 156, 156, 0.3);
  280. padding: 5px 14px;
  281. font-size: 13px;
  282. }
  283. .original_price {
  284. text-decoration: line-through;
  285. color: #ababab;
  286. font-size: 13px;
  287. }
  288. /deep/ .zhuti {
  289. padding: 0px 5px 10px;
  290. }
  291. /deep/ .kuang {
  292. margin: 0 !important;
  293. padding: 0px !important;
  294. }
  295. /deep/ .round-4 {
  296. border-radius: 0px !important;
  297. }
  298. .kuang .line_bottom {
  299. padding: 10px;
  300. border-bottom: 2px solid rgba(129, 129, 129, 0.2);
  301. }
  302. .line_my {
  303. margin: 10px 0;
  304. display: flex;
  305. font-size: 14px;
  306. }
  307. /deep/ .qiehuan1 .text-primary {
  308. color: white !important;
  309. }
  310. .touxiang {
  311. width: 100%;
  312. display: block;
  313. margin-top: 10px;
  314. }
  315. .xiugai image {
  316. width: 18px;
  317. vertical-align: middle;
  318. margin-right: 5px;
  319. }
  320. .xiugai text {
  321. vertical-align: middle;
  322. }
  323. .xiugai {
  324. position: absolute;
  325. right: 5px;
  326. top: 10px;
  327. }
  328. .you {
  329. border-radius: 10px;
  330. padding: 10px;
  331. width: 88%;
  332. margin: 0 auto;
  333. margin-top: 20px;
  334. }
  335. /deep/ .you .grey-darken-5 {
  336. background-color: #0d0d0d !important;
  337. padding: 0px !important;
  338. }
  339. /deep/ .you .text-red {
  340. color: white;
  341. }
  342. /deep/ .tan .active {
  343. background-color: #AAAAAA !important;
  344. }
  345. /deep/ .tan .tm-poups .grey-darken-5 {
  346. background-color: gray !important;
  347. }
  348. /deep/ .tan uni-input {
  349. text-align: right;
  350. }
  351. /deep/ .you .border-grey-darken-4-b-1 {
  352. border-bottom: solid 1px #313131 !important;
  353. }
  354. .yiguicla image {
  355. width: 95%;
  356. display: block;
  357. margin: 0 auto;
  358. margin-top: 5px;
  359. }
  360. .yiguicla {
  361. width: 30%;
  362. border-radius: 10px;
  363. }
  364. .sao {
  365. width: 88%;
  366. margin: 0 auto;
  367. margin-top: 40px;
  368. }
  369. /deep/ .mx-32 {
  370. margin: 0px !important;
  371. margin-top: 15px !important;
  372. }
  373. .bottom_btn {
  374. left: 0;
  375. bottom: 0;
  376. width: 100%;
  377. height: 50px;
  378. display: flex;
  379. position: fixed;
  380. font-size: 15px;
  381. justify-content: space-between;
  382. box-sizing: border-box;
  383. .btn_col,
  384. .btn_gouwu,
  385. .btn_buy {
  386. height: 100%;
  387. width: 50%;
  388. display: flex;
  389. align-items: center;
  390. justify-content: center;
  391. box-sizing: border-box;
  392. }
  393. }
  394. .logo {
  395. width: 100%;
  396. }
  397. .dingwei {
  398. width: 21%;
  399. margin-top: 3%;
  400. }
  401. .contone {
  402. width: 48%;
  403. }
  404. .remenzan {
  405. width: 18px !important;
  406. margin-top: 10px;
  407. }
  408. .more {
  409. text-align: center;
  410. }
  411. .more image {
  412. margin-right: 10px;
  413. vertical-align: middle;
  414. width: 30px;
  415. }
  416. .biaoqian {
  417. background: #303440;
  418. padding: 4px 15px;
  419. border-radius: 30px;
  420. }
  421. </style>