国外MOSE官网
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

279 lines
6.8 KiB

2 days ago
  1. <template>
  2. <view class="goods-detail">
  3. <!-- 轮播图 -->
  4. <view class="banner-container">
  5. <uv-swiper
  6. indicator
  7. indicatorMode="dot"
  8. indicatorActiveColor="blue"
  9. height="700rpx"
  10. :list="bannerImages"></uv-swiper>
  11. </view>
  12. <!-- 商品信息 -->
  13. <view class="goods-info">
  14. <!-- 积分信息 -->
  15. <view class="points-section">
  16. <uv-icon name="integral" size="16" color="#218cdd"></uv-icon>
  17. <text class="points-text">{{ goodsData.points }}积分</text>
  18. </view>
  19. <!-- 商品标题 -->
  20. <view class="title-section">
  21. <text class="goods-title">{{ goodsData.name }}</text>
  22. </view>
  23. </view>
  24. <!-- 商品详情独立容器 -->
  25. <view class="detail-container">
  26. <!-- 商品详情标题 -->
  27. <view class="detail-title-section">
  28. <text class="detail-title">商品详情</text>
  29. </view>
  30. <!-- 商品图集 -->
  31. <view class="gallery-section">
  32. <view class="gallery-grid">
  33. <image
  34. v-for="(img, index) in goodsData.gallery"
  35. :key="index"
  36. :src="img"
  37. class="gallery-image"
  38. mode="aspectFill"
  39. @click="previewImage(img, goodsData.gallery)"
  40. ></image>
  41. </view>
  42. </view>
  43. </view>
  44. <!-- 底部操作栏 - 只在待领取状态显示 -->
  45. <view v-if="status === 'pending'" class="bottom-bar">
  46. <view class="exchange-btn" @click="confirmReceive">
  47. <text class="exchange-text">确认取货</text>
  48. </view>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. export default {
  54. name: 'ExchangeDetail',
  55. data() {
  56. return {
  57. goodsId: '',
  58. status: 'pending', // pending: 待领取, received: 已领取, cancelled: 系统取消
  59. goodsData: {
  60. id: 1,
  61. name: '哪吒之魔童闹海新款首套装哪吒校内艺术手办树脂摆件学生小礼品',
  62. points: 100,
  63. category: '积分兑换',
  64. exchangeCount: 120,
  65. stock: 50,
  66. description: '这是一款美味的薄脆小饼干,口感酥脆,营养丰富。采用优质原料制作,无添加剂,适合全家人享用。每一口都能感受到浓郁的香味和酥脆的口感,是您休闲时光的最佳选择。',
  67. gallery: [
  68. '/static/商城_商品1.png',
  69. '/static/商城_商品2.png',
  70. '/static/bannerImage.png',
  71. '/static/商城_商品1.png',
  72. '/static/商城_商品2.png',
  73. '/static/bannerImage.png'
  74. ]
  75. },
  76. bannerImages: [
  77. '/static/商城_商品1.png',
  78. '/static/商城_商品2.png',
  79. '/static/bannerImage.png'
  80. ]
  81. }
  82. },
  83. onLoad(options) {
  84. if (options.id) {
  85. this.goodsId = options.id;
  86. }
  87. if (options.status) {
  88. this.status = options.status;
  89. }
  90. this.getGoodsDetail(this.goodsId);
  91. },
  92. methods: {
  93. getGoodsDetail(id) {
  94. // 模拟获取商品详情
  95. console.log('获取商品详情:', id);
  96. // 根据id设置不同的商品数据
  97. const goodsMap = {
  98. '1': {
  99. id: 1,
  100. name: '哪吒之魔童闹海新款首套装哪吒校内艺术手办树脂摆件学生小礼品',
  101. points: 100,
  102. category: '积分兑换',
  103. exchangeCount: 120,
  104. stock: 50,
  105. description: '这是一款美味的薄脆小饼干,口感酥脆,营养丰富。采用优质原料制作,无添加剂,适合全家人享用。',
  106. gallery: ['/static/商城_商品1.png', '/static/商城_商品2.png', '/static/bannerImage.png', '/static/商城_商品1.png', '/static/商城_商品2.png', '/static/bannerImage.png']
  107. },
  108. '2': {
  109. id: 2,
  110. name: '幼儿园宝宝启蒙书',
  111. points: 145,
  112. category: '母婴',
  113. exchangeCount: 85,
  114. stock: 30,
  115. description: '专为幼儿园宝宝设计的启蒙读物,内容丰富有趣,图文并茂,有助于培养孩子的阅读兴趣和认知能力。',
  116. gallery: ['/static/商城_商品2.png', '/static/商城_商品1.png', '/static/bannerImage.png', '/static/商城_商品2.png', '/static/商城_商品1.png', '/static/bannerImage.png']
  117. }
  118. };
  119. if (goodsMap[id]) {
  120. this.goodsData = goodsMap[id];
  121. this.bannerImages = goodsMap[id].gallery.slice(0, 3);
  122. }
  123. },
  124. previewImage(current, urls) {
  125. uni.previewImage({
  126. current: current,
  127. urls: urls
  128. });
  129. },
  130. confirmReceive() {
  131. uni.showModal({
  132. title: '确认取货',
  133. content: `确定已取货${this.goodsData.name}吗?`,
  134. success: (res) => {
  135. if (res.confirm) {
  136. // 执行确认取货逻辑
  137. uni.showToast({
  138. title: '取货成功',
  139. icon: 'success'
  140. });
  141. // 延迟返回上一页
  142. setTimeout(() => {
  143. uni.navigateBack();
  144. }, 1500);
  145. }
  146. }
  147. });
  148. }
  149. }
  150. }
  151. </script>
  152. <style lang="scss" scoped>
  153. .goods-detail {
  154. background: #f8f8f8;
  155. min-height: 100vh;
  156. padding-bottom: 120rpx; // 为底部固定栏留出空间
  157. }
  158. .banner-container {
  159. height: 700rpx;
  160. .banner-swiper {
  161. width: 100%;
  162. .banner-image {
  163. width: 100%;
  164. height: 100%;
  165. }
  166. }
  167. }
  168. .goods-info {
  169. background: #ffffff;
  170. margin-top: 20rpx;
  171. padding: 30rpx;
  172. }
  173. .points-section {
  174. display: flex;
  175. align-items: center;
  176. margin-bottom: 20rpx;
  177. .points-text {
  178. font-size: 32rpx;
  179. font-weight: bold;
  180. color: #218cdd;
  181. margin-left: 6rpx;
  182. }
  183. }
  184. .title-section {
  185. margin-bottom: 40rpx;
  186. .goods-title {
  187. font-size: 28rpx;
  188. color: #333333;
  189. line-height: 1.5;
  190. display: block;
  191. }
  192. }
  193. .detail-container {
  194. background: #ffffff;
  195. margin-top: 20rpx;
  196. padding: 30rpx;
  197. margin-bottom: 120rpx;
  198. }
  199. .detail-title-section {
  200. display: flex;
  201. align-items: center;
  202. justify-content: center;
  203. margin-bottom: 30rpx;
  204. .detail-title {
  205. font-size: 28rpx;
  206. font-weight: bold;
  207. color: #333333;
  208. }
  209. }
  210. .gallery-section {
  211. margin-bottom: 40rpx;
  212. .gallery-grid {
  213. display: grid;
  214. grid-template-columns: repeat(3, 1fr);
  215. gap: 16rpx;
  216. .gallery-image {
  217. width: 100%;
  218. height: 200rpx;
  219. border-radius: 12rpx;
  220. border: 1rpx solid #f0f0f0;
  221. }
  222. }
  223. }
  224. .bottom-bar {
  225. position: fixed;
  226. bottom: 0;
  227. left: 0;
  228. right: 0;
  229. background: #ffffff;
  230. padding: 20rpx 30rpx;
  231. border-top: 1rpx solid #f0f0f0;
  232. z-index: 999;
  233. box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.1);
  234. display: flex;
  235. align-items: center;
  236. justify-content: center;
  237. .exchange-btn {
  238. width: 100%;
  239. height: 80rpx;
  240. border-radius: 40rpx;
  241. background-color: #218cdd;
  242. display: flex;
  243. align-items: center;
  244. justify-content: center;
  245. .exchange-text {
  246. color: #ffffff;
  247. font-size: 28rpx;
  248. }
  249. }
  250. }
  251. </style>