index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <template>
  2. <view class="detail" style=" padding: 30rpx;">
  3. <scroll-view scroll-y="true" scroll-with-animation='true' style="height: calc(100% - 100rpx)">
  4. <view class="detail-img">
  5. <image
  6. :src="goodsInfo.goodsCover"
  7. mode="scaleToFill" />
  8. </view>
  9. <view class="detail-content">
  10. <view style="display:flex; margin-bottom: 20rpx;">
  11. <text class="red"> ¥{{goodsInfo.discountPrice}}</text>
  12. <text class="line-thr">¥{{goodsInfo.salePrice}}</text>
  13. </view>
  14. <view class="detail-content-t">
  15. {{goodsInfo.goodsName}}
  16. </view>
  17. <!-- <view class='time '>
  18. <image src="http://www.gzzzyd.com/groupon/home_slices/编辑@2x.png" mode="scaleToFill" />
  19. 发布于:
  20. <text class="imp_info">
  21. 1天20小时36分钟前
  22. </text>
  23. </view> -->
  24. </view>
  25. <view class="detail-info">
  26. <view class="title">
  27. 商品信息
  28. </view>
  29. </view>
  30. </scroll-view>
  31. <view class="footer acea-row row-between-wrapper">
  32. <!-- <button open-type="contact" hover-class='none' class='item'>
  33. <view class='iconfont icon-kefu'></view>
  34. <view>客服</view>
  35. </button> -->
  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. };
  89. },
  90. computed: mapGetters(['isLogin']),
  91. watch: {
  92. isLogin: {
  93. handler: function (newV, oldV) {
  94. if (newV) {
  95. this.getUserInfo();
  96. }
  97. },
  98. deep: true
  99. }
  100. },
  101. onLoad () {
  102. if (this.isLogin) {
  103. this.getUserInfo();
  104. // #ifdef APP-PLUS
  105. this.formatSize()
  106. // 获取版本号
  107. plus.runtime.getProperty(plus.runtime.appid, (inf) => {
  108. console.log(inf.version)
  109. this.version = inf.version;
  110. });
  111. // #endif
  112. this.setLang();
  113. } else {
  114. toLogin();
  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>