敢为人鲜小程序前端代码仓库
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.

316 lines
6.2 KiB

5 months ago
5 months ago
3 months ago
3 months ago
5 months ago
5 months ago
5 months ago
3 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
3 months ago
3 months ago
3 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
3 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
3 months ago
3 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
  1. <template>
  2. <view class="page">
  3. <!-- 导航栏 -->
  4. <!-- <navbar title="商品详情" leftClick @leftClick="$utils.navigateBack" /> -->
  5. <view class="leftClick"
  6. @click="$utils.navigateBack">
  7. <uv-icon
  8. size="30rpx"
  9. color="#fff"
  10. name="arrow-left"></uv-icon>
  11. </view>
  12. <view class="swipe">
  13. <uv-swiper :list="productDetail.image
  14. && productDetail.image.split(',')" indicator height="750rpx"></uv-swiper>
  15. </view>
  16. <!-- 商品标题 -->
  17. <view class="info">
  18. <view class="title">
  19. {{ productDetail.title }}
  20. </view>
  21. <view class="price">
  22. <view class="money">
  23. <text>{{ productDetail.price }}</text>
  24. <text class="unit">/元每件</text>
  25. </view>
  26. <view class="oldPrice">
  27. <text>{{ productDetail.oldPrice }}</text>
  28. <text class="unit">/</text>
  29. </view>
  30. </view>
  31. <view class="price">
  32. <view class="money">
  33. <text>{{ productDetail.goldPrice }}</text>
  34. <text class="unit">/元每件</text>
  35. </view>
  36. <view class="price-imgs">
  37. <image :src="configList.vip_money_one" mode="aspectFill"
  38. class="price-img"></image>
  39. </view>
  40. </view>
  41. <view class="price">
  42. <view class="money">
  43. <text>{{ productDetail.silverPrice }}</text>
  44. <text class="unit">/元每件</text>
  45. </view>
  46. <view class="price-imgs">
  47. <image :src="configList.vip_money_two" mode="aspectFill" class="price-img">
  48. </image>
  49. </view>
  50. </view>
  51. <view class="price">
  52. <view class="money">
  53. <text>{{ productDetail.diamondPrice }}</text>
  54. <text class="unit">/元每件</text>
  55. </view>
  56. <view class="price-imgs">
  57. <image :src="configList.vip_money_three" mode="aspectFill" class="price-img">
  58. </image>
  59. </view>
  60. </view>
  61. </view>
  62. <!-- 服务 -->
  63. <view class="server">
  64. <view class="setver-main">
  65. <view class="title">服务</view>
  66. <view class="descript">
  67. 免费上门退·7天无理由退货·快递发货
  68. </view>
  69. </view>
  70. <view class="server-arraw">
  71. <uv-icon name="arrow-right"></uv-icon>
  72. </view>
  73. </view>
  74. <!-- 参数 -->
  75. <view v-if="productDetail.sku" class="params">
  76. <view class="params-main">
  77. <view class="title">参数</view>
  78. <view class="descript">
  79. {{ productDetail.sku }}
  80. </view>
  81. </view>
  82. <view class="server-arraw">
  83. <uv-icon name="arrow-right"></uv-icon>
  84. </view>
  85. </view>
  86. <!-- 商品详情 -->
  87. <view class="item-line">
  88. <view class="before"></view>
  89. <view class="label">商品详情</view>
  90. </view>
  91. <uv-parse :content="productDetail.details"></uv-parse>
  92. <!-- 分享和购买按钮 -->
  93. <submit
  94. @service="service"
  95. @toSend="toSend"
  96. @submit="submit"
  97. @addCart="addCart"
  98. :detail="productDetail" />
  99. <!-- 联系客服 -->
  100. <customerServicePopup ref="customerServicePopup" />
  101. </view>
  102. </template>
  103. <script>
  104. import submit from '../components/product/submit.vue'
  105. import submitUnitSelect from '../components/product/submitUnitSelect.vue'
  106. import customerServicePopup from '@/components/config/customerServicePopup.vue'
  107. export default {
  108. components: {
  109. submit,
  110. submitUnitSelect,
  111. customerServicePopup
  112. },
  113. data() {
  114. return {
  115. productDetail: {
  116. image: '',
  117. details: '',
  118. },
  119. id: 0,
  120. }
  121. },
  122. onLoad(args) {
  123. this.id = args.id
  124. },
  125. onShow() {
  126. this.getRiceProductDetail()
  127. },
  128. methods: {
  129. // 分享商品
  130. share() {
  131. },
  132. // 加入购物车
  133. addCart(){
  134. this.$api('addCart', {
  135. shopId : this.id,
  136. num : 1,
  137. }, res => {
  138. if(res.code == 200){
  139. uni.showToast({
  140. title: '加入购物车成功',
  141. icon: 'none'
  142. })
  143. }
  144. })
  145. },
  146. // 立即下单
  147. submit() {
  148. this.$store.commit('setPayOrderProduct', [
  149. this.productDetail
  150. ])
  151. this.$utils.navigateTo('/pages_order/order/createOrder')
  152. },
  153. toSend(){
  154. this.$store.commit('setPayOrderProduct', [
  155. this.productDetail
  156. ])
  157. // this.$utils.navigateTo('/pages_order/order/receiveGift?id=1894006757315850241')
  158. this.$utils.navigateTo('/pages_order/order/createOrder?type=give')
  159. },
  160. // 获取商品
  161. getRiceProductDetail() {
  162. this.$api('getRiceProductDetail', {
  163. id: this.id
  164. }, res => {
  165. if (res.code == 200) {
  166. res.result.num = 1
  167. this.productDetail = res.result
  168. }
  169. })
  170. },
  171. // 联系客服
  172. service() {
  173. this.$refs.customerServicePopup.open()
  174. },
  175. }
  176. }
  177. </script>
  178. <style scoped lang="scss">
  179. .page {
  180. padding-bottom: 120rpx;
  181. .leftClick{
  182. position: absolute;
  183. top: calc(var(--status-bar-height) + 20rpx);
  184. left: 20rpx;
  185. background-color: #00000073;
  186. padding: 20rpx;
  187. border-radius: 50%;
  188. z-index: 99;
  189. }
  190. .swipe {}
  191. // 商品标题
  192. .info {
  193. padding: 20rpx;
  194. background-color: #fff;
  195. display: flex;
  196. flex-direction: column;
  197. gap: 14rpx;
  198. .title {
  199. font-size: 36rpx;
  200. font-weight: 900;
  201. }
  202. }
  203. // 服务 & 参数
  204. .server,
  205. .params {
  206. background: white;
  207. display: flex;
  208. justify-content: space-between;
  209. flex-wrap: wrap;
  210. padding: 30rpx 20rpx;
  211. box-sizing: border-box;
  212. .setver-main,
  213. .params-main {
  214. display: flex;
  215. flex-wrap: wrap;
  216. width: 90%;
  217. font-size: 32rpx;
  218. .title {
  219. color: #7C7C7C;
  220. margin-right: 20rpx;
  221. }
  222. }
  223. .server-arraw {
  224. display: flex;
  225. justify-content: flex-end;
  226. text-align: right;
  227. }
  228. }
  229. // 价格
  230. .price {
  231. display: flex;
  232. align-items: center;
  233. color: #f40;
  234. font-size: 30rpx;
  235. align-items: flex-end;
  236. .money {
  237. font-size: 30rpx;
  238. .unit {
  239. font-size: 24rpx;
  240. }
  241. }
  242. .price-imgs {
  243. display: flex;
  244. flex-wrap: wrap;
  245. .price-img {
  246. width: 80rpx;
  247. height: 30rpx;
  248. margin-left: 10rpx;
  249. }
  250. }
  251. }
  252. .oldPrice{
  253. color: #999;
  254. font-size: 24rpx;
  255. text-decoration: line-through;
  256. }
  257. // 商品详情
  258. .item-line {
  259. display: flex;
  260. background: white;
  261. box-sizing: border-box;
  262. font-size: 34rpx;
  263. padding: 20rpx;
  264. }
  265. .item-line .before {
  266. content: "";
  267. width: 8rpx;
  268. height: 30rpx;
  269. background: $uni-color;
  270. border-radius: 4rpx;
  271. margin-right: 10rpx;
  272. margin-top: 15rpx;
  273. }
  274. .item-line .label {
  275. display: flex;
  276. align-items: center;
  277. width: 152rpx;
  278. height: 60rpx;
  279. }
  280. }
  281. </style>