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

198 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. // todo
  113. this.$emit('delete')
  114. }
  115. }
  116. })
  117. },
  118. }
  119. }
  120. </script>
  121. <style scoped lang="scss">
  122. .card {
  123. padding: 24rpx 32rpx;
  124. background: #FFFFFF;
  125. border-radius: 24rpx;
  126. .top {
  127. padding-bottom: 24rpx;
  128. justify-content: flex-start;
  129. column-gap: 24rpx;
  130. .info {
  131. .name {
  132. justify-content: flex-start;
  133. column-gap: 24rpx;
  134. font-size: 32rpx;
  135. color: #181818;
  136. .tag {
  137. padding: 2rpx 14rpx;
  138. font-size: 24rpx;
  139. color: #00A9FF;
  140. background: #E9F8FF;
  141. border: 2rpx solid #00A9FF;
  142. border-radius: 8rpx;
  143. &-1 {
  144. color: #03C25C;
  145. background: #E9FFF5;
  146. border-color: #03C25C;
  147. }
  148. &-2 {
  149. color: #EE6E05;
  150. background: #FFEFE9;
  151. border-color: #EE6E05;
  152. }
  153. }
  154. }
  155. .id {
  156. margin-top: 8rpx;
  157. font-size: 28rpx;
  158. color: #9B9B9B;
  159. }
  160. }
  161. }
  162. .bottom {
  163. padding-top: 24rpx;
  164. column-gap: 24rpx;
  165. border-top: 2rpx dashed #DADADA;
  166. .col {
  167. flex: 1;
  168. column-gap: 8rpx;
  169. font-family: PingFang SC;
  170. font-weight: 400;
  171. font-size: 24rpx;
  172. line-height: 1.4;
  173. color: #9B9B9B;
  174. .icon {
  175. width: 36rpx;
  176. height: 36rpx;
  177. }
  178. }
  179. }
  180. }
  181. </style>