selectSaleOrder.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  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. isNoSendDone: 0,
  119. orderStatus: 2,
  120. }
  121. getTableList(params).then(res => {
  122. if (this.page === 1) {
  123. this.listData = res.list
  124. } else {
  125. this.listData.push(...res.list)
  126. }
  127. this.page += 1
  128. this.isEnd = this.listData.length >= res.count
  129. }).then(() => {
  130. uni.hideLoading()
  131. })
  132. // this.isEnd = false
  133. // this._getClassifyList()
  134. },
  135. async _getClassifyList() {
  136. uni.showLoading({
  137. title: '数据加载中'
  138. })
  139. const params = {
  140. pageNum: 1,
  141. size: this.size,
  142. searchName: this.searchVal,
  143. isNoSendDone: 0,
  144. orderStatus: 2,
  145. }
  146. getTableList(params).then(res => {
  147. uni.hideLoading()
  148. if (this.page == 1) {
  149. this.listData = []
  150. }
  151. this.listData = this.listData.concat(res.list)
  152. this.isEnd = this.listData.length >= res.count
  153. })
  154. },
  155. confirm([id]) {
  156. this.categoryLevelId = id
  157. this.page = 1
  158. this.getList()
  159. },
  160. async getClassify() {
  161. listOrganizations(1).then(res => {
  162. this.classificationList = res
  163. this.page = 1
  164. this.getList()
  165. });
  166. },
  167. doSearch() {
  168. this.isEnd = false
  169. this.page = 1
  170. this.getList()
  171. },
  172. //勾选
  173. selectVal(e, val, index) {
  174. this.$set(this.listData[index], 'checked', !this.listData[index].checked)
  175. if (this.isAll != 1) {
  176. this.listData.forEach((item, i) => {
  177. if (item.id != val.id) {
  178. this.$set(this.listData[i], 'checked', false)
  179. }
  180. })
  181. } else {
  182. this.seletedAll = !this.listData.some(item => !item.checked)
  183. }
  184. },
  185. //全选按钮
  186. _seletedAll() {
  187. if (!this.seletedAll) {
  188. this.seletedAll = true
  189. this.listData.map(item => {
  190. this.$set(item, 'checked', true)
  191. })
  192. } else {
  193. this.seletedAll = false
  194. this.listData.map(item => {
  195. this.$set(item, 'checked', false)
  196. })
  197. }
  198. },
  199. //跳转回添加页面
  200. jumpAdd() {
  201. uni.$emit(
  202. 'setSaleOrder',
  203. this.listData.filter(item => item.checked)
  204. )
  205. uni.navigateBack()
  206. },
  207. //返回添加页
  208. backAdd() {
  209. uni.navigateBack()
  210. }
  211. }
  212. }
  213. </script>
  214. <style lang="scss" scoped>
  215. .mainBox {
  216. height: 100vh;
  217. display: flex;
  218. flex-direction: column;
  219. .wrapper {
  220. flex: 1;
  221. overflow: hidden;
  222. }
  223. .searchBox {
  224. padding: 10rpx 0;
  225. box-sizing: border-box;
  226. background-color: #dedede;
  227. height: 90rpx;
  228. width: 100%;
  229. line-height: 90rpx;
  230. display: flex;
  231. justify-content: space-around;
  232. align-items: center;
  233. input {
  234. height: 78rpx;
  235. width: 65%;
  236. background: #f9f9f9 !important;
  237. margin: 0 10rpx;
  238. padding: 0 10rpx;
  239. box-sizing: border-box;
  240. border-radius: 5rpx;
  241. }
  242. .searchBtn {
  243. height: 80rpx;
  244. background: #f9f9f9 !important;
  245. color: #676767;
  246. font-size: 28rpx;
  247. padding: 0 42rpx;
  248. box-sizing: border-box;
  249. outline: none;
  250. border: none;
  251. width: 260rpx;
  252. .icon-sousuo {
  253. font-size: 22px;
  254. }
  255. .text {
  256. font-size: 16px;
  257. margin-left: 10px;
  258. }
  259. }
  260. }
  261. .tab-title {
  262. position: fixed;
  263. top: 190rpx;
  264. z-index: 99;
  265. width: 100%;
  266. display: flex;
  267. justify-content: space-between;
  268. align-items: center;
  269. height: $tab-height;
  270. line-height: $tab-height;
  271. background-color: #ffffff;
  272. border-bottom: 2rpx solid #f2f2f2;
  273. box-sizing: border-box;
  274. .tab-item {
  275. width: 25%;
  276. text-align: center;
  277. font-size: 32rpx;
  278. color: $uni-text-color-grey;
  279. }
  280. .tab-item.active {
  281. color: $j-primary-border-green;
  282. border-bottom: 1px solid $j-primary-border-green;
  283. font-weight: bold;
  284. }
  285. .tab-item.filter {
  286. flex: 1;
  287. padding: 0px 30rpx;
  288. .uni-icons {
  289. display: flex;
  290. padding-top: 5px;
  291. }
  292. }
  293. .screenIcon {
  294. display: flex;
  295. width: 80px;
  296. justify-content: center;
  297. .screenText {
  298. font-size: 32rpx;
  299. color: $uni-text-color-grey;
  300. }
  301. }
  302. }
  303. .listContent {
  304. height: 100% !important;
  305. .listBox {
  306. display: flex;
  307. // height: 180rpx;
  308. padding: 20rpx 0;
  309. border-bottom: 2rpx solid #e5e5e5;
  310. .listBox-sel {
  311. height: 90rpx;
  312. width: 80rpx;
  313. // line-height: 90rpx;
  314. text-align: center;
  315. checkbox {
  316. transform: scale(1.2);
  317. }
  318. }
  319. .listBox-con {
  320. width: 100%;
  321. // display: flex;
  322. // flex-wrap: wrap;
  323. // justify-content: space-between;
  324. align-items: center;
  325. padding: 0 18rpx 0 0;
  326. .listBox-top {
  327. width: 100%;
  328. display: flex;
  329. justify-content: space-between;
  330. padding-bottom: 10rpx;
  331. .listBox-name,
  332. .listBox-code {
  333. display: inline-block;
  334. font-size: $uni-font-size-sm;
  335. font-weight: bold;
  336. }
  337. }
  338. .listBox-bottom {
  339. width: 100%;
  340. display: flex;
  341. justify-content: space-between;
  342. font-size: $uni-font-size-sm;
  343. flex-wrap: wrap;
  344. >view {
  345. width: 50%;
  346. overflow: hidden;
  347. white-space: nowrap;
  348. text-overflow: ellipsis;
  349. }
  350. }
  351. }
  352. }
  353. .noDate {
  354. height: 100%;
  355. }
  356. }
  357. //底部按钮
  358. .footer {
  359. height: 90rpx;
  360. position: relative;
  361. display: flex;
  362. justify-content: space-between;
  363. align-items: center;
  364. bottom: 0;
  365. width: 100%;
  366. height: 100rpx;
  367. border-top: 1rpx solid #eeecec;
  368. background-color: #ffffff;
  369. z-index: 999;
  370. .bottom {
  371. margin-left: 10rpx;
  372. }
  373. .u-reset-button {
  374. position: absolute;
  375. right: 10rpx;
  376. top: 20rpx;
  377. width: 150rpx;
  378. }
  379. }
  380. }
  381. </style>