12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <template>
- <div class="" style="background-color: #171520; height: 100vh">
- <div class="py-3 px-2 flex flex-wrap justify-between">
- <div
- style="width: 175px"
- v-for="goods in list"
- :key="goods.id"
- @click="handleSubmit(goods)"
- class="mx-1 bg-white rounded-lg shadow-md mb-2"
- >
- <img
- :src="goods.icon"
- class="rounded-t-lg w-full"
- style="height: 200px"
- />
- <div class="fontPFSCS p-2">{{ goods.name }}</div>
- <div class="text-right pr-2 mb-1">
- <span style="font-size: 12px">积分:</span>
- <span class="fontPFSCS text-red-500">{{ goods.integral }}</span>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import { goodsList, submitGoods } from '@/api/shoppingMall'
- export default {
- data() {
- return {
- list: [],
- }
- },
- methods: {
- handleSubmit(goods) {
- wx.showModal({
- title: '提示',
- content: '确认兑换商品?',
- success: (res) => {
- if (res.confirm) {
- console.log('用户点击确定')
- submitGoods({ id: goods.id }).then((res) => {
- console.log(res)
- })
- } else if (res.cancel) {
- console.log('用户点击取消')
- }
- },
- })
- },
- },
- created() {
- goodsList({ page: 1, limit: 1000 }).then((res) => {
- this.list = res.data.list
- })
- },
- }
- </script>
|