鸿宇研学生前端代码
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.

197 lines
4.2 KiB

  1. <template>
  2. <view class="card">
  3. <view class="flex top">
  4. <view>
  5. <uv-checkbox
  6. size="36rpx"
  7. icon-size="36rpx"
  8. activeColor="#00A9FF"
  9. :name="data.id"
  10. ></uv-checkbox>
  11. </view>
  12. <view class="info">
  13. <view class="flex name">
  14. <view>{{ data.name }}</view>
  15. <view :class="['tag', `tag-${type}`]">{{ typeDesc }}</view>
  16. </view>
  17. <view class="id">{{ data.cerNo }}</view>
  18. </view>
  19. </view>
  20. <view class="flex bottom">
  21. <view class="flex col">
  22. <view>
  23. <uv-checkbox-group
  24. v-model="defaultCheckboxValue"
  25. @change="onDefaultChange"
  26. >
  27. <uv-checkbox
  28. size="36rpx"
  29. icon-size="36rpx"
  30. activeColor="#00A9FF"
  31. :name="1"
  32. ></uv-checkbox>
  33. </uv-checkbox-group>
  34. </view>
  35. <view>默认出行人</view>
  36. </view>
  37. <button class="flex col btn" @click="onEdit">
  38. <image class="icon" src="@/pages_order/static/traveler/icon-edit.png" mode="scaleToFill"></image>
  39. <view>编辑</view>
  40. </button>
  41. <button class="flex col btn" @click="onDelete">
  42. <image class="icon" src="@/pages_order/static/traveler/icon-delete.png" mode="scaleToFill"></image>
  43. <view>删除</view>
  44. </button>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. export default {
  50. props: {
  51. data: {
  52. type: Object,
  53. default() {
  54. return {}
  55. }
  56. },
  57. },
  58. data() {
  59. return {
  60. defaultCheckboxValue: [],
  61. }
  62. },
  63. computed: {
  64. isDefault: {
  65. set(val) {
  66. this.defaultCheckboxValue = val ? [1]: []
  67. if (this.data.isDefault == val) {
  68. return
  69. }
  70. this.$emit('defaultChange', val)
  71. },
  72. get() {
  73. return this.defaultCheckboxValue.length ? true : false
  74. }
  75. },
  76. typeDesc() {
  77. const { periodId } = this.data
  78. return this.configList.periodList?.find?.(item => item.id === periodId)?.title
  79. },
  80. type() {
  81. if (this.typeDesc == '青少年') {
  82. return 1
  83. }
  84. if (this.typeDesc == '儿童') {
  85. return 2
  86. }
  87. return 0
  88. },
  89. },
  90. watch: {
  91. data: {
  92. handler(val) {
  93. this.isDefault = val.isDefault
  94. },
  95. immediate: true,
  96. deep: true,
  97. }
  98. },
  99. methods: {
  100. onDefaultChange(val) {
  101. this.isDefault = val.length ? true : false
  102. },
  103. onEdit() {
  104. // todo
  105. this.$emit('edit')
  106. },
  107. onDelete() {
  108. uni.showModal({
  109. title: '确认删除?',
  110. success : e => {
  111. if(e.confirm){
  112. this.$emit('delete')
  113. }
  114. }
  115. })
  116. },
  117. }
  118. }
  119. </script>
  120. <style scoped lang="scss">
  121. .card {
  122. padding: 24rpx 32rpx;
  123. background: #FFFFFF;
  124. border-radius: 24rpx;
  125. .top {
  126. padding-bottom: 24rpx;
  127. justify-content: flex-start;
  128. column-gap: 24rpx;
  129. .info {
  130. .name {
  131. justify-content: flex-start;
  132. column-gap: 24rpx;
  133. font-size: 32rpx;
  134. color: #181818;
  135. .tag {
  136. padding: 2rpx 14rpx;
  137. font-size: 24rpx;
  138. color: #00A9FF;
  139. background: #E9F8FF;
  140. border: 2rpx solid #00A9FF;
  141. border-radius: 8rpx;
  142. &-1 {
  143. color: #03C25C;
  144. background: #E9FFF5;
  145. border-color: #03C25C;
  146. }
  147. &-2 {
  148. color: #EE6E05;
  149. background: #FFEFE9;
  150. border-color: #EE6E05;
  151. }
  152. }
  153. }
  154. .id {
  155. margin-top: 8rpx;
  156. font-size: 28rpx;
  157. color: #9B9B9B;
  158. }
  159. }
  160. }
  161. .bottom {
  162. padding-top: 24rpx;
  163. column-gap: 24rpx;
  164. border-top: 2rpx dashed #DADADA;
  165. .col {
  166. flex: 1;
  167. column-gap: 8rpx;
  168. font-family: PingFang SC;
  169. font-weight: 400;
  170. font-size: 24rpx;
  171. line-height: 1.4;
  172. color: #9B9B9B;
  173. .icon {
  174. width: 36rpx;
  175. height: 36rpx;
  176. }
  177. }
  178. }
  179. }
  180. </style>