modal-checked.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <view class="">
  3. <u-modal @confirm="confirm" v-model="show" title="请选择服务方式" confirm-color="#EF9944">
  4. <view class="modal-content">
  5. <view v-for="(item,index) in list" :key="index"
  6. @click="activeIndex=index" class="item" :class="{'active':activeIndex==index}">
  7. <view class="flex">
  8. <image class="img1" :src="item.icon" mode="widthFix"></image>
  9. <text class="center">{{item.name}}</text>
  10. </view>
  11. <view class="">
  12. <image v-if="activeIndex==index" class="img2 center" src="/pagesD/static/icon/checked.png" mode=""></image>
  13. </view>
  14. </view>
  15. </view>
  16. </u-modal>
  17. </view>
  18. </template>
  19. <script>
  20. export default {
  21. props:{
  22. list:Array
  23. },
  24. data() {
  25. return {
  26. show:false,
  27. activeIndex:0
  28. };
  29. },
  30. onLoad() {
  31. },
  32. methods:{
  33. showModal(){
  34. this.show=true
  35. },
  36. hideModal(){
  37. this.show=false
  38. },
  39. confirm(){
  40. this.$emit('confirm',this.activeIndex)
  41. }
  42. }
  43. };
  44. </script>
  45. <style lang="scss" scoped>
  46. .modal-content{
  47. padding:70rpx 30rpx;
  48. .img1{
  49. width: 40rpx;
  50. height: 40rpx;
  51. margin-right: 20rpx;
  52. margin-left: 20rpx;
  53. }
  54. .img2{
  55. width: 36rpx;
  56. height: 36rpx;
  57. margin-right: 20rpx;
  58. }
  59. .img3{
  60. width: 42rpx;
  61. height: 42rpx;
  62. margin-right: 20rpx;
  63. margin-left: 20rpx;
  64. }
  65. .item{
  66. display: flex;
  67. justify-content: space-between;
  68. background-color: #f7f7f7;
  69. border-radius: 50rpx;
  70. padding: 20rpx;
  71. margin-bottom: 30rpx;
  72. font-size: 26rpx;
  73. font-weight: 400;
  74. color: #696969;
  75. }
  76. .active {
  77. color: #0b0100;
  78. // background-color:rgba(255, 148, 71,.3);
  79. background-color: #fef6e1;
  80. image{
  81. transform: scale(1.3);
  82. }
  83. text{
  84. transform: scale(1.1);
  85. }
  86. }
  87. }
  88. </style>