|
|
@@ -3,16 +3,16 @@
|
|
|
<el-col :md="20">
|
|
|
<el-row>
|
|
|
<h3>确认收货地址</h3>
|
|
|
- <el-divider/>
|
|
|
+ <el-divider />
|
|
|
<div v-for="(item, index) in addresses">
|
|
|
<el-row style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
|
|
|
- <el-radio v-model="radio" :label=item.deliveryId>{{item.address}}</el-radio>
|
|
|
+ <el-radio v-model="radio" :label="item.deliveryId">{{ item.address }}</el-radio>
|
|
|
</el-row>
|
|
|
</div>
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
<h3>确认订单信息</h3>
|
|
|
- <el-divider/>
|
|
|
+ <el-divider />
|
|
|
<el-table
|
|
|
:data="dataList"
|
|
|
:show-header="true"
|
|
|
@@ -30,7 +30,7 @@
|
|
|
</el-col>
|
|
|
<el-col :md="20">
|
|
|
<router-link target="_blank" style="text-decoration-line: none" :to="`/mall/item?id=${scope.row.itemId}`">
|
|
|
- <span>{{scope.row.title}}</span>
|
|
|
+ <span>{{ scope.row.title }}</span>
|
|
|
</router-link>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
@@ -44,31 +44,36 @@
|
|
|
label="单价"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
- <span style="color: red">¥{{scope.row.price}}</span>
|
|
|
+ <span style="color: red">¥{{ scope.row.price }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
prop="num"
|
|
|
label="数量"
|
|
|
- />
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input-number v-model="scope.row.num" :min="1" :max="20" style="margin-left: 5px" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column
|
|
|
prop="num"
|
|
|
label="小计"
|
|
|
/>
|
|
|
</el-table>
|
|
|
- <el-divider/>
|
|
|
+ <el-divider />
|
|
|
<el-form>
|
|
|
<el-form-item>
|
|
|
<span style="position: relative; bottom: 0; right: 0; color:blue">
|
|
|
- 已选商品 <span style="color: red">{{dataList.length}}</span> 件
|
|
|
+ 已选商品 <span style="color: red">{{ dataList.length }}</span> 件
|
|
|
</span>
|
|
|
<span style="position: relative; bottom: 0; right: 0; color:blue">
|
|
|
- 合计(不含运费): <span style="color: red">{{totalPrice}}</span> 元
|
|
|
+ 合计(不含运费): <span style="color: red">{{ totalPrice }}</span> 元
|
|
|
</span>
|
|
|
<el-button
|
|
|
size="mini"
|
|
|
type="danger"
|
|
|
- @click="submitOrder">
|
|
|
+ @click="submitOrder"
|
|
|
+ >
|
|
|
提交订单
|
|
|
</el-button>
|
|
|
</el-form-item>
|
|
|
@@ -79,7 +84,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import {getUserDelivery, submitOrder} from "@/api/mall";
|
|
|
+import {getProduct, getUserDelivery, submitOrder} from '@/api/mall'
|
|
|
|
|
|
export default {
|
|
|
name: 'ConfirmOrder',
|
|
|
@@ -96,14 +101,25 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
+ document.title = '确认订单'
|
|
|
this.productId = this.$route.query.productId
|
|
|
var items = window.sessionStorage.getItem('cart0')
|
|
|
- this.dataList = JSON.parse(items)
|
|
|
- for (const item of this.dataList) {
|
|
|
- this.totalPrice += item.price * item.num
|
|
|
+ if (items !== null) {
|
|
|
+ this.dataList = JSON.parse(items)
|
|
|
+ for (const item of this.dataList) {
|
|
|
+ this.totalPrice += item.price * item.num
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ getProduct(this.productId).then(resp => {
|
|
|
+ if (resp.code === 0) {
|
|
|
+ const item = resp.data
|
|
|
+ item.num = 1
|
|
|
+ this.dataList.push(item)
|
|
|
+ this.totalPrice = item.price
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
- document.title = '确认订单'
|
|
|
getUserDelivery().then(resp => {
|
|
|
if (resp.code === 0) {
|
|
|
// console.log(resp.data)
|
|
|
@@ -117,7 +133,7 @@ export default {
|
|
|
jsonData.deliveryId = 110011
|
|
|
jsonData.items = []
|
|
|
for (const item of this.dataList) {
|
|
|
- jsonData.items.push({itemId: item.itemId, num: item.num, shopId: item.shopId, sellerId: item.sellerId})
|
|
|
+ jsonData.items.push({ itemId: item.itemId, num: item.num, shopId: item.shopId, sellerId: item.sellerId })
|
|
|
}
|
|
|
|
|
|
submitOrder(jsonData).then(resp => {
|
|
|
@@ -128,16 +144,16 @@ export default {
|
|
|
text: '订单已提交, 跳转到支付页面',
|
|
|
spinner: 'el-icon-loading',
|
|
|
background: 'rgba(0, 0, 0, 0.7)'
|
|
|
- });
|
|
|
+ })
|
|
|
setTimeout(() => {
|
|
|
- loading.close();
|
|
|
+ loading.close()
|
|
|
this.$router.push({
|
|
|
path: '/mall/pay',
|
|
|
query: {
|
|
|
orderId: orderId
|
|
|
}
|
|
|
})
|
|
|
- }, 1000);
|
|
|
+ }, 1000)
|
|
|
}
|
|
|
})
|
|
|
}
|