moneyList.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  6. <meta name="apple-mobile-web-app-capable" content="yes">
  7. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  8. <title>账户管理</title>
  9. <link href="../../../css/mui.min.css" rel="stylesheet" />
  10. <link href="../../../css/OA-style.css" rel="stylesheet" />
  11. <!--<style>
  12. /*跨webview需要手动指定位置*/
  13. .mui-plus header.mui-bar {display: none!important;}
  14. .mui-plus .mui-bar-nav~.mui-content {padding: 0!important;}
  15. .mui-plus .plus{display: inline;}
  16. .plus{display: none;}
  17. #topPopover {position: fixed;top: 16px;right: 6px;}
  18. #topPopover .mui-popover-arrow {left: auto;right: 6px;}
  19. p {text-indent: 22px;}
  20. span.mui-icon {font-size: 14px;color: #007aff;margin-left: -15px;padding-right: 10px;}
  21. .mui-popover {height: 80px;}
  22. .mui-content {padding: 10px;}
  23. .mui-btn, button, input[type=button], input[type=reset], input[type=submit]{padding: 1px 5px;}
  24. </style>-->
  25. </head>
  26. <body>
  27. <header class="mui-bar mui-bar-nav" id="login">
  28. <a href="" class="mui-action-back back mui-pull-left"><img src="../../../images/back.png"></a>
  29. <h1 class="mui-title" id="title">账户管理</h1>
  30. <a id="menu" class="mui-action-menu mui-icon mui-pull-right" href="#topPopover"><img src="../../../images/dd_search.png" style="width: 25px;margin-top: -2px;"></a>
  31. </header>
  32. <div class="mui-content" >
  33. <!--<div class="mui-input-row" style="margin:0px 0 0px 10px;position: relative; top: 15px;">
  34. <input type="text" id="searchname" style="width: 80%;" placeholder="账户名称"/>&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" style="width: 15%;" id="search" value="搜索"/><br />
  35. </div>-->
  36. <div id="pullrefresh" class="mui-content mui-scroll-wrapper" style="">
  37. <div class="zhgl_div1" v-for="item in items">
  38. <div class="mydd_div8">
  39. <div class="mydd_div1">{{item.name}} </div>
  40. </div>
  41. <div class="mydd_div3">
  42. <div class="mydd_div4"></div>
  43. <div class="mydd_div5">补贴余额:
  44. <br><span class="zhgl_span">普通余额:</span>
  45. </div>
  46. <div class="mydd_div6">¥{{item.allowance}}
  47. <br><span class="zhgl_span1">¥{{item.moneys}}</span>
  48. </div>
  49. </div>
  50. <div class="zhgl_div">
  51. <button type="button" id="perorder" @tap="perorder(item)" class="mui-btn mui-btn-outlined">账户明细</button>
  52. <button type="button" id="del" @tap="addmoney(item)" class="mui-btn mui-btn-outlined">个人打款</button>
  53. <button type="button" id="del" @tap="delmoney(item)" class="mui-btn mui-btn-danger mui-btn-outlined">扣款</button>
  54. </div>
  55. </div>
  56. <!--右上角弹出菜单-->
  57. <div id="topPopover" class="mui-popover">
  58. <div class="mui-popover-arrow"></div>
  59. <div class="mui-scroll-wrapper">
  60. <div class="mui-scroll">
  61. <ul class="mui-table-view">
  62. <li class="mui-table-view-cell">
  63. <a href="#" >
  64. <div class="mui-input-row mui-search" @tap="search()">
  65. <input type="search" id="searchname" class="mui-input-clear" placeholder="账户名称">
  66. </div>
  67. </a>
  68. </li>
  69. <li class="mui-button-row">
  70. <button type="button" class="mui-btn mui-btn-primary" id="save">查找</button>&nbsp;&nbsp;
  71. <button type="button" class="mui-btn mui-btn-primary" id="saveall">查找全部</button>
  72. </li>
  73. </ul>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. <script type="text/javascript" src="../../../js/jquery-1.11.2.min.js"></script>
  79. <script src="../../../js/mui.min.js"></script>
  80. <script src="../../../js/config.js"></script>
  81. <script src="../../../js/app.js"></script>
  82. <script src="../../../js/dj/article/list.js"></script>
  83. <script src="../../../js/vue.min.js"></script>
  84. <script>
  85. var pageDetail = null;
  86. mui.init({
  87. pullRefresh: {
  88. container: '#pullrefresh',
  89. down: {
  90. style: 'circle', //必选,下拉刷新样式,目前支持原生5+ ‘circle’ 样式
  91. color: '#2BD009', //可选,默认“#2BD009” 下拉刷新控件颜色
  92. height: '50px', //可选,默认50px.下拉刷新控件的高度,
  93. range: '100px', //可选 默认100px,控件可下拉拖拽的范围
  94. offset: '0px', //可选 默认0px,下拉刷新控件的起始位置
  95. // auto: true, //可选,默认false.首次加载自动上拉刷新一次
  96. callback: reloadNews //必选,刷新函数,根据具体业务来编写,比如通过ajax从服务器获取新数据;
  97. },
  98. up: {
  99. contentrefresh: '正在加载...',
  100. auto: true, //可选,默认false.自动上拉加载一次
  101. callback: pullupRefresh
  102. }
  103. },
  104. statusBarBackground: '#FFFFFF', //设置状态栏颜色,仅iOS可用
  105. // preloadLimit:5,
  106. });
  107. var vmA = new Vue({
  108. el: '#pullrefresh',
  109. data: {
  110. items: [] //列表信息流数据
  111. }
  112. });
  113. /**
  114. * 下拉刷新具体业务实现
  115. */
  116. function reloadNews() {
  117. pageNo = 1;
  118. vmA.items = [];
  119. // var table = document.body.querySelector('.mui-table-view');
  120. // table.innerHTML = "";
  121. addData();
  122. }
  123. var pageNo = 1;
  124. var type = 0;
  125. /**
  126. * 上拉加载具体业务实现
  127. */
  128. function pullupRefresh() {
  129. addData();
  130. }
  131. function addData() {
  132. var url = API.API_URL();
  133. var serviceId = "oa_2017V001PHONE_moneyList";
  134. var state = app.getState(); //获取登陆信息
  135. var searchname=null;
  136. /*var staffId = state.user.useId;
  137. var unitId = state.user.unitId;
  138. var notice_title = "";*/
  139. var obj = {
  140. /*unitId: unitId,
  141. userId: staffId,
  142. notice_title: notice_title,*/
  143. searchname:searchname,
  144. type: type,
  145. pSize: APP.PageSize,
  146. p: pageNo
  147. };
  148. app.ajax(serviceId,obj, function(data) {
  149. //服务器返回响应
  150. console.log(JSON.stringify(data))
  151. var result = data.returnParams;
  152. var totalRow = data.total;
  153. var totalPage = Math.ceil(totalRow / APP.PageSize);
  154. if(totalPage == 0){
  155. totalPage =1;
  156. }
  157. var list = data.list;
  158. if(list.length > 0) {
  159. vmA.items = vmA.items.concat(convert(list));
  160. }
  161. mui('#pullrefresh').pullRefresh().endPullupToRefresh(totalPage == pageNo); //参数为true代表没有更多数据了。
  162. if(pageNo == 1 && totalPage>1) {
  163. mui('#pullrefresh').pullRefresh().endPulldown();
  164. mui('#pullrefresh').pullRefresh().refresh(true);
  165. }
  166. if(totalPage == 1 ){
  167. mui('#pullrefresh').pullRefresh().endPulldown();
  168. }
  169. pageNo = pageNo + 1;
  170. });
  171. }
  172. /**
  173. * 1、将服务端返回数据,转换成前端需要的格式
  174. * 2、若服务端返回格式和前端所需格式相同,则不需要改功能
  175. *
  176. * @param {Array} items
  177. */
  178. function convert(items) {
  179. var newItems = [];
  180. items.forEach(function(item) {
  181. if(item.moneys == "" || item.moneys == null){
  182. item.moneys=0.0;
  183. }
  184. if(item.allowance == "" || item.allowance == null){
  185. item.allowance=0.0;
  186. }
  187. newItems.push({
  188. universalid: item.universalid,
  189. name: item.name,
  190. allowance: item.allowance,
  191. moneys: item.moneys,
  192. /*content: item.noticecontent == null ? "" : item.noticecontent.substr(0, 70),
  193. name : item.name,
  194. isread: item.if_read,*/
  195. });
  196. });
  197. return newItems;
  198. }
  199. mui.plusReady(function() {
  200. var self = plus.webview.currentWebview();
  201. type = self.type;
  202. var title1 = mui('#title');
  203. title1[0].innerHTML = self.name;
  204. //接收上个界面传递的参数
  205. window.addEventListener('listEvent', function(event) {
  206. location.reload();
  207. });
  208. // pageDetail = mui.preload({
  209. // url: 'detailList.html',
  210. // id: 'detailList.html',
  211. // })
  212. });
  213. window.addEventListener('refresh', function(e){//执行刷新
  214. location.reload();
  215. });
  216. /**
  217. * 打开详情
  218. *
  219. * @param {Object} item
  220. */
  221. // function open_detail(item) {
  222. // //触发子窗口变更详情
  223. //// mui.fire(pageDetail, 'newsEvent', {
  224. //// articleId: item.articleId
  225. //// });
  226. //
  227. //// setTimeout(function() {
  228. //// pageDetail.show("slide-in-right", 300);
  229. //// }, 150);
  230. // mui.openWindow({
  231. // url: 'noticeInfo.html',
  232. // id: 'noticeInfo.html',
  233. // extras:{'notice_id':item.id}
  234. // })
  235. //
  236. // }
  237. //搜索提交按钮
  238. // var search = document.getElementById("search");
  239. // search.addEventListener("click", function() {
  240. document.getElementById("save").addEventListener('click',function(){
  241. var url = API.API_URL();
  242. var searchname=$("#searchname").val();
  243. var serviceId = "oa_2017V001PHONE_moneyList";
  244. var obj = {
  245. searchname: searchname,
  246. pSize: APP.PageSize,
  247. p: 1
  248. };
  249. app.ajax(serviceId,obj, function(data) {
  250. //服务器返回响应
  251. console.log(JSON.stringify(data))
  252. mui.toast("查找成功");
  253. var result = data.returnParams;
  254. var list = data.list;
  255. console.log(list.length);
  256. vmA.items = [];
  257. if(list.length > 0) {
  258. vmA.items = vmA.items.concat(convert(list));
  259. }
  260. mui(".mui-popover").popover("toggle");
  261. });
  262. });
  263. //查找全部
  264. document.getElementById("saveall").addEventListener('click',function(){
  265. vmA.items = [];
  266. var url = API.API_URL();
  267. var serviceId = "oa_2017V001PHONE_moneyList";
  268. var state = app.getState(); //获取登陆信息
  269. var searchname=null;
  270. /*var staffId = state.user.useId;
  271. var unitId = state.user.unitId;
  272. var notice_title = "";*/
  273. var obj = {
  274. /*unitId: unitId,
  275. userId: staffId,
  276. notice_title: notice_title,*/
  277. searchname:searchname,
  278. type: type,
  279. pSize: APP.PageSize,
  280. p: 1
  281. };
  282. app.ajax(serviceId,obj, function(data) {
  283. //服务器返回响应
  284. console.log(JSON.stringify(data))
  285. var result = data.returnParams;
  286. var totalRow = data.total;
  287. var totalPage = Math.ceil(totalRow / APP.PageSize);
  288. var list = data.list;
  289. console.log(list.length);
  290. if(list.length > 0) {
  291. vmA.items = vmA.items.concat(convert(list));
  292. }
  293. pageNo = endPull(totalPage, pageNo);
  294. mui(".mui-popover").popover("toggle");
  295. });
  296. });
  297. //账户明细
  298. function perorder(item) {
  299. mui.openWindow({
  300. url: '../myrecord/otherrecordList.html',
  301. //id: '../myrecord/myrecordList.html',
  302. extras:{'universalid':item.universalid,"name":"个人账单"}
  303. })
  304. }
  305. //账户扣款
  306. function delmoney(item) {
  307. var btnArray=['取消','继续'];
  308. var btnArray2=['取消','扣款'];
  309. mui.prompt("本月离开天数","","",btnArray,function(e){
  310. if(e.index==0){
  311. }else {
  312. var leaveday=e.value;
  313. mui.prompt("每日补贴金额","","",btnArray2,function(f){
  314. if(f.index==0){
  315. }else {
  316. var perdaymoney=f.value;
  317. var universalid=item.universalid;
  318. var serviceId = "oa_2017V001PHONE_moneyOperation";
  319. var obj = {
  320. type:2,
  321. perdaymoney: perdaymoney,
  322. universalid:universalid,
  323. leaveday:leaveday,
  324. };
  325. app.ajax(serviceId,obj, function(data) {
  326. //服务器返回响应
  327. console.log(JSON.stringify(data))
  328. if(data.boo == true) {
  329. alert('扣款成功');
  330. location.reload();
  331. }else{
  332. alert('扣款失败');
  333. }
  334. });
  335. }
  336. },'div');
  337. }
  338. },'div');
  339. }
  340. //个人账户打款
  341. function addmoney(item) {
  342. var btnValue=['普通余额','补贴余额'];
  343. var btnArray1=['取消','打款'];
  344. mui.confirm("选择充值账户","",btnValue,function(c){
  345. if(c.index==0){
  346. mui.prompt("充值金额","","",btnArray1,function(e){
  347. if(e.index==0){
  348. }else {
  349. var chongzhi=e.value;
  350. var universalid=item.universalid;
  351. var serviceId = "oa_2017V001PHONE_moneyOperation";
  352. var obj = {
  353. type:3,
  354. chongzhi: chongzhi,
  355. universalid:universalid,
  356. };
  357. app.ajax(serviceId,obj, function(data) {
  358. //服务器返回响应
  359. console.log(JSON.stringify(data))
  360. if(data.boo == true) {
  361. alert('打款成功');
  362. location.reload();
  363. }else{
  364. alert('打款失败');
  365. }
  366. });
  367. }
  368. },'div');
  369. }else {
  370. mui.prompt("充值金额","","",btnArray1,function(f){
  371. if(f.index==0){
  372. }else {
  373. var chongzhi=f.value;
  374. var universalid=item.universalid;
  375. var serviceId = "oa_2017V001PHONE_moneyOperation";
  376. var obj = {
  377. type:5,
  378. chongzhi: chongzhi,
  379. universalid:universalid,
  380. };
  381. app.ajax(serviceId,obj, function(data) {
  382. //服务器返回响应
  383. console.log(JSON.stringify(data))
  384. if(data.boo == true) {
  385. alert('打款成功');
  386. location.reload();
  387. }else{
  388. alert('打款失败');
  389. }
  390. });
  391. }
  392. },'div');
  393. }
  394. },'div');
  395. }
  396. </script>
  397. </body>
  398. </html>