detail.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <div id="detail">
  3. <el-row>
  4. <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
  5. <el-col :span="24" class="one">
  6. <cSearch :is_back="true" @toBack="toBack"></cSearch>
  7. </el-col>
  8. <div class="center">
  9. <el-col :span="12" class="two">
  10. <el-col :span="24" class="two_1">
  11. <el-col :span="12" class="left">
  12. <el-icon>
  13. <Shop />
  14. </el-icon>
  15. {{ info.supplier_name || '暂无' }}
  16. </el-col>
  17. <el-col :span="12" class="right"> {{ info.zhStatus }}</el-col>
  18. </el-col>
  19. <el-col :span="24" class="two_2">
  20. <el-col :span="6" class="left">
  21. <el-image v-if="info.spec_file" class="image" :src="info.spec_file && info.spec_file.length > 0 ? info.spec_file[0].url : ''" />
  22. <el-image v-else class="image" :src="info.good_file && info.good_file.length > 0 ? info.good_file[0].url : ''" />
  23. </el-col>
  24. <el-col :span="18" class="right">
  25. <el-col :span="24" class="name">
  26. <text>{{ info.zhType || '暂无' }}</text>
  27. <text>{{ info.good_name || '暂无' }}</text>
  28. </el-col>
  29. <el-col :span="24" class="spec">
  30. <text>规格:{{ info.spec_name || '暂无' }}</text>
  31. </el-col>
  32. <el-col :span="24" class="num">
  33. <text>数量:{{ info.num || '暂无' }}</text>
  34. </el-col>
  35. <el-col :span="24" class="money">
  36. <text>¥{{ info.money || '暂无' }}</text>
  37. </el-col>
  38. </el-col>
  39. </el-col>
  40. </el-col>
  41. <el-col :span="12" class="thr">
  42. <el-col :span="24" class="thr_1">
  43. <text>订单号:</text>
  44. <text>{{ info.order_id || '暂无' }}</text>
  45. </el-col>
  46. <el-col :span="24" class="thr_1">
  47. <text>下单时间:</text>
  48. <text>{{ info.buy_time || '暂无' }}</text>
  49. </el-col>
  50. <el-col :span="24" class="thr_1" v-if="info.sleader_name">
  51. <text>采购审批领导:</text>
  52. <text>{{ info.sleader_name || '暂无' }}</text>
  53. </el-col>
  54. <el-col :span="24" class="thr_1" v-if="info.saccounting_name">
  55. <text>采购审批会计:</text>
  56. <text>{{ info.saccounting_name || '暂无' }}</text>
  57. </el-col>
  58. </el-col>
  59. <el-col :span="12" class="four">
  60. <el-col :span="24" class="four_1">
  61. <text>下单人员:</text>
  62. <text>{{ info.user_name || '暂无' }}</text>
  63. </el-col>
  64. <el-col :span="24" class="four_1">
  65. <text>下单角色:</text>
  66. <text>{{ info.zhRole || '暂无' }}</text>
  67. </el-col>
  68. <el-col :span="24" class="four_1">
  69. <text>下单人员电话:</text>
  70. <text>{{ info.user_tel || '暂无' }}</text>
  71. </el-col>
  72. <el-col :span="24" class="four_1">
  73. <text>收货地址:</text>
  74. <text>{{ info.address || '暂无' }}</text>
  75. </el-col>
  76. </el-col>
  77. <el-col :span="12" class="five">
  78. <el-col :span="12" class="left">
  79. <text>商品总价</text>
  80. </el-col>
  81. <el-col :span="12" class="right">
  82. <text>¥{{ info.total_money || '暂无' }}</text>
  83. </el-col>
  84. </el-col>
  85. </div>
  86. </el-col>
  87. </el-row>
  88. </div>
  89. </template>
  90. <script setup lang="ts">
  91. // 基础
  92. import type { Ref } from 'vue';
  93. import { ref, onMounted } from 'vue';
  94. import { useRoute } from 'vue-router';
  95. // 接口
  96. import { OrderDetailStore } from '@/stores/order/orderDetail';
  97. import { DictDataStore } from '@/stores/dict/dictData';
  98. import { RoleStore } from '@/stores/role/role'; // 角色
  99. import type { IQueryResult } from '@/util/types.util';
  100. const dictData = DictDataStore();
  101. const roleAxios = RoleStore();
  102. const orderDetailAxios = OrderDetailStore();
  103. // 路由
  104. const route = useRoute();
  105. // 加载中
  106. const loading: Ref<any> = ref(false);
  107. // 表单
  108. let info: Ref<any> = ref({});
  109. // 字典表
  110. const statusList: Ref<any> = ref([]);
  111. const typeList: Ref<any> = ref([]);
  112. const roleList: Ref<any> = ref([]);
  113. // 请求
  114. onMounted(async () => {
  115. loading.value = true;
  116. await searchOther();
  117. await search();
  118. loading.value = false;
  119. });
  120. const search = async () => {
  121. let id = route.query.id;
  122. if (id) {
  123. let res: any = await orderDetailAxios.detail(id);
  124. if (res.errcode == '0') {
  125. res.data.zhStatus = await searchDict(res.data.status, 'status');
  126. res.data.zhType = await searchDict(res.data.good_type, 'type');
  127. res.data.zhRole = await searchDict(res.data.user_role, 'role');
  128. info.value = res.data as {};
  129. }
  130. }
  131. };
  132. // 查询字典表
  133. const searchDict = async (e, model) => {
  134. let data;
  135. if (model == 'status') {
  136. data = statusList.value.find((i) => i.value == e);
  137. if (data) return data.label;
  138. else return '暂无';
  139. } else if (model == 'type') {
  140. data = typeList.value.find((i) => i.value == e);
  141. if (data) return data.label;
  142. else return '暂无';
  143. } else {
  144. data = roleList.value.find((i) => i.code == e);
  145. if (data) return data.name;
  146. else return '暂无';
  147. }
  148. };
  149. // 查询其他信息
  150. const searchOther = async () => {
  151. let res: IQueryResult;
  152. // 状态
  153. res = await dictData.query({ type: 'order_status', is_use: '0' });
  154. if (res.errcode == '0') statusList.value = res.data;
  155. // 类型
  156. res = await dictData.query({ type: 'goods_type', is_use: '0' });
  157. if (res.errcode == '0') typeList.value = res.data;
  158. // 角色
  159. res = await roleAxios.query({ is_use: '0' });
  160. if (res.errcode == '0') roleList.value = res.data;
  161. };
  162. // 返回上一页
  163. const toBack = () => {
  164. window.history.go(-1);
  165. };
  166. </script>
  167. <style scoped lang="scss">
  168. .center {
  169. display: flex;
  170. flex-direction: column;
  171. align-items: center;
  172. }
  173. .two {
  174. width: 100%;
  175. display: flex;
  176. flex-direction: column;
  177. justify-content: center;
  178. padding: 15px;
  179. border: 1px solid #f1f1f1;
  180. border-radius: 10px;
  181. .two_1 {
  182. display: flex;
  183. justify-content: space-around;
  184. padding: 0 0 10px 0;
  185. border-bottom: 1px solid #e2e2e2;
  186. .left {
  187. display: flex;
  188. align-items: center;
  189. }
  190. .right {
  191. color: red;
  192. text-align: right;
  193. }
  194. }
  195. .two_2 {
  196. display: flex;
  197. padding: 10px 0;
  198. .left {
  199. .image {
  200. width: 150px;
  201. height: 150px;
  202. border-radius: 5px;
  203. border: 1px solid #f9f9f9;
  204. }
  205. }
  206. .right {
  207. .name {
  208. padding: 10px 0 0 0;
  209. font-size: 20px;
  210. text:first-child {
  211. font-size: 16px;
  212. color: #ffffff;
  213. background-color: #007AFF;
  214. border-radius: 5px;
  215. padding: 2px 5px;
  216. }
  217. }
  218. .spec {
  219. font-size: 16px;
  220. }
  221. .num {
  222. font-size: 16px;
  223. color: #858585;
  224. }
  225. .money {
  226. font-size: 18px;
  227. color: red;
  228. font-weight: bold;
  229. }
  230. }
  231. }
  232. }
  233. .thr {
  234. width: 100%;
  235. margin: 10px 0 0 0;
  236. padding: 10px;
  237. border-radius: 10px;
  238. border: 1px solid #f1f1f1;
  239. .thr_1 {
  240. padding: 5px 0;
  241. font-size: 18px;
  242. text:first-child {
  243. color: #858585;
  244. }
  245. }
  246. }
  247. .four {
  248. width: 100%;
  249. margin: 1vw 0 0 0;
  250. padding: 0 10px;
  251. border-radius: 10px;
  252. border: 1px solid #f1f1f1;
  253. .four_1 {
  254. padding: 5px 0;
  255. font-size: 18px;
  256. text:first-child {
  257. color: #858585;
  258. }
  259. }
  260. }
  261. .five {
  262. width: 100%;
  263. display: flex;
  264. justify-content: space-between;
  265. margin: 10px 0 0 0;
  266. padding: 10px;
  267. border-radius: 10px;
  268. font-size: 18px;
  269. border: 1px solid #f1f1f1;
  270. .left {
  271. color: #858585;
  272. }
  273. .right {
  274. text-align: right;
  275. }
  276. }
  277. </style>