ServicePackageDetail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. <script setup lang="ts">
  2. import { ref, reactive } from 'vue';
  3. import { getConditioningRecordDetailMethod, voidConditioningSchemeMethod } from '@/request/api/care.api';
  4. import { usePagination, useRequest } from 'alova/client';
  5. import type { ConditioningRecordListModel, ConditioningRecordListQuery,SystemCwModel } from '@/model/care.model';
  6. import CareProcess from '@/service/CareProgress.vue';
  7. import { message, notification } from 'ant-design-vue';
  8. import VxeUI from 'vxe-table';
  9. const model = shallowRef<ConditioningRecordListQuery>();
  10. const props = defineProps<{
  11. data: ConditioningRecordListModel;
  12. }>();
  13. const isVoided = ref(true);
  14. const emit = defineEmits<{
  15. (e: 'submit', data: SystemCwModel): void;
  16. (e: 'voidSubmit', data: SystemCwModel): void;
  17. }>();
  18. let tableData = ref<any>({});
  19. async function getRecordDetail(){
  20. try {
  21. const res: any = await getConditioningRecordDetailMethod(props.data);
  22. tableData.value = res;
  23. } catch (error) {
  24. console.log(error,'获取数据失败');
  25. notification.error({ message: '获取数据失败' });
  26. }
  27. }
  28. onMounted(async () => {
  29. await getRecordDetail();
  30. });
  31. // 转方案
  32. function handleChangePlan() {
  33. tableData.value.btnType = '转方案';
  34. emit('submit', tableData.value as SystemCwModel);
  35. VxeUI.modal.close('servicePackageDetail-modal');
  36. }
  37. // 查看记录
  38. function handleViewRecord(model?: ConditioningRecordListModel) {
  39. console.log(model,'查看记录');
  40. VxeUI.modal.open({
  41. title: model?.id ? `调养过程` : `新增调养过程`,
  42. height: 700,
  43. width: 1200,
  44. position: {
  45. top: Math.min(100, window.innerHeight * 0.1),
  46. },
  47. escClosable: true,
  48. destroyOnClose: true,
  49. id: `plan-modal`,
  50. remember: true,
  51. storage: true,
  52. slots: {
  53. default() {
  54. return h(CareProcess, <any>{
  55. data: model,
  56. onSubmit(data: ConditioningRecordListModel) {
  57. VxeUI.modal.close(`plan-modal`);
  58. },
  59. });
  60. },
  61. },
  62. });
  63. }
  64. const visible = ref<boolean>(false);
  65. const setVisible = (value: boolean): void => {
  66. visible.value = value;
  67. };
  68. // 作废
  69. function handleVoid() {
  70. voidConditioningSchemeMethod(Number(props.data.id)).then(async (res) => {
  71. notification.success({
  72. message: '作废成功',
  73. description: '',
  74. });
  75. // 作废之后刷新详情列表
  76. await getRecordDetail();
  77. isVoided.value = false;
  78. emit('voidSubmit', tableData.value as SystemCwModel);
  79. });
  80. }
  81. </script>
  82. <template>
  83. <div class="service-package">
  84. <h2 class="title">{{ tableData?.name || tableData?.conditioningWrapName }}</h2>
  85. <!-- 顶部信息 -->
  86. <div class="header">
  87. <span class="status" v-if="tableData?.progress">{{
  88. tableData?.progress === '0'
  89. ? '待付款'
  90. : tableData?.progress === '1'
  91. ? '已作废'
  92. : tableData?.progress === '2'
  93. ? '用户取消'
  94. : tableData?.progress === '3'
  95. ? '未开始'
  96. : tableData?.progress === '4'
  97. ? '调理中'
  98. : tableData?.progress === '5'
  99. ? '已完结'
  100. : ''
  101. }}</span>
  102. <div>
  103. <div class="flex mb-2" style="align-items: center">
  104. <!-- 机构名称 -->
  105. <div class="mr-10" v-if="props.data?.types === 'institution'" style="display: flex; align-items: center; margin-bottom: 0">
  106. <span style="white-space: nowrap; margin-right: 8px">机构名称:</span>
  107. <span>{{ tableData?.institutionName }}</span>
  108. </div>
  109. <!-- 服务包名称 -->
  110. <!-- <div class="mr-6" style="display: flex; align-items: center; margin-bottom: 0" v-if="tableData?.name">
  111. <span style="white-space: nowrap; margin-right: 8px">服务包名称:</span>
  112. <span>{{ tableData?.name }}</span>
  113. </div> -->
  114. <!-- 服务形象照 -->
  115. <div class="flex" v-if="props.data?.types === 'institution'" style="align-items: center; margin-bottom: 0">
  116. <div class="w-20" style="white-space: nowrap; margin-right: 8px">服务形象照:</div>
  117. <a-image
  118. :width="100"
  119. :height="100"
  120. :preview="{
  121. visible,
  122. onVisibleChange: setVisible,
  123. }"
  124. :src="tableData?.photo"
  125. />
  126. </div>
  127. </div>
  128. <div style="margin-bottom: 16px">
  129. <div class="mb-3">适用情况</div>
  130. <div class="flex items-center mb-3" v-if="tableData?.conditioningWrapPatientMatchRule?.sex || tableData?.conditioningWrapPatientMatchRule?.age">
  131. <span class="w-20">使用限制</span>
  132. <div class="mr-10" v-if="tableData?.conditioningWrapPatientMatchRule?.sex">
  133. <span>性别:{{ tableData?.conditioningWrapPatientMatchRule?.sex }}</span>
  134. </div>
  135. <div v-if="tableData?.conditioningWrapPatientMatchRule?.age">
  136. <span>年龄:{{ tableData?.conditioningWrapPatientMatchRule?.age }}</span>
  137. </div>
  138. </div>
  139. <div class="flex items-center" v-if="tableData?.conditioningWrapPatientMatchRule?.diagnoseDiseaseNames?.length > 0 || tableData?.conditioningWrapPatientMatchRule?.diagnoseSyndromeNames?.length > 0 || tableData?.conditioningWrapPatientMatchRule?.constitutionGroupNames?.length > 0 || tableData?.conditioningWrapPatientMatchRule?.willillStateNames?.length > 0">
  140. <span class="w-20">适用</span>
  141. <div class="mr-10 flex items-center" v-if="tableData?.conditioningWrapPatientMatchRule?.diagnoseDiseaseNames?.length > 0">
  142. <span>专病:</span>
  143. <span>{{ tableData?.conditioningWrapPatientMatchRule?.diagnoseDiseaseNames?.join(',') }}</span>
  144. </div>
  145. <div class="mr-10 flex items-center" v-if="tableData?.conditioningWrapPatientMatchRule?.diagnoseSyndromeNames?.length > 0">
  146. <span>证型:</span>
  147. <span>{{ tableData?.conditioningWrapPatientMatchRule?.diagnoseSyndromeNames?.join(',') }}</span>
  148. </div>
  149. <div class="flex items-center mr-10" v-if="tableData?.conditioningWrapPatientMatchRule?.constitutionGroupNames?.length > 0">
  150. <span>体质:</span>
  151. <span>{{ tableData?.conditioningWrapPatientMatchRule?.constitutionGroupNames?.join(',') }}</span>
  152. </div>
  153. <div v-if="tableData?.conditioningWrapPatientMatchRule?.willillStateNames?.length > 0">
  154. <span>欲病状态:</span>
  155. <span>{{ tableData?.conditioningWrapPatientMatchRule?.willillStateNames?.join(',') }}</span>
  156. </div>
  157. </div>
  158. </div>
  159. </div>
  160. <!-- <span v-if="tableData?.diagnosis || tableData?.diagnoseDiseaseNames?.length > 0">疾病名称:{{ tableData?.diagnosis || tableData?.diagnoseDiseaseNames?.join(',') }}</span>
  161. <span v-if="tableData?.symptom || tableData?.diagnoseSyndromeNames?.length > 0">证型:{{ tableData?.symptom || tableData?.diagnoseSyndromeNames?.join(',') }}</span>
  162. <span>开具医生:{{ tableData?.createBy }}</span>
  163. <span>开具时间:{{ tableData?.createTime }}</span>
  164. <span v-if="tableData?.estimatedEndDate">调养周期:{{ tableData?.estimatedStartDate }} - {{ tableData?.estimatedEndDate }}</span> -->
  165. </div>
  166. <!-- 表格和作废字样包裹层 -->
  167. <div class="table-wrapper">
  168. <!-- <div v-if="tableData.progress === '1'" class="voided-stamp">作废</div> -->
  169. <vxe-table :data="tableData?.items" border>
  170. <vxe-column field="conditioningProgramDetail.name" title="项目名称" align="center" />
  171. <vxe-column field="days" title="周期" align="center" :disabled="true" />
  172. <vxe-column field="frequencyType" title="频率" width="auto">
  173. <template #default="{ row }">
  174. <div v-if="row.frequencyType === '不限'">不限</div>
  175. <div style="display: flex; align-items: center" v-else>
  176. <span>每</span>
  177. <a-input v-model:value="row.frequencyType" style="width: 60px" @change="() => calculateCount(row)" :disabled="true" />
  178. <span>天</span>
  179. <a-input v-model:value="row.frequencyMeasure" style="width: 60px" @change="() => calculateCount(row)" :disabled="true" />
  180. <span>{{ row.conditioningProgramDetail?.cpFixedPricingRule?.pricingUnit }}</span>
  181. </div>
  182. </template>
  183. </vxe-column>
  184. <vxe-column field="conditioningProgramDetail.conditioningProgramType" title="方案类型" align="center" />
  185. <vxe-column field="totalMeasure" title="数量" align="center" />
  186. <vxe-column field="conditioningProgramDetail.cpFixedPricingRule.pricingUnit" title="单位" align="center" />
  187. <vxe-column field="conditioningProgramDetail.cpFixedPricingRule.unitPrice" title="单价(元)" align="center" />
  188. <vxe-column field="totalPrice" title="总价(元)" align="center" />
  189. <vxe-column field="conditioningProgramDetail.medicineNames" title="组成" align="center" />
  190. <vxe-column field="acuPointNames" title="穴位/经络/部位" align="center" />
  191. <vxe-column field="remark" title="说明" align="center" />
  192. </vxe-table>
  193. </div>
  194. <!-- 合计 -->
  195. <div class="total-row">
  196. 合计:<b>{{ tableData?.price || tableData?.cost || 0 }}元</b>
  197. </div>
  198. <!-- 配送信息 -->
  199. <div class="delivery" v-if="tableData?.isDelivery === 'Y'">
  200. <span style="color: #52c41a; font-size: 20px">✔</span>
  201. <span
  202. >配送 地址:{{ tableData.provinceName }} {{ tableData.cityName }} {{ tableData.areaName }} {{ tableData.detailAddress }} {{ tableData.patientName }}
  203. {{ tableData.phone }}</span
  204. >
  205. </div>
  206. <!-- 按钮区,作废后隐藏 -->
  207. <!-- <div class="footer-btns">
  208. <a-button type="primary" style="margin-right: 24px" @click="handleChangePlan" v-if="props.data.title === '调养方案'">转方案</a-button>
  209. <a-button @click="handleVoid" v-if="tableData.progress !== '1'" >作废</a-button>
  210. <a-button type="primary" style="margin-left: 24px" @click="handleViewRecord(props.data)" v-if="isVoided && tableData.progress !== '1'">查看记录</a-button>
  211. </div> -->
  212. </div>
  213. </template>
  214. <style scoped>
  215. .table-wrapper {
  216. position: relative;
  217. }
  218. .voided-stamp {
  219. position: absolute;
  220. left: 50%;
  221. top: 50px;
  222. transform: translateX(-50%) rotate(-15deg);
  223. color: #ff8f8d;
  224. font-size: 40px;
  225. font-weight: bold;
  226. letter-spacing: 16px;
  227. opacity: 1;
  228. pointer-events: none;
  229. z-index: 10;
  230. user-select: none;
  231. border-radius: 10px;
  232. border: 5px solid #ff8f8d;
  233. }
  234. .service-package {
  235. padding: 0 10px;
  236. background: #fff;
  237. }
  238. .header {
  239. /* display: flex;
  240. align-items: center; */
  241. gap: 24px;
  242. margin-bottom: 12px;
  243. }
  244. .status {
  245. background: #ff9800;
  246. color: #fff;
  247. padding: 8px 12px;
  248. border-radius: 4px;
  249. margin-right: 12px;
  250. font-weight: bold;
  251. width: 100px;
  252. text-align: center;
  253. height: 40px;
  254. line-height: 40px;
  255. }
  256. .title {
  257. text-align: center;
  258. margin: 16px 0 24px 0;
  259. font-size: 22px;
  260. font-weight: bold;
  261. }
  262. .total-row {
  263. display: flex;
  264. justify-content: flex-end;
  265. font-size: 18px;
  266. font-weight: bold;
  267. margin: 12px 0 24px 0;
  268. }
  269. .delivery {
  270. display: flex;
  271. align-items: center;
  272. margin-bottom: 32px;
  273. font-size: 16px;
  274. gap: 8px;
  275. }
  276. .footer-btns {
  277. display: flex;
  278. justify-content: center;
  279. margin-top: 24px;
  280. }
  281. </style>