goods-details.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  1. <template>
  2. <view class="">
  3. <uni-nav-bar left-icon="left" :title="goodsdetais.name" color="" :statusBar="true" :border="false" :size="60" @clickLeft="back"/>
  4. <view class="goods-details">
  5. <view class="goods-image">
  6. <image :src="goodsdetais.cover_pic" mode="widthFix"></image>
  7. </view>
  8. <view class="infogoods">
  9. <text class="goods-name">{{goodsdetais.name}}</text>
  10. <view class="goods-price">
  11. <view class="all-price">
  12. <text class="tag">¥</text>
  13. <text class="pricenum">{{goodsdetais.original_price}}</text>
  14. </view>
  15. <view class="coup-price">
  16. <text class="couptag">券后价 ¥</text>
  17. <text class="couprice">{{goodsdetais.price}}</text>
  18. </view>
  19. </view>
  20. <view class="totalnum">
  21. <text>销量{{goodsdetais.sales}}{{goodsdetais.unit}}</text>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="goods-specific">
  26. <view class="specific-detail" >
  27. <view class="one">
  28. <text class="specific-title">商品规格</text>
  29. <view class="kindof" v-for="(item,inedx) in goodsdetais.attr_groups" >
  30. <text class="kindoftitle">{{item.attr_group_name}}</text>
  31. <view v-for="i in item.attr_list" class="kindofspec" >
  32. <text>{{i.attr_name}}<text v-if="item.attr_list.length>1">/</text></text>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. <view class="goods-webview">
  39. <view class="goodsmsg">
  40. <text class="tah" style="padding-right: 24rpx;" id="gang">— </text>
  41. <text>商品详情</text>
  42. <text class="tah" style="padding-left: 24rpx;" id="ang">—</text>
  43. </view>
  44. </view>
  45. <view class="addshop" @click="open">
  46. <uni-icons type="cart-filled" size="40" color="#fff"></uni-icons>
  47. </view>
  48. <uni-popup ref="popup" type="center">
  49. <view class="icode">
  50. <text style="font-size: 28rpx;">扫描二维码,去微信商城购买</text>
  51. <view class="codeimg">
  52. <image src="/static/image/hxj.jpg" mode="aspectFill"></image>
  53. </view>
  54. </view>
  55. </uni-popup>
  56. <!-- <view class="webview">
  57. <view v-html="goodsdetais.detail"></view>
  58. </view> -->
  59. <view >
  60. <bd-detail :detail="goodsdetais.detail" ></bd-detail>
  61. </view>
  62. </view>
  63. </template>
  64. <script>
  65. let _this
  66. import bdDetail from "@/components/goods/bd-detail.vue"
  67. export default {
  68. components: {
  69. bdDetail
  70. },
  71. data() {
  72. return {
  73. id:'',
  74. goodsdetais:[],
  75. webview:'/static/image/zu.png',
  76. speclist:[
  77. {
  78. "name":"颜色",
  79. "kind":"黄色/绿色/蓝色/紫色"
  80. },
  81. {
  82. "name":"尺码",
  83. "kind":"xs/s/m/xl"
  84. },
  85. ],
  86. webview:''
  87. }
  88. },
  89. onLoad(option) {
  90. _this=this
  91. "id" in option?this.id=JSON.parse(option.id):''
  92. this.getGoods()
  93. },
  94. methods: {
  95. open() {
  96. this.$refs.popup.open()
  97. },
  98. back(){
  99. uni.navigateBack({
  100. delta:1
  101. })
  102. },
  103. getGoods(){
  104. uni.showLoading({
  105. title:"加载中",
  106. marsk:true
  107. })
  108. _this.$post('api/goods/detail',{
  109. data:{
  110. id:_this.id,
  111. plugin:"mall",
  112. },
  113. success(res){
  114. uni.hideLoading()
  115. if(res.code==1){
  116. _this.$toast(res.msg)
  117. }else{
  118. _this.goodsdetais=res.data.goods
  119. console.log(_this.goodsdetais,55)
  120. }
  121. },
  122. error(err) {
  123. _this.$toast(err)
  124. }
  125. },'GET')
  126. }
  127. }
  128. }
  129. </script>
  130. <style lang="scss">
  131. .canshu{
  132. text-align: center;
  133. .canshutitle{
  134. color: #222222;
  135. display: flex;
  136. flex-direction: column;
  137. margin: 45rpx 0;
  138. }
  139. .td-form{
  140. padding:0 40rpx;
  141. box-sizing: border-box;
  142. padding-bottom: 80rpx;
  143. }
  144. }
  145. .addshop{
  146. position: fixed;
  147. bottom: 80rpx;
  148. z-index: 999;
  149. right: 70rpx;
  150. width: 120rpx;
  151. height: 120rpx;
  152. border-radius: 50%;
  153. background-color: #AE8445;
  154. display: flex;
  155. align-items: center;
  156. justify-content: center;
  157. }
  158. .icode{
  159. width: 600rpx;
  160. height: 600rpx;
  161. background-color: #fff;
  162. border-radius: 15rpx;
  163. display: flex;
  164. flex-direction: column;
  165. justify-content: center;
  166. align-items: center;
  167. .codeimg{
  168. margin-top: 10rpx;
  169. width: 450rpx;
  170. height: 450rpx;
  171. image{
  172. width: 100%;
  173. height: 100%;
  174. }
  175. }
  176. }
  177. .infogoods{
  178. box-sizing: border-box;
  179. padding:0 30rpx;
  180. padding-bottom: 40rpx;
  181. .goods-name{
  182. font-size: 35rpx;
  183. font-weight: 600;
  184. display: block;
  185. padding-right: 20rpx;
  186. }
  187. .coup-price{
  188. background-image: url(../../static/image/couimgbg.png);
  189. background-size:100% 100%;
  190. // background-position: center;
  191. // width: 250rpx;
  192. height: 60rpx;
  193. line-height: 50rpx;
  194. box-sizing: border-box;
  195. padding: 0 20rpx;
  196. text-align: center;
  197. box-sizing: border-box;
  198. .couptag{
  199. font-size: 24rpx;
  200. }
  201. .couprice{
  202. font-size: 30rpx;
  203. }
  204. }
  205. .goods-price{
  206. font-size: 40rpx;
  207. color: #F95353;
  208. display: flex;
  209. margin-top: 24rpx;
  210. }
  211. .totalnum{
  212. margin-top: 24rpx;
  213. font-size: 22rpx;
  214. padding-left: 7rpx;
  215. color: #A2A4AB;
  216. box-sizing: border-box;
  217. }
  218. }
  219. page{
  220. background-color: #F8F8F8;
  221. padding: 0;
  222. margin: 0;
  223. font-family: PingFang-SC-Heavy;
  224. }
  225. html{
  226. padding: 0;
  227. margin: 0;
  228. }
  229. body{
  230. padding: 0;
  231. margin: 0;
  232. }
  233. .webview{
  234. width: 750rpx;
  235. // height: 1000rpx;
  236. image{
  237. // display: block;
  238. width:750rpx;
  239. height: 100%;
  240. }
  241. }
  242. .goods-details{
  243. background-color: #FFFFFF;
  244. // display: flex;
  245. flex-direction: column;
  246. // justify-content: center;
  247. align-items: center;
  248. .goods-image{
  249. // margin-top: 30rpx;
  250. width: 100%;
  251. // height: 664rpx;
  252. image{
  253. width: 100%;
  254. height: 100%;
  255. }
  256. }
  257. // .infogoods{
  258. // .goods-name{
  259. // font-size: 35rpx;
  260. // font-weight: 600;
  261. // }
  262. // }
  263. .goods-title{
  264. width: 690rpx;
  265. margin: 40rpx 0;
  266. .goods-name{
  267. font-size: 32rpx;
  268. font-weight: 600;
  269. }
  270. .goods-price{
  271. color: #F95353;
  272. display: flex;
  273. margin-top: 24rpx;
  274. .all-price{
  275. font-weight: bold;
  276. margin-right: 12rpx;
  277. .tag{
  278. font-size: 28rpx;
  279. }
  280. .pricenum{
  281. font-size: 44rpx;
  282. }
  283. }
  284. .coup-price{
  285. background-image: url(../../static/image/couimgbg.png);
  286. background-size:100% 100%;
  287. // background-position: center;
  288. // width: 250rpx;
  289. height: 60rpx;
  290. line-height: 60rpx;
  291. box-sizing: border-box;
  292. padding: 0 20rpx;
  293. text-align: center;
  294. box-sizing: border-box;
  295. .couptag{
  296. font-size: 24rpx;
  297. }
  298. .couprice{
  299. font-size: 30rpx;
  300. }
  301. }
  302. }
  303. .totalnum{
  304. margin-top: 24rpx;
  305. font-size: 22rpx;
  306. padding-left: 7rpx;
  307. color: #A2A4AB;
  308. box-sizing: border-box;
  309. }
  310. }
  311. }
  312. .goods-specific{
  313. margin-top: 18rpx;
  314. background-color: #FFFFFF;
  315. display: flex;
  316. justify-content: center;
  317. padding: 36rpx 34rpx 0 34rpx;
  318. box-sizing: border-box;
  319. .specific-detail{
  320. box-sizing: border-box;
  321. width: 690rpx;
  322. // padding-bottom: 50rpx;
  323. .specific-title{
  324. font-size:18rpx;
  325. font-weight: bold;
  326. // padding-top: 35rpx;
  327. display: block;
  328. padding-bottom: 24rpx;
  329. box-sizing: border-box;
  330. }
  331. .kindof{
  332. padding-bottom: 12rpx;
  333. display: flex;
  334. box-sizing: border-box;
  335. .kindoftitle{
  336. width: 150rpx;
  337. font-size:16rpx;
  338. font-weight: 500;
  339. color: #222222;
  340. }
  341. .kindofspec{
  342. width: 480rpx;
  343. display: block;
  344. overflow:hidden; //超出的文本隐藏
  345. text-overflow:ellipsis; //溢出用省略号显示
  346. white-space:nowrap; //溢出不换行
  347. font-size: 16rpx;
  348. margin-left: 40rpx;
  349. color: #666666;
  350. box-sizing: border-box;
  351. }
  352. }
  353. .one{
  354. margin-bottom: 30rpx;
  355. }
  356. .two{
  357. margin-bottom: 50rpx;
  358. }
  359. }
  360. }
  361. .goods-webview{
  362. background-color: #FFFFFF;
  363. // width: 750rpx;
  364. .goodsmsg{
  365. font-size: 26rpx;
  366. color: #666666;
  367. text-align: center;
  368. padding-bottom: 30rpx;
  369. box-sizing: border-box;
  370. .tah{
  371. }
  372. @media screen and (-webkit-min-device-pixel-ratio:0) {
  373. #gang {
  374. background: -webkit-gradient(linear,left top,right bottom,from(#FFFFFF),to(#666666));
  375. -webkit-background-clip: text;
  376. -webkit-text-fill-color: transparent;
  377. }
  378. }
  379. @media screen and (-webkit-min-device-pixel-ratio:0) {
  380. #ang {
  381. background: -webkit-gradient(linear,left top,right bottom,from(#666666),to(#FFFFFF));
  382. -webkit-background-clip: text;
  383. -webkit-text-fill-color: transparent;
  384. }
  385. }
  386. }
  387. }
  388. </style>