declare-select.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <view>
  3. <view class="box">
  4. <view class="top">
  5. <text class="title">申报记录</text>
  6. </view>
  7. </view>
  8. <u-search v-if="recordItemList.length>0" placeholder="申报人" shape="square" v-model="p.declarePeople" @search="getDeclareList()" @change="getDeclareList"
  9. :height="80" style="margin: 30rpx;">
  10. </u-search>
  11. <view class="card-box">
  12. <u-radio-group v-model="p.declareNo" placement="column" @change="onSelect">
  13. <view class="card" v-for="(recordItem,index) in recordItemList" :key="index">
  14. <view class="c">
  15. <view class="item car-num-item">
  16. <text class="car-num">申报时间:{{recordItem.createTime}}</text>
  17. </view>
  18. <view class="item">
  19. <text class="p1">申报人:</text>
  20. <text class="p2">{{recordItem.declarePeople}}</text>
  21. </view>
  22. <view class="item">
  23. <text class="p1">申报电话:</text>
  24. <text class="p2">{{recordItem.declarePhone}}</text>
  25. </view>
  26. <view class="item">
  27. <text class="p1">产品学名:</text>
  28. <text class="p2">{{recordItem.goodsName}}</text>
  29. </view>
  30. <view class="item">
  31. <text class="p1">越南车牌:</text>
  32. <text class="p2">{{recordItem.carNo}}</text>
  33. </view>
  34. </view>
  35. <view class="b">
  36. <u-radio :key="index" :name="recordItem.declareNo" label="选择">
  37. </u-radio>
  38. </view>
  39. </view>
  40. </u-radio-group>
  41. </view>
  42. <!-- 没有数据时显示noData -->
  43. <noData v-if="recordItemList.length==0"></noData>
  44. <view style="text-align: center;margin: 20rpx 0 50rpx 0;color: #007AFF;" @click="toDeclare">前往添加</view>
  45. <u-loadmore v-if="recordItemList.length>0" style="margin: 30rpx;" :status="status" />
  46. </view>
  47. </template>
  48. <script>
  49. export default {
  50. data() {
  51. return {
  52. p:{
  53. pageNo: 1,
  54. pageSize: 10,
  55. dataCount: 0,
  56. declareNo: '',
  57. },
  58. status: 'loadmore',
  59. recordItemList: [],
  60. }
  61. },
  62. onLoad(options) {
  63. this.p.declareNo = options.declareNo;
  64. },
  65. methods: {
  66. toDeclare(){
  67. this.$common.to('/pages/declare/add');
  68. },
  69. onSelect() {
  70. let select = this.p.declareNo;
  71. let declare = this.recordItemList.filter(obj => obj.declareNo == select).pop();
  72. uni.navigateBack({
  73. delta: 1,
  74. success: function(resp) {
  75. uni.$emit('getSelectDeclare', declare) //触发事件
  76. }
  77. })
  78. },
  79. getDeclareList() {
  80. if(!this.p.declareNo){
  81. this.p.declareNo='-1'
  82. }
  83. this.$api.getDeclareList(this.p).then(resp => {
  84. this.status = 'loadmore';
  85. let recordList = resp.data;
  86. this.p.dataCount = resp.dataCount;
  87. this.p.pageNo = resp.pageNo;
  88. this.recordItemList = recordList;
  89. if (this.dataCount < this.pageSize * this.pageNo) this.status = 'nomore';
  90. })
  91. },
  92. //------------------------------------------
  93. //上拉加载更多,分页模拟数据
  94. onReachBottom() {
  95. this.status = 'loading';
  96. if (this.p.dataCount > this.p.pageSize * this.p.pageNo) {
  97. this.p.pageSize = parseInt(this.p.pageSize) + 3;
  98. this.getDeclareList();
  99. } else {
  100. this.status = 'nomore';
  101. }
  102. }
  103. },
  104. onShow() {
  105. this.getDeclareList();
  106. },
  107. }
  108. </script>
  109. <style lang="scss">
  110. .card-box {
  111. display: flex;
  112. width: 100%;
  113. flex-direction: column;
  114. .card {
  115. background-color: #fff;
  116. border-radius: 20rpx;
  117. margin: 20rpx 20rpx 0 20rpx;
  118. padding: 30rpx;
  119. box-sizing: border-box;
  120. display: flex;
  121. flex-direction: column;
  122. .t {
  123. width: 100%;
  124. display: flex;
  125. align-items: center;
  126. padding-bottom: 30rpx;
  127. border-bottom: 1rpx solid #f5f5f5;
  128. .icon {
  129. width: 40rpx;
  130. height: 40rpx;
  131. }
  132. .title {
  133. font-size: 30rpx;
  134. font-weight: bold;
  135. margin-left: 20rpx;
  136. }
  137. }
  138. .c {
  139. padding: 15rpx 0 0 0;
  140. display: flex;
  141. flex-wrap: wrap;
  142. //border-bottom: 1rpx solid #f5f5f5;
  143. .item {
  144. width: 50%;
  145. padding: 20rpx 0;
  146. display: flex;
  147. .car-num {
  148. background-color: #edf6ff;
  149. color: #0080ff;
  150. font-size: 30rpx;
  151. padding: 15rpx 0;
  152. text-align: center;
  153. width: 100%;
  154. border-radius: 10rpx;
  155. font-weight: bold;
  156. }
  157. .p1 {
  158. font-size: 28rpx;
  159. color: #999;
  160. flex: 5;
  161. }
  162. .p2 {
  163. font-size: 28rpx;
  164. color: #191919;
  165. font-weight: bold;
  166. margin-left: 20rpx;
  167. flex: 7;
  168. }
  169. }
  170. .car-num-item {
  171. width: 100%;
  172. display: flex;
  173. align-items: center;
  174. justify-content: center;
  175. }
  176. }
  177. .b {
  178. margin-top: 20rpx;
  179. display: flex;
  180. width: 100%;
  181. align-items: center;
  182. justify-content: space-between;
  183. }
  184. }
  185. }
  186. .t-btn {
  187. width: 400rpx;
  188. margin: 0 auto 80rpx auto;
  189. height: 88rpx;
  190. font-weight: bold;
  191. display: flex;
  192. align-items: center;
  193. justify-content: center;
  194. border-radius: 10rpx;
  195. color: #191919;
  196. font-size: 28rpx;
  197. background-color: #fff;
  198. border: 1px solid #eee;
  199. }
  200. @import '@/common/common.scss'
  201. </style>