buy_confirm.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <view class="cu-modal" :class="{ show: visible }">
  3. <view class="mask" @click="close"></view>
  4. <view class="cu-dialog" style="background-color: transparent; width: 100%">
  5. <view class="relative wrapper">
  6. <view v-if="type === 0" class="text">是否要合成蛋糕</view>
  7. <view v-else class="text">是否要购买材料《{{ material }}》</view>
  8. <view class="cancel">
  9. <image :src="resource.doll_btn_cancel" class="x" @click="close" />
  10. </view>
  11. <view class="confirm">
  12. <image :src="resource.doll_btn_confirm" class="x" @click="submit" />
  13. </view>
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. import resource from '@/utils/resource'
  20. export default {
  21. data() {
  22. return {
  23. resource,
  24. visible: false,
  25. id: null,
  26. material: '',
  27. type: 1
  28. }
  29. },
  30. methods: {
  31. show(data) {
  32. if (data === 0) {
  33. this.type = data
  34. } else {
  35. this.id = data.id
  36. this.material = data.name
  37. }
  38. this.visible = true
  39. },
  40. close() {
  41. this.visible = false
  42. },
  43. submit() {
  44. this.visible = false
  45. if (this.type === 0) {
  46. this.$emit('submit', this.type)
  47. } else {
  48. this.$emit('submit', this.id)
  49. }
  50. }
  51. }
  52. }
  53. </script>
  54. <style lang="scss" scoped>
  55. .mask {
  56. position: absolute;
  57. left: 0;
  58. right: 0;
  59. top: 0;
  60. bottom: 0;
  61. }
  62. .wrapper {
  63. width: 566rpx;
  64. height: 300rpx;
  65. background-color: #a4bef3;
  66. border: 10rpx solid #0035d9;
  67. border-radius: 48rpx;
  68. margin: 220rpx 92rpx 0;
  69. }
  70. .text {
  71. font-size: 40rpx;
  72. color: #fff;
  73. margin: 58rpx auto 0;
  74. text-align: center;
  75. }
  76. .cancel {
  77. position: absolute;
  78. bottom: 30rpx;
  79. left: 42rpx;
  80. }
  81. .confirm {
  82. position: absolute;
  83. bottom: 30rpx;
  84. right: 42rpx;
  85. }
  86. .x {
  87. width: 232rpx;
  88. height: 88rpx;
  89. }
  90. </style>