getStoreNet_body.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  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. api.closeWin({
  320. });
  321. this.sendEvent("gotocart");
  322. },
  323. // 控制数量
  324. minusSign: function (index, type) {
  325. var number = this.list[index].purchaseNumber ? this.list[index].purchaseNumber : 0;
  326. if (type == 0) {
  327. // -
  328. if (number > 0) {
  329. this.$set(this.list[index], "purchaseNumber", (parseInt(number) - 1));
  330. }
  331. } else {
  332. this.$set(this.list[index], "purchaseNumber", (parseInt(number) + 1));
  333. }
  334. },
  335. // 获取购物车数量
  336. getCarList: function () {
  337. var url = "getCarListU",
  338. _this = this,
  339. data = {
  340. "storeId": this.userId,
  341. "url": "json",
  342. "type": "body"
  343. };
  344. this.$post(url, data, function (ret) {
  345. if (ret.code == 0 || ret.code == '0') {
  346. _this.cartNums = ret.data.length;
  347. }
  348. })
  349. },
  350. getNumber: function (item) {
  351. if (item.purchaseNumber < 0) {
  352. item.purchaseNumber = 0;
  353. }
  354. },
  355. // 添加购物车
  356. addStoreCar: function (index) {
  357. if (this.status == 3) {
  358. api.alert({
  359. title: '系统提示',
  360. msg: '门店已冻结,请找相关业务经理解冻!',
  361. }, function (ret, err) {
  362. });
  363. return;
  364. }
  365. var storeInfo = this.list[index];
  366. var data = {
  367. "matnr": storeInfo.matnr,
  368. "storeId": this.userId,
  369. "purchaseNumber": storeInfo.purchaseNumber ? storeInfo.purchaseNumber : 0,
  370. "cartType": "1",
  371. "maktx": storeInfo.maktx,
  372. "brand": storeInfo.pinpai,
  373. "spec": storeInfo.guige,
  374. "pattern": storeInfo.huawen,
  375. "url": "json",
  376. "type": 'body'
  377. },
  378. _this = this,
  379. url = "addStoreToCarU";
  380. this.$post(url, data, function (ret) {
  381. if (ret.code == 0 || ret.code == '0') {
  382. if (!ret.message) {
  383. api.toast({
  384. msg: '添加购物车成功'
  385. });
  386. setTimeout(function () {
  387. _this.getCarList();
  388. }, 200);
  389. } else {
  390. api.toast({
  391. msg: ret.message
  392. });
  393. }
  394. }
  395. })
  396. },
  397. // 立即抢购
  398. buyStore: function (index) {
  399. if (this.status == 3) {
  400. api.alert({
  401. title: '系统提示',
  402. msg: '门店已冻结,请找相关业务经理解冻!',
  403. }, function (ret, err) {
  404. });
  405. return;
  406. }
  407. var _this = this;
  408. this.showModal("下单提示", "是否确认立即购买该商品?", ["确认", "取消"], function (type) {
  409. if (type == 1) {
  410. _this.buyStoreDone(index);
  411. }
  412. })
  413. },
  414. buyStoreDone: function (index) {
  415. var storeInfo = this.list[index];
  416. var _this = this,
  417. url = "rushToBuyU";
  418. var data = {
  419. "retarilerId": this.userId,
  420. "qty": storeInfo.purchaseNumber ? storeInfo.purchaseNumber : 0,
  421. "materialId": storeInfo.matnr,
  422. "orderType": "0",
  423. "maktx": storeInfo.maktx,
  424. "brand": storeInfo.pinpai,
  425. "spec": storeInfo.guige,
  426. "pattern": storeInfo.huawen,
  427. "url": "json",
  428. "type": 'body'
  429. }
  430. this.$post(url, data, function (ret) {
  431. if (ret.code == 0 || ret.code == '0') {
  432. if (!ret.message) {
  433. api.toast({
  434. msg: '下单成功'
  435. });
  436. // 跳转订单页面
  437. _this.goWin('orderInfo_win', 'orderInfo_win.html', {
  438. id: ret.data.result
  439. });
  440. } else {
  441. api.toast({
  442. msg: ret.message
  443. });
  444. }
  445. }
  446. })
  447. },
  448. // 选择筛选条件
  449. chooseAndtion: function (type) {
  450. var types = ["brandList", "guigeList", "pattern"],
  451. _this = this;
  452. var data = eval('this.' + types[type]);
  453. this.chooseRegion(this.UIActionSelector, 1, data, function (ret) {
  454. if (ret.eventType == 'ok') {
  455. if (type == 0) {
  456. _this.choosePP = ret.selectedInfo[0]
  457. } else if (type == 1) {
  458. _this.chooseGG = ret.selectedInfo[0]
  459. } else {
  460. _this.chooseHW = ret.selectedInfo[0]
  461. }
  462. }
  463. _this.getStoreList();
  464. })
  465. }
  466. },
  467. filters: {},
  468. mounted: function () {
  469. this.init();
  470. }
  471. })
  472. }
  473. </script>
  474. </html>