integral_search.html 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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/aui.css" />
  14. <link rel="stylesheet" type="text/css" href="css/vant-ui.css" />
  15. <link rel="stylesheet" type="text/css" href="css/iconfont.css">
  16. <link rel="stylesheet" type="text/css" href="css/main.css" />
  17. <script type="text/javascript" src="../script/aui-tab.js"></script>
  18. <script src="js/vue.js"></script>
  19. <script src="js/vant-ui.js"></script>
  20. <script src="js/main.js"></script>
  21. <title></title>
  22. </head>
  23. <style>
  24. .card {
  25. background-color: #fff;
  26. display: flex;
  27. border-bottom: 1px solid #F1F1F1;
  28. }
  29. .card:last-child {
  30. border-bottom: 0px solid #F1F1F1;
  31. }
  32. .card-img {
  33. padding: .3rem;
  34. }
  35. .card-right {
  36. width: 13rem;
  37. padding: .3rem;
  38. display: flex;
  39. flex-direction: column;
  40. justify-content: space-between;
  41. }
  42. .card-title-p {
  43. display: -webkit-box;
  44. -webkit-box-orient: vertical;
  45. -webkit-line-clamp: 2;
  46. overflow: hidden;
  47. width: 12.4rem;
  48. }
  49. [v-cloak] {
  50. display: none;
  51. }
  52. </style>
  53. <body>
  54. <div id="app">
  55. <header class="aui-bar aui-bar-nav aui-bar-info" id="aui-header">
  56. <div>
  57. <a class="aui-btn aui-btn-info aui-pull-left" tapmode onclick="closeWin()"> <span class="aui-iconfont aui-icon-left"></span> </a>
  58. <div class="aui-title" style="left:2rem; right: 0.5rem;">
  59. <div class="aui-searchbar" style="background-color:#00a0ea">
  60. <div class="aui-searchbar-input aui-border-radius">
  61. <i class="aui-iconfont aui-icon-search"></i>
  62. <input type="search" placeholder="请输入搜索内容" id="search-input" v-model="keyword">
  63. <div class="aui-searchbar-clear-btn">
  64. <i class="aui-iconfont aui-icon-close"></i>
  65. </div>
  66. </div>
  67. <div class="aui-searchbar-btn" tapmode>取消</div>
  68. </div>
  69. </div>
  70. </div>
  71. </header>
  72. <div class="list" style="height:90%;overflow-y:scroll;">
  73. <div class="card" v-for="(item,index) in shopList" :key="index">
  74. <div class="card-img" v-on:click="inDetails(item)">
  75. <img :src="item.productImage" style="height:5rem;width:5rem;" alt="">
  76. </div>
  77. <div class="card-right">
  78. <div v-on:click="inDetails(item)">
  79. <p class="card-title-p"></p>
  80. {{item.productName}}
  81. </div>
  82. <div style="display:flex;justify-content:space-between;">
  83. <div style="display:flex;flex-direction:column;" v-on:click="inDetails(item)">
  84. <div style="color:#333333;font-size:.6rem">
  85. 剩余库存:{{item.productQtyStock}}
  86. </div>
  87. <div style="color:#FF0000;font-size:.8rem;margin-top:.5rem">
  88. {{item.productPrice}}积分
  89. </div>
  90. </div>
  91. <div style="display:flex;justify-content:flex-end;align-items:flex-end">
  92. <div style="
  93. font-size:.6rem;
  94. color: #fff;
  95. background-color: #0098E2;
  96. padding: .2rem .5rem;
  97. border-radius: .2rem;"
  98. v-on:click="addShopCart(item)"
  99. >
  100. 加入购物车
  101. </div>
  102. </div>
  103. </div>
  104. </div>
  105. </div>
  106. </div>
  107. </div>
  108. </body>
  109. <link rel="stylesheet" href="./mescroll/mescroll.min.css">
  110. <script type="text/javascript" src="./mescroll/mescroll.min.js"></script>
  111. <script type="text/javascript" src="../script/api.js"></script>
  112. <script type="text/javascript" src="../script/httpRequest.js"></script>
  113. <script type="text/javascript" src="../script/vue_plugins.js"></script>
  114. <script type="text/javascript">
  115. function closeWin() {
  116. api.closeWin({});
  117. }
  118. apiready = function() {
  119. api.parseTapmode();
  120. var header = $api.byId('aui-header');
  121. $api.fixStatusBar(header);
  122. new Vue({
  123. el: '#app',
  124. data: {
  125. keyword: '',
  126. shopList: []
  127. },
  128. watch: {
  129. keyword: function() {
  130. this.getShopList();
  131. }
  132. },
  133. methods: {
  134. init: function() {
  135. this.storeId = $api.getStorage('userid');
  136. },
  137. getShopList: function() {
  138. var data = {
  139. "productName": this.keyword,
  140. "url": "json",
  141. "type": "body"
  142. },
  143. _this = this,
  144. url = "searchShop";
  145. this.$post(url, data, function(ret) {
  146. _this.shopList = ret.product
  147. })
  148. },
  149. addShopCart: function(item) {
  150. if(item.productQtyStock==0){
  151. api.toast({
  152. msg: '很抱歉,当前商品暂时缺货'
  153. });
  154. return
  155. }
  156. var data = {
  157. "url": "json",
  158. "type": "body",
  159. "productId": item.mainId,
  160. "storeId":this.storeId,
  161. "cartQty": 1,
  162. "cartType": "0",
  163. "productIntroduction": item.productName,
  164. "spec": item.productSpecs,
  165. "productPrice": item.productPrice,
  166. "productImage": item.productImage
  167. },
  168. _this = this,
  169. url = "addShopCart";
  170. this.$post(url, data, function(ret) {
  171. if (ret.code == 0 || ret.code == '0') {
  172. if (!ret.message) {
  173. api.toast({
  174. msg: '成功加入购物车'
  175. });
  176. } else {
  177. api.toast({
  178. msg: ret.message
  179. });
  180. }
  181. }
  182. })
  183. },
  184. inDetails: function(item) {
  185. this.goWin('integral_details', 'integral_details.html', {
  186. productId: item.mainId
  187. });
  188. },
  189. },
  190. mounted: function() {
  191. this.init();
  192. },
  193. })
  194. }
  195. </script>
  196. </html>