商城下单购买,品类接口,钱包依赖

This commit is contained in:
唐明明
2022-01-07 16:28:29 +08:00
parent 6d4971bc5e
commit a75b9e7964
20 changed files with 1176 additions and 69 deletions

View File

@@ -1,52 +1,97 @@
<template>
<view class="content">
<!-- address -->
<view class="block address">
<uni-icons class="address-icon location" type="location-filled" size="24" color="#34CE98"></uni-icons>
<uni-icons class="address-icon arrows" type="right" size="20" color="#999"></uni-icons>
<view class="user"><text>唐明阳</text>18245180131</view>
<view class="city">黑龙江省哈尔滨市南岗区汉水路265号</view>
</view>
<block v-if="address != ''">
<view class="block address" @click="$Router.push({name: 'Address'})">
<uni-icons class="address-icon location" type="location-filled" size="24" color="#34CE98"></uni-icons>
<uni-icons class="address-icon arrows" type="right" size="20" color="#999"></uni-icons>
<view class="user"><text>{{address.name}}</text>{{address.phone}}</view>
<view class="city">{{address.address}}{{address.city}}</view>
</view>
</block>
<block v-else>
<view class="block address-new" @click="$Router.push({name: 'Address'})">
<uni-icons class="icon" type="plus" size="26" color="#34CE98"></uni-icons>添加收货地址
</view>
</block>
<!-- 订单产品 -->
<view class="block goods-box">
<view class="goods-item">
<image class="order-cover" src="https://yanxuan-item.nosdn.127.net/6d48e6ea51a06b1356ccda21497fdb14.png" mode="aspectFill"></image>
<view class="order-title">茅台王子酒 金王子 53 500毫升</view>
<view class="order-count">
<view class="order-price"><text></text>275.00</view>
<view class="order-sum">共1件</view>
<block v-for="(item, index) in goodsInfo" :key="index">
<view class="goods-item">
<image class="order-cover" :src="item.items[0].cover" mode="aspectFill"></image>
<view class="order-title">{{item.items[0].title}}</view>
<view class="order-count">
<view class="order-price"><text></text>{{item.items[0].price}}</view>
</view>
</view>
</view>
</block>
</view>
<!-- 订单信息 -->
<view class="block info-box">
<view class="info-item">
<view class="label">购买数量</view>
<uni-number-box class="info-number" :value="qty" :min="1" :max="999" @change="numberChange" />
</view>
<view class="info-item">
<view class="label">配送方式</view>
<view class="nowrap">快递</view>
</view>
<view class="info-item">
<view class="label">优惠金额</view>
<view class="nowrap">无优惠</view>
<view class="label">配送费用</view>
<view class="nowrap">{{freight <= 0 ? '免费': freight}}</view>
</view>
</view>
<!-- footer -->
<view class="order-footer">
<view class="total">总计<text>1399.00</text></view>
<view class="total">总计<text>{{total}}</text></view>
<button class="btn">确认订单</button>
</view>
</view>
</template>
<script>
import { buy, verify } from '@/apis/interfaces/store'
export default {
data() {
return {
goodsInfo : {},
expressPickerValue : 0,
addressId : '',
paramsId : '',
goodsNumber : ''
qty : 1,
goodsInfo : [],
total : 0,
freight : 0,
address : ""
};
},
computed:{
},
onShow(){
if(JSON.stringify(this.$store.getters.getAddress) !== '{}') this.address = this.$store.getters.getAddress
},
mounted() {
console.log(this.$Route.query)
this.getBuy()
},
methods:{
getBuy(){
buy({
goods_sku_id: this.$Route.query.skuId,
qty: this.qty
}).then(res => {
this.address = res.address
this.freight = res.freight
this.total = res.total
this.goodsInfo = res.detail
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
},
numberChange(e){
this.qty = e
this.getBuy()
}
}
}
</script>
@@ -99,6 +144,18 @@
}
}
}
.address-new{
padding: $padding;
text-align: center;
height: 90rpx;
line-height: 90rpx;
color: $main-color;
.icon{
vertical-align: middle;
margin-bottom: 8rpx;
margin-right: 10rpx;
}
}
// 订单列表
.goods-item{
display: flex;
@@ -130,8 +187,8 @@
}
}
.order-sum{
font-size: 26rpx;
color: #777;
font-size: $title-size-sm;
color: $text-gray;
}
}
}