moreInfo.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <view class="more-info-wrapper">
  3. <u-modal :show="show" @confirm="confirmModal" :showCancelButton="showCancelButton" @cancel="closeModal" @close="closeModal">
  4. <view class="modal-content">
  5. <view class="more-info">
  6. <view class="modal-item" v-if="getWarehouseFieldPermissions('dictLabel','read')">
  7. <text>品牌:</text>
  8. <text>{{ moreOptions.dictLabel || '-' }}</text>
  9. </view>
  10. <view class="modal-item" v-if="getWarehouseFieldPermissions('origin','read')">
  11. <text>来源:</text>
  12. <text>{{ moreOptions.origin || '-' }}</text>
  13. </view>
  14. <view class="modal-item" v-if="getWarehouseFieldPermissions('actualPrice','read')">
  15. <text>实价:</text>
  16. <text>¥{{ moreOptions.actualPrice || '-' }}</text>
  17. </view>
  18. <view class="modal-item" v-if="getWarehouseFieldPermissions('model','read')">
  19. <text>型号:</text>
  20. <text>{{ moreOptions.model || '-' }}</text>
  21. </view>
  22. <view class="modal-item" v-if="getWarehouseFieldPermissions('indentifyCode','read')">
  23. <text>编码:</text>
  24. <text>{{ moreOptions.indentifyCode || '-' }}</text>
  25. </view>
  26. <view class="modal-item" v-if="getWarehouseFieldPermissions('cardYear','read')">
  27. <text>日期:</text>
  28. <text>{{ moreOptions.cardYear || '-' }}</text>
  29. </view>
  30. <view class="modal-item" v-if="getWarehouseFieldPermissions('productDesc','read')">
  31. <text>备注:</text>
  32. <text>{{ moreOptions.productDesc || '-' }}</text>
  33. </view>
  34. </view>
  35. <view v-if="isCopy">
  36. <u-button type="primary" text="一键复制" size="small" @click="copy"></u-button>
  37. </view>
  38. </view>
  39. </u-modal>
  40. </view>
  41. </template>
  42. <script>
  43. import { getWarehouseFieldPermissions } from '../../../utils/util.js'
  44. export default {
  45. name: 'MoreInfo',
  46. props: {
  47. moreOptions: {
  48. type: Object,
  49. default: () => { }
  50. },
  51. isCopy: {
  52. type: Boolean,
  53. default: false
  54. },
  55. showCancelButton: {
  56. type: Boolean,
  57. default: false
  58. },
  59. },
  60. emits: ['confirm'],
  61. data() {
  62. return {
  63. show: false,
  64. }
  65. },
  66. methods: {
  67. getWarehouseFieldPermissions,
  68. showMoreInfo() {
  69. this.show = true;
  70. },
  71. confirmModal() {
  72. this.$emit('confirm', this.moreOptions);
  73. },
  74. closeModal(){
  75. this.show = false;
  76. },
  77. copy() {
  78. const { dictLabel, origin, actualPrice, model, indentifyCode, cardYear, productDesc } = this.moreOptions;
  79. const copyText = `品牌:${dictLabel || '-'}\n来源:${origin || '-'}\n实价:¥${actualPrice || '-'}\n型号:${model || '-'}\n编码:${indentifyCode || '-'}\n日期:${cardYear || '-'}\n备注:${productDesc || '-'}`;
  80. uni.setClipboardData({
  81. data: copyText,
  82. success: () => {
  83. uni.showToast({
  84. title: '复制成功',
  85. icon: 'none'
  86. })
  87. },
  88. fail: () => {
  89. uni.showToast({
  90. title: '复制失败',
  91. icon: 'none'
  92. })
  93. }
  94. })
  95. }
  96. }
  97. }
  98. </script>
  99. <style lang="scss" scoped>
  100. .more-info-wrapper {
  101. position: absolute;
  102. width: 0;
  103. height: 0;
  104. overflow: hidden;
  105. }
  106. ::v-deep .modal-content{
  107. width:90%;
  108. }
  109. ::v-deep .u-modal__content{
  110. padding:24rpx 0;
  111. }
  112. .modal-content{
  113. display: flex;
  114. justify-content: space-between;
  115. }
  116. </style>