moldPopu.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <template>
  2. <view>
  3. <uni-popup ref="popup" type="bottom">
  4. <div class="popup">
  5. <div class="popup-top">
  6. <div class="top-left">选择模具</div>
  7. <div class="top-right">
  8. <button @click="close">关闭</button>
  9. <button @click="comfirm">确定</button>
  10. </div>
  11. </div>
  12. <view class="search-box">
  13. <uni-easyinput prefixIcon="search" v-model="searchKey" placeholder="请输入搜索内容" @iconClick="iconClick">
  14. </uni-easyinput>
  15. <view class="search-botton" @click="toSearch">搜索</view>
  16. </view>
  17. <view class="table">
  18. <radio-group @change="radioChange">
  19. <label class="table-item" v-for="(item, index) in tableData" :key="index">
  20. <view class="item-left">
  21. <radio :value="index + ''" :checked="index == current" />
  22. </view>
  23. <view class="item-right">
  24. <view class="title">编码:{{ item.code }}</view>
  25. <view class="other">
  26. 名称:{{ item.name }}
  27. </view>
  28. <view class="other">
  29. 牌号:{{ item.brandNum }}
  30. </view>
  31. </view>
  32. </label>
  33. </radio-group>
  34. </view>
  35. </div>
  36. </uni-popup>
  37. </view>
  38. </template>
  39. <script>
  40. import { get, getJ, post, postJ } from '@/utils/api.js'
  41. import { getList } from '@/api/classifyManage/itemInformation.js'
  42. let [page, size, isEnd] = [1, 10, false]
  43. export default {
  44. components: {
  45. },
  46. data () {
  47. return {
  48. searchKey:'',
  49. tableData:[],
  50. current: -1,
  51. currentData:{}
  52. }
  53. },
  54. onShow () {
  55. },
  56. //触底加载
  57. onReachBottom: function () {
  58. if (isEnd) {
  59. uni.showToast({
  60. title: '已经没有更多数据了!',
  61. icon: 'none',
  62. duration: 1000 //提示持续时间
  63. })
  64. return
  65. }
  66. // 显示加载图标
  67. uni.showLoading({
  68. title: '数据加载中'
  69. })
  70. this.getMoreLists()
  71. },
  72. methods: {
  73. open() {
  74. this.$refs.popup.open()
  75. this.getFirstList()
  76. },
  77. close() {
  78. this.$refs.popup.close()
  79. },
  80. getMoldList(){
  81. uni.showLoading({
  82. title: '加载中'
  83. })
  84. let data = {
  85. pageNum:page,
  86. size,
  87. searchKey:this.searchKey,
  88. categoryLevelId:5,
  89. isProduct:true
  90. }
  91. getList(data).then(res=>{
  92. if (page === 1) {
  93. this.tableData = res.list
  94. } else {
  95. this.tableData.push(...res.list)
  96. }
  97. isEnd = this.tableData.length >= res.count
  98. }).then(()=>{
  99. uni.hideLoading()
  100. })
  101. },
  102. getFirstList () {
  103. page = 1
  104. this.searchVisible = false
  105. isEnd = true
  106. uni.showLoading({
  107. title: '数据加载中'
  108. })
  109. this.getMoldList()
  110. },
  111. getMoreLists () {
  112. //获取更多数据
  113. page++
  114. this.getMoldList()
  115. },
  116. toSearch(){
  117. this.getFirstList()
  118. },
  119. radioChange (e) {
  120. let value = Number(e.detail.value)
  121. let data = this.tableData[value]
  122. this.currentData = data
  123. },
  124. comfirm(){
  125. this.$refs.popup.close()
  126. this.$emit('chooseMold',this.currentData)
  127. }
  128. }
  129. }
  130. </script>
  131. <style lang="scss" scoped>
  132. .popup{
  133. width: 100%;
  134. height: 900rpx;
  135. background: #fff;
  136. .popup-top{
  137. width: 100%;
  138. display: flex;
  139. align-items: center;
  140. justify-content: space-between;
  141. height: 80rpx;
  142. background: rgba(21, 122, 44, 1);
  143. color: #fff;
  144. .top-left{
  145. font-size: 32rpx;
  146. margin-left: 10rpx;
  147. }
  148. .top-right{
  149. display: flex;
  150. align-items: center;
  151. justify-content: flex-end;
  152. margin-right: 10rpx;
  153. uni-button{
  154. background: rgba(21, 122, 44, 1);
  155. color: #fff;
  156. width: 100rpx;
  157. height: 60rpx;
  158. line-height: 60rpx;
  159. font-size: 28rpx;
  160. padding: 0;
  161. border: 1rpx solid #fff;
  162. margin-left: 20rpx;
  163. }
  164. }
  165. }
  166. .search-box{
  167. display: flex;
  168. align-items: center;
  169. justify-content: space-around;
  170. width: 94%;
  171. margin: 20rpx auto;
  172. .search-botton{
  173. background: rgba(112, 182, 3, 1);
  174. color: #fff;
  175. padding: 10rpx 20rpx;
  176. border-radius: 8rpx;
  177. margin-left: 20rpx;
  178. }
  179. }
  180. .table{
  181. width: 100%;
  182. border-top: 1rpx solid #ccc;
  183. .table-item{
  184. padding: 10rpx 20rpx;
  185. display: flex;
  186. align-items: center;
  187. justify-content: flex-start;
  188. border-bottom: 1rpx solid #ccc;
  189. .item-left{
  190. margin-right: 30rpx;
  191. }
  192. .item-right{
  193. flex: 1;
  194. .title{
  195. font-weight: bold;
  196. color: #000;
  197. margin: 10rpx 0;
  198. }
  199. .other{
  200. display: flex;
  201. align-items: center;
  202. margin-bottom: 10rpx;
  203. }
  204. }
  205. }
  206. }
  207. }
  208. </style>