declare-select.vue 4.9 KB

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