index.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <!-- 询价消息-买方询价-同意/拒绝 -->
  2. <template>
  3. <app-drawer :title="code === 'bargain_buy_agree' ? '同意' : '拒绝'" :width="720" v-model:show="show" :loading="loading"
  4. :refresh="refresh">
  5. <app-table-details :label-width="100" :data="selectedRow" :cell-props="detailProps" :column="2">
  6. <!-- 价格 -->
  7. <template #price>
  8. {{ selectedRow.zscurrencytypedisplayunit + formatDecimal(selectedRow.price) }}
  9. </template>
  10. <!-- 克拉单价 -->
  11. <template #priceper>
  12. {{ selectedRow.zscurrencytypedisplayunit + formatDecimal(selectedRow.priceper) }}
  13. </template>
  14. <!-- 我的出价 -->
  15. <template #applyprice>
  16. {{ selectedRow.zscurrencytypedisplayunit + formatDecimal(selectedRow.applyprice) }}
  17. </template>
  18. <!-- 申请状态 -->
  19. <template #applystatus>
  20. {{ getApplyStatusName(selectedRow.applystatus) }}
  21. </template>
  22. </app-table-details>
  23. <el-form ref="formRef" label-width="60px" :model="formData" :rules="formRules" style="margin-top: 20px;">
  24. <el-form-item label="备注" prop="AuditRemark">
  25. <el-input type="textarea" maxlength="120" :rows="3" v-model="formData.AuditRemark" />
  26. </el-form-item>
  27. </el-form>
  28. <template #footer>
  29. <el-button @click="onCancel(false)" plain>取消</el-button>
  30. <el-button type="primary" @click="onSubmit">确认</el-button>
  31. </template>
  32. </app-drawer>
  33. </template>
  34. <script lang="ts" setup>
  35. import { ref, PropType } from 'vue'
  36. import { ElMessage, ElMessageBox } from 'element-plus'
  37. import type { FormInstance, FormRules } from 'element-plus'
  38. import { formatDecimal } from '@/filters'
  39. import { getApplyStatusName } from '@/constants/order'
  40. import { useBargainOperate } from '@/business/bargain'
  41. import AppDrawer from '@pc/components/base/drawer/index.vue'
  42. import AppTableDetails from '@pc/components/base/table-details/index.vue'
  43. const props = defineProps({
  44. code: String,
  45. selectedRow: {
  46. type: Object as PropType<Ermcp.MyBargainApplyRsp>,
  47. default: () => ({})
  48. },
  49. })
  50. const operateType = (() => {
  51. switch (props.code) {
  52. case 'bargain_buy_agree': {
  53. return 3
  54. }
  55. case 'bargain_buy_refuse': {
  56. return 2
  57. }
  58. }
  59. return 0
  60. })()
  61. const { loading, formData, formSubmit } = useBargainOperate(props.selectedRow)
  62. const show = ref(true)
  63. const refresh = ref(false)
  64. const formRef = ref<FormInstance>()
  65. const formRules: FormRules = {
  66. AuditRemark: [{ required: true, message: '请输入备注', trigger: 'blur' }],
  67. }
  68. const detailProps = [
  69. { prop: 'warehousenamedisplay', label: '仓库' },
  70. { prop: 'zsshapetypedisplay', label: '形状' },
  71. { prop: 'zscolortype1display', label: '颜色' },
  72. { prop: 'zsclaritytype1display', label: '净度' },
  73. { prop: 'zscuttype1display', label: '切工' },
  74. { prop: 'zspolishtype1display', label: '抛光' },
  75. { prop: 'zssymmetrytype1display', label: '对称' },
  76. { prop: 'zsfluorescencetype1display', label: '荧光' },
  77. { prop: 'sizedisplay', label: '尺寸' },
  78. { prop: 'price', label: '价格' },
  79. { prop: 'qty', label: '克拉重量' },
  80. { prop: 'priceper', label: '克拉单价' },
  81. { prop: 'buyusername', label: '买方' },
  82. { prop: 'applyprice', label: '买方出价' },
  83. { prop: 'applyremark', label: '备注' },
  84. { prop: 'applystatus', label: '申请状态' },
  85. { prop: 'applytime', label: '申请时间' },
  86. ]
  87. const onCancel = (isRefresh = false) => {
  88. show.value = false
  89. refresh.value = isRefresh
  90. }
  91. const onSubmit = () => {
  92. formRef.value?.validate((valid) => {
  93. if (valid) {
  94. ElMessageBox.confirm(`是否${props.code === 'bargain_buy_agree' ? '同意' : '拒绝'}此询价?`).then(() => {
  95. formSubmit(operateType).then(() => {
  96. ElMessage.success('提交成功')
  97. onCancel(true)
  98. }).catch((err) => {
  99. ElMessage.error('提交失败:' + err)
  100. })
  101. })
  102. }
  103. })
  104. }
  105. </script>