getStoreNet_body.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  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"
  100. xmlns="http://www.w3.org/2000/svg" p-id="5394" width="22" height="22">
  101. <path
  102. 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"
  103. p-id="5395" fill="#bfbfbf"></path>
  104. </svg>
  105. <input type="search" placeholder="请输入轮胎规格" v-model="keyword">
  106. </div>
  107. </div>
  108. </div>
  109. <div class="item flex a-center j-center" v-on:click="chooseAndtion(2)"
  110. style="width:15%;padding-right: 10px;">
  111. {{ chooseHW.name || '花纹' }} <i class="iconfont icon-xia"></i>
  112. </div>
  113. <!-- <div class="item flex a-center j-center">
  114. {{ choosePPone || '品牌' }}
  115. </div>
  116. <div class="fgx"></div> -->
  117. <!-- <div class="item flex a-center j-center" v-on:click="chooseAndtion(1)">
  118. {{ chooseGG.name || '规格' }} <i class="iconfont icon-xia"></i>
  119. </div>
  120. <div class="fgx"></div> -->
  121. <!-- <div class="item flex a-center j-center" v-on:click="chooseAndtion(2)">
  122. {{ chooseHW.name || '花纹' }} <i class="iconfont icon-xia"></i>
  123. </div> -->
  124. </div>
  125. <ul style="overflow : scroll;margin-top : 0.76rem" class="mescroll" v-show="list.length > 0"
  126. id="mescroll">
  127. <li class="flex col" v-for="(item,index) in list" :key="index">
  128. <div class="flex libox">
  129. <div class="info">
  130. <h4>{{ item.maktx }}</h4>
  131. <span>{{ item.pinpai }}</span>
  132. <div class="flex a-center jlr">
  133. <!-- <div class="kuchun">
  134. 有货:1000
  135. </div> -->
  136. <div class="setp flex jlr a-center">
  137. <div class="left flex a-center j-center" v-on:click="minusSign(index,0)">
  138. -
  139. </div>
  140. <div class="value flex a-center j-center">
  141. <input type="number" style="width:0.8rem;text-align:center;border:none"
  142. v-model="item.purchaseNumber" />
  143. </div>
  144. <div class="right flex a-center j-center" v-on:click="minusSign(index,1)">
  145. +
  146. </div>
  147. </div>
  148. </div>
  149. </div>
  150. <div class="flex a-center">
  151. <div class="item flex a-center j-center active" v-on:click="addStoreCar(index)">
  152. <img class="downOrder" src="./image/bottombtn0202.png" />
  153. </div>
  154. <div class="item flex a-center j-center" v-on:click="buyStore(index)">
  155. <img class="downOrder" src="./image/downOrder.png" />
  156. </div>
  157. </div>
  158. </div>
  159. <div class="timer flex a-center">
  160. <!--活动倒计时: 10:20:36-->
  161. </div>
  162. </li>
  163. </ul>
  164. <div v-show="list.length == 0" style="text-align:center">
  165. <img src="./image/noData.png" style="margin:2rem auto" />
  166. </div>
  167. </div>
  168. </div>
  169. </div>
  170. </body>
  171. <script type="text/javascript" src="../script/aui-scroll.js"></script>
  172. <script type="text/javascript" src="./mescroll/mescroll.min.js"></script>
  173. <script type="text/javascript" src="../script/api.js"></script>
  174. <script type="text/javascript" src="../script/httpRequest.js"></script>
  175. <script type="text/javascript" src="../script/vue_plugins.js"></script>
  176. <script type="text/javascript">
  177. apiready = function () {
  178. new Vue({
  179. el: '#app',
  180. data: {
  181. list: [],
  182. userId: '',
  183. kunnr: '',
  184. cartNums: '', // 购物车数量
  185. size: 10,
  186. current: 1,
  187. totalPages: 1, // 总页数
  188. mescroll: '',
  189. frist: 1,
  190. mescroll: '',
  191. brandList: [],
  192. guigeList: [],
  193. huawenList: [],
  194. choosePP: {}, // 选择品牌
  195. chooseGG: {}, // 选择规格
  196. chooseHW: {}, // 选择花纹
  197. UIActionSelector: '',
  198. choosePPone: '',
  199. keyword: '',
  200. },
  201. watch: {
  202. keyword: function (nw, od) {
  203. this.current = 1;
  204. this.getStoreList();
  205. }
  206. },
  207. methods: {
  208. init: function () {
  209. var _this = this;
  210. this.choosePPone = $api.getStorage('brand');
  211. this.UIActionSelector = api.require("UIActionSelector");
  212. this.userId = $api.getStorage('userid');
  213. this.status = $api.getStorage('status');
  214. this.getStoreList();
  215. this.getCarList();
  216. this.getWuliaoAntion();
  217. this.addEvent("refushCarList", function () {
  218. _this.getCarList();
  219. })
  220. this.$set(this.list, "urchaseNumber", 1);
  221. },
  222. // 配置一下上拉和下拉
  223. configs: function () {
  224. var _this = this;
  225. this.frist = 2;
  226. this.configDownAndPull("mescroll", function (mescroll) {
  227. _this.mescroll = mescroll;
  228. _this.current = 1;
  229. _this.getStoreList(mescroll);
  230. }, function (mescroll) {
  231. if (_this.current < _this.totalPages) {
  232. _this.current = _this.current + 1;
  233. _this.getStoreList(mescroll, 1);
  234. } else {
  235. mescroll.endSuccess(_this.size, false);
  236. }
  237. });
  238. },
  239. // 获取筛选条件
  240. getWuliaoAntion: function () {
  241. var url = "getWuliaoAntionU",
  242. _this = this;
  243. var data = {
  244. storeId: this.userId,
  245. url: 'json',
  246. type: 'body'
  247. }
  248. this.$post(url, data, function (ret) {
  249. if (ret.code == 0 || ret.code == '0') {
  250. var brands = [{
  251. name: '全部'
  252. }],
  253. specs = [{
  254. name: '全部'
  255. }],
  256. pattern = [{
  257. name: '全部'
  258. }]
  259. ret.data.pingpaiList = ret.data.pingpaiList == null ? [] : ret.data.pingpaiList;
  260. ret.data.pingpaiList.map(function (pp, index) {
  261. brands.push({
  262. name: pp
  263. })
  264. })
  265. _this.brandList = brands;
  266. ret.data.guigeList = ret.data.guigeList == null ? [] : ret.data.guigeList;
  267. ret.data.guigeList.map(function (gg, index) {
  268. specs.push({
  269. name: gg
  270. })
  271. })
  272. _this.guigeList = specs;
  273. ret.data.huawenList = ret.data.huawenList == null ? [] : ret.data.huawenList;
  274. ret.data.huawenList.map(function (hw, index) {
  275. pattern.push({
  276. name: hw
  277. })
  278. })
  279. _this.pattern = pattern;
  280. if (_this.frist == 1) {
  281. _this.$nextTick(function () {
  282. _this.configs();
  283. })
  284. }
  285. }
  286. })
  287. },
  288. // 获取门店经销商对应物料
  289. getStoreList: function (mescroll, type) {
  290. var data = {
  291. url: 'json',
  292. type: 'body',
  293. "storeId": this.userId,
  294. "size": this.size,
  295. current: this.current,
  296. "pinpai": this.choosePP.name == '全部' ? '' : this.choosePP.name,
  297. "guige": this.keyword,
  298. "huawen": this.chooseHW.name == '全部' ? '' : this.chooseHW.name
  299. },
  300. _this = this,
  301. url = "getStoreListU";
  302. this.$post(url, data, function (ret) {
  303. // console.log(JSON.stringify(ret))
  304. if (ret.code == 0 || ret.code == '0') {
  305. ret.data.records.map(function (store, index) {
  306. store.purchaseNumber = 1;
  307. })
  308. _this.list = _this.current == 1 ? ret.data.records : (_this.list.concat(ret.data.records));
  309. _this.totalPages = ret.data.pages;
  310. if (mescroll) {
  311. mescroll.endSuccess(_this.size, true);
  312. }
  313. }
  314. })
  315. },
  316. // 跳转购物车
  317. goCar: function () {
  318. this.goWin('cartList_win', 'cartList_win.html', '');
  319. },
  320. // 控制数量
  321. minusSign: function (index, type) {
  322. var number = this.list[index].purchaseNumber ? this.list[index].purchaseNumber : 0;
  323. if (type == 0) {
  324. // -
  325. if (number > 0) {
  326. this.$set(this.list[index], "purchaseNumber", (parseInt(number) - 1));
  327. }
  328. } else {
  329. this.$set(this.list[index], "purchaseNumber", (parseInt(number) + 1));
  330. }
  331. },
  332. // 获取购物车数量
  333. getCarList: function () {
  334. var url = "getCarListU",
  335. _this = this,
  336. data = {
  337. "storeId": this.userId,
  338. "url": "json",
  339. "type": "body"
  340. };
  341. this.$post(url, data, function (ret) {
  342. if (ret.code == 0 || ret.code == '0') {
  343. _this.cartNums = ret.data.length;
  344. }
  345. })
  346. },
  347. getNumber: function (item) {
  348. if (item.purchaseNumber < 0) {
  349. item.purchaseNumber = 0;
  350. }
  351. },
  352. // 添加购物车
  353. addStoreCar: function (index) {
  354. if (this.status == 3) {
  355. api.alert({
  356. title: '系统提示',
  357. msg: '门店已冻结,请找相关业务经理解冻!',
  358. }, function (ret, err) {
  359. });
  360. return;
  361. }
  362. var storeInfo = this.list[index];
  363. var data = {
  364. "matnr": storeInfo.matnr,
  365. "storeId": this.userId,
  366. "purchaseNumber": storeInfo.purchaseNumber ? storeInfo.purchaseNumber : 0,
  367. "cartType": "1",
  368. "maktx": storeInfo.maktx,
  369. "brand": storeInfo.pinpai,
  370. "spec": storeInfo.guige,
  371. "pattern": storeInfo.huawen,
  372. "url": "json",
  373. "type": 'body'
  374. },
  375. _this = this,
  376. url = "addStoreToCarU";
  377. this.$post(url, data, function (ret) {
  378. if (ret.code == 0 || ret.code == '0') {
  379. if (!ret.message) {
  380. api.toast({
  381. msg: '添加购物车成功'
  382. });
  383. setTimeout(function () {
  384. _this.getCarList();
  385. }, 200);
  386. } else {
  387. api.toast({
  388. msg: ret.message
  389. });
  390. }
  391. }
  392. })
  393. },
  394. // 立即抢购
  395. buyStore: function (index) {
  396. if (this.status == 3) {
  397. api.alert({
  398. title: '系统提示',
  399. msg: '门店已冻结,请找相关业务经理解冻!',
  400. }, function (ret, err) {
  401. });
  402. return;
  403. }
  404. var _this = this;
  405. this.showModal("下单提示", "是否确认立即购买该商品?", ["确认", "取消"], function (type) {
  406. if (type == 1) {
  407. _this.buyStoreDone(index);
  408. }
  409. })
  410. },
  411. buyStoreDone: function (index) {
  412. var storeInfo = this.list[index];
  413. var _this = this,
  414. url = "rushToBuyU";
  415. var data = {
  416. "retarilerId": this.userId,
  417. "qty": storeInfo.purchaseNumber ? storeInfo.purchaseNumber : 0,
  418. "materialId": storeInfo.matnr,
  419. "orderType": "0",
  420. "maktx": storeInfo.maktx,
  421. "brand": storeInfo.pinpai,
  422. "spec": storeInfo.guige,
  423. "pattern": storeInfo.huawen,
  424. "url": "json",
  425. "type": 'body'
  426. }
  427. this.$post(url, data, function (ret) {
  428. if (ret.code == 0 || ret.code == '0') {
  429. if (!ret.message) {
  430. api.toast({
  431. msg: '下单成功'
  432. });
  433. // 跳转订单页面
  434. _this.goWin('orderInfo_win', 'orderInfo_win.html', {
  435. id: ret.data.result
  436. });
  437. } else {
  438. api.toast({
  439. msg: ret.message
  440. });
  441. }
  442. }
  443. })
  444. },
  445. // 选择筛选条件
  446. chooseAndtion: function (type) {
  447. var types = ["brandList", "guigeList", "pattern"],
  448. _this = this;
  449. var data = eval('this.' + types[type]);
  450. this.chooseRegion(this.UIActionSelector, 1, data, function (ret) {
  451. if (ret.eventType == 'ok') {
  452. if (type == 0) {
  453. _this.choosePP = ret.selectedInfo[0]
  454. } else if (type == 1) {
  455. _this.chooseGG = ret.selectedInfo[0]
  456. } else {
  457. _this.chooseHW = ret.selectedInfo[0]
  458. }
  459. }
  460. _this.getStoreList();
  461. })
  462. }
  463. },
  464. filters: {},
  465. mounted: function () {
  466. this.init();
  467. }
  468. })
  469. }
  470. </script>
  471. </html>