integral_index.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  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 http-equiv="x-dns-prefetch-control" content="on">
  9. <meta name="description" content="">
  10. <meta name="format-detection" content="telephone=no" />
  11. <link rel="stylesheet" type="text/css" href="../css/api.css" />
  12. <link rel="stylesheet" type="text/css" href="../css/aui-win.css" />
  13. <link rel="stylesheet" type="text/css" href="css/vant-ui.css" />
  14. <link rel="stylesheet" type="text/css" href="css/iconfont.css">
  15. <link rel="stylesheet" type="text/css" href="css/main.css" />
  16. <script type="text/javascript" src="../script/aui-tab.js"></script>
  17. <script src="js/vue.js"></script>
  18. <script src="js/vant-ui.js"></script>
  19. <script src="js/main.js"></script>
  20. <title></title>
  21. </head>
  22. <style>
  23. .card-main {
  24. position: relative;
  25. top: -3.5rem;
  26. height: 100%
  27. }
  28. .card {
  29. display: flex;
  30. justify-content: center;
  31. height: 100%
  32. }
  33. .card-left {
  34. background-color: #EBEBEB;
  35. width: 1.5rem;
  36. border-top-left-radius: .3rem;
  37. }
  38. .type-list {
  39. padding: .1rem 0;
  40. font-size: .3rem;
  41. display: flex;
  42. justify-content: center;
  43. color: #333333;
  44. }
  45. .type-active {
  46. background-color: #fff;
  47. }
  48. .card-right {
  49. background-color: #fff;
  50. border-top-right-radius: .3rem;
  51. width: 5.5rem;
  52. }
  53. .shop-list {
  54. display: flex;
  55. padding: .2rem .15rem;
  56. }
  57. /*.shop-img {
  58. width: 1.5rem;
  59. height: 1.5rem;
  60. background-color: #000
  61. }*/
  62. .shop-list-right {
  63. display: flex;
  64. flex-direction: column;
  65. width: 3.4rem;
  66. justify-content: space-between;
  67. padding-left: .1rem;
  68. }
  69. .shop-title {
  70. display: flex;
  71. color: #333333;
  72. }
  73. .shop-title-p {
  74. font-size: .28rem;
  75. display: -webkit-box;
  76. -webkit-box-orient: vertical;
  77. -webkit-line-clamp: 2;
  78. overflow: hidden;
  79. width: 3.4rem;
  80. }
  81. .shop-integral {
  82. display: flex;
  83. align-items: flex-end;
  84. }
  85. .shop-integral-left {
  86. font-size: .25rem;
  87. width: 1.4rem;
  88. color: #666666;
  89. }
  90. .shop-integral-right {
  91. font-size: .25rem;
  92. color: #333333;
  93. }
  94. .shop-add {
  95. display: flex;
  96. align-items: flex-end;
  97. justify-content: space-between;
  98. }
  99. .shop-add-right {
  100. font-size: .25rem;
  101. color: #fff;
  102. background-color: #0098E2;
  103. padding: .05rem .1rem;
  104. border-radius: .1rem;
  105. }
  106. [v-cloak] {
  107. display: none;
  108. }
  109. </style>
  110. <body>
  111. <div id="app" style="background-color:#F5F5F5">
  112. <header class="aui-bar aui-bar-nav aui-bar-info" id="aui-header">
  113. <div>
  114. <a class="aui-btn aui-btn-info aui-pull-left" tapmode onclick="closeWin()"> <span class="aui-iconfont aui-icon-left"></span> </a>
  115. <div class="aui-title" id="aui-title">
  116. 积分商城
  117. </div>
  118. <a class="aui-btn aui-btn-info aui-pull-right" tapmode v-on:click="inSearchPage()"> <span class="aui-iconfont aui-icon-search"></span> </a>
  119. </div>
  120. </header>
  121. <div class="banner">
  122. </div>
  123. <div class="card-main">
  124. <div class="card">
  125. <div class="card-left" style="height:90%;overflow-y:scroll;padding-bottom:1rem;" v-cloak>
  126. <div v-bind:class="index==activeId?'type-active':''" class="type-list" v-for="(item,index) in typeList" :key="index" v-on:click="getId(item,index);getshopLists(item)">
  127. {{item.categoryName}}
  128. </div>
  129. </div>
  130. <div class="card-right" style="height:90%;overflow-y:scroll;padding-bottom:1rem;" v-cloak>
  131. <div style="display:flex;align-items:flex-end;margin:.1rem 0 0 .1rem" v-if="this.activeId==0">
  132. <div style="font-weight:800;margin-left:.1rem">
  133. 热销
  134. </div>
  135. <div style="font-size:.25rem;color:#7C7C7C;padding-bottom:.03rem;margin-left:.1rem">
  136. 大家都换,才是真的好用
  137. </div>
  138. </div>
  139. <div v-if="shopList.length!=0">
  140. <div class="shop-list" v-for="(list,index) in shopList" :key="index">
  141. <div class="shop-img" v-on:click="inDetails(list)">
  142. <img v-if="list.productImage==null" src="img/nothing.png" style="width:1.8rem;height:1.8rem">
  143. <img v-else :src="list.productImage" style="width:1.8rem;height:1.8rem">
  144. </div>
  145. <div class="shop-list-right">
  146. <div v-on:click="inDetails(list)">
  147. <div class="shop-title">
  148. <p class="shop-title-p">{{list.productName}}</p>
  149. </div>
  150. </div>
  151. <div class="shop-add">
  152. <div class="shop-add-left">
  153. <div style="color:#333333;font-size:.25rem;">
  154. 剩余库存:{{list.productQtyStock}}
  155. </div>
  156. <div style="color:#FF0000;font-size:.25rem;margin-top:.1rem">
  157. {{list.productPrice}}积分
  158. </div>
  159. <!-- <van-stepper v-model="list.defaultCount" input-width=".6rem" button-size=".4rem" integer min="1" max="999" v-on:change="inputNum(list)" /> -->
  160. <!-- <div class="but-sub" v-on:click="subQuantity(list)">-</div>
  161. <input type="number" v-model="list.defaultCount" v-on:input="inputNum(list)" v-on:Blur="outBlur(list)">
  162. <div class="but-add" v-on:click="addQuantity(list)">+</div> -->
  163. </div>
  164. <div class="shop-add-right" v-on:click="addShopCart(list)">
  165. 加入购物车
  166. </div>
  167. </div>
  168. </div>
  169. </div>
  170. </div>
  171. <div v-else style="display:flex;justify-content:center;color:#ccc;padding-top:1.5rem">
  172. 暂无商品
  173. </div>
  174. </div>
  175. </div>
  176. </div>
  177. </div>
  178. </body>
  179. <link rel="stylesheet" href="./mescroll/mescroll.min.css">
  180. <script type="text/javascript" src="./mescroll/mescroll.min.js"></script>
  181. <script type="text/javascript" src="../script/api.js"></script>
  182. <script type="text/javascript" src="../script/httpRequest.js"></script>
  183. <script type="text/javascript" src="../script/vue_plugins.js"></script>
  184. <script type="text/javascript">
  185. function closeWin() {
  186. api.closeWin({});
  187. }
  188. apiready = function() {
  189. api.parseTapmode();
  190. var header = $api.byId('aui-header');
  191. $api.fixStatusBar(header);
  192. new Vue({
  193. el: '#app',
  194. data: {
  195. typeList: [],
  196. shopList: [],
  197. activeId: 0
  198. },
  199. methods: {
  200. init: function() {
  201. this.getTypes();
  202. this.getshopLists();
  203. this.storeId = $api.getStorage('userid');
  204. this.status = $api.getStorage('status');
  205. // this.verifyBusiness();
  206. var _this = this;
  207. this.addEvent("refreshindex", function() {
  208. _this.getshopLists();
  209. _this.activeId=0
  210. });
  211. },
  212. verifyBusiness: function() {
  213. var data = {
  214. "storeId": this.storeId,
  215. "url": "json",
  216. "type": "body"
  217. },
  218. _this = this,
  219. url = "verifyBusiness";
  220. this.$postuser(url, data, function(ret) {
  221. if(ret.code==500){
  222. api.alert({
  223. title: '系统提示',
  224. msg: ret.msg,
  225. }, function (ret, err) {
  226. if(ret){
  227. _this.goWin("license_win","license_win.html",{})
  228. }
  229. });
  230. }
  231. })
  232. },
  233. getTypes: function() {
  234. var data = {
  235. "url": "json",
  236. "type": "body"
  237. },
  238. _this = this,
  239. url = "getTypes";
  240. this.$post(url, data, function(ret) {
  241. _this.typeList = ret.productCategory;
  242. })
  243. },
  244. getshopLists: function(item) {
  245. if (!item) {
  246. var data = {
  247. "url": "json",
  248. "type": "body",
  249. "mainId": 0
  250. },
  251. _this = this,
  252. url = "getshopLists";
  253. this.$post(url, data, function(ret) {
  254. _this.shopList = ret.product;
  255. })
  256. } else {
  257. var data = {
  258. "url": "json",
  259. "type": "body",
  260. "mainId": item.mainId
  261. },
  262. _this = this,
  263. url = "getshopLists";
  264. this.$post(url, data, function(ret) {
  265. _this.shopList = ret.product;
  266. })
  267. }
  268. },
  269. getId: function(item, index) {
  270. this.activeId = index;
  271. },
  272. addShopCart: function(list) {
  273. if(this.status==3){
  274. api.alert({
  275. title: '系统提示',
  276. msg: '门店已冻结,请找相关业务经理解冻!',
  277. }, function (ret, err) {
  278. });
  279. return;
  280. }
  281. if(list.productQtyStock==0||list.productQtyStock==null){
  282. api.toast({
  283. msg: '很抱歉,当前商品暂时缺货'
  284. });
  285. return
  286. }
  287. var data = {
  288. "url": "json",
  289. "type": "body",
  290. "productId": list.mainId,
  291. "storeId": this.storeId,
  292. "cartQty": 1,
  293. "cartType": "0",
  294. "productIntroduction": list.productName,
  295. "spec": list.productSpecs,
  296. "productPrice": list.productPrice,
  297. "productImage": list.productImage
  298. },
  299. _this = this,
  300. url = "addShopCart";
  301. this.$post(url, data, function(ret) {
  302. if (ret.code == 0 || ret.code == '0') {
  303. api.toast({
  304. msg: '成功加入购物车'
  305. });
  306. }
  307. })
  308. },
  309. inDetails: function(list) {
  310. this.goWin('integral_details', 'integral_details.html', {
  311. productId: list.mainId
  312. });
  313. },
  314. inSearchPage:function(){
  315. this.goWin('integral_search', 'integral_search.html');
  316. }
  317. },
  318. mounted: function() {
  319. this.init();
  320. },
  321. })
  322. }
  323. </script>
  324. </html>