You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

189 lines
6.0 KiB

  1. <template>
  2. <uv-popup ref="popup" :round="10">
  3. <view class="companion-popup" v-if="type == 0">
  4. <view class="popup-header">
  5. <text class="popup-title">是否指定之前服务过的伴宠师</text>
  6. <view class="popup-close" @click="close">
  7. <uni-icons type="close" size="20" color="#999"></uni-icons>
  8. </view>
  9. </view>
  10. <view class="popup-content">
  11. <view class="option-item" @click="selectOption('yes')">
  12. <text class="option-text"></text>
  13. <view class="option-circle" :class="{'selected': selectedOption === 'yes'}">
  14. <view class="option-inner" v-if="selectedOption === 'yes'"></view>
  15. </view>
  16. </view>
  17. <view class="option-item" @click="selectOption('no')">
  18. <text class="option-text"></text>
  19. <view class="option-circle" :class="{'selected': selectedOption === 'no'}">
  20. <view class="option-inner" v-if="selectedOption === 'no'"></view>
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="companion-popup" v-else>
  26. <view class="popup-header">
  27. <text class="popup-title">请选择您喜欢的下单方式</text>
  28. <view class="popup-close" @click="close">
  29. <uni-icons type="close" size="20" color="#999"></uni-icons>
  30. </view>
  31. </view>
  32. <view class="popup-content">
  33. <view class="option-item" @click="selectOption('yes')">
  34. <text class="option-text">系统下单</text>
  35. <view class="option-circle" :class="{'selected': selectedOption === 'yes'}">
  36. <view class="option-inner" v-if="selectedOption === 'yes'"></view>
  37. </view>
  38. </view>
  39. <view class="option-item" @click="selectOption('no')">
  40. <text class="option-text">指定伴宠师</text>
  41. <view class="option-circle" :class="{'selected': selectedOption === 'no'}">
  42. <view class="option-inner" v-if="selectedOption === 'no'"></view>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </uv-popup>
  48. </template>
  49. <script>
  50. export default {
  51. data() {
  52. return {
  53. selectedOption: '',
  54. type : 0,
  55. }
  56. },
  57. methods: {
  58. // 打开弹窗
  59. open() {
  60. this.selectedOption = '';
  61. this.type = 0;
  62. this.$refs.popup.open('bottom');
  63. },
  64. // 关闭弹窗
  65. close() {
  66. this.$refs.popup.close();
  67. },
  68. // 选择选项
  69. selectOption(option) {
  70. this.selectedOption = option;
  71. if(this.type == 1){
  72. if (option === 'yes') {
  73. this.close();
  74. setTimeout(() => {
  75. uni.navigateTo({
  76. url: '/pages/newOrder/serviceNew'
  77. });
  78. }, 300);
  79. } else if (option === 'no') {
  80. this.close();
  81. setTimeout(() => {
  82. uni.navigateTo({
  83. url: '/pages/companionPetList/companionPetList'
  84. });
  85. }, 300);
  86. }
  87. return
  88. }
  89. // 如果选择"是",跳转到伴宠师选择页面
  90. if (option === 'yes') {
  91. this.close();
  92. setTimeout(() => {
  93. uni.navigateTo({
  94. url: '/pages_order/order/companionSelect'
  95. });
  96. }, 300);
  97. } else if (option === 'no') {
  98. this.type = 1;
  99. this.selectedOption = '';
  100. }
  101. }
  102. }
  103. }
  104. </script>
  105. <style lang="scss" scoped>
  106. .companion-popup {
  107. position: relative;
  108. background-color: #FFFFFF;
  109. border-radius: 20rpx;
  110. .popup-header {
  111. display: flex;
  112. align-items: center;
  113. justify-content: center;
  114. padding: 30rpx 20rpx;
  115. position: relative;
  116. .popup-title {
  117. font-size: 32rpx;
  118. font-weight: bold;
  119. color: #333;
  120. text-align: center;
  121. }
  122. .popup-close {
  123. position: absolute;
  124. right: 20rpx;
  125. top: 30rpx;
  126. }
  127. }
  128. .popup-content {
  129. padding: 20rpx 30rpx 50rpx;
  130. .option-item {
  131. display: flex;
  132. align-items: center;
  133. justify-content: space-between;
  134. height: 100rpx;
  135. border-radius: 10rpx;
  136. background-color: #F8F8F8;
  137. margin-bottom: 20rpx;
  138. padding: 0 30rpx;
  139. // &:first-child {
  140. // background-color: #FFF9E6;
  141. // .option-text {
  142. // color: #FFAA48;
  143. // }
  144. // }
  145. &:last-child {
  146. margin-bottom: 0;
  147. }
  148. .option-text {
  149. font-size: 28rpx;
  150. color: #333;
  151. }
  152. .option-circle {
  153. width: 36rpx;
  154. height: 36rpx;
  155. border-radius: 50%;
  156. border: 2rpx solid #DDDDDD;
  157. display: flex;
  158. align-items: center;
  159. justify-content: center;
  160. &.selected {
  161. border-color: #FFAA48;
  162. }
  163. .option-inner {
  164. width: 24rpx;
  165. height: 24rpx;
  166. border-radius: 50%;
  167. background-color: #FFAA48;
  168. }
  169. }
  170. }
  171. }
  172. }
  173. </style>