index.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <template>
  2. <div class="page-yahtzee">
  3. <div class="box-shop-wrap">
  4. <div class="box-shop">
  5. <h1>商城</h1>
  6. <ul class="list-gold">
  7. <li class="gold-item" v-for="(item,index) in shopList" :key="index" @click="handlePay(item.id,1)">
  8. <div class="item-bd">
  9. <img :src="item.icon" alt="">
  10. <p>¥{{item.price/100}}</p>
  11. </div>
  12. <div class="item-ft">获取 <img src="@/img/yahtzee/icon_coin.png" alt=""><em>{{item.name}}</em></div>
  13. </li>
  14. </ul>
  15. </div>
  16. </div>
  17. </div>
  18. </template>
  19. <script>
  20. import lib from 'lib'
  21. import axios from 'axios'
  22. import {Indicator, Toast, MessageBox} from 'mint-ui';
  23. import pay from 'pay';
  24. export default {
  25. data () {
  26. return {
  27. picUrl: lib.domain+"/build/img/taptapstar/",
  28. appid: lib.getParam('dwAppId'),
  29. selectIndex:1,
  30. shopList : [], //推荐列表
  31. tradeNo: "", //小游戏支付交易的订单号
  32. }
  33. },
  34. mounted () {
  35. this.getGoodsInfo();
  36. },
  37. methods:{
  38. getGoodsInfo(){
  39. let url = `${lib.apiUrl}/product/${this.appid}/products/${this.selectIndex}`;
  40. axios.get(url,{
  41. dwAppId : this.appid,
  42. type : this.selectIndex
  43. }).then(({data}) => {
  44. console.log(data.data.list)
  45. this.shopList = data.data.list;
  46. });
  47. },
  48. handlePay(productId,productCount=1){
  49. pay.handlePay(productId,productCount);
  50. }
  51. },
  52. }
  53. </script>
  54. <style lang="scss">
  55. @import "./scss/yahtzee.scss";
  56. </style>