selectSaleOrder.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="选择" @clickLeft="backAdd">
  4. </uni-nav-bar>
  5. <view class="searchBox">
  6. <input v-model="searchVal" placeholder="请输入名称" class="searchInput" />
  7. <u-button type="icon-shixiangxinzeng" size="30" @click="doSearch" data-icon="Search" class="searchBtn">
  8. <view class="iconfont icon-sousuo"></view>
  9. <view class="text">搜索</view>
  10. </u-button>
  11. </view>
  12. <view class="wrapper">
  13. <u-list @scrolltolower="scrolltolower" class="listContent">
  14. <checkbox-group v-for="(item, index) in listData" :key="index" @change="e => selectVal(e, item, index)">
  15. <label>
  16. <view class="listBox">
  17. <view class="listBox-sel">
  18. <checkbox :value="item.code" color="#fff" :disabled="item.disabled"
  19. :checked="item.checked" />
  20. </view>
  21. <view class="listBox-con">
  22. <view class="listBox-top">
  23. <view class="listBox-name">
  24. {{ item.productNames }}
  25. </view>
  26. <view class="listBox-code">
  27. {{ item.orderNo }}
  28. </view>
  29. </view>
  30. <view class="listBox-bottom">
  31. <view>编码:{{ item.productCodes }}</view>
  32. <view>订单类型:{{ item.needProduce }}</view>
  33. <view>客户名称:{{ item.partaName }}</view>
  34. <view>客户联系人:{{ item.partaLinkName }}</view>
  35. <view>生产编号:{{ item.productionCodes }}</view>
  36. <view>库存数:{{ item.inventoryQuantity }}</view>
  37. <view>库存状态:{{ item.inventoryQuantity }}</view>
  38. </view>
  39. </view>
  40. </view>
  41. </label>
  42. </checkbox-group>
  43. <u-empty class="noDate" style="margin-top: 20vh" v-if="!listData.length"></u-empty>
  44. </u-list>
  45. </view>
  46. <view class="footer">
  47. <view class="bottom" v-if="this.isAll==1">
  48. <checkbox v-if="!seletedAll" color="#fff" :checked="seletedAll" @tap="_seletedAll">全选</checkbox>
  49. <checkbox class="select-all" color="#fff" v-else :checked="seletedAll" @tap="_seletedAll">取消全选
  50. </checkbox>
  51. </view>
  52. <u-button type="success" size="small" class="u-reset-button" :disabled="!checkListLen" @click="jumpAdd">
  53. <view class="selBtn">选择( {{ checkListLen }} )</view>
  54. </u-button>
  55. </view>
  56. <ba-tree-picker ref="treePicker" key="verify" :multiple="false" @select-change="confirm" title="选择部门"
  57. :localdata="classificationList" valueKey="id" textKey="name" />
  58. </view>
  59. </template>
  60. <script>
  61. import {
  62. getTableList,
  63. } from '@/api/saleManage/saleorder'
  64. import baTreePicker from '@/components/ba-tree-picker/ba-tree-picker.vue'
  65. export default {
  66. components: {
  67. baTreePicker
  68. },
  69. data() {
  70. return {
  71. page: 1,
  72. size: 10,
  73. isEnd: false,
  74. searchVal: '',
  75. pickTabIndex: 1,
  76. popupShow: false, //右侧搜索窗
  77. typeIndex: 1,
  78. listData: [], //列表数据
  79. classificationList: [], //分类数据
  80. seletedAll: false, //全选状态,
  81. isAll: ''
  82. }
  83. },
  84. //选择的列表长度
  85. computed: {
  86. checkListLen() {
  87. return this.listData.filter(el => el.checked).length
  88. },
  89. },
  90. onShow() {
  91. this.isEnd = false
  92. this.page = 1
  93. this.getList()
  94. },
  95. onLoad({
  96. isAll
  97. }) {
  98. this.isAll = isAll //1多选 2单选
  99. this.getList()
  100. },
  101. onShow() {},
  102. methods: {
  103. scrolltolower() {
  104. this.getList()
  105. },
  106. //列表数据
  107. getList() {
  108. if (this.isEnd) {
  109. return
  110. }
  111. uni.showLoading({
  112. title: '加载中'
  113. })
  114. let params = {
  115. pageNum: this.page,
  116. size: this.size,
  117. name: this.searchVal
  118. }
  119. getTableList(params).then(res => {
  120. if (this.page === 1) {
  121. this.listData = res.list
  122. } else {
  123. this.listData.push(...res.list)
  124. }
  125. this.page += 1
  126. this.isEnd = this.listData.length >= res.count
  127. }).then(() => {
  128. uni.hideLoading()
  129. })
  130. // this.isEnd = false
  131. // this._getClassifyList()
  132. },
  133. async _getClassifyList() {
  134. uni.showLoading({
  135. title: '数据加载中'
  136. })
  137. const params = {
  138. pageNum: 1,
  139. size: this.size,
  140. searchName: this.searchVal,
  141. isNoSendDone: 0,
  142. orderStatus: 2,
  143. }
  144. getTableList(params).then(res => {
  145. uni.hideLoading()
  146. if (this.page == 1) {
  147. this.listData = []
  148. }
  149. this.listData = this.listData.concat(res.list)
  150. this.isEnd = this.listData.length >= res.count
  151. })
  152. },
  153. confirm([id]) {
  154. this.categoryLevelId = id
  155. this.page = 1
  156. this.getList()
  157. },
  158. async getClassify() {
  159. listOrganizations(1).then(res => {
  160. this.classificationList = res
  161. this.page = 1
  162. this.getList()
  163. });
  164. },
  165. doSearch() {
  166. this.isEnd = false
  167. this.page = 1
  168. this.getList()
  169. },
  170. //勾选
  171. selectVal(e, val, index) {
  172. this.$set(this.listData[index], 'checked', !this.listData[index].checked)
  173. if (this.isAll != 1) {
  174. this.listData.forEach((item, i) => {
  175. if (item.id != val.id) {
  176. this.$set(this.listData[i], 'checked', false)
  177. }
  178. })
  179. } else {
  180. this.seletedAll = !this.listData.some(item => !item.checked)
  181. }
  182. },
  183. //全选按钮
  184. _seletedAll() {
  185. if (!this.seletedAll) {
  186. this.seletedAll = true
  187. this.listData.map(item => {
  188. this.$set(item, 'checked', true)
  189. })
  190. } else {
  191. this.seletedAll = false
  192. this.listData.map(item => {
  193. this.$set(item, 'checked', false)
  194. })
  195. }
  196. },
  197. //跳转回添加页面
  198. jumpAdd() {
  199. uni.$emit(
  200. 'setSaleOrder',
  201. this.listData.filter(item => item.checked)
  202. )
  203. uni.navigateBack()
  204. },
  205. //返回添加页
  206. backAdd() {
  207. uni.navigateBack()
  208. }
  209. }
  210. }
  211. </script>
  212. <style lang="scss" scoped>
  213. .mainBox {
  214. height: 100vh;
  215. display: flex;
  216. flex-direction: column;
  217. .wrapper {
  218. flex: 1;
  219. overflow: hidden;
  220. }
  221. .searchBox {
  222. padding: 10rpx 0;
  223. box-sizing: border-box;
  224. background-color: #dedede;
  225. height: 90rpx;
  226. width: 100%;
  227. line-height: 90rpx;
  228. display: flex;
  229. justify-content: space-around;
  230. align-items: center;
  231. input {
  232. height: 78rpx;
  233. width: 65%;
  234. background: #f9f9f9 !important;
  235. margin: 0 10rpx;
  236. padding: 0 10rpx;
  237. box-sizing: border-box;
  238. border-radius: 5rpx;
  239. }
  240. .searchBtn {
  241. height: 80rpx;
  242. background: #f9f9f9 !important;
  243. color: #676767;
  244. font-size: 28rpx;
  245. padding: 0 42rpx;
  246. box-sizing: border-box;
  247. outline: none;
  248. border: none;
  249. width: 260rpx;
  250. .icon-sousuo {
  251. font-size: 22px;
  252. }
  253. .text {
  254. font-size: 16px;
  255. margin-left: 10px;
  256. }
  257. }
  258. }
  259. .tab-title {
  260. position: fixed;
  261. top: 190rpx;
  262. z-index: 99;
  263. width: 100%;
  264. display: flex;
  265. justify-content: space-between;
  266. align-items: center;
  267. height: $tab-height;
  268. line-height: $tab-height;
  269. background-color: #ffffff;
  270. border-bottom: 2rpx solid #f2f2f2;
  271. box-sizing: border-box;
  272. .tab-item {
  273. width: 25%;
  274. text-align: center;
  275. font-size: 32rpx;
  276. color: $uni-text-color-grey;
  277. }
  278. .tab-item.active {
  279. color: $j-primary-border-green;
  280. border-bottom: 1px solid $j-primary-border-green;
  281. font-weight: bold;
  282. }
  283. .tab-item.filter {
  284. flex: 1;
  285. padding: 0px 30rpx;
  286. .uni-icons {
  287. display: flex;
  288. padding-top: 5px;
  289. }
  290. }
  291. .screenIcon {
  292. display: flex;
  293. width: 80px;
  294. justify-content: center;
  295. .screenText {
  296. font-size: 32rpx;
  297. color: $uni-text-color-grey;
  298. }
  299. }
  300. }
  301. .listContent {
  302. height: 100% !important;
  303. .listBox {
  304. display: flex;
  305. // height: 180rpx;
  306. padding: 20rpx 0;
  307. border-bottom: 2rpx solid #e5e5e5;
  308. .listBox-sel {
  309. height: 90rpx;
  310. width: 80rpx;
  311. // line-height: 90rpx;
  312. text-align: center;
  313. checkbox {
  314. transform: scale(1.2);
  315. }
  316. }
  317. .listBox-con {
  318. width: 100%;
  319. // display: flex;
  320. // flex-wrap: wrap;
  321. // justify-content: space-between;
  322. align-items: center;
  323. padding: 0 18rpx 0 0;
  324. .listBox-top {
  325. width: 100%;
  326. display: flex;
  327. justify-content: space-between;
  328. padding-bottom: 10rpx;
  329. .listBox-name,
  330. .listBox-code {
  331. display: inline-block;
  332. font-size: $uni-font-size-sm;
  333. font-weight: bold;
  334. }
  335. }
  336. .listBox-bottom {
  337. width: 100%;
  338. display: flex;
  339. justify-content: space-between;
  340. font-size: $uni-font-size-sm;
  341. flex-wrap: wrap;
  342. >view {
  343. width: 50%;
  344. overflow: hidden;
  345. white-space: nowrap;
  346. text-overflow: ellipsis;
  347. }
  348. }
  349. }
  350. }
  351. .noDate {
  352. height: 100%;
  353. }
  354. }
  355. //底部按钮
  356. .footer {
  357. height: 90rpx;
  358. position: relative;
  359. display: flex;
  360. justify-content: space-between;
  361. align-items: center;
  362. bottom: 0;
  363. width: 100%;
  364. height: 100rpx;
  365. border-top: 1rpx solid #eeecec;
  366. background-color: #ffffff;
  367. z-index: 999;
  368. .bottom {
  369. margin-left: 10rpx;
  370. }
  371. .u-reset-button {
  372. position: absolute;
  373. right: 10rpx;
  374. top: 20rpx;
  375. width: 150rpx;
  376. }
  377. }
  378. }
  379. </style>