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

360 lines
7.6 KiB

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