getStoreNet_body.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467
  1. <!DOCTYPE html>
  2. <html class="">
  3. <!--STATUS OK-->
  4. <head>
  5. <meta name="referrer" content="always" />
  6. <meta charset='utf-8' />
  7. <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
  8. <meta name="description" content="">
  9. <meta name="format-detection" content="telephone=no" />
  10. <link rel="stylesheet" type="text/css" href="css/vant-ui.css" />
  11. <link rel="stylesheet" type="text/css" href="css/iconfont.css">
  12. <link rel="stylesheet" type="text/css" href="css/main.css" />
  13. <script src="js/vue.js"></script>
  14. <script src="js/vant-ui.js"></script>
  15. <script src="js/main.js"></script>
  16. <link rel="stylesheet" href="./mescroll/mescroll.min.css">
  17. <title></title>
  18. </head>
  19. <style>
  20. .cartNum {
  21. z-index: 2222;
  22. font-size: .3rem;
  23. text-align: center;
  24. color: #f00;
  25. font-weight: 500;
  26. }
  27. .gouwuche .caigouBg .caigouBgPix {
  28. background-color: #00a0ea !important;
  29. }
  30. .downOrder {
  31. width: 0.5rem;
  32. height: 0.5rem;
  33. margin-right: 0.3rem;
  34. margin-top: 0.3rem;
  35. }
  36. .gouwuche .caigouBg ul li {
  37. height: 2rem;
  38. }
  39. .searchSpec {
  40. z-index: 1111;
  41. width: 85%;
  42. height: 1rem;
  43. }
  44. .search {
  45. top: 0rem;
  46. }
  47. .search {
  48. width: 100%;
  49. background: #00a0ea;
  50. height: 0.9rem;
  51. padding-left: 0.36rem;
  52. padding-right: 0.36rem;
  53. }
  54. .search .searchbox input {
  55. width: 100%;
  56. font-size: 0.3rem;
  57. display: block;
  58. color: #999;
  59. height: 100%;
  60. position: relative;
  61. padding-left: 5%;
  62. padding-right: 5%;
  63. background: none;
  64. border: 0;
  65. outline: none;
  66. margin-top: 0.1rem;
  67. }
  68. .searchbox {
  69. background-color: #fff;
  70. display: flex;
  71. padding: 0.1rem;
  72. width: 100%;
  73. border-radius: 5px;
  74. }
  75. .gouwuche .caigouBg .caigouBgPix {
  76. padding: 0;
  77. }
  78. .setp .right,
  79. .setp .left {
  80. width: 0.7rem;
  81. height: 0.7rem;
  82. }
  83. .setp {
  84. width: 2rem;
  85. height: 0.7rem;
  86. }
  87. </style>
  88. <body>
  89. <div id="app" style="overflow : scroll;">
  90. <div class="pageView gouwuche" style="padding-top : 0px;position:relative;overflow : scroll">
  91. <div class="caigouBg">
  92. <div class="fixBor cartNum" v-on:click="goCar">
  93. {{ cartNums }}
  94. </div>
  95. <div class="caigouBgPix flex a-center" style="flex-wrap: wrap;">
  96. <div class="searchSpec">
  97. <div class="search flex a-center">
  98. <div class="searchbox">
  99. <svg t="1589079341958" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5394" width="22" height="22">
  100. <path d="M883.626667 823.04l-145.066667-144.64A337.92 337.92 0 0 0 810.666667 469.333333a341.333333 341.333333 0 1 0-341.333334 341.333334 337.92 337.92 0 0 0 209.066667-72.106667l144.64 145.066667a42.666667 42.666667 0 0 0 60.586667 0 42.666667 42.666667 0 0 0 0-60.586667zM213.333333 469.333333a256 256 0 1 1 256 256 256 256 0 0 1-256-256z" p-id="5395" fill="#bfbfbf"></path>
  101. </svg>
  102. <input type="search" placeholder="请输入轮胎规格" v-model="keyword">
  103. </div>
  104. </div>
  105. </div>
  106. <div class="item flex a-center j-center" v-on:click="chooseAndtion(2)" style="width:15%;padding-right: 10px;">
  107. {{ chooseHW.name || '花纹' }} <i class="iconfont icon-xia"></i>
  108. </div>
  109. <!-- <div class="item flex a-center j-center">
  110. {{ choosePPone || '品牌' }}
  111. </div>
  112. <div class="fgx"></div> -->
  113. <!-- <div class="item flex a-center j-center" v-on:click="chooseAndtion(1)">
  114. {{ chooseGG.name || '规格' }} <i class="iconfont icon-xia"></i>
  115. </div>
  116. <div class="fgx"></div> -->
  117. <!-- <div class="item flex a-center j-center" v-on:click="chooseAndtion(2)">
  118. {{ chooseHW.name || '花纹' }} <i class="iconfont icon-xia"></i>
  119. </div> -->
  120. </div>
  121. <ul style="overflow : scroll;margin-top : 0.76rem" class="mescroll" v-show="list.length > 0" id="mescroll">
  122. <li class="flex col" v-for="(item,index) in list" :key="index">
  123. <div class="flex libox">
  124. <div class="info">
  125. <h4>{{ item.maktx }}</h4>
  126. <span>{{ item.pinpai }}</span>
  127. <div class="flex a-center jlr">
  128. <!-- <div class="kuchun">
  129. 有货:1000
  130. </div> -->
  131. <div class="setp flex jlr a-center">
  132. <div class="left flex a-center j-center" v-on:click="minusSign(index,0)">
  133. -
  134. </div>
  135. <div class="value flex a-center j-center">
  136. <input type="number" style="width:0.8rem;text-align:center;border:none" v-model="item.purchaseNumber" />
  137. </div>
  138. <div class="right flex a-center j-center" v-on:click="minusSign(index,1)">
  139. +
  140. </div>
  141. </div>
  142. </div>
  143. </div>
  144. <div class="flex a-center">
  145. <div class="item flex a-center j-center active" v-on:click="addStoreCar(index)">
  146. <img class="downOrder" src="./image/bottombtn0202.png" />
  147. </div>
  148. <div class="item flex a-center j-center" v-on:click="buyStore(index)">
  149. <img class="downOrder" src="./image/downOrder.png" />
  150. </div>
  151. </div>
  152. </div>
  153. <div class="timer flex a-center">
  154. <!--活动倒计时: 10:20:36-->
  155. </div>
  156. </li>
  157. </ul>
  158. <div v-show="list.length == 0" style="text-align:center">
  159. <img src="./image/noData.png" style="margin:2rem auto" />
  160. </div>
  161. </div>
  162. </div>
  163. </div>
  164. </body>
  165. <script type="text/javascript" src="../script/aui-scroll.js"></script>
  166. <script type="text/javascript" src="./mescroll/mescroll.min.js"></script>
  167. <script type="text/javascript" src="../script/api.js"></script>
  168. <script type="text/javascript" src="../script/httpRequest.js"></script>
  169. <script type="text/javascript" src="../script/vue_plugins.js"></script>
  170. <script type="text/javascript">
  171. apiready = function() {
  172. new Vue({
  173. el: '#app',
  174. data: {
  175. list: [],
  176. userId: '',
  177. kunnr: '',
  178. cartNums: '', // 购物车数量
  179. size: 10,
  180. current: 1,
  181. totalPages: 1, // 总页数
  182. mescroll: '',
  183. frist: 1,
  184. mescroll: '',
  185. brandList: [],
  186. guigeList: [],
  187. huawenList: [],
  188. choosePP: {}, // 选择品牌
  189. chooseGG: {}, // 选择规格
  190. chooseHW: {}, // 选择花纹
  191. UIActionSelector: '',
  192. choosePPone: '',
  193. keyword: '',
  194. },
  195. watch: {
  196. keyword: function(nw, od) {
  197. this.current = 1;
  198. this.getStoreList();
  199. }
  200. },
  201. methods: {
  202. init: function() {
  203. var _this = this;
  204. this.choosePPone = $api.getStorage('brand');
  205. this.UIActionSelector = api.require("UIActionSelector");
  206. this.userId = $api.getStorage('userid');
  207. this.status = $api.getStorage('status');
  208. this.getStoreList();
  209. this.getCarList();
  210. this.getWuliaoAntion();
  211. this.addEvent("refushCarList", function() {
  212. _this.getCarList();
  213. })
  214. this.$set(this.list, "urchaseNumber", 1);
  215. },
  216. // 配置一下上拉和下拉
  217. configs: function() {
  218. var _this = this;
  219. this.frist = 2;
  220. this.configDownAndPull("mescroll", function(mescroll) {
  221. _this.mescroll = mescroll;
  222. _this.current = 1;
  223. _this.getStoreList(mescroll);
  224. }, function(mescroll) {
  225. if (_this.current < _this.totalPages) {
  226. _this.current = _this.current + 1;
  227. _this.getStoreList(mescroll, 1);
  228. } else {
  229. mescroll.endSuccess(_this.size, false);
  230. }
  231. });
  232. },
  233. // 获取筛选条件
  234. getWuliaoAntion: function() {
  235. var url = "getWuliaoAntionU",
  236. _this = this;
  237. var data = {
  238. storeId: this.userId,
  239. url: 'json',
  240. type: 'body'
  241. }
  242. this.$post(url, data, function(ret) {
  243. if (ret.code == 0 || ret.code == '0') {
  244. var brands = [{
  245. name: '全部'
  246. }],
  247. specs = [{
  248. name: '全部'
  249. }],
  250. pattern = [{
  251. name: '全部'
  252. }]
  253. ret.data.pingpaiList = ret.data.pingpaiList == null ? [] : ret.data.pingpaiList;
  254. ret.data.pingpaiList.map(function(pp, index) {
  255. brands.push({
  256. name: pp
  257. })
  258. })
  259. _this.brandList = brands;
  260. ret.data.guigeList = ret.data.guigeList == null ? [] : ret.data.guigeList;
  261. ret.data.guigeList.map(function(gg, index) {
  262. specs.push({
  263. name: gg
  264. })
  265. })
  266. _this.guigeList = specs;
  267. ret.data.huawenList = ret.data.huawenList == null ? [] : ret.data.huawenList;
  268. ret.data.huawenList.map(function(hw, index) {
  269. pattern.push({
  270. name: hw
  271. })
  272. })
  273. _this.pattern = pattern;
  274. if (_this.frist == 1) {
  275. _this.$nextTick(function() {
  276. _this.configs();
  277. })
  278. }
  279. }
  280. })
  281. },
  282. // 获取门店经销商对应物料
  283. getStoreList: function(mescroll, type) {
  284. var data = {
  285. url: 'json',
  286. type: 'body',
  287. "storeId": this.userId,
  288. "size": this.size,
  289. current: this.current,
  290. "pinpai": this.choosePP.name == '全部' ? '' : this.choosePP.name,
  291. "guige": this.keyword,
  292. "huawen": this.chooseHW.name == '全部' ? '' : this.chooseHW.name
  293. },
  294. _this = this,
  295. url = "getStoreListU";
  296. this.$post(url, data, function(ret) {
  297. // console.log(JSON.stringify(ret))
  298. if (ret.code == 0 || ret.code == '0') {
  299. ret.data.records.map(function(store, index) {
  300. store.purchaseNumber = 1;
  301. })
  302. _this.list = _this.current == 1 ? ret.data.records : (_this.list.concat(ret.data.records));
  303. _this.totalPages = ret.data.pages;
  304. if (mescroll) {
  305. mescroll.endSuccess(_this.size, true);
  306. }
  307. }
  308. })
  309. },
  310. // 跳转购物车
  311. goCar: function() {
  312. this.goWin('cartList_win', 'cartList_win.html', '');
  313. },
  314. // 控制数量
  315. minusSign: function(index, type) {
  316. var number = this.list[index].purchaseNumber ? this.list[index].purchaseNumber : 0;
  317. if (type == 0) {
  318. // -
  319. if (number > 0) {
  320. this.$set(this.list[index], "purchaseNumber", (parseInt(number) - 1));
  321. }
  322. } else {
  323. this.$set(this.list[index], "purchaseNumber", (parseInt(number) + 1));
  324. }
  325. },
  326. // 获取购物车数量
  327. getCarList: function() {
  328. var url = "getCarListU",
  329. _this = this,
  330. data = {
  331. "storeId": this.userId,
  332. "url": "json",
  333. "type": "body"
  334. };
  335. this.$post(url, data, function(ret) {
  336. if (ret.code == 0 || ret.code == '0') {
  337. _this.cartNums = ret.data.length;
  338. }
  339. })
  340. },
  341. getNumber: function(item) {
  342. if (item.purchaseNumber < 0) {
  343. item.purchaseNumber = 0;
  344. }
  345. },
  346. // 添加购物车
  347. addStoreCar: function(index) {
  348. if(this.status==3){
  349. api.alert({
  350. title: '系统提示',
  351. msg: '门店已冻结,请找相关业务经理解冻!',
  352. }, function (ret, err) {
  353. });
  354. return;
  355. }
  356. var storeInfo = this.list[index];
  357. var data = {
  358. "matnr": storeInfo.matnr,
  359. "storeId": this.userId,
  360. "purchaseNumber": storeInfo.purchaseNumber ? storeInfo.purchaseNumber : 0,
  361. "cartType": "1",
  362. "maktx": storeInfo.maktx,
  363. "brand": storeInfo.pinpai,
  364.   "spec": storeInfo.guige,
  365. "pattern": storeInfo.huawen,
  366. "url": "json",
  367. "type": 'body'
  368. },
  369. _this = this,
  370. url = "addStoreToCarU";
  371. this.$post(url, data, function(ret) {
  372. if (ret.code == 0 || ret.code == '0') {
  373. api.toast({
  374. msg: '添加购物车成功'
  375. });
  376. setTimeout(function() {
  377. _this.getCarList();
  378. }, 200);
  379. }
  380. })
  381. },
  382. // 立即抢购
  383. buyStore: function(index) {
  384. if(this.status==3){
  385. api.alert({
  386. title: '系统提示',
  387. msg: '门店已冻结,请找相关业务经理解冻!',
  388. }, function (ret, err) {
  389. });
  390. return;
  391. }
  392. var _this = this;
  393. this.showModal("下单提示", "是否确认立即购买该商品?", ["确认", "取消"], function(type) {
  394. if (type == 1) {
  395. _this.buyStoreDone(index);
  396. }
  397. })
  398. },
  399. buyStoreDone: function(index) {
  400. var storeInfo = this.list[index];
  401. var _this = this,
  402. url = "rushToBuyU";
  403. var data = {
  404. "retarilerId": this.userId,
  405. "qty": storeInfo.purchaseNumber ? storeInfo.purchaseNumber : 0,
  406. "materialId": storeInfo.matnr,
  407. "orderType": "0",
  408. "maktx": storeInfo.maktx,
  409. "brand": storeInfo.pinpai,
  410. "spec": storeInfo.guige,
  411. "pattern": storeInfo.huawen,
  412. "url": "json",
  413. "type": 'body'
  414. }
  415. this.$post(url, data, function(ret) {
  416. if (ret.code == 0 || ret.code == '0') {
  417. api.toast({
  418. msg: '下单成功'
  419. });
  420. // 跳转订单页面
  421. _this.goWin('orderInfo_win', 'orderInfo_win.html', {
  422. id: ret.data.result
  423. });
  424. }
  425. })
  426. },
  427. // 选择筛选条件
  428. chooseAndtion: function(type) {
  429. var types = ["brandList", "guigeList", "pattern"],
  430. _this = this;
  431. var data = eval('this.' + types[type]);
  432. this.chooseRegion(this.UIActionSelector, 1, data, function(ret) {
  433. if (ret.eventType == 'ok') {
  434. if (type == 0) {
  435. _this.choosePP = ret.selectedInfo[0]
  436. } else if (type == 1) {
  437. _this.chooseGG = ret.selectedInfo[0]
  438. } else {
  439. _this.chooseHW = ret.selectedInfo[0]
  440. }
  441. }
  442. _this.getStoreList();
  443. })
  444. }
  445. },
  446. filters: {},
  447. mounted: function() {
  448. this.init();
  449. }
  450. })
  451. }
  452. </script>
  453. </html>