123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 |
- <!DOCTYPE html>
- <html class="">
- <!--STATUS OK-->
- <head>
- <meta name="referrer" content="always" />
- <meta charset='utf-8' />
- <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
- <meta http-equiv="x-dns-prefetch-control" content="on">
- <meta name="description" content="">
- <meta name="format-detection" content="telephone=no" />
- <link rel="stylesheet" type="text/css" href="../css/api.css" />
- <link rel="stylesheet" type="text/css" href="../css/aui-win.css" />
- <link rel="stylesheet" type="text/css" href="../css/aui.css" />
- <link rel="stylesheet" type="text/css" href="css/vant-ui.css" />
- <link rel="stylesheet" type="text/css" href="css/iconfont.css">
- <link rel="stylesheet" type="text/css" href="css/main.css" />
- <script type="text/javascript" src="../script/aui-tab.js"></script>
- <script src="js/vue.js"></script>
- <script src="js/vant-ui.js"></script>
- <script src="js/main.js"></script>
- <title></title>
- </head>
- <style>
- .card {
- background-color: #fff;
- display: flex;
- border-bottom: 1px solid #F1F1F1;
- }
- .card:last-child {
- border-bottom: 0px solid #F1F1F1;
- }
- .card-img {
- padding: .3rem;
- }
- .card-right {
- width: 13rem;
- padding: .3rem;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- }
- .card-title-p {
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- overflow: hidden;
- width: 12.4rem;
- }
- [v-cloak] {
- display: none;
- }
- </style>
- <body>
- <div id="app">
- <header class="aui-bar aui-bar-nav aui-bar-info" id="aui-header">
- <div>
- <a class="aui-btn aui-btn-info aui-pull-left" tapmode onclick="closeWin()"> <span class="aui-iconfont aui-icon-left"></span> </a>
- <div class="aui-title" style="left:2rem; right: 0.5rem;">
- <div class="aui-searchbar" style="background-color:#00a0ea">
- <div class="aui-searchbar-input aui-border-radius">
- <i class="aui-iconfont aui-icon-search"></i>
- <input type="search" placeholder="请输入搜索内容" id="search-input" v-model="keyword">
- <div class="aui-searchbar-clear-btn">
- <i class="aui-iconfont aui-icon-close"></i>
- </div>
- </div>
- <div class="aui-searchbar-btn" tapmode>取消</div>
- </div>
- </div>
- </div>
- </header>
- <div class="list" style="height:90%;overflow-y:scroll;">
- <div class="card" v-for="(item,index) in shopList" :key="index">
- <div class="card-img" v-on:click="inDetails(item)">
- <img :src="item.productImage" style="height:5rem;width:5rem;" alt="">
- </div>
- <div class="card-right">
- <div v-on:click="inDetails(item)">
- <p class="card-title-p"></p>
- {{item.productName}}
- </div>
- <div style="display:flex;justify-content:space-between;">
- <div style="display:flex;flex-direction:column;" v-on:click="inDetails(item)">
- <div style="color:#333333;font-size:.6rem">
- 剩余库存:{{item.productQtyStock}}
- </div>
- <div style="color:#FF0000;font-size:.8rem;margin-top:.5rem">
- {{item.productPrice}}积分
- </div>
- </div>
- <div style="display:flex;justify-content:flex-end;align-items:flex-end">
- <div style="
- font-size:.6rem;
- color: #fff;
- background-color: #0098E2;
- padding: .2rem .5rem;
- border-radius: .2rem;"
- v-on:click="addShopCart(item)"
- >
- 加入购物车
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </body>
- <link rel="stylesheet" href="./mescroll/mescroll.min.css">
- <script type="text/javascript" src="./mescroll/mescroll.min.js"></script>
- <script type="text/javascript" src="../script/api.js"></script>
- <script type="text/javascript" src="../script/httpRequest.js"></script>
- <script type="text/javascript" src="../script/vue_plugins.js"></script>
- <script type="text/javascript">
- function closeWin() {
- api.closeWin({});
- }
- apiready = function() {
- api.parseTapmode();
- var header = $api.byId('aui-header');
- $api.fixStatusBar(header);
- new Vue({
- el: '#app',
- data: {
- keyword: '',
- shopList: []
- },
- watch: {
- keyword: function() {
- this.getShopList();
- }
- },
- methods: {
- init: function() {
- this.storeId = $api.getStorage('userid');
- },
- getShopList: function() {
- var data = {
- "productName": this.keyword,
- "url": "json",
- "type": "body"
- },
- _this = this,
- url = "searchShop";
- this.$post(url, data, function(ret) {
- _this.shopList = ret.product
- })
- },
- addShopCart: function(item) {
- if(item.productQtyStock==0){
- api.toast({
- msg: '很抱歉,当前商品暂时缺货'
- });
- return
- }
- var data = {
- "url": "json",
- "type": "body",
- "productId": item.mainId,
- "storeId":this.storeId,
- "cartQty": 1,
- "cartType": "0",
- "productIntroduction": item.productName,
- "spec": item.productSpecs,
- "productPrice": item.productPrice,
- "productImage": item.productImage
- },
- _this = this,
- url = "addShopCart";
- this.$post(url, data, function(ret) {
- if (ret.code == 0 || ret.code == '0') {
- if (!ret.message) {
- api.toast({
- msg: '成功加入购物车'
- });
- } else {
- api.toast({
- msg: ret.message
- });
- }
- }
- })
- },
- inDetails: function(item) {
- this.goWin('integral_details', 'integral_details.html', {
- productId: item.mainId
- });
- },
- },
- mounted: function() {
- this.init();
- },
- })
- }
- </script>
- </html>
|