index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <!-- 钻石搜索-单颗彩钻 -->
  2. <template>
  3. <app-view>
  4. <template #header>
  5. <el-form ref="formRef" label-width="80px" :rules="formRules">
  6. <el-form-item label="形状">
  7. <app-multiple :data-list="enums.shapeTypeList" v-model="formData.zsshapetype" checkbox />
  8. </el-form-item>
  9. <el-form-item label="颜色">
  10. <app-multiple :data-list="enums.colorTypeList" v-model="formData.zscolortype" checkbox />
  11. </el-form-item>
  12. <el-form-item label="净度">
  13. <app-multiple :data-list="enums.clarityTypeList" v-model="formData.zsclaritytype" checkbox />
  14. </el-form-item>
  15. <el-form-item label="对称">
  16. <app-multiple :data-list="enums.symmetryTypeList" v-model="formData.zssymmetrytype" checkbox />
  17. </el-form-item>
  18. <el-form-item label="抛光">
  19. <app-multiple :data-list="enums.polishTypeList" v-model="formData.zspolishtype" checkbox />
  20. </el-form-item>
  21. <el-form-item label="荧光">
  22. <app-multiple :data-list="enums.fluorescenceTypeList" v-model="formData.zsfluorescencetype"
  23. checkbox />
  24. </el-form-item>
  25. <!-- <el-form-item label="仓库">
  26. <el-select v-model="formData.warehouseid" clearable>
  27. <el-option :label="item.warehousename" :value="item.autoid"
  28. v-for="(item, index) in warehouseList" :key="index" />
  29. </el-select>
  30. </el-form-item> -->
  31. <el-form-item label="货币">
  32. <app-multiple :data-list="enums.currencyTypeList" v-model="formData.zscurrencytype" checkbox />
  33. </el-form-item>
  34. <el-form-item label="证书">
  35. <app-multiple :data-list="enums.certTypeList" v-model="formData.zscerttype" checkbox />
  36. </el-form-item>
  37. <el-form-item label="克拉重量" prop="weight">
  38. <div class="el-form-item--col">
  39. <el-input-number placeholder="从" v-model="formData.weight1" :precision="2" :controls="false" />
  40. <span>-</span>
  41. <el-input-number placeholder="至" v-model="formData.weight2" :precision="2" :controls="false" />
  42. </div>
  43. </el-form-item>
  44. <el-form-item>
  45. <el-button type="primary" :loading="loading" @click="onSearch">搜索</el-button>
  46. <el-button :disabled="loading" @click="onReset">重置</el-button>
  47. </el-form-item>
  48. </el-form>
  49. </template>
  50. <app-table :data="dataList" v-model:columns="columns" :show-header="false" :loading="loading">
  51. <!-- 价格 -->
  52. <template #price="{ row }">
  53. {{ row.zscurrencytypedisplayunit + formatDecimal(row.price) }}
  54. </template>
  55. <!-- 克拉单价 -->
  56. <template #fixedprice="{ row }">
  57. {{ row.zscurrencytypedisplayunit + formatDecimal(row.fixedprice) }}
  58. </template>
  59. <!-- 操作 -->
  60. <template #operate="{ row }">
  61. <app-auth-operation :menus="handleTableButtons(row)" :options="{ selectedRow: row }"
  62. @closed="getSellOrderList" />
  63. </template>
  64. <template #footer>
  65. <app-pagination :total="total" v-model:page-size="pageSize" v-model:page-index="pageIndex"
  66. @change="getSellOrderList" />
  67. </template>
  68. </app-table>
  69. </app-view>
  70. </template>
  71. <script lang="ts" setup>
  72. import { ref } from 'vue'
  73. import type { FormInstance, FormRules } from 'element-plus'
  74. import { formatDecimal } from '@/filters'
  75. import { useLoginStore, useFavoriteStore } from '@/stores'
  76. import { useSearch } from '@/business/search'
  77. import { Category } from '@/constants/diamond'
  78. import AppMultiple from '@pc/components/base/multiple/index.vue'
  79. import AppTable from '@pc/components/base/table/index.vue'
  80. import AppAuthOperation from '@pc/components/modules/auth-operation/index.vue'
  81. import AppPagination from '@pc/components/base/pagination/index.vue'
  82. const { getUserId } = useLoginStore()
  83. const { hasFavorite } = useFavoriteStore()
  84. const { loading, dataList, columns, total, pageIndex, pageSize, formData, enums, getSellOrderList, onSearch, onReset } = useSearch(Category.Fancy)
  85. const formRef = ref<FormInstance>()
  86. const formRules: FormRules = {
  87. weight: [{
  88. validator: (rule, value, callback) => {
  89. const { weight1 = 0, weight2 = 0 } = formData.value
  90. if (weight1 && weight2) {
  91. if (weight1 > weight2) {
  92. callback(new Error('克拉重量应该从小到大'))
  93. } else {
  94. callback()
  95. }
  96. } else {
  97. if ((!weight1 || !weight2) && (weight1 || weight2)) {
  98. callback(new Error('克拉重量不能小于 0'))
  99. } else {
  100. callback()
  101. }
  102. }
  103. }
  104. }],
  105. }
  106. // 未收藏的卖委托有收藏按钮
  107. const handleTableButtons = (row: Ermcp.SellOrderRsp) => {
  108. if (hasFavorite(row.goodsno) || row.userid === getUserId()) {
  109. return ['details']
  110. }
  111. return ['details', 'favorite']
  112. }
  113. getSellOrderList()
  114. </script>