123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- <template>
- <custom-dialog
- :visible.sync="dialogVisible"
- title=""
- content-width="720rpx"
- closeImg="/static/island/UI/btn_close.png"
- closeImgTop="50rpx"
- background-color="transparent"
- @close="onClose"
- >
- <view class="shop-content">
- <!-- <view class="shop-tabs">
- <view
- v-for="(tab, index) in tabs"
- :key="index"
- class="tab-item"
- :class="{'active': currentTab === index}"
- @click="currentTab = index"
- >
- {{tab}}
- </view>
- </view> -->
- <view class="shop-header"></view>
- <view class="shop-name">{{shopName}}</view>
- <view class="shop-items">
- <view class="shop-item" v-for="(item, index) in currentItems" :key="index" @click="onItemClick(item)">
- <view class="item-card">
- <view class="new-tag" v-if="item.isNew">新品</view>
- <view class="item-left">
- <view class="item-grid">
- <image class="item-icon" :src="item.icon" mode="aspectFit"></image>
- <text class="owned-text">已有: {{item.owned}}</text>
- </view>
- </view>
- <view class="item-center">
- <text class="item-name">{{item.name}}</text>
- <view class="item-details">
- <text class="detail-text">{{item.detail}}</text>
- </view>
- </view>
- <view class="item-right">
- <view class="buy-btn">
- <view class="item-price">
- <image class="currency-icon" src="/static/island/UI/wd_icon_xingyuan.png" mode="aspectFit"></image>
- <text>{{item.price}}</text>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </custom-dialog>
- </template>
- <script>
- import CustomDialog from '../CustomDialog/CustomDialog.vue'
- export default {
- name: 'ShopDialog',
- components: {
- CustomDialog
- },
- props: {
- visible: {
- type: Boolean,
- default: false
- },
- shopName: {
- type: String,
- default: '商店'
- }
- },
- data() {
- return {
- dialogVisible: false,
- currentTab: 0,
- tabs: ['种子', '道具', '钻石'],
- items: {
- 0: [
- {
- icon: '/static/island/items/item_wood1.png',
- name: '草莓种子',
- detail: '收获期: 160时\n成长期: 60时\n产量: 10',
- price: 100,
- owned: 3,
- isNew: false
- },
- {
- icon: '/static/island/items/item_wood2.png',
- name: '草莓种子',
- detail: '收获期: 160时\n成长期: 60时\n产量: 10',
- price: 100,
- owned: 3,
- isNew: false
- },
- {
- icon: '/static/island/items/item_mine1.png',
- name: '草莓种子',
- detail: '收获期: 160时\n成长期: 60时\n产量: 10',
- price: 100,
- owned: 3,
- isNew: false
- },
- {
- icon: '/static/island/items/item_mine2.png',
- name: '铁矿石',
- detail: '收获期: 160时\n成长期: 60时\n产量: 10',
- price: 100,
- owned: 3,
- isNew: false
- },
- {
- icon: '/static/island/items/item_axe1.png',
- name: '斧头',
- detail: '收获期: 160时\n成长期: 60时\n产量: 10',
- price: 100,
- owned: 3,
- isNew: false
- }
- ],
- 1: [],
- 2: []
- }
- }
- },
- computed: {
- currentItems() {
- return this.items[this.currentTab]
- }
- },
- watch: {
- visible(val) {
- this.dialogVisible = val
- },
- dialogVisible(val) {
- this.$emit('update:visible', val)
- }
- },
- methods: {
- onClose() {
- this.dialogVisible = false
- },
- onItemClick(item) {
- this.$emit('buy', item)
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- @import './ShopDialog.scss';
- </style>
|