chooseorder.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. <template>
  2. <view class="order-list content">
  3. <view class="swiper-box">
  4. <template v-if="tableData.length">
  5. <u-checkbox-group
  6. v-model="checked"
  7. @change="checkChange"
  8. iconPlacement="left"
  9. shape='circle'
  10. placement="column">
  11. <view class="order-card" v-for="(item, index) in tableData" :key="index">
  12. <view class="order-card-title">
  13. <u-checkbox class="check-item" activeColor="#4680F9" :name='item.Hcontent'></u-checkbox>
  14. {{work == 'in'?$t('spare.orderCode')+':'+item.orderCode:$t('spare.applyCode')+':'+item.takeCode}}
  15. </view>
  16. <view class="order-info">
  17. <p class="info-line">
  18. <text class="label">{{$t('spare.spareName')}}:</text>
  19. <text class="info"> {{item.materialName || ''}}</text>
  20. </p>
  21. <p class="info-line">
  22. <text class="label">{{$t('spare.orderNum')}}:</text>
  23. <text class="info"> {{item.number}}</text>
  24. </p>
  25. <template v-if="work == 'in'">
  26. <p class="info-line">
  27. <text class="label">{{$t('spare.alreadyInNumber')}}:</text>
  28. <text class="info"> {{item.entryNum}}</text>
  29. </p>
  30. <p class="info-line">
  31. <text class="label">{{$t('spare.canInNumber')}}:</text>
  32. <text class="info"> {{item.number-item.entryNum}}</text>
  33. </p>
  34. </template>
  35. <template v-else>
  36. <p class="info-line">
  37. <text class="label">{{$t('spare.canOutNumber')}}:</text>
  38. <text class="info"> {{item.number-item.outNum}}</text>
  39. </p>
  40. <p class="info-line">
  41. <text class="label">{{$t('spare.alreadyOutNumber')}}:</text>
  42. <text class="info"> {{item.outNum}}</text>
  43. </p>
  44. <p class="info-line">
  45. <text class="label">{{$t('spare.storeHaveNumber')}}:</text>
  46. <text class="info"> {{item.totalNum}}</text>
  47. </p>
  48. </template>
  49. </view>
  50. </view>
  51. </u-checkbox-group>
  52. </template>
  53. <template v-else>
  54. <u-empty mode="list" icon="https://cdn.uviewui.com/uview/empty/list.png">
  55. </u-empty>
  56. </template>
  57. </view>
  58. <view class="examine" v-if="tableData.length != 0">
  59. <u-checkbox-group
  60. v-model="checkAll"
  61. placement="column"
  62. @change="checkAllChange"
  63. >
  64. <u-checkbox shape='circle' activeColor="#4680F9" label="全选" :name="true"></u-checkbox>
  65. </u-checkbox-group>
  66. <view class="exam-wrap">
  67. <button @click='confirm' class='exam-btn'>{{$t('spare.sureSelect')}}</button>
  68. </view>
  69. </view>
  70. <u-loading-page
  71. color="#666"
  72. loading-mode="semicircle"
  73. :loading="loading">
  74. </u-loading-page>
  75. </view>
  76. </template>
  77. <script>
  78. import {getOrderDetailByPurveyId,getOrderDetailBydeptId} from '../../api/warehousing'
  79. export default {
  80. components:{
  81. },
  82. data() {
  83. return {
  84. tableData:[],
  85. loading:false,
  86. keyword:'',
  87. checkAll:[],
  88. checked:[],
  89. work:'',
  90. };
  91. },
  92. onLoad(options) {
  93. this.purveyId = options.purveyId
  94. this.dept = options.dept
  95. this.work = options.work
  96. this.getList()
  97. },
  98. methods: {
  99. //确认选择
  100. confirm(){
  101. let pages = getCurrentPages();
  102. let prevPage = pages[pages.length - 2]; //上一个页面
  103. if(this.work == 'in'){
  104. this.checked.forEach(j=>{
  105. let item = JSON.parse(j)
  106. let boo = true
  107. prevPage.$vm.details.forEach(i=>{
  108. if(item.id == i.orderDtlId && i.sourceType == '101'){
  109. boo = false
  110. }
  111. })
  112. if(boo){
  113. item.count=0
  114. item.shelfList = [
  115. {
  116. shelf:0,
  117. floor:0,
  118. seat:0,
  119. sign:0,
  120. num:0,
  121. }
  122. ]
  123. item.unit=item.materialUnit
  124. item.remark=''
  125. item.orderDtlId = item.id
  126. item.sourceType = '101'
  127. item.maxNumber = item.number - item.entryNum
  128. item.cess = parseInt(item.cess)
  129. prevPage.$vm.details.push(item)
  130. }
  131. })
  132. }else{
  133. this.checked.forEach(j=>{
  134. let item = JSON.parse(j)
  135. let boo = true
  136. prevPage.$vm.details.forEach(i=>{
  137. if(item.id == i.takeId && i.sourceType == '101'){
  138. boo = false
  139. }
  140. })
  141. if(boo){
  142. item.count=0
  143. item.unit=item.materialUnit
  144. item.remark=''
  145. item.takeId = item.id
  146. item.sourceType = '101'
  147. prevPage.$vm.details.push(item)
  148. }
  149. })
  150. }
  151. uni.navigateBack();
  152. },
  153. //获取订单列表
  154. getList() {
  155. this.loading = true
  156. if(this.work == 'in'){
  157. let data = {
  158. purveyId:this.purveyId
  159. };
  160. getOrderDetailByPurveyId(data).then((res) => {
  161. this.loading = false
  162. if(res.data.code == 0){
  163. this.tableData = res.data.data
  164. this.tableData.forEach(item=>{
  165. item.Hcontent = JSON.stringify(item)
  166. })
  167. }
  168. }).catch(()=>{
  169. this.loading = false
  170. })
  171. }else{
  172. getOrderDetailBydeptId(this.dept).then(res=>{
  173. this.loading = false
  174. if(res.data.code == 0){
  175. this.tableData = res.data.data
  176. this.tableData.forEach(item=>{
  177. item.Hcontent = JSON.stringify(item)
  178. })
  179. }
  180. }).catch(()=>{
  181. this.loading = false
  182. })
  183. }
  184. },
  185. //审批选择
  186. checkChange(item){
  187. console.log(item);
  188. this.checked = [...item]
  189. if(this.checked.length == this.tableData.length && this.tableData.length!=0){
  190. this.checkAll = [true]
  191. }else{
  192. this.checkAll = []
  193. }
  194. },
  195. //全选
  196. checkAllChange(item){
  197. if(item[0]){
  198. this.checked = this.tableData.map(item=>{
  199. return item.Hcontent
  200. })
  201. }else{
  202. this.checked = []
  203. }
  204. }
  205. },
  206. };
  207. </script>
  208. <style>
  209. /* #ifndef APP-NVUE */
  210. view {
  211. /* display: flex; */
  212. box-sizing: border-box;
  213. /* flex-direction: column; */
  214. }
  215. page {
  216. box-sizing: border-box;
  217. /* padding: 40rpx 40rpx 80rpx; */
  218. height: 100%;
  219. }
  220. /* #endif*/
  221. </style>
  222. <style lang="scss" scoped>
  223. @import '../../common/css/public.scss';
  224. .order-list {
  225. // height: calc(100vh - var(--window-top)) ;
  226. // overflow: hidden;
  227. .swiper-box{
  228. padding: 4rpx 0 24rpx;
  229. }
  230. background-color: #f8f8f8;
  231. .qrcode-wrap{
  232. padding: 24rpx;
  233. text-align: center;
  234. .info-line{
  235. text-align: center;
  236. font-size: 32rpx;
  237. margin-top: 24rpx;
  238. }
  239. }
  240. }
  241. .examine{
  242. position: fixed;
  243. bottom: 0;
  244. background-color: #fff;
  245. height: 80rpx;
  246. line-height: 80rpx;
  247. padding: 24rpx;
  248. width: 100%;
  249. display: flex;
  250. flex-direction: row;
  251. align-items: center;
  252. .exam-wrap{
  253. height: 80rpx;
  254. line-height: 80rpx;
  255. flex: 1;
  256. display: flex;
  257. justify-content: flex-end;
  258. flex-direction: row;
  259. font-size: 24rpx;
  260. align-items: center;
  261. .num{
  262. font-size: 32rpx;
  263. color: #4680F9;
  264. margin-right: 32rpx;
  265. }
  266. .exam-btn{
  267. height: 60rpx;
  268. border: none;
  269. background-color: #4680F9;
  270. color: #fff;
  271. font-size: 32rpx;
  272. line-height: 60rpx;
  273. margin: 0;
  274. border-radius: 80rpx;
  275. padding: 0 40rpx;
  276. }
  277. .disabled{
  278. color: rgba(0,0,0,.3);
  279. background-color: #f2f2f2;
  280. }
  281. }
  282. }
  283. .popupShow {
  284. overflow: hidden;
  285. position: fixed;
  286. }
  287. .order-card .order-card-title{
  288. justify-content: left;
  289. }
  290. </style>