|
@@ -6,8 +6,8 @@ import {Back, RefreshRight} from "@element-plus/icons-vue";
|
|
|
import {ElTable} from "element-plus";
|
|
import {ElTable} from "element-plus";
|
|
|
import {calculateOrder, createOrder, payOrder} from "../../api/order.ts";
|
|
import {calculateOrder, createOrder, payOrder} from "../../api/order.ts";
|
|
|
import {getAvailableCouponsByStoreId} from "../../api/coupon.ts";
|
|
import {getAvailableCouponsByStoreId} from "../../api/coupon.ts";
|
|
|
-import {getCommentsById} from "../../api/comment.ts";
|
|
|
|
|
-import OrderItem from "../../components/OrderItem.vue";
|
|
|
|
|
|
|
+import {getCommentsById} from "../../api/product.ts";
|
|
|
|
|
+import CommentItem from "../../components/CommentItem.vue";
|
|
|
|
|
|
|
|
const router = useRouter();
|
|
const router = useRouter();
|
|
|
const role = sessionStorage.getItem("role")
|
|
const role = sessionStorage.getItem("role")
|
|
@@ -55,11 +55,12 @@ const commentList = ref([])
|
|
|
|
|
|
|
|
getCommentsById(productId).then(res => {
|
|
getCommentsById(productId).then(res => {
|
|
|
commentList.value = res.result
|
|
commentList.value = res.result
|
|
|
|
|
+ console.log(res)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
getProductDetail()
|
|
getProductDetail()
|
|
|
|
|
|
|
|
-function getProductDetail () {
|
|
|
|
|
|
|
+function getProductDetail() {
|
|
|
getProductById(productId).then(res => {
|
|
getProductById(productId).then(res => {
|
|
|
productVO.value = res.result
|
|
productVO.value = res.result
|
|
|
storeId.value = productVO.value.storeId
|
|
storeId.value = productVO.value.storeId
|
|
@@ -296,57 +297,62 @@ function toBackPage() {
|
|
|
</div>
|
|
</div>
|
|
|
</el-aside>
|
|
</el-aside>
|
|
|
|
|
|
|
|
- <el-main v-if="role === 'CUSTOMER'">
|
|
|
|
|
- <div>
|
|
|
|
|
- <span class="main-title">购买商品</span>
|
|
|
|
|
|
|
+ <el-main>
|
|
|
|
|
+ <div v-if="role === 'CUSTOMER'">
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <span class="main-title">购买商品</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <el-form class="buy-form">
|
|
|
|
|
+ <el-form-item>
|
|
|
|
|
+ <label for="amount">购买数量:</label>
|
|
|
|
|
+ <el-input-number v-model="amount" :min="1" :max="stock + 10" @change="handleChange"/>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item>
|
|
|
|
|
+ <label for="type">提货方式:</label>
|
|
|
|
|
+ <el-select id="type"
|
|
|
|
|
+ v-model="type"
|
|
|
|
|
+ placeholder="请选择"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-option value="PICKUP" label="到店自提"/>
|
|
|
|
|
+ <el-option value="DELIVERY" label="快递到家"/>
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item>
|
|
|
|
|
+ <label for="discountPrice">折扣前总价:</label>
|
|
|
|
|
+ {{ totalPrice }} 元
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ <el-button @click="handleCreateOrder" :disabled="createOrderDisabled"
|
|
|
|
|
+ class="buy-button" type="primary" plain>创建订单
|
|
|
|
|
+ </el-button>
|
|
|
</div>
|
|
</div>
|
|
|
- <el-form class="buy-form">
|
|
|
|
|
- <el-form-item>
|
|
|
|
|
- <label for="amount">购买数量:</label>
|
|
|
|
|
- <el-input-number v-model="amount" :min="1" :max="stock + 10" @change="handleChange"/>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item>
|
|
|
|
|
- <label for="type">提货方式:</label>
|
|
|
|
|
- <el-select id="type"
|
|
|
|
|
- v-model="type"
|
|
|
|
|
- placeholder="请选择"
|
|
|
|
|
- >
|
|
|
|
|
- <el-option value="PICKUP" label="到店自提"/>
|
|
|
|
|
- <el-option value="DELIVERY" label="快递到家"/>
|
|
|
|
|
- </el-select>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item>
|
|
|
|
|
- <label for="discountPrice">折扣前总价:</label>
|
|
|
|
|
- {{ totalPrice }} 元
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- </el-form>
|
|
|
|
|
- <el-button @click="handleCreateOrder" :disabled="createOrderDisabled"
|
|
|
|
|
- class="buy-button" type="primary" plain>创建订单
|
|
|
|
|
- </el-button>
|
|
|
|
|
- </el-main>
|
|
|
|
|
|
|
|
|
|
- <el-main v-if="role === 'STAFF'">
|
|
|
|
|
- <div>
|
|
|
|
|
- <span class="main-title">添加库存</span>
|
|
|
|
|
|
|
+ <div v-if="role === 'STAFF'">
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <span class="main-title">添加库存</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="add-stock-main">
|
|
|
|
|
+ <el-input class="add-stock-number-input"
|
|
|
|
|
+ v-model="addStockNumber" placeholder="请输入添加库存数">
|
|
|
|
|
+ <template #append>件</template>
|
|
|
|
|
+ </el-input>
|
|
|
|
|
+ <br>
|
|
|
|
|
+ <el-button @click="AddStock" :disabled="addStockDisabled"
|
|
|
|
|
+ class="add-stock-button" type="primary" plain>
|
|
|
|
|
+ 新增库存
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="add-stock-main">
|
|
|
|
|
- <el-input class="add-stock-number-input"
|
|
|
|
|
- v-model="addStockNumber" placeholder="请输入添加库存数">
|
|
|
|
|
- <template #append>件</template>
|
|
|
|
|
- </el-input>
|
|
|
|
|
- <br>
|
|
|
|
|
- <el-button @click="AddStock" :disabled="addStockDisabled"
|
|
|
|
|
- class="add-stock-button" type="primary" plain>
|
|
|
|
|
- 新增库存
|
|
|
|
|
- </el-button>
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <span class="main-title">评论区</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <commentItem v-for="commentVO in commentList" :commentVO="commentVO">
|
|
|
|
|
+ </commentItem>
|
|
|
</div>
|
|
</div>
|
|
|
</el-main>
|
|
</el-main>
|
|
|
|
|
|
|
|
-<!-- <div class="comment-item-list">-->
|
|
|
|
|
-<!-- <CommentItem-->
|
|
|
|
|
-<!-- v-for="commentVO in commentList"/>-->
|
|
|
|
|
-<!-- </div>-->
|
|
|
|
|
-
|
|
|
|
|
<el-dialog v-model="orderDialogVisible" :before-close="handlePayDialogClose">
|
|
<el-dialog v-model="orderDialogVisible" :before-close="handlePayDialogClose">
|
|
|
<el-row>
|
|
<el-row>
|
|
|
<span class="pay-dialog-title">订单支付</span>
|
|
<span class="pay-dialog-title">订单支付</span>
|
|
@@ -469,6 +475,7 @@ function toBackPage() {
|
|
|
|
|
|
|
|
.buy-button {
|
|
.buy-button {
|
|
|
margin-left: 30px;
|
|
margin-left: 30px;
|
|
|
|
|
+ margin-bottom: 40px;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.pay-dialog-title {
|
|
.pay-dialog-title {
|