index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. <template>
  2. <view class="detail" style=" padding: 30rpx;">
  3. <scroll-view scroll-y="true" scroll-with-animation='true' style="height: 100%">
  4. <view class="detail-img">
  5. <image :src="goodsInfo.goodsCover" mode="scaleToFill" />
  6. </view>
  7. <view class="detail-content">
  8. <view style="display:flex; margin-bottom: 20rpx;">
  9. <text class="red"> ¥{{ goodsInfo.discountPrice }}</text>
  10. <text class="line-thr">¥{{ goodsInfo.salePrice }}</text>
  11. </view>
  12. <view class="detail-content-t">
  13. {{ goodsInfo.goodsName }}
  14. </view>
  15. <!-- <view class='time '>
  16. <image src="http://www.gzzzyd.com/groupon/home_slices/编辑@2x.png" mode="scaleToFill" />
  17. 发布于:
  18. <text class="imp_info">
  19. 1天20小时36分钟前
  20. </text>
  21. </view> -->
  22. </view>
  23. <view class="detail-info product-intro">
  24. <view class="title">
  25. 商品信息
  26. </view>
  27. <u-album :urls="goodsInfo.detailImgUrlList" :rowCount="1" :multipleSize="albumWidth" maxCount="9999"
  28. multipleMode="widthFix"></u-album>
  29. </view>
  30. </scroll-view>
  31. <!-- <view class="footer acea-row row-between-wrapper">-->
  32. <!-- &lt;!&ndash; <button open-type="contact" hover-class='none' class='item'>-->
  33. <!-- <view class='iconfont icon-kefu'></view>-->
  34. <!-- <view>客服</view>-->
  35. <!-- </button> &ndash;&gt;-->
  36. <!-- <navigator hover-class="none" class="item skeleton-rect" open-type="switchTab" url="/pages/index/index">-->
  37. <!-- <view class="iconfont icon-shouye6"></view>-->
  38. <!-- <view class="p_center">{{ $t(`首页`) }}</view>-->
  39. <!-- </navigator>-->
  40. <!-- <view style=" margin-right: 30rpx;">-->
  41. <!-- <view class="bnt acea-row">-->
  42. <!-- <view class="buy-box">-->
  43. <!-- <button class="share-btn ">-->
  44. <!-- 分享有礼-->
  45. <!-- </button>-->
  46. <!-- <button class="now-btn " @submit="goBuy">-->
  47. <!-- 立即购买-->
  48. <!-- </button>-->
  49. <!-- </view>-->
  50. <!-- </view>-->
  51. <!-- </view>-->
  52. <!-- </view>-->
  53. </view>
  54. </template>
  55. <script>
  56. import {
  57. userEdit,
  58. } from '@/api/user.js';
  59. import {
  60. toLogin
  61. } from '@/libs/login.js';
  62. import {
  63. mapGetters
  64. } from "vuex";
  65. import dayjs from "@/plugin/dayjs/dayjs.min.js";
  66. // #ifdef MP
  67. import authorize from '@/components/Authorize';
  68. // #endif
  69. import colors from '@/mixins/color.js';
  70. export default {
  71. props: {
  72. goodsInfo: {
  73. type: Object,
  74. default: () => { }
  75. }
  76. },
  77. components: {
  78. // #ifdef APP-PLUS
  79. appUpdate,
  80. // #endif
  81. // #ifdef MP
  82. authorize
  83. // #endif
  84. },
  85. mixins: [colors],
  86. data () {
  87. return {
  88. albumWidth: 0,
  89. };
  90. },
  91. computed: mapGetters(['isLogin']),
  92. watch: {
  93. isLogin: {
  94. handler: function (newV, oldV) {
  95. if (newV) {
  96. }
  97. },
  98. deep: true
  99. }
  100. },
  101. created(options) {
  102. console.log('???')
  103. let that = this;
  104. uni.getSystemInfo({
  105. success: function (res) {
  106. console.log(res,'getSystemInfo')
  107. that.albumWidth = res.windowWidth - 30
  108. that.height = res.windowHeight;
  109. //res.windowHeight:获取整个窗口高度为px,*2为rpx;98为头部占据的高度;
  110. // #ifndef APP-PLUS || H5 || MP-ALIPAY
  111. that.navbarRight =
  112. res.windowWidth - uni.getMenuButtonBoundingClientRect().left;
  113. // #endif
  114. },
  115. });
  116. },
  117. methods: {
  118. formSubmit: function (e) {
  119. let that = this,
  120. value = e.detail.value,
  121. userInfo = that.switchUserInfo[that.userIndex];
  122. if (!value.nickname) return that.$util.Tips({
  123. title: that.$t(`请输入姓名`)
  124. });
  125. value.avatar = this.userInfo.avatar;
  126. userEdit(value).then(res => {
  127. return that.$util.Tips({
  128. title: res.msg,
  129. icon: 'success'
  130. }, {
  131. tab: 3,
  132. url: 1
  133. });
  134. }).catch(msg => {
  135. return that.$util.Tips({
  136. title: msg || that.$t(`保存失败`)
  137. }, {
  138. tab: 3,
  139. url: 1
  140. });
  141. });
  142. }
  143. }
  144. }
  145. </script>
  146. <style scoped lang="scss">
  147. .time {
  148. height: 44rpx;
  149. font-size: 24rpx;
  150. font-weight: 400;
  151. color: #999999;
  152. line-height: 44rpx;
  153. image {
  154. width: 40rpx;
  155. height: 40rpx;
  156. margin: 0 10rpx;
  157. vertical-align: middle;
  158. }
  159. .imp_info {
  160. height: 44rpx;
  161. font-size: 24rpx;
  162. font-weight: 400;
  163. color: #333333;
  164. line-height: 44rpx;
  165. }
  166. }
  167. .detail {
  168. height: 80vh;
  169. }
  170. .detail-img {
  171. image {
  172. width: 702rpx;
  173. height: 702rpx;
  174. }
  175. margin-bottom: 20rpx;
  176. }
  177. .detail-content-t {
  178. flex: 1;
  179. font-size: 20rpx;
  180. font-weight: 400;
  181. color: #333333;
  182. line-height: 28rpx;
  183. margin-bottom: 20rpx;
  184. }
  185. .detail-content {
  186. .red {
  187. display: block;
  188. font-size: 28rpx;
  189. font-weight: 500;
  190. color: #B22338 !important;
  191. margin-right: 10rpx;
  192. }
  193. .line-thr {
  194. display: block;
  195. font-size: 28rpx;
  196. font-weight: 400;
  197. color: #999999;
  198. text-decoration: line-through;
  199. }
  200. }
  201. .detail-info {
  202. .title {
  203. margin: 30rpx 0;
  204. height: 44rpx;
  205. font-size: 32rpx;
  206. font-weight: 500;
  207. color: #111111;
  208. line-height: 44rpx;
  209. }
  210. }
  211. .footer {
  212. padding: 0 20rpx 0 10rpx;
  213. position: fixed;
  214. bottom: 0;
  215. width: 100%;
  216. box-sizing: border-box;
  217. background-color: #fff;
  218. z-index: 277;
  219. border-top: 1rpx solid #f0f0f0;
  220. height: 100rpx;
  221. height: calc(100rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  222. height: calc(100rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  223. }
  224. .footer .item .iconfont {
  225. text-align: center;
  226. font-size: 40rpx;
  227. }
  228. .footer .item .iconfont.icon-shoucang1 {
  229. color: var(--view-theme);
  230. }
  231. .footer .item .iconfont.icon-gouwuche1 {
  232. font-size: 40rpx;
  233. position: relative;
  234. }
  235. .buy-box {
  236. display: flex;
  237. width: 100%;
  238. }
  239. .share-btn {
  240. width: 280rpx;
  241. height: 84rpx;
  242. background: #F1F8E5;
  243. border-radius: 54rpx 0rpx 0rpx 54rpx;
  244. font-size: 28rpx;
  245. font-weight: 400;
  246. color: #75BE00;
  247. line-height: 84rpx;
  248. }
  249. .now-btn {
  250. width: 280rpx;
  251. height: 84rpx;
  252. background: #B42A3E;
  253. border-radius: 0rpx 54rpx 54rpx 0rpx;
  254. font-size: 28rpx;
  255. font-weight: 400;
  256. color: #fff;
  257. line-height: 84rpx;
  258. }
  259. </style>