integralGoodsDetails.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  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. this.$isLogin().then(
  68. res => {
  69. if(res){
  70. uni.navigateTo({
  71. url: "./integralOrderPay?goodsId="+this.goodsId
  72. })
  73. } else {
  74. uni.navigateTo({
  75. url:'/pages/auth/login'
  76. })
  77. }
  78. }
  79. );
  80. },
  81. swiperChange(event) {
  82. this.activeImg = event.detail.current + 1
  83. },
  84. showImg() {
  85. //预览图片
  86. uni.previewImage({
  87. urls: this.imgs,
  88. current: this.imgs[0]
  89. });
  90. },
  91. getIntegralGoodsById(){
  92. let data = {goodsId:this.goodsId};
  93. getIntegralGoodsById(data).then(
  94. res => {
  95. if(res.code==200){
  96. this.item=res.data;
  97. if(res.data.images!=null){
  98. this.imgs=res.data.images.split(",")
  99. }
  100. else{
  101. this.activeImg=0;
  102. }
  103. console.log(this.imgs)
  104. }else{
  105. uni.showToast({
  106. icon:'none',
  107. title: "请求失败",
  108. });
  109. }
  110. },
  111. rej => {}
  112. );
  113. },
  114. }
  115. }
  116. </script>
  117. <style lang="scss">
  118. page{
  119. height: 100%;
  120. }
  121. .content{
  122. height: 100%;
  123. display: flex;
  124. flex-direction: column;
  125. .cont-box{
  126. padding-bottom: 121rpx;
  127. .integral-box{
  128. background-color: #fff;
  129. padding: 20rpx;
  130. width: 100%;
  131. display: flex;
  132. flex-direction: column;
  133. align-items: flex-start;
  134. justify-content: flex-start;
  135. .title{
  136. font-weight: bold;
  137. font-size: 34upx;
  138. font-family: PingFang SC;
  139. color: #111;
  140. }
  141. .desc{
  142. margin-top: 15rpx;
  143. display: flex;
  144. align-items: flex-start;
  145. justify-content: flex-start;
  146. .cycle{
  147. background-color: #eee;
  148. border-radius: 30rpx;
  149. padding: 5rpx 15rpx;
  150. font-size: 26upx;
  151. font-family: PingFang SC;
  152. color: #C39A58;
  153. }
  154. .duration{
  155. margin-left: 10rpx;
  156. background-color: #eee;
  157. border-radius: 30rpx;
  158. padding: 5rpx 15rpx;
  159. font-size: 26upx;
  160. font-family: PingFang SC;
  161. color: #C39A58;
  162. }
  163. }
  164. .num-box{
  165. margin-top: 15rpx;
  166. flex: 1;
  167. display: flex;
  168. align-items: flex-end;
  169. justify-content: space-between;
  170. width: 100%;
  171. .price{
  172. padding: 5rpx 10rpx;
  173. background-color: #C39A58;
  174. border-radius: 30rpx;
  175. font-size: 20upx;
  176. font-family: PingFang SC;
  177. color: #ffffff;
  178. }
  179. .count{
  180. font-size: 24upx;
  181. font-family: PingFang SC;
  182. color: #333333;
  183. }
  184. }
  185. }
  186. .desc-box{
  187. background-color: #fff;
  188. padding: 20rpx;
  189. margin-top: 10rpx;
  190. .title-box{
  191. display: flex;
  192. flex-direction: row;
  193. align-items: center;
  194. justify-content: flex-start;
  195. .title{
  196. font-size: 32upx;
  197. font-family: PingFang SC;
  198. font-weight: bold;
  199. color: #111111;
  200. }
  201. .line{
  202. margin-right: 15rpx;
  203. height: 30rpx;
  204. width: 6rpx;
  205. background-color: #C39A58;
  206. }
  207. }
  208. .desc{
  209. margin-top: 15rpx;
  210. font-size: 28upx;
  211. font-family: PingFang SC;
  212. color: #9a9a9c;
  213. }
  214. }
  215. }
  216. }
  217. .btn-foot{
  218. box-sizing: border-box;
  219. width: 100%;
  220. height: 121upx;
  221. background: #FFFFFF;
  222. padding: 0 32upx 0 28upx;
  223. display: flex;
  224. align-items: center;
  225. justify-content: space-between;
  226. position: fixed;
  227. left: 0;
  228. bottom: 0;
  229. z-index: 99;
  230. .p-price-box{
  231. display: flex;
  232. align-items: center;
  233. .p-name{
  234. font-size: 28upx;
  235. font-family: PingFang SC;
  236. font-weight: 500;
  237. color: #666666;
  238. }
  239. .p-price{
  240. margin-left: 10rpx;
  241. color: #FF6633;
  242. font-size: 32upx;
  243. font-family: PingFang SC;
  244. font-weight: bold;
  245. }
  246. }
  247. .btn-box{
  248. display: flex;
  249. align-items: center;
  250. .btn{
  251. width: 200upx;
  252. height: 88upx;
  253. line-height: 88upx;
  254. text-align: center;
  255. border-radius: 44upx;
  256. margin-left: 20upx;
  257. font-size: 30upx;
  258. font-family: PingFang SC;
  259. font-weight: bold;
  260. color: #FFFFFF;
  261. &:first-child{
  262. margin-left: 0;
  263. }
  264. &.buy{
  265. background: #C39A58;
  266. }
  267. }
  268. }
  269. }
  270. .goods-banner{
  271. height: 756upx;
  272. background-color: #FFFFFF;
  273. position: relative;
  274. .swiper-item{
  275. box-sizing: border-box;
  276. }
  277. .swiper,
  278. .swiper-item,
  279. .swiper-item image{
  280. width: 100%;
  281. height: 100%;
  282. }
  283. .num-box{
  284. width: 80upx;
  285. height: 44upx;
  286. line-height: 44upx;
  287. text-align: center;
  288. font-size: 24upx;
  289. font-family: PingFang SC;
  290. font-weight: 500;
  291. color: #FFFFFF;
  292. background: rgba(0, 0, 0, .3);
  293. border-radius: 22upx;
  294. position: absolute;
  295. right: 30upx;
  296. bottom: 30upx;
  297. z-index: 10;
  298. }
  299. }
  300. </style>