myCard.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <template>
  2. <view class="card_box">
  3. <view class="item_box rx-bc" v-for="(_item,i) in columns" :key="i">
  4. <view class="perce50" :class="val.className" v-for="(val) in _item" :key="val.prop">
  5. <view class="item_box rx-sc" v-if="val.type=='title'">
  6. <view class="round" v-if='index'>{{index}}</view>
  7. <view class="orderId" :style="{marginLeft: index?'16rpx':''}">{{item[val.prop]||''}} </view>
  8. </view>
  9. <view class="item_one rx-sc" v-else-if="val.type=='action'">
  10. <view class="lable">{{val.label}}</view>
  11. <view class="text">
  12. <u-button :plain="true" :hairline="true" size='mini' :type="btn.btnType" v-if="judge(btn)"
  13. :text="btn.name" @click="action(btn)" v-for="(btn,bI) in btnList" :key="bI"></u-button>
  14. </view>
  15. </view>
  16. <view class="item_one rx-sc" v-else>
  17. <view class="lable">{{val.label}}</view>
  18. <view class="text" v-if="val.formatter">{{val.formatter(item)||''}}</view>
  19. <view class="text" v-else-if="val.slot">
  20. <slot :name="val.slot"> </slot>
  21. </view>
  22. <view class="text" v-else>{{item[val.prop]||''}}</view>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. export default {
  30. props: {
  31. btnList: {
  32. type: Array,
  33. default: () => []
  34. },
  35. item: {
  36. type: Object,
  37. default: () => ({})
  38. },
  39. columns: {
  40. type: Array,
  41. default: () => []
  42. },
  43. index: '',
  44. },
  45. computed: {
  46. judge() {
  47. return (item) => {
  48. if (item.judge) {
  49. let is = true
  50. item.judge.forEach(({
  51. key,
  52. value
  53. }) => {
  54. if (!value.includes(this.item[key])) {
  55. is = false
  56. }
  57. })
  58. return is
  59. } else {
  60. return true
  61. }
  62. }
  63. }
  64. },
  65. data() {
  66. return {
  67. }
  68. },
  69. methods: {
  70. action(item) {
  71. if (item.type == 1) {
  72. uni.navigateTo({
  73. url: item.pageUrl + '?id=' + this.item.id+(item.query||'')
  74. })
  75. } else {
  76. this.$emit(item.apiName)
  77. }
  78. },
  79. }
  80. }
  81. </script>
  82. <style lang="scss" scoped>
  83. .card_box {
  84. width: 750rpx;
  85. padding: 16rpx 32rpx;
  86. box-sizing: border-box;
  87. border-bottom: 2rpx solid #E1E1E1;
  88. .rx-bc {
  89. align-items: start;
  90. flex-flow: row wrap;
  91. >view{
  92. margin-top: 8rpx;
  93. }
  94. }
  95. .rx-sc {
  96. align-items: start;
  97. }
  98. .item_box {
  99. // margin-top: 10rpx;
  100. .text {
  101. display: flex;
  102. // padding-right: 6rpx;
  103. flex: 1;
  104. uni-button:after {
  105. border: none;
  106. }
  107. ;
  108. uni-button {
  109. width: 100rpx;
  110. // height: 50rpx;
  111. margin-left: 10rpx;
  112. margin-right: 0;
  113. color: #fff !important;
  114. border: none;
  115. background: #157a2c;
  116. // border: none;
  117. // /deep/uni-text {
  118. // font-size: 26rpx !important;
  119. // }
  120. }
  121. }
  122. .round {
  123. width: 40rpx;
  124. height: 40rpx;
  125. line-height: 40rpx;
  126. border-radius: 50%;
  127. background: $theme-color;
  128. color: #fff;
  129. text-align: center;
  130. font-size: 20rpx;
  131. }
  132. .orderId {
  133. color: #000;
  134. font-family: PingFang HK;
  135. font-size: 28rpx;
  136. font-style: normal;
  137. font-weight: 600;
  138. }
  139. .item_one {
  140. width: 100%;
  141. font-size: 26rpx;
  142. font-style: normal;
  143. font-weight: 400;
  144. line-height: 38rpx;
  145. word-wrap: break-word;
  146. }
  147. .gylx {
  148. color: $theme-color;
  149. }
  150. .perce50 {
  151. min-width: 50%;
  152. }
  153. .perce100 {
  154. width: 100% !important;
  155. }
  156. }
  157. }
  158. /deep/.u-input {
  159. padding: 0 !important;
  160. height: 38rpx !important;
  161. font-size: 26rpx !important;
  162. }
  163. /deep/.u-input__content__field-wrapper__field {
  164. font-size: 26rpx !important;
  165. }
  166. /deep/.uni-date-editor--x .uni-date__icon-clear {
  167. border: none !important;
  168. }
  169. /deep/.uni-date__x-input,
  170. /deep/.uni-date-x {
  171. padding: 0 !important;
  172. height: 38rpx !important;
  173. font-size: 26rpx !important;
  174. }
  175. /deep/.input-value {
  176. font-size: 26rpx !important;
  177. height: 38rpx !important;
  178. uni-text {
  179. font-size: 26rpx !important;
  180. }
  181. }
  182. /deep/.u-textarea {
  183. padding: 2px !important;
  184. }
  185. /deep/.u-textarea__field {
  186. font-size: 26rpx !important;
  187. }
  188. </style>