gasApplyAdd.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  1. <!--申请气瓶-->
  2. <template>
  3. <view id="transportPerson">
  4. <picker @change="bindPickerChange" :value="pickerIndex" :range="pickerArray">
  5. <view class="title">
  6. <viwe class="title_l">实验地点:</viwe>
  7. <input class="title_r" v-model="form.location" disabled type="text" placeholder="请选择实验地点">
  8. </view>
  9. </picker>
  10. <scroll-view scroll-y @scrolltolower="scrollGet" class="scroll-box">
  11. <view class="list">
  12. <view class="list_li" v-for="(item,index) in listDetail">
  13. <view class="list_li_l">
  14. <view class="list_li_l_t">{{item.airName}}-{{item.configName}}</view>
  15. <view class="list_li_l_b">
  16. <img src="@/images/basicsModules/icon_14.png">
  17. <text>{{item.companyName}}</text>
  18. </view>
  19. </view>
  20. <view class="list_li_r">
  21. <view class="minus" @click="minus(item)"><img src="@/pages_manage/images/icon_zgsq_jian.png"></view>
  22. <input v-model="item.bottleNumber" disabled type="text" >
  23. <view class="add" @click="add(item)"><img src="@/pages_manage/images/icon_zgsq_j.png"></view>
  24. </view>
  25. </view>
  26. </view>
  27. </scroll-view>
  28. <view class="empty" v-if="pageType==4">
  29. <img class="for-back-img" src="@/pages_manage/images/icon_sqqp_sqys.png">
  30. <view>
  31. <text>气瓶已全部向供应商申请运输</text>
  32. <text>如需更多气瓶请重新提交资格申请</text>
  33. </view>
  34. </view>
  35. <view v-if="amount>0" class="sub_btn">
  36. <view class="sub_btn_l">已选择{{amount}}个气瓶</view>
  37. <view class="sub_btn_r" @click="submitVerify()">提交</view>
  38. </view>
  39. <view v-if="amount==0" class="sub_btn2">
  40. <view class="sub_btn_l">暂未选择气瓶</view>
  41. <view class="sub_btn_r">提交</view>
  42. </view>
  43. <view class="sub_btn2" v-if="pageType==4">提交申请</view>
  44. </view>
  45. </template>
  46. <script>
  47. import { taskListGood,labList,gasApplyAdd,gasApplyVerify} from '@/api/apiDemo/index.js'
  48. export default {
  49. name: "transportPerson",
  50. data() {
  51. return {
  52. pageType:0,
  53. //列表请求参数
  54. params:{
  55. pageNum:1,
  56. pageSize:20,
  57. searchValue:'',
  58. },
  59. listDetail:[],
  60. form:{
  61. location:'',
  62. },
  63. pickerArray:[],
  64. pickerArrayList:[],
  65. amount:0,
  66. status:null,//0添加1编辑
  67. }
  68. },
  69. onLoad(option) {
  70. this.status=option.status;
  71. },
  72. onShow() {
  73. },
  74. methods: {
  75. search(){
  76. this.getList();
  77. },
  78. minus(d) {
  79. let _this=this;
  80. if(d.bottleNumber>0){
  81. _this.amount=0;
  82. d.bottleNumber--;
  83. this.listDetail.forEach(function(item){
  84. _this.amount+=item.bottleNumber;
  85. })
  86. }
  87. },
  88. add(d) {
  89. let _this=this;
  90. _this.amount=0;
  91. d.bottleNumber++;
  92. this.listDetail.forEach(function(item){
  93. _this.amount+=item.bottleNumber;
  94. })
  95. },
  96. //滚动加载事件
  97. scrollGet(){
  98. this.params.pageNum += 1;
  99. this.getList();
  100. },
  101. //选择实验室
  102. bindPickerChange(e){
  103. let _this=this;
  104. let index=e.target.value
  105. //获取实验室名称
  106. _this.form.location=_this.pickerArray[index]
  107. //循环获取实验室id
  108. _this.pickerArrayList.forEach(function(item){
  109. if(_this.pickerArray[index]==item.name){
  110. _this.form.locationId=item.id;
  111. }
  112. })
  113. },
  114. //查询实验室
  115. async labList(){
  116. const {data} = await labList()
  117. if(data.code == 200){
  118. let _this=this;
  119. let res=data.data
  120. _this.pickerArrayList=res;
  121. res.forEach(function(item){
  122. _this.pickerArray.push(item.name);
  123. })
  124. }
  125. },
  126. //获取列表数据
  127. async getList(){
  128. let _this = this;
  129. const {data} = await taskListGood(this.params);
  130. if(data.code==200){
  131. let res=data.rows;
  132. if(res){
  133. if(_this.params.pageNum==1){
  134. res.forEach(function(item){
  135. item.bottleNumber=0;
  136. })
  137. _this.listDetail=res;
  138. }else{
  139. res.forEach(function(item){
  140. item.bottleNumber=0;
  141. })
  142. _this.listDetail=_this.listDetail.concat(res);
  143. }
  144. }
  145. }
  146. },
  147. async submitVerify(){
  148. let _this=this;
  149. if(_this.form.location==''){
  150. uni.showToast({
  151. title: '请先选择实验室!',
  152. icon:"none",
  153. mask:true,
  154. duration: 2000
  155. });
  156. return;
  157. }
  158. const {data} = await gasApplyVerify({subjectId:_this.form.locationId});
  159. if(data.code == 200){
  160. let res=data.data
  161. if(!res.flgSubject){
  162. uni.showToast({
  163. title: '请先配置实验室气瓶总量数',
  164. icon:"none",
  165. mask:true,
  166. duration: 2000
  167. });
  168. return
  169. }
  170. if(!res.flgUser){
  171. uni.showToast({
  172. title: '请先配置实验室个人气瓶总量数',
  173. icon:"none",
  174. mask:true,
  175. duration: 2000
  176. });
  177. return
  178. }
  179. if(_this.amount>res.subjectNum){
  180. uni.showToast({
  181. title: '当前申请气瓶个数大于当前实验室气瓶存量!',
  182. icon:"none",
  183. mask:true,
  184. duration: 2000
  185. });
  186. return
  187. }
  188. if(_this.amount>res.userNum){
  189. uni.showToast({
  190. title: '当前申请气瓶个数大于个人气瓶存量!',
  191. icon:"none",
  192. mask:true,
  193. duration: 2000
  194. });
  195. return
  196. }
  197. _this.submitForm();
  198. }else{
  199. return
  200. }
  201. },
  202. //注册提交
  203. async submitForm(){
  204. let _this = this;
  205. if(_this.listDetail){
  206. let arr=[];
  207. let supplierId='';
  208. _this.listDetail.forEach(function(item){
  209. item.supplierId=item.companyId
  210. supplierId=item.companyId
  211. if(item.bottleNumber>0){
  212. arr.push(item)
  213. }
  214. })
  215. _this.form.detailListVO=arr;
  216. }
  217. const {data} = await gasApplyAdd(_this.form);
  218. if(data.code == 200){
  219. uni.showToast({
  220. title: '提交成功',
  221. icon:"none",
  222. mask:true,
  223. duration: 2000
  224. });
  225. setTimeout(function(){
  226. uni.redirectTo({
  227. url: '/pages_manage/gasBottle/gasApply/gasApply'
  228. });
  229. },2000);
  230. }
  231. },
  232. },
  233. mounted(){
  234. this.getList()
  235. this.labList()
  236. },
  237. }
  238. </script>
  239. <style lang="stylus" scoped>
  240. #transportPerson {
  241. height: 100%;
  242. width: 100%;
  243. flex :1;
  244. display flex;
  245. flex-direction column
  246. overflow hidden;
  247. .title{
  248. width: 750rpx;
  249. height: 118rpx;
  250. background: #FFFFFF;
  251. padding: 0 40rpx;
  252. box-sizing: border-box;
  253. display: flex;
  254. justify-content: space-between;
  255. align-items: center;
  256. margin-bottom: 20rpx;
  257. .title_l{
  258. font-size: 28rpx;
  259. font-family: PingFang SC;
  260. font-weight: 500;
  261. color: #999999;
  262. line-height: 118rpx;
  263. }
  264. .title_r{
  265. flex: 1;
  266. font-size: 28rpx;
  267. font-family: PingFang SC;
  268. font-weight: 500;
  269. color: #333333;
  270. text-align: right;
  271. }
  272. }
  273. .scroll-box{
  274. // flex:1;
  275. overflow-y scroll;
  276. padding-top: 30rpx;
  277. padding-bottom: 180rpx;
  278. .list{
  279. background: #FFFFFF;
  280. border-radius: 20rpx;
  281. margin: 0 20rpx;
  282. padding: 0 20rpx;
  283. box-sizing: border-box;
  284. .list_li{
  285. height: 180rpx;
  286. display: flex;
  287. justify-content: space-between;
  288. padding: 0 20rpx;
  289. box-sizing: border-box;
  290. border-bottom:1px solid #f5f5f5;
  291. .list_li_l{
  292. flex: 1;
  293. .list_li_l_t{
  294. font-size: 28rpx;
  295. font-family: PingFang SC;
  296. font-weight: 500;
  297. color: #333333;
  298. line-height: 28rpx;
  299. margin-top: 44rpx;
  300. }
  301. .list_li_l_b{
  302. display: flex;
  303. justify-content: flex-start;
  304. margin: 42rpx 0 34rpx 0;
  305. >img{
  306. width: 28rpx;
  307. height: 30rpx;
  308. margin-right: 18rpx;
  309. }
  310. >text{
  311. font-size: 24rpx;
  312. font-family: PingFang SC;
  313. font-weight: 400;
  314. color: #666666;
  315. line-height: 24rpx;
  316. }
  317. }
  318. }
  319. .list_li_r{
  320. width: 222rpx;
  321. display: flex;
  322. justify-content: space-between;
  323. align-items: center;
  324. .minus{
  325. width: 96rpx;
  326. height: 96rpx;
  327. >img{
  328. width: 36rpx;
  329. height: 36rpx;
  330. margin-top: 30rpx;
  331. margin-left: 30rpx;
  332. }
  333. }
  334. .add{
  335. width: 96rpx;
  336. height: 96rpx;
  337. >img{
  338. width: 36rpx;
  339. height: 36rpx;
  340. margin-top: 30rpx;
  341. margin-left: 30rpx;
  342. }
  343. }
  344. >input{
  345. text-align: center;
  346. width: 90rpx;
  347. font-size: 28rpx;
  348. font-family: PingFang SC;
  349. font-weight: 500;
  350. color: #333333;
  351. line-height: 36rpx;
  352. }
  353. }
  354. }
  355. }
  356. }
  357. .empty{
  358. width: 710rpx;
  359. height: 700rpx;
  360. background: #FFFFFF;
  361. border-radius: 20px;
  362. text-align: center;
  363. margin:20rpx;
  364. >img{
  365. width: 430rpx;
  366. height: 280rpx;
  367. margin-left: 142rpx;
  368. margin-top: 72rpx;
  369. }
  370. >view{
  371. margin-top: 48rpx;
  372. >text{
  373. display: block;
  374. font-size: 24rpx;
  375. font-family: PingFang SC;
  376. font-weight: 500;
  377. color: #999999;
  378. line-height: 44rpx;
  379. }
  380. }
  381. }
  382. /* 按钮 */
  383. .sub_btn{
  384. width: 750rpx;
  385. height: 120rpx;
  386. background: #FFFFFF;
  387. position: fixed;
  388. bottom: 0;
  389. display: flex;
  390. justify-content: space-between;
  391. align-items: center;
  392. padding: 0 20rpx 0 40rpx;
  393. box-sizing: border-box;
  394. z-index: 1000;
  395. .sub_btn_l{
  396. font-size: 28rpx;
  397. font-family: PingFang SC;
  398. font-weight: 500;
  399. color: #333333;
  400. line-height: 120rpx;
  401. flex: 1;
  402. }
  403. .sub_btn_r{
  404. width: 200rpx;
  405. height: 70rpx;
  406. background: #0183FA;
  407. border-radius: 35rpx;
  408. font-size: 28rpx;
  409. font-family: PingFang SC;
  410. font-weight: 500;
  411. color: #FFFFFF;
  412. line-height: 70rpx;
  413. text-align: center;
  414. }
  415. }
  416. .sub_btn2{
  417. width: 750rpx;
  418. height: 120rpx;
  419. background: #FFFFFF;
  420. position: fixed;
  421. bottom: 0;
  422. display: flex;
  423. justify-content: space-between;
  424. align-items: center;
  425. padding: 0 20rpx 0 40rpx;
  426. box-sizing: border-box;
  427. z-index: 1000;
  428. .sub_btn_l{
  429. font-size: 28rpx;
  430. font-family: PingFang SC;
  431. font-weight: 500;
  432. color: #CCCCCC;
  433. line-height: 120rpx;
  434. flex: 1;
  435. }
  436. .sub_btn_r{
  437. width: 200rpx;
  438. height: 70rpx;
  439. background: #E0E0E0;
  440. border-radius: 35rpx;
  441. font-size: 28rpx;
  442. font-family: PingFang SC;
  443. font-weight: 500;
  444. color: #999999;
  445. line-height: 70rpx;
  446. text-align: center;
  447. }
  448. }
  449. }
  450. </style>