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.

338 lines
7.6 KiB

1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
  1. <template>
  2. <view class="container">
  3. <view class="details-container">
  4. <uni-swiper-dot class="uni-swiper-dot-box" field="content">
  5. <swiper style="height: 245px;" indicator-dots indicator-color="rgba(255, 255, 255, 0.50)"
  6. indicator-active-color="#ffffff" autoplay interval="3000">
  7. <swiper-item class="swiper-box" v-for="(item,index) in slideshow" :key="index">
  8. <img :src="item" style="width: 100%; height:100%" />
  9. </swiper-item class="swiper-box">
  10. </swiper>
  11. </uni-swiper-dot>
  12. <view class="details-price">
  13. <view class="details-price1">
  14. <view class="details-price-normal">
  15. <text class="details-price-big">{{detailInfo.price}}.00</text>
  16. <text>{{detailInfo.unit}}</text>
  17. </view>
  18. <button open-type="share" @click="sharePage" class="share-btn">
  19. <img src="../../static/images/details/share.svg"
  20. style="width: 14px;height: 14px; margin-right:5px" alt="share" srcset="">
  21. </button>
  22. </view>
  23. <view class="details-price2">
  24. <text class="details-price-item">{{detailInfo.name}}</text>
  25. <button class="details-price-share share-btn" open-type="share" @click="sharePage">分享</button>
  26. </view>
  27. </view>
  28. <view class="details-banner">
  29. <view class="details-banner-item">
  30. <!-- <img src="../../static/images/details/right.svg" alt="right">
  31. <text>全程直播</text> -->
  32. <img src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/second_stage/spzb.png"
  33. style="width: 96px;" mode="widthFix" alt="">
  34. </view>
  35. <view class="details-banner-item">
  36. <img src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/second_stage/fwdj.png"
  37. style="width: 109px;" mode="widthFix" alt="">
  38. <!-- <img src="../../static/images/details/right.svg" alt="right">
  39. <text>1v1服务</text> -->
  40. </view>
  41. <view class="details-banner-item">
  42. <img src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/second_stage/kspp.png"
  43. style="width: 96px;" mode="widthFix" alt="">
  44. <!-- <img src="../../static/images/details/right.svg" alt="right">
  45. <text>及时匹配</text> -->
  46. </view>
  47. </view>
  48. <view class="details-img">
  49. <img :src="detailInfo.detailPic" style="width: 100%;" mode="widthFix" show-menu-by-longpress />
  50. </view>
  51. </view>
  52. <view class="details-subscribe">
  53. <button v-if="isMember" class="details-btn" @click="goSubscribe">去预约</button>
  54. <button v-else class="details-btn" open-type="getPhoneNumber"
  55. @getphonenumber="onGetPhoneNumber">去预约</button>
  56. </view>
  57. <Kefu></Kefu>
  58. </view>
  59. </template>
  60. <script>
  61. import {
  62. setToken,
  63. getToken,
  64. getOpenIdKey
  65. } from '@/utils/auth'
  66. import Kefu from '../common/kefu.vue'
  67. import {
  68. getProductDetails,
  69. getPhoneNumber
  70. } from '@/api/system/user.js'
  71. export default {
  72. data() {
  73. return {
  74. currentProductId: '',
  75. isAgree: false,
  76. code: '',
  77. detailInfo: {},
  78. skus: null,
  79. slideshow: [],
  80. isMember: false,
  81. };
  82. },
  83. components: {
  84. Kefu
  85. },
  86. mounted() {
  87. // this.currentProductId = this.$globalData.selectedProductId;
  88. console.log(this.currentProductId);
  89. this.getDetailInfo();
  90. },
  91. methods: {
  92. getDetailInfo() {
  93. getProductDetails(this.currentProductId).then(response => {
  94. this.detailInfo = response.product
  95. this.skus = response.skus
  96. if (response.product && response.product.albumPics) {
  97. this.slideshow = response.product.albumPics.split(",")
  98. }
  99. })
  100. },
  101. sharePage() {
  102. uni.shareAppMessage({
  103. title: '猫妈狗爸',
  104. path: `/pages/details/detail?id=${this.currentProductId}`,
  105. imageUrl: this.detailInfo.pic
  106. })
  107. },
  108. changeAgree() {
  109. console.log(this.isAgree);
  110. if (this.isAgree) {
  111. this.isAgree = false
  112. } else {
  113. this.isAgree = true
  114. }
  115. },
  116. goSubscribe() {
  117. if (this.skus) {
  118. let productSku = {
  119. "skuId": this.skus[0].id,
  120. "quantity": 1
  121. }
  122. this.$globalData.mainSku = [productSku]
  123. this.$globalData.newOrderData = {
  124. currentAddress: {},
  125. currentPets: [],
  126. totalPrice: 0,
  127. needPreFamiliarize: []
  128. }
  129. uni.navigateTo({
  130. url: `/pages/newOrder/serviceNew`
  131. // url: `/pages/details/service?price=${this.detailInfo.price}`
  132. });
  133. } else {
  134. this.$modal.showToast('产品SKU有误,请联系系统管理员');
  135. }
  136. },
  137. init() {
  138. this.$globalData.itemPrice = []
  139. this.$globalData.submitData = {
  140. "phone": "",
  141. "wechatId": "",
  142. "note": "",
  143. "totalPrice": "",
  144. "address": {
  145. "province": "上海市",
  146. "city": "上海市",
  147. "district": "",
  148. "detailAddress": ""
  149. },
  150. "skuList": [],
  151. "service": {
  152. "serviceFrequency": "once_a_day",
  153. "serviceDate": [],
  154. "serviceTimeFirst": "",
  155. "serviceTimeSecond": "",
  156. "pet": []
  157. }
  158. }
  159. },
  160. onGetPhoneNumber(e) {
  161. if (e.detail.errMsg == "getPhoneNumber:fail user deny") { //用户拒绝授权
  162. //拒绝授权后弹出一些提示
  163. } else { //允许授权
  164. if (getOpenIdKey()) {
  165. this.getPhoneNumber({
  166. "openId": getOpenIdKey(),
  167. "code": e.detail.code
  168. })
  169. }
  170. }
  171. },
  172. getPhoneNumber(data) {
  173. getPhoneNumber(data).then(res => {
  174. if (res && res.code == 200) {
  175. let token = res.data.token
  176. setToken(token)
  177. this.isMember = true
  178. this.goSubscribe()
  179. } else {
  180. uni.showToast({
  181. icon: 'error',
  182. title: '获取手机号失败'
  183. })
  184. }
  185. })
  186. },
  187. },
  188. onLoad: function(option) {
  189. this.init();
  190. this.currentProductId = option.id;
  191. this.isMember = getToken() ? true : false
  192. },
  193. onShareAppMessage(res) {
  194. if (res.from === 'button') { // 来自页面内分享按钮
  195. console.log(res.target)
  196. }
  197. return {
  198. title: '猫妈狗爸',
  199. path: `/pages/details/detail?id=${this.currentProductId}`,
  200. imageUrl: this.detailInfo.pic
  201. }
  202. }
  203. }
  204. </script>
  205. <style lang="scss">
  206. .container {
  207. position: relative;
  208. height: 100%;
  209. padding-bottom: 58px;
  210. .details-subscribe {
  211. background-color: #FFFFFF;
  212. padding: 10px;
  213. width: 100%;
  214. height: 58px;
  215. position: fixed;
  216. bottom: 0;
  217. z-index: 100;
  218. .details-btn {
  219. width: 100%;
  220. border-radius: 6px;
  221. background: #FFB13F;
  222. font-size: 16px;
  223. color: #FFFFFF;
  224. }
  225. }
  226. }
  227. .details-container {
  228. .share-btn {
  229. margin: 0;
  230. border: 0;
  231. padding: 0 !important;
  232. background: #fff;
  233. border-color: #fff;
  234. display: flex;
  235. border-radius: 0px;
  236. }
  237. .share-btn::after {
  238. border: none;
  239. }
  240. .details-price {
  241. background: #FFFFFF;
  242. padding: 10px 19px 15px;
  243. margin-top: -5px;
  244. .details-price1 {
  245. display: flex;
  246. justify-content: space-between;
  247. align-items: baseline;
  248. .details-price-normal {
  249. color: #FF530A;
  250. font-size: 16px;
  251. font-style: normal;
  252. font-weight: bold;
  253. line-height: normal;
  254. .details-price-big {
  255. font-size: 24px;
  256. }
  257. }
  258. }
  259. .details-price2 {
  260. display: flex;
  261. justify-content: space-between;
  262. align-items: center;
  263. margin-top: 5px;
  264. .details-price-item {
  265. color: #333;
  266. font-size: 18px;
  267. font-weight: bold;
  268. line-height: 16px;
  269. /* 100% */
  270. margin-left: 5px;
  271. }
  272. .details-price-share {
  273. color: #666;
  274. font-size: 14px;
  275. font-weight: 400;
  276. line-height: 13px;
  277. /* 92.857% */
  278. }
  279. }
  280. }
  281. .details-banner {
  282. width: 100%;
  283. height: 36px;
  284. background-color: #FFF8DF;
  285. display: flex;
  286. justify-content: space-around;
  287. .details-banner-item {
  288. display: flex;
  289. justify-content: space-between;
  290. align-items: center;
  291. font-size: 12px;
  292. line-height: 13px;
  293. color: #A94F20;
  294. img {
  295. width: 13px;
  296. }
  297. }
  298. }
  299. .details-img {
  300. background: #F5F5F7;
  301. padding: 10px;
  302. }
  303. }
  304. </style>