VerifyPeriodPicker.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <template>
  2. <u-popup v-model="visible" mode="center" border-radius="50" width="88%" :mask-close-able="true" :custom-style="popupCustomStyle" @close="close">
  3. <view class="verify-period-picker">
  4. <image class="popup-bg" src="/pages-home/static/images/verify-period-popup-bg.png" mode="scaleToFill"></image>
  5. <view class="picker-content">
  6. <view class="picker-header">
  7. <view class="close-btn" @click.stop="close">
  8. <image class="close-icon" src="/pages-home/static/images/verify-period-close.png" mode="aspectFit"></image>
  9. </view>
  10. </view>
  11. <view class="options-row">
  12. <view class="option-item" :class="{ 'is-selected': tempDays === 7 }" @click="selectDays(7)">
  13. <view class="option-content">
  14. <image
  15. class="radio-icon"
  16. :src="tempDays === 7 ? checkSrc : radioUnselectedSrc"
  17. mode="aspectFit"
  18. ></image>
  19. <view class="option-days">7天</view>
  20. <view class="option-type">普通验货</view>
  21. <view class="option-desc">快速完成结算</view>
  22. </view>
  23. </view>
  24. <view class="option-item" :class="{ 'is-selected': tempDays === 15 }" @click="selectDays(15)">
  25. <view class="option-content">
  26. <image
  27. class="radio-icon"
  28. :src="tempDays === 15 ? checkSrc : radioUnselectedSrc"
  29. mode="aspectFit"
  30. ></image>
  31. <view class="option-days">15天</view>
  32. <view class="option-type">安心验货</view>
  33. <view class="option-badge">98%用户选择</view>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="benefits-wrap is-visible" :class="{ 'is-visible': tempDays === 15 || tempDays === 7 }">
  38. <image
  39. class="benefits-img"
  40. src="/pages-home/static/images/verify-period-benefits.png"
  41. mode="widthFix"
  42. ></image>
  43. </view>
  44. <view class="confirm-wrap" @click="confirm">
  45. <image class="confirm-btn" src="/pages-home/static/images/verify-period-confirm-btn.png" mode="widthFix"></image>
  46. </view>
  47. </view>
  48. </view>
  49. </u-popup>
  50. </template>
  51. <script>
  52. export default {
  53. props: {
  54. show: {
  55. type: Boolean,
  56. default: false
  57. },
  58. value: {
  59. type: Number,
  60. default: null
  61. }
  62. },
  63. data() {
  64. return {
  65. tempDays: 15,
  66. popupCustomStyle: {
  67. background: 'transparent'
  68. },
  69. checkSrc: '/pages-home/static/images/verify-period-check.png',
  70. radioUnselectedSrc: '/pages-home/static/images/verify-period-radio-unselected.png'
  71. };
  72. },
  73. computed: {
  74. visible: {
  75. get() {
  76. return this.show;
  77. },
  78. set(val) {
  79. this.$emit('update:show', val);
  80. }
  81. }
  82. },
  83. watch: {
  84. show(val) {
  85. if (val) {
  86. this.tempDays = this.value || 15;
  87. }
  88. }
  89. },
  90. methods: {
  91. selectDays(days) {
  92. this.tempDays = days;
  93. },
  94. confirm() {
  95. if (this.tempDays !== 7 && this.tempDays !== 15) {
  96. uni.showToast({ title: '请选择结算时效', icon: 'none' });
  97. return;
  98. }
  99. this.$emit('confirm', {
  100. verifyPeriodDays: this.tempDays,
  101. label: this.getVerifyPeriodLabel(this.tempDays)
  102. });
  103. this.close();
  104. },
  105. getVerifyPeriodLabel(days) {
  106. if (days === 7) return '7天普通验货';
  107. if (days === 15) return '15天安心验货';
  108. return '';
  109. },
  110. close() {
  111. this.$emit('update:show', false);
  112. }
  113. }
  114. };
  115. </script>
  116. <style lang="scss" scoped>
  117. ::v-deep .u-mode-center-box {
  118. background-color: transparent !important;
  119. overflow: hidden;
  120. border-radius: 50rpx;
  121. }
  122. ::v-deep .u-drawer__scroll-view {
  123. background: transparent !important;
  124. }
  125. ::v-deep .u-drawer-content {
  126. background: transparent !important;
  127. }
  128. .verify-period-picker {
  129. position: relative;
  130. width: 100%;
  131. overflow: hidden;
  132. border-radius: 50rpx;
  133. background: transparent;
  134. .popup-bg {
  135. position: absolute;
  136. left: 0;
  137. top: 0;
  138. width: 100%;
  139. height: 100%;
  140. z-index: 0;
  141. border-radius: 50rpx;
  142. }
  143. .picker-content {
  144. position: relative;
  145. z-index: 1;
  146. padding: 0 28rpx 36rpx;
  147. box-sizing: border-box;
  148. }
  149. .picker-header {
  150. position: relative;
  151. height: 108rpx;
  152. }
  153. .close-btn {
  154. position: absolute;
  155. right: -8rpx;
  156. top: 8rpx;
  157. width: 56rpx;
  158. height: 56rpx;
  159. display: flex;
  160. align-items: center;
  161. justify-content: center;
  162. z-index: 3;
  163. .close-icon {
  164. width: 44rpx;
  165. height: 44rpx;
  166. }
  167. }
  168. .options-row {
  169. display: flex;
  170. gap: 16rpx;
  171. margin-bottom: 20rpx;
  172. margin-top: 54rpx;
  173. }
  174. .option-item {
  175. flex: 1;
  176. position: relative;
  177. height: 196rpx;
  178. background: #ffffff;
  179. border: 3rpx solid #38c148;
  180. border-radius: 20rpx;
  181. box-sizing: border-box;
  182. overflow: hidden;
  183. &.is-selected {
  184. background: #edfbe8;
  185. }
  186. }
  187. .option-content {
  188. position: relative;
  189. z-index: 1;
  190. height: 100%;
  191. padding: 28rpx 20rpx 20rpx;
  192. box-sizing: border-box;
  193. }
  194. .radio-icon {
  195. position: absolute;
  196. right: 14rpx;
  197. top: 14rpx;
  198. width: 40rpx;
  199. height: 40rpx;
  200. }
  201. .option-days {
  202. font-size: 48rpx;
  203. font-weight: 700;
  204. color: #222222;
  205. line-height: 1.1;
  206. }
  207. .option-type {
  208. font-size: 32rpx;
  209. font-weight: 600;
  210. color: #5e9f02;
  211. margin-top: 10rpx;
  212. line-height: 1.2;
  213. }
  214. .option-desc {
  215. font-size: 28rpx;
  216. color: #999999;
  217. margin-top: 14rpx;
  218. line-height: 1.3;
  219. }
  220. .option-badge {
  221. display: inline-flex;
  222. align-items: center;
  223. margin-top: 12rpx;
  224. padding: 6rpx 14rpx;
  225. background: #59b828;
  226. border-radius: 24rpx;
  227. font-size: 26rpx;
  228. font-weight: 500;
  229. color: #ffffff;
  230. line-height: 1;
  231. }
  232. .benefits-wrap {
  233. max-height: 0;
  234. opacity: 0;
  235. overflow: hidden;
  236. margin-bottom: 0;
  237. &.is-visible {
  238. max-height: 520rpx;
  239. opacity: 1;
  240. margin-bottom: 20rpx;
  241. }
  242. }
  243. .benefits-img {
  244. width: 100%;
  245. display: block;
  246. border-radius: 16rpx;
  247. }
  248. .confirm-wrap {
  249. padding-top: 24rpx;
  250. }
  251. .confirm-btn {
  252. width: 100%;
  253. display: block;
  254. }
  255. }
  256. </style>