declare-select.vue 5.4 KB

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