item-select.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <view>
  3. <view class="input-box">
  4. <view class="uni-input">
  5. <input class="input" confirm-type="search" @input="getBaseGoods()" v-model="p.name"
  6. @confirm="getBaseGoods()" placeholder="输入关键字搜索"/>
  7. <view class="clear" @click="clear()">
  8. <u-icon name="close-circle-fill" color="#ccc" size="38"></u-icon>
  9. </view>
  10. </view>
  11. <view class="btn" @click="getBaseGoods()">搜索</view>
  12. </view>
  13. <view class="box pay-way">
  14. <view class="pay-way-box" style="height: auto;">
  15. <radio-group @change="radioChange">
  16. <view class="item" v-for="(item,index) in goodsList" :key="item.id">
  17. <label>
  18. <image class="icon" :src="item.avatar"></image>
  19. <view class="text">
  20. <text class="title">{{ item.name }}</text>
  21. <text class="p">编号:{{ item.code }}</text>
  22. </view>
  23. <radio class="pay-radio" :value="item.id"/>
  24. </label>
  25. </view>
  26. </radio-group>
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. export default {
  33. data() {
  34. return {
  35. p: { // 查询参数
  36. status: '1', // 描述
  37. pageNo: 1, // 当前页
  38. pageSize: 10, // 页大小
  39. sortType: 0, // 排序方式
  40. dataCount: 0,// 排序方式
  41. name: ''
  42. },
  43. goodsList: []
  44. }
  45. },
  46. onLoad() {
  47. },
  48. onShow() {
  49. this.getBaseGoods();
  50. },
  51. methods: {
  52. isInput() {
  53. }, clear() {
  54. },
  55. getBaseGoods() {
  56. this.$api.getBaseGoods(this.p).then(resp => {
  57. this.goodsList = resp.data;
  58. this.p.dataCount = resp.dataCount;
  59. })
  60. },
  61. radioChange(event) {
  62. let that = this;
  63. uni.navigateBack({
  64. data: 1,
  65. url: '/pages/business-entering/business-entering',
  66. success: function (resp) {
  67. uni.$emit('getGoods', {goodsId: event.detail.value}) //触发事件
  68. }
  69. })
  70. }
  71. }
  72. }
  73. </script>
  74. <style lang="scss">
  75. .input-box {
  76. display: flex;
  77. align-items: center;
  78. width: 100%;
  79. padding: 20rpx 30rpx;
  80. padding-right: 0;
  81. box-sizing: border-box;
  82. background-color: #fff;
  83. position: fixed;
  84. z-index: 9;
  85. top: 0;
  86. left: 0;
  87. /*#ifdef H5*/
  88. top: 45px;
  89. /*#endif*/
  90. .uni-input {
  91. background-color: #f7f7f7;
  92. height: 80rpx;
  93. line-height: 80rpx;
  94. padding: 0 80rpx 0 30rpx;
  95. box-sizing: border-box;
  96. flex: 1;
  97. border-radius: 10rpx;
  98. display: flex;
  99. align-items: center;
  100. position: relative;
  101. .input {
  102. flex: 1;
  103. height: 100%;
  104. }
  105. .clear {
  106. width: 80rpx;
  107. height: 80rpx;
  108. display: flex;
  109. align-items: center;
  110. justify-content: center;
  111. position: absolute;
  112. right: 0;
  113. }
  114. }
  115. .icon {
  116. width: 40rpx;
  117. height: 40rpx;
  118. position: absolute;
  119. background-color: #ddd;
  120. right: 210rpx;
  121. border-radius: 50%;
  122. }
  123. .btn {
  124. width: 130rpx;
  125. height: 80rpx;
  126. color: #191919;
  127. display: flex;
  128. align-items: center;
  129. justify-content: center;
  130. border-radius: 0 10rpx 10rpx 0;
  131. font-size: 32rpx;
  132. }
  133. }
  134. .box {
  135. display: flex;
  136. margin: 20rpx;
  137. border-radius: 20rpx;
  138. flex: 1;
  139. box-sizing: border-box;
  140. flex-wrap: wrap;
  141. }
  142. .pay-way {
  143. margin-bottom: 20rpx;
  144. margin-top: 130rpx;
  145. .top {
  146. display: flex;
  147. width: 100%;
  148. align-items: center;
  149. margin: 0 30rpx;
  150. padding: 30rpx 0;
  151. .title {
  152. font-size: 34rpx;
  153. font-weight: bold;
  154. }
  155. }
  156. .pay-way-box {
  157. width: 100%;
  158. overflow: hidden;
  159. }
  160. .s-H {
  161. height: 120rpx;
  162. }
  163. .e-H {
  164. height: auto;
  165. }
  166. .tab-show {
  167. width: 100%;
  168. height: 88rpx;
  169. display: flex;
  170. align-items: center;
  171. justify-content: center;
  172. text {
  173. font-size: 30rpx;
  174. color: #999;
  175. margin-right: 20rpx;
  176. }
  177. }
  178. radio-group {
  179. width: 100%;
  180. display: flex;
  181. flex-direction: column;
  182. }
  183. .item {
  184. border-radius: 10rpx;
  185. margin-top: 5rpx;
  186. background-color: #fff;
  187. label {
  188. display: flex;
  189. flex: 1;
  190. align-items: center;
  191. margin: 0 30rpx;
  192. min-height: 120rpx;
  193. }
  194. .icon {
  195. width: 60rpx;
  196. height: 60rpx;
  197. }
  198. .text {
  199. flex: 1;
  200. margin-left: 20rpx;
  201. display: flex;
  202. flex-direction: column;
  203. .title {
  204. font-size: 30rpx;
  205. color: #191919;
  206. }
  207. .p {
  208. font-size: 24rpx;
  209. color: #999;
  210. }
  211. }
  212. .pay-radio {
  213. margin-left: auto;
  214. }
  215. }
  216. }
  217. </style>