orderGood_body.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
  6. <title>询价物料</title>
  7. <link rel="stylesheet" href="../../css/api.css"/>
  8. <link rel="stylesheet" href="../../css/aui.css"/>
  9. <link rel="stylesheet" href="../../css/weui.min.css"/>
  10. <link rel="stylesheet" href="../../css/html.css"/>
  11. <link rel="stylesheet" href="../../css/xunjia_wuliao.css"/>
  12. <!--<script type="text/javascript" src="../../script/rem.js"></script>-->
  13. <style>
  14. #app {
  15. padding-bottom: 3rem;
  16. }
  17. .weui_cell:before {
  18. border-top: 0px !important;
  19. }
  20. .weui_btn {
  21. border-radius: 0px !important;
  22. }
  23. </style>
  24. </head>
  25. <body>
  26. <div id="app" v-cloak>
  27. <zmqalert v-bind:info = "alertInfo" v-on:donechoose="alertBtn"></zmqalert>
  28. <article style="bottom: 0;">
  29. <div class="weui_cells weui_cells_access zmq-width-90 zmq-bg-transparent" v-if="frameType == 0">
  30. <a class="weui_cell zmq-margin-top-10 zmq-bg-white zmq-radius-10" href="javascript:;" v-for="(store,index) in list">
  31. <div class="weui_cell_bd weui_cell_primary">
  32. <div class="wuliao-title zmq-border-bottom-1">
  33. <label class="zmq-text-msg">商品编码:{{store.bizGoodsDto.serialNumber}}</label>
  34. <!--<span class="zmq-text-msg" >-{{store.statusName}}</span>-->
  35. <span class="require zmq-line-1 zmq-float-right zmq-position-absolute">总库存:<label class="zmq-text-msg">{{store.tatalStock}}</label></span>
  36. </div>
  37. <div class="wuliao-title">
  38. <label class="zmq-text-font-06 zmq-margin-vertical-5">{{store.bizGoodsDto.comName}}</label>
  39. </div>
  40. <div class="detail clearfix">
  41. <span class="date zmq-text-explain">上架时间:{{store.createTime}}</span>
  42. <div class="org">
  43. <label v-if="store.isok == true" class="zmq-btn-border zmq-btn-border-done zmq-btn-img" v-on:click="controlThis(store,index)">已添加</label>
  44. <label v-else class="zmq-btn-border zmq-text-msg" v-on:click="controlThis(store,index)">入库</label>
  45. </div>
  46. </div>
  47. </div> </a>
  48. </div>
  49. <div class="weui_cells weui_cells_access zmq-width-90 zmq-bg-transparent" v-else-if="frameType == 1">
  50. <a class="weui_cell zmq-margin-top-10 zmq-bg-white zmq-radius-10" href="javascript:;" v-for="(store,index) in list">
  51. <div class="weui_cell_bd weui_cell_primary">
  52. <div class="wuliao-title zmq-border-bottom-1">
  53. <label class="zmq-text-msg">商品编码:{{store.bizGoodsDto.serialNumber}}</label>
  54. <!--<span class="zmq-text-msg" >-{{store.goodsType}}</span>-->
  55. <span class="require zmq-line-1 zmq-float-right zmq-position-absolute">总库存:<label class="zmq-text-msg">{{store.tatalStock}}</label></span>
  56. </div>
  57. <div class="wuliao-title">
  58. <label class="zmq-text-font-06 zmq-margin-vertical-5">{{store.bizGoodsDto.comName}}</label>
  59. </div>
  60. <div class="detail clearfix">
  61. <span class="date zmq-text-explain">上架时间:{{store.createTime}}</span>
  62. <div class="org">
  63. <label v-if="store.isok == true" class="zmq-btn-border-done zmq-btn-img zmq-btn-border" v-on:click="controlThis(store,index)">已添加</label>
  64. <label v-else class="zmq-btn-border zmq-text-msg" v-on:click="controlThis(store,index)">出库</label>
  65. </div>
  66. </div>
  67. </div> </a>
  68. </div>
  69. <div class="weui_cells weui_cells_access zmq-width-90 zmq-bg-transparent" v-else-if="frameType == 2">
  70. <a class="weui_cell zmq-margin-top-10 zmq-bg-white zmq-radius-10" href="javascript:;" v-for="(storeType,index) in list">
  71. <div class="weui_cell_bd weui_cell_primary">
  72. <div class="wuliao-title">
  73. <label class="zmq-text-msg zmq-text-font-07">{{storeType.typeName}}</label>
  74. </div>
  75. <div class="detail clearfix">
  76. <span class="date zmq-text-font-06">创建时间:{{storeType.createTime}}</span>
  77. </div>
  78. </div> </a>
  79. </div>
  80. <div class="weui_cells weui_cells_access zmq-width-90 zmq-bg-transparent" v-else-if ="frameType == 5">
  81. <a class="weui_cell zmq-margin-top-10 zmq-bg-white zmq-radius-10" href="javascript:;" v-for="(supplier,index) in list">
  82. <div class="weui_cell_bd weui_cell_primary">
  83. <div class="wuliao-title">
  84. <label class="zmq-text-msg zmq-text-font-07 zmq-padding-vertical-5">{{supplier.supplierName}}</label>
  85. </div>
  86. <div class="wuliao-title zmq-border-top-1">
  87. <label class="zmq-text-black zmq-text-font-06 zmq-margin-vertical-5">{{supplier.contacts}}-{{supplier.phone}}</label>
  88. </div>
  89. <div class="detail clearfix">
  90. <span class="date zmq-text-explain zmq-text-font-06">{{supplier.site}}</span>
  91. </div>
  92. </div> </a>
  93. </div>
  94. </article>
  95. <img class="zmq-img-nodata" v-show="hasData == false" src="../../image/nodata.png" />
  96. <div v-show="upLock == false" class="zmq-text-explain zmq-margin-top-10 zmq-textAlign-center zmq-margin-bottom-10 zmq-block-text">
  97. 已无更多数据
  98. </div>
  99. <footer v-show="frameType < 2">
  100. <div class="button zmq-bg-white zmq-padding-vertical-5">
  101. <div class="bd">
  102. <a href="javascript:void(0);" class="zmq-textAlign-center zmq-text-white zmq-width-90 zmq-btn-img zmq-padding-btn" v-on:click="sumbilt">提交{{frameTitle[frameType]}}({{hasChooseThisArr.length}})</a>
  103. </div>
  104. </div>
  105. </footer>
  106. </div>
  107. </body>
  108. <script type="text/javascript" src="../../script/api.js"></script>
  109. <script type="text/javascript" src="../../script/aui-scroll.js"></script>
  110. <script type="text/javascript" src="../../script/vue.js"></script>
  111. <script type="text/javascript" src="../../script/httpRequest.js"></script>
  112. <script type="text/javascript" src="../../script/vue_plugins.js"></script>
  113. <script type="text/javascript">
  114. var vm = '', type = '';
  115. apiready = function() {
  116. type = api.pageParam.type;
  117. vm = new Vue({
  118. el : '#app',
  119. data : {
  120. // 页面类别
  121. frameTitle : ["入库", "出库"],
  122. frameType : '',
  123. retariler_id : '',
  124. // 获取商品类别
  125. getStoreTypeUrl : 'getStoreTypeUrl',
  126. addTypeUrl : 'addStoreTypeUrl',
  127. // 获取供应商列表
  128. getSupplierUrl : 'getSupplierUrl',
  129. // 获取的列表信息
  130. list : [],
  131. // 获取库存url
  132. getStockUrl : 'getKucunInfoUrl',
  133. type : '',
  134. hasChooseThisArr : [], // 已经选择商品
  135. // 弹出框信息
  136. alertInfo : {
  137. show : false,
  138. title : '请输入类别名称',
  139. showMsg : true,
  140. msg : '',
  141. content : '',
  142. },
  143. // 是否有数据
  144. hasData : false,
  145. // 分页查询
  146. upLock : true,
  147. current : 1,
  148. total : 1,
  149. },
  150. methods : {
  151. init : function() {
  152. var _this = this;
  153. this.retariler_id = $api.getStorage("retailerid");
  154. this.frameType = type;
  155. this.addEvent("refushView", function() {
  156. _this.funcByType();
  157. _this.hasChooseThisArr = [];
  158. });
  159. this.configHeaderRefush(function() {
  160. _this.upLock = true;
  161. _this.current = 1;
  162. _this.downData = 'down';
  163. _this.funcByType();
  164. })
  165. // 根据frameType获取页面信息
  166. _this.funcByType();
  167. this.configBottomRefush(function(status) {
  168. if (_this.hasData == true) {
  169. // 开启上拉加载
  170. if (_this.total > _this.current) {
  171. _this.downData = 'up';
  172. _this.current = _this.current + 1;
  173. _this.funcByType();
  174. } else {
  175. // 上啦没有数据了
  176. _this.upLock = false;
  177. }
  178. }
  179. })
  180. },
  181. // 根据页面type调用方法
  182. funcByType : function() {
  183. switch (this.frameType) {
  184. case 0 :
  185. this.getStoreList();
  186. break;
  187. case 1 :
  188. this.getStoreList();
  189. break;
  190. case 2 :
  191. this.getStore();
  192. break;
  193. case 3 :
  194. this.getStore();
  195. break;
  196. case 4 :
  197. this.getStore();
  198. break;
  199. case 5 :
  200. this.getSupplier();
  201. break;
  202. default :
  203. break;
  204. }
  205. },
  206. // 获取商品列表
  207. getStoreList : function() {
  208. var data = {
  209. retailerId : this.retariler_id,
  210. current : this.current,
  211. }, _this = this;
  212. this.$post(this.getStockUrl, data, function(ret) {
  213. if (ret.code == 0) {
  214. _this.total = ret.page.pages;
  215. if (_this.downData == 'up') {
  216. _this.list = _this.list.concat(ret.page.records);
  217. } else {
  218. _this.list = ret.page.records;
  219. if (_this.list.length > 0) {
  220. _this.hasData = true;
  221. }
  222. }
  223. }
  224. })
  225. },
  226. // 获取商品类别列表
  227. getStore : function() {
  228. var data = {
  229. retailer_id : this.retariler_id,
  230. url : 'json',
  231. type : 'body'
  232. }, url = this.getStoreTypeUrl, _this = this;
  233. this.requestAjax(data, url, function(ret) {
  234. _this.list = ret.list;
  235. if (ret.list.length > 0) {
  236. _this.hasData = true;
  237. }
  238. })
  239. },
  240. // 获取供应商列表
  241. getSupplier : function() {
  242. var data = {
  243. retailer_id : this.retariler_id,
  244. url : 'json',
  245. type : 'body'
  246. }, url = this.getSupplierUrl, _this = this;
  247. this.requestAjax(data, url, function(ret) {
  248. _this.list = ret.list;
  249. if (ret.list.length > 0) {
  250. _this.hasData = true;
  251. }
  252. })
  253. },
  254. // 添加一个商品类别
  255. chooseThis : function(name) {
  256. var data = {
  257. retailerId : this.retariler_id,
  258. typeName : name,
  259. url : 'json',
  260. type : 'body'
  261. }, url = this.addTypeUrl, _this = this;
  262. // this.showModal("添加提示", "是否添加该类别?", ["确认", "取消"], function(index) {
  263. // if (index == 1) {
  264. _this.requestAjax(data, url, function(ret) {
  265. api.toast({
  266. msg : '添加类别成功'
  267. });
  268. setTimeout(function() {
  269. _this.getStore();
  270. // 告诉添加商品页面已完善类别
  271. _this.sendEvent("refushModel");
  272. }, 200);
  273. })
  274. // };
  275. // })
  276. },
  277. // 添加商品类别
  278. add : function() {
  279. var _this = this;
  280. // this.showPromt("添加类别", "请输入库存名称", ["确认", "取消"], function(ret) {
  281. // if (ret.buttonIndex == 1) {
  282. //
  283. // }
  284. // })
  285. this.alertInfo.show = true;
  286. },
  287. // 点击了弹出层的按钮
  288. alertBtn : function(type) {
  289. this.chooseThis(this.alertInfo.content);
  290. },
  291. // 点击进货出货
  292. controlThis : function(good, index) {
  293. var _this = this;
  294. var title = this.frameTitle[this.frameType];
  295. //this.showPromt(title + "提示", "请输入" + title + '数量,单价默认为1元', ["确认", "取消"], function(ret) {
  296. //if (ret.buttonIndex == 1) {
  297. if (_this.list[index].isok == false || typeof _this.list[index].isok == 'undefined') {
  298. _this.$set(_this.list[index], "isok", true);
  299. _this.hasChooseThisArr.push(good);
  300. } else {
  301. var gi = _this.hasChooseThisArr.indexOf(good);
  302. _this.$set(_this.list[index], "isok", false);
  303. _this.hasChooseThisArr.splice(gi, 1);
  304. }
  305. //}
  306. //})
  307. },
  308. // 提交 -- 跳转扫码之后的页面
  309. sumbilt : function() {
  310. // 将this.hasChooseThisArr为null的剔除掉
  311. if(this.hasChooseThisArr.length == 0){
  312. api.toast({
  313. msg:'请先选择商品'
  314. });
  315. return;
  316. }
  317. var page = {
  318. content : JSON.stringify(this.hasChooseThisArr),
  319. type : this.frameType,
  320. page : 'nnn', // 页面进销存进入的
  321. }
  322. this.goWin("orderPlace_win", "orderPlace_win.html", page)
  323. },
  324. // 请求链接
  325. requestAjax : function(data, url, callback) {
  326. var _this = this;
  327. this.$post(url, data, function(ret) {
  328. if (ret.code == 0) {
  329. callback(ret);
  330. }
  331. })
  332. }
  333. },
  334. mounted : function() {
  335. this.init();
  336. }
  337. })
  338. }
  339. function goWin(winName) {
  340. api.openWin({
  341. name : winName,
  342. url : './' + winName + '.html'
  343. });
  344. }
  345. function add() {
  346. // 添加了
  347. if (type == 2) {
  348. vm.add();
  349. } else if (type == 5) {
  350. goWin("addSupplier_win");
  351. }
  352. }
  353. </script>
  354. </html>