| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <template>
- <view class="more-info-wrapper">
- <u-modal :show="show" @confirm="confirmModal" :showCancelButton="showCancelButton" @cancel="closeModal" @close="closeModal">
- <view class="modal-content">
- <view class="more-info">
- <view class="modal-item">
- <text>品牌:</text>
- <text>{{ moreOptions.dictLabel || '-' }}</text>
- </view>
- <view class="modal-item">
- <text>来源:</text>
- <text>{{ moreOptions.origin || '-' }}</text>
- </view>
- <view class="modal-item">
- <text>实价:</text>
- <text>¥{{ moreOptions.actualPrice || '-' }}</text>
- </view>
- <view class="modal-item">
- <text>型号:</text>
- <text>{{ moreOptions.model || '-' }}</text>
- </view>
- <view class="modal-item">
- <text>编码:</text>
- <text>{{ moreOptions.indentifyCode || '-' }}</text>
- </view>
- <view class="modal-item">
- <text>日期:</text>
- <text>{{ moreOptions.cardYear || '-' }}</text>
- </view>
- <view class="modal-item">
- <text>备注:</text>
- <text>{{ moreOptions.productDesc || '-' }}</text>
- </view>
- </view>
- <view v-if="isCopy">
- <u-button type="primary" text="一键复制" size="small" @click="copy"></u-button>
- </view>
- </view>
- </u-modal>
- </view>
- </template>
- <script>
- export default {
- name: 'MoreInfo',
- props: {
- moreOptions: {
- type: Object,
- default: () => { }
- },
- isCopy: {
- type: Boolean,
- default: false
- },
- showCancelButton: {
- type: Boolean,
- default: false
- },
- },
- emits: ['confirm'],
- data() {
- return {
- show: false,
- }
- },
- methods: {
- showMoreInfo() {
- this.show = true;
- },
- confirmModal() {
- this.$emit('confirm', this.moreOptions);
- },
- closeModal(){
- this.show = false;
- },
- copy() {
- const { dictLabel, origin, actualPrice, model, indentifyCode, cardYear, productDesc } = this.moreOptions;
- const copyText = `品牌:${dictLabel || '-'}\n来源:${origin || '-'}\n实价:¥${actualPrice || '-'}\n型号:${model || '-'}\n编码:${indentifyCode || '-'}\n日期:${cardYear || '-'}\n备注:${productDesc || '-'}`;
-
- uni.setClipboardData({
- data: copyText,
- success: () => {
- uni.showToast({
- title: '复制成功',
- icon: 'none'
- })
- },
- fail: () => {
- uni.showToast({
- title: '复制失败',
- icon: 'none'
- })
- }
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .more-info-wrapper {
- position: absolute;
- width: 0;
- height: 0;
- overflow: hidden;
- }
- ::v-deep .modal-content{
- width:90%;
- }
- ::v-deep .u-modal__content{
- padding:24rpx 0;
- }
- .modal-content{
- display: flex;
- justify-content: space-between;
- }
- </style>
|