integralGoodsDetails.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. <template>
  2. <view class="content">
  3. <view class="cont-box">
  4. <view class="goods-banner" @click="showImg()">
  5. <swiper
  6. class="swiper"
  7. :indicator-dots="false"
  8. :circular="true"
  9. :autoplay="true"
  10. :interval="3000"
  11. :duration="1000"
  12. indicator-color="rgba(255, 255, 255, 0.6)"
  13. indicator-active-color="#ffffff"
  14. @change="swiperChange"
  15. >
  16. <swiper-item class="swiper-item" v-for="(item,index) in imgs" :key="index">
  17. <image :src="item" mode="aspectFit"></image>
  18. </swiper-item>
  19. </swiper>
  20. <!-- 数量 -->
  21. <view class="num-box">{{ activeImg }}/{{ imgs.length }}</view>
  22. </view>
  23. <view class="integral-box">
  24. <view class="title">{{item.goodsName}}</view>
  25. <view class="num-box">
  26. <view class="price" >{{item.integral}} 积分</view>
  27. <view class="count">原价:{{item.otPrice.toFixed(2)}}元</view>
  28. </view>
  29. </view>
  30. <view class="desc-box">
  31. <view class="desc" v-html="item.descs" >
  32. </view>
  33. </view>
  34. </view>
  35. <view class="btn-foot">
  36. <view class="p-price-box">
  37. <view class="p-name">兑换积分: </view>
  38. <view class="p-price" >{{item.integral}}</view>
  39. </view>
  40. <view class="btn-box">
  41. <view class="btn buy" @click="submit()" >
  42. 立即兑换
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. import {getIntegralGoodsById,createOrder} from '@/api/integral.js'
  50. export default {
  51. data() {
  52. return {
  53. imgs:[],
  54. activeImg: 1,
  55. goodsId:null,
  56. item:{},
  57. };
  58. },
  59. onLoad(option) {
  60. this.goodsId=option.goodsId;
  61. },
  62. onShow() {
  63. this.getIntegralGoodsById();
  64. },
  65. methods:{
  66. submit(){
  67. uni.navigateTo({
  68. url: "./integralOrderPay?goodsId="+this.goodsId
  69. })
  70. },
  71. swiperChange(event) {
  72. this.activeImg = event.detail.current + 1
  73. },
  74. showImg() {
  75. //预览图片
  76. uni.previewImage({
  77. urls: this.imgs,
  78. current: this.imgs[0]
  79. });
  80. },
  81. getIntegralGoodsById(){
  82. let data = {goodsId:this.goodsId};
  83. getIntegralGoodsById(data).then(
  84. res => {
  85. if(res.code==200){
  86. this.item=res.data;
  87. if(res.data.images!=null){
  88. this.imgs=res.data.images.split(",")
  89. }
  90. else{
  91. this.activeImg=0;
  92. }
  93. console.log(this.imgs)
  94. }else{
  95. uni.showToast({
  96. icon:'none',
  97. title: "请求失败",
  98. });
  99. }
  100. },
  101. rej => {}
  102. );
  103. },
  104. }
  105. }
  106. </script>
  107. <style lang="scss">
  108. page{
  109. height: 100%;
  110. }
  111. .content{
  112. height: 100%;
  113. display: flex;
  114. flex-direction: column;
  115. .cont-box{
  116. padding-bottom: 121rpx;
  117. .integral-box{
  118. background-color: #fff;
  119. padding: 20rpx;
  120. width: 100%;
  121. display: flex;
  122. flex-direction: column;
  123. align-items: flex-start;
  124. justify-content: flex-start;
  125. .title{
  126. font-weight: bold;
  127. font-size: 34upx;
  128. font-family: PingFang SC;
  129. color: #111;
  130. }
  131. .desc{
  132. margin-top: 15rpx;
  133. display: flex;
  134. align-items: flex-start;
  135. justify-content: flex-start;
  136. .cycle{
  137. background-color: #eee;
  138. border-radius: 30rpx;
  139. padding: 5rpx 15rpx;
  140. font-size: 26upx;
  141. font-family: PingFang SC;
  142. color: #C39A58;
  143. }
  144. .duration{
  145. margin-left: 10rpx;
  146. background-color: #eee;
  147. border-radius: 30rpx;
  148. padding: 5rpx 15rpx;
  149. font-size: 26upx;
  150. font-family: PingFang SC;
  151. color: #C39A58;
  152. }
  153. }
  154. .num-box{
  155. margin-top: 15rpx;
  156. flex: 1;
  157. display: flex;
  158. align-items: flex-end;
  159. justify-content: space-between;
  160. width: 100%;
  161. .price{
  162. padding: 5rpx 10rpx;
  163. background-color: #C39A58;
  164. border-radius: 30rpx;
  165. font-size: 20upx;
  166. font-family: PingFang SC;
  167. color: #ffffff;
  168. }
  169. .count{
  170. font-size: 24upx;
  171. font-family: PingFang SC;
  172. color: #333333;
  173. }
  174. }
  175. }
  176. .desc-box{
  177. background-color: #fff;
  178. padding: 20rpx;
  179. margin-top: 10rpx;
  180. .title-box{
  181. display: flex;
  182. flex-direction: row;
  183. align-items: center;
  184. justify-content: flex-start;
  185. .title{
  186. font-size: 32upx;
  187. font-family: PingFang SC;
  188. font-weight: bold;
  189. color: #111111;
  190. }
  191. .line{
  192. margin-right: 15rpx;
  193. height: 30rpx;
  194. width: 6rpx;
  195. background-color: #C39A58;
  196. }
  197. }
  198. .desc{
  199. margin-top: 15rpx;
  200. font-size: 28upx;
  201. font-family: PingFang SC;
  202. color: #9a9a9c;
  203. }
  204. }
  205. }
  206. }
  207. .btn-foot{
  208. box-sizing: border-box;
  209. width: 100%;
  210. height: 121upx;
  211. background: #FFFFFF;
  212. padding: 0 32upx 0 28upx;
  213. display: flex;
  214. align-items: center;
  215. justify-content: space-between;
  216. position: fixed;
  217. left: 0;
  218. bottom: 0;
  219. z-index: 99;
  220. .p-price-box{
  221. display: flex;
  222. align-items: center;
  223. .p-name{
  224. font-size: 28upx;
  225. font-family: PingFang SC;
  226. font-weight: 500;
  227. color: #666666;
  228. }
  229. .p-price{
  230. margin-left: 10rpx;
  231. color: #FF6633;
  232. font-size: 32upx;
  233. font-family: PingFang SC;
  234. font-weight: bold;
  235. }
  236. }
  237. .btn-box{
  238. display: flex;
  239. align-items: center;
  240. .btn{
  241. width: 200upx;
  242. height: 88upx;
  243. line-height: 88upx;
  244. text-align: center;
  245. border-radius: 44upx;
  246. margin-left: 20upx;
  247. font-size: 30upx;
  248. font-family: PingFang SC;
  249. font-weight: bold;
  250. color: #FFFFFF;
  251. &:first-child{
  252. margin-left: 0;
  253. }
  254. &.buy{
  255. background: #C39A58;
  256. }
  257. }
  258. }
  259. }
  260. .goods-banner{
  261. height: 756upx;
  262. background-color: #FFFFFF;
  263. position: relative;
  264. .swiper-item{
  265. box-sizing: border-box;
  266. }
  267. .swiper,
  268. .swiper-item,
  269. .swiper-item image{
  270. width: 100%;
  271. height: 100%;
  272. }
  273. .num-box{
  274. width: 80upx;
  275. height: 44upx;
  276. line-height: 44upx;
  277. text-align: center;
  278. font-size: 24upx;
  279. font-family: PingFang SC;
  280. font-weight: 500;
  281. color: #FFFFFF;
  282. background: rgba(0, 0, 0, .3);
  283. border-radius: 22upx;
  284. position: absolute;
  285. right: 30upx;
  286. bottom: 30upx;
  287. z-index: 10;
  288. }
  289. }
  290. </style>