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

371 lines
7.8 KiB

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
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
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
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
  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: 'success'
  157. })
  158. }else{
  159. uni.showToast({
  160. title: '加入购物车失败',
  161. icon: 'error'
  162. })
  163. }
  164. },
  165. error => {
  166. uni.showToast({
  167. title: '加入购物车失败',
  168. icon: 'error'
  169. })
  170. })
  171. },
  172. // 立即下单
  173. submit() {
  174. this.$refs.placeOrder.open()
  175. // this.$store.commit('setPayOrderProduct', [
  176. // this.productDetail
  177. // ])
  178. // this.$utils.navigateTo('/pages_order/order/createOrder')
  179. },
  180. toSend(){
  181. this.$store.commit('setPayOrderProduct', [
  182. this.productDetail
  183. ])
  184. // this.$utils.navigateTo('/pages_order/order/receiveGift?id=1894006757315850241')
  185. this.$utils.navigateTo('/pages_order/order/createOrder?type=give')
  186. },
  187. // 获取商品
  188. getRiceProductDetail() {
  189. this.$api('getRiceProductDetail', {
  190. id: this.id
  191. }, res => {
  192. if (res.code == 200) {
  193. res.result.num = 1
  194. this.productDetail = res.result
  195. }
  196. })
  197. },
  198. // 联系客服
  199. service() {
  200. this.$refs.customerServicePopup.open()
  201. },
  202. }
  203. }
  204. </script>
  205. <style scoped lang="scss">
  206. .page {
  207. padding-bottom: 120rpx;
  208. .leftClick{
  209. position: absolute;
  210. top: calc(var(--status-bar-height) + 20rpx);
  211. left: 20rpx;
  212. background-color: #00000073;
  213. padding: 20rpx;
  214. border-radius: 50%;
  215. z-index: 99;
  216. }
  217. .swipe {
  218. // 这是轮播图的指示器自定义样式
  219. @mixin flex($direction: row) {
  220. /* #ifndef APP-NVUE */
  221. display: flex;
  222. /* #endif */
  223. flex-direction: $direction;
  224. }
  225. .indicator {
  226. @include flex(row);
  227. justify-content: center;
  228. &__dot {
  229. height: 8px;
  230. width: 8px;
  231. border-radius: 100%;
  232. background-color: #fff;
  233. margin: 0 5px;
  234. transition: background-color 0.3s;
  235. &--active {
  236. background-color: $uni-color;
  237. }
  238. }
  239. }
  240. }
  241. // 商品标题
  242. .info {
  243. padding: 20rpx;
  244. padding-left: 30rpx;
  245. background-color: #fff;
  246. display: flex;
  247. flex-direction: column;
  248. gap: 14rpx;
  249. border-bottom: 30rpx #F7F7F7 solid;
  250. .new-price{
  251. color: $uni-color-second;
  252. }
  253. .title {
  254. font-size: 30rpx;
  255. font-weight: 600;
  256. }
  257. }
  258. // 服务 & 参数
  259. .server,
  260. .params {
  261. background: white;
  262. display: flex;
  263. justify-content: space-between;
  264. flex-wrap: wrap;
  265. padding: 30rpx 20rpx;
  266. box-sizing: border-box;
  267. .setver-main,
  268. .params-main {
  269. display: flex;
  270. flex-wrap: wrap;
  271. width: 90%;
  272. font-size: 32rpx;
  273. .title {
  274. color: #7C7C7C;
  275. margin-right: 20rpx;
  276. }
  277. }
  278. .server-arraw {
  279. display: flex;
  280. justify-content: flex-end;
  281. text-align: right;
  282. }
  283. }
  284. // 价格
  285. .price {
  286. display: flex;
  287. align-items: center;
  288. color: #f40;
  289. font-size: 30rpx;
  290. align-items: flex-end;
  291. .money {
  292. font-size: 30rpx;
  293. .unit {
  294. font-size: 24rpx;
  295. }
  296. }
  297. .price-imgs {
  298. display: flex;
  299. flex-wrap: wrap;
  300. .price-img {
  301. width: 80rpx;
  302. height: 30rpx;
  303. margin-left: 10rpx;
  304. }
  305. }
  306. }
  307. .oldPrice{
  308. color: #999;
  309. font-size: 24rpx;
  310. text-decoration: line-through;
  311. }
  312. // 商品详情
  313. .item-line {
  314. display: flex;
  315. background: white;
  316. box-sizing: border-box;
  317. font-size: 34rpx;
  318. padding: 20rpx;
  319. }
  320. .item-line .before {
  321. content: "";
  322. width: 8rpx;
  323. height: 30rpx;
  324. background: $uni-color;
  325. border-radius: 4rpx;
  326. margin-right: 10rpx;
  327. margin-top: 15rpx;
  328. }
  329. .item-line .label {
  330. display: flex;
  331. align-items: center;
  332. width: 152rpx;
  333. height: 60rpx;
  334. }
  335. }
  336. </style>