index.vue
5.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<!--
* @Date: 2024-07-23 18:31:35
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-08-13 10:18:33
* @FilePath: /temple_material_request/src/components/materialDetail/index.vue
* @Description: 物资详情页面
-->
<template>
<div class="material-detail-page">
<van-popup
v-model:show="showRight"
position="right"
:style="{ height: '100%', width: '100%' }"
>
<div style="margin-top: 3rem; background-color: white; position: relative;">
<div style="display: flex; justify-content: center; align-items: center;">
<div v-if="!goodInfo.cover" style="padding: 2rem 5rem; padding-bottom: 2rem; border: 1px solid #F2EDE6; background-color: #FFFDF6; text-align: center;">
<van-image
width="6rem"
height="6rem"
fit="contain"
src="https://cdn.ipadbiz.cn/oa/pic/%E7%89%A9%E8%B5%84%E5%9B%BE@2x.png"
/>
<div style="color: #e0d0ba; margin-top: 1rem;">物资图正在整理中</div>
</div>
<div v-else>
<van-image
width="15rem"
height="12rem"
fit="contain"
:src="goodInfo.cover"
/>
</div>
</div>
<div style="text-align: center; font-weight: bold; color: #A67939; font-size: 1.15rem; margin: 1.5rem auto;">{{ goodInfo.name }}</div>
<div style="color: #1C1C1C; background-color: #F2F2F2; font-size: 1rem; font-weight: bold; padding: 0.5rem 1.5rem;">基本信息</div>
<div style="padding: 1rem;">
<van-row style="margin-bottom: 0.5rem;">
<van-col span="8" style="color: #AFAFAF;">编码</van-col>
<van-col span="16">{{ goodInfo.coding }}</van-col>
</van-row>
<van-row style="margin-bottom: 0.5rem;">
<van-col span="8" style="color: #AFAFAF;">规格</van-col>
<van-col span="16">{{ goodInfo.spec }}</van-col>
</van-row>
<van-row style="margin-bottom: 0.5rem;">
<van-col span="8" style="color: #AFAFAF;">单位</van-col>
<van-col span="16">{{ goodInfo.specification }}</van-col>
</van-row>
<van-row style="margin-bottom: 0.5rem;">
<van-col span="8" style="color: #AFAFAF;">分类</van-col>
<van-col span="16">
<div v-if="goodInfo.category_name">{{ goodInfo.category_name }}</div>
<div v-else>/</div>
</van-col>
</van-row>
<van-row style="margin-bottom: 0.5rem;">
<van-col span="8" style="color: #AFAFAF;">描述</van-col>
<van-col span="16">
<div v-if="goodInfo.description" v-html="goodInfo.description"></div>
<div v-else>/</div>
</van-col>
</van-row>
<van-row style="margin-bottom: 0.5rem;">
<van-col span="8" style="color: #AFAFAF;">条码</van-col>
<van-col span="16">
<div v-if="goodInfo.bar_code">{{ goodInfo.bar_code }}</div>
<div v-else>/</div>
</van-col>
</van-row>
<van-row style="margin-bottom: 0.5rem;">
<van-col span="8" style="color: #AFAFAF;">价格</van-col>
<van-col span="16">
<div v-if="goodInfo.price">{{ goodInfo.price }}</div>
<div v-else>/</div>
</van-col>
</van-row>
<van-row style="margin-bottom: 0.5rem;">
<van-col span="8" style="color: #AFAFAF;">是否可定</van-col>
<van-col span="16">
<div v-if="goodInfo.is_ordered">可定</div>
<div v-else>不可定</div>
</van-col>
</van-row>
<van-row style="margin-bottom: 0.5rem;">
<van-col span="8" style="color: #AFAFAF;">状态</van-col>
<van-col span="16">
<div v-if="goodInfo.status === 9">上架</div>
<div v-else>下架</div>
</van-col>
</van-row>
</div>
<div style="height: 4rem;"></div>
<div style="padding: 1rem; position: sticky; bottom: 10px; left:0; right: 0;">
<van-button block :color="styleColor.baseColor" @click="onClose">关闭</van-button>
</div>
</div>
</van-popup>
</div>
</template>
<script setup>
import { ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { Cookies, $, _, axios, storeToRefs, mainStore, Toast, useTitle } from '@/utils/generatePackage.js'
//import { } from '@/utils/generateModules.js'
//import { } from '@/utils/generateIcons.js'
//import { } from '@/composables'
import { getSkuInfoAPI } from "@/api/material";
import { styleColor } from "@/constant.js";
const $route = useRoute();
const $router = useRouter();
useTitle($route.meta.title);
const props = defineProps({
show: Boolean,
goodId: Number,
});
const emit = defineEmits(['close']);
const showRight = ref(false);
const onClose = () => {
emit('close');
}
const goodInfo = ref({});
// 监听字段变化
watch(
() => props.show,
async (v) => {
showRight.value = v;
if (v) {
const { code, data } = await getSkuInfoAPI({ i: props.goodId });
if (code) {
// 物资信息
goodInfo.value = data;
}
}
}
);
</script>
<style lang="less" scoped>
.material-detail-page {}
</style>