123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <template>
- <view>
- <view class="product_detail">
- <image src="../../../static/news.jpg" mode="widthFix" class="pic"></image>
- <view class="box">
- <view class="title">{{ item.goodsName }}</view>
- <view class="price">¥ {{ item.price }}</view>
- <view class="clear"></view>
- <u-divider text="规格参数"></u-divider>
- <view class="item">
- <text class="desc">净重:</text>
- <text>{{item.netWeight}}吨</text>
- </view>
- <view class="item">
- <text class="desc">毛重:</text>
- <text>{{item.grossWeight}}吨</text>
- </view>
- <view class="item">
- <text class="desc">计量单位:</text>
- <text>{{item.goodsUnits}}</text>
- </view>
- <view class="item">
- <text class="desc">商户:</text>
- <text>{{item.merchantName}}</text>
- </view>
- <view class="item">
- <text class="desc">互市区:</text>
- <text>{{item.tradeAreaName}}</text>
- </view>
- <view class="item">
- <text class="desc">发布时间:</text>
- <text>{{item.createTime}}</text>
- </view>
- <u-divider text="商品介绍"></u-divider>
- <view class="contents" v-if="item.description">{{item.description}}</view>
- <view class="contents">暂无关于该商品的介绍</view>
- </view>
- </view>
- <view class="mfooter" v-if="user.userType == 2">
- <view class="flex">
- <view class="f">
- <button class="save btn" @click="addCar()">加入购物车</button>
- </view>
- <view class="f">
- <button class="btn" @click="buy()">立即购买</button>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- user: this.getUser(),
- item: {}
- };
- },
- onLoad(e) {
- if (e.id) {
- this.http.request({
- url: '/level-one-server/TbGoodsTransit/getById?id=' + e.id,
- success: res => {
- this.item = res.data.data;
- }
- });
- }
- },
- methods: {
- //加入购物车
- addCar() {
- let params = {
- buyUserId: this.user.id,
- enterpriseId: this.item.merchantId,
- shopId: this.item.shopId,
- tradeAreaId: this.item.tradeAreaId,
- saleGoodsInfoId: this.item.id,
- goodsImg: this.item.goodsImg,
- goodsName: this.item.goodsName,
- publishGoodsId: this.item.id
- };
- this.http.request({
- url: '/level-one-server/app/TbGoodsCart/addGoodsInShopCart',
- data: params,
- method: 'POST',
- contentType: 'application/json; charset=utf-8',
- success: res => {
- uni.showToast({ title: '添加成功' });
- }
- });
- },
- // 立即购买
- buy() {
- this.http.request({
- url: '/level-one-server/app/TbGoodsTransit/purchaseLevelOntGoodsTransit',
- data: { goodsTransitId: this.item.id },
- method: 'POST',
- contentType: 'application/json; charset=utf-8',
- success: res => {
- uni.redirectTo({ url: '/pages/market/one/leader/success' });
- }
- });
- }
- }
- };
- </script>
- <style lang="scss">
- page {
- background-color: $pg;
- }
- .btn {
- width: 100%;
- border-radius: 5px;
- }
- </style>
|