123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 |
- <template>
- <view class="content">
- <!-- 轮播图 -->
- <top-swiper :imgList="imgList"></top-swiper>
- <!-- 价格 -->
- <view class="good-price flex">
- <view class="new-price">
- ¥{{goodItem.price}}
- </view>
- <view class="old-price">
- ¥{{goodItem.ot_price}}
- </view>
- </view>
- <!-- 标题 -->
- <view class="good-tit">
- {{goodItem.title}}
- </view>
- <content-text :description="description"></content-text>
- <view class="btn-ts" style="height: 130rpx; background-color: #fff;">
- </view>
- <view class="btm-btn" @click="loading? '':reservePackage()">
- 立即预约
- </view>
- </view>
- </template>
- <script>
- // 头部轮播图
- import topSwiper from './common/topSwiper.vue';
- // 图文详情
- import contentText from './common/contentText.vue';
- import {
- getUserInfo
- } from '@/api/user.js'
- import {
- getWholeDetai,
- reservePackage,
- getWholeInfo
- } from '@/api/whole.js'
- export default {
- components: {
- topSwiper,
- contentText
- },
- data() {
- return {
- imgList: [],
- goodItem: {},
- good_id: '',
- time_id: '',
- status: 1,
- is_new: 'non',
- description: '',
- loading: false,
- }
- },
- onLoad(opt) {
- if (opt.id) {
- this.good_id = opt.id
- }
- if (opt.time) {
- this.time_id = opt.time
- }
- if (opt.status) {
- this.status = opt.status
- }
- // if (opt.is_new) {
- // this.is_new = opt.is_new
- // }
- this.getUserInfo()
- this.getWholeDetai()
- },
- methods: {
- getUserInfo() {
- getUserInfo().then(res => {
- console.log(res)
- // this.setUserInfo(res.data);
- // this.userInfo = res.data
- this.is_new = res.data.is_whole == 0? 'isn': 'non'
- })
- },
- getWholeDetai() {
- let obj = this
- if (obj.is_new) {
- getWholeDetai({}, obj.good_id, obj.time_id, obj.status, 1).then(({
- data
- }) => {
- obj.goodItem = data.storeInfo
- obj.imgList = data.storeInfo.images
- obj.description = data.storeInfo.description.replace(/\<img/gi, '<img class="rich-img"')
- })
- } else {
- getWholeInfo({},obj.good_id).then(({data}) => {
- obj.goodItem = data.storeInfo
- obj.imgList = data.storeInfo.images
- obj.description = data.storeInfo.description.replace(/\<img/gi, '<img class="rich-img"')
- })
- // getWholeDetai({}, obj.good_id, obj.time_id, obj.status, 0).then(({
- // data
- // }) => {
- // obj.goodItem = data.storeInfo
- // obj.imgList = data.storeInfo.images
- // obj.description = data.storeInfo.description.replace(/\<img/gi, '<img class="rich-img"')
- // })
- }
- },
- // 预约包
- reservePackage() {
- let obj = this
- if(obj.is_new == 'non') {
- this.$api.msg('您已不是新人,无法购买新人专属商品')
- return
- }
- let updata = {
- whole_id: obj.good_id,
- time_id: obj.time_id,
- price: obj.goodItem.price,
- to_uid: obj.is_new == 'isn' ? 0 : '',
- first_price: obj.is_new == 'isn' ? 0 : '',
- last_id: obj.is_new == 'isn' ? 0 : ''
- }
- obj.loading = true
- reservePackage(updata).then(res => {
- uni.showToast({
- title: '预约成功',
- duration: 2000
- });
- setTimeout(function() {
- uni.navigateTo({
- url: '/pages/user/myWholesale'
- });
- }, 800);
- }).catch(err => {
- obj.loading = false
- console.log(err)
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .good-price {
- padding-left: 20rpx;
- padding-top: 20rpx;
- justify-content: flex-start;
- background-color: #fff;
- // align-items: f;
- .new-price {
- font-size: 50rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #FF4C4C;
- }
- .old-price {
- padding-left: 8rpx;
- font-size: 33rpx;
- font-family: PingFang SC;
- font-weight: bold;
- text-decoration: line-through;
- color: #999999;
- }
- }
- .good-tit {
- padding: 20rpx;
- background-color: #fff;
- }
- .btm-btn {
- position: fixed;
- bottom: 35rpx;
- left: 0;
- right: 0;
- margin: auto;
- width: 699rpx;
- height: 90rpx;
- line-height: 90rpx;
- text-align: center;
- background: linear-gradient(90deg, #FE6F61 0%, #FF4343 100%);
- border-radius: 45rpx;
- font-size: 36rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #FFFFFF;
- // background-color: #fff;
- }
- /* 商品详情中限制图片大小 */
- /deep/ .rich-img {
- width: 100% !important;
- height: auto;
- }
- </style>
|