123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489 |
- <!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 name="description" content="">
- <meta name="format-detection" content="telephone=no" />
- <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 src="js/vue.js"></script>
- <script src="js/vant-ui.js"></script>
- <script src="js/main.js"></script>
- <link rel="stylesheet" href="./mescroll/mescroll.min.css">
- <title></title>
- </head>
- <style>
- .cartNum {
- z-index: 2222;
- font-size: .3rem;
- text-align: center;
- color: #f00;
- font-weight: 500;
- }
- .gouwuche .caigouBg .caigouBgPix {
- background-color: #00a0ea !important;
- }
- .downOrder {
- width: 0.5rem;
- height: 0.5rem;
- margin-right: 0.3rem;
- margin-top: 0.3rem;
- }
- .gouwuche .caigouBg ul li {
- height: 2rem;
- }
- .searchSpec {
- z-index: 1111;
- width: 85%;
- height: 1rem;
- }
- .search {
- top: 0rem;
- }
- .search {
- width: 100%;
- background: #00a0ea;
- height: 0.9rem;
- padding-left: 0.36rem;
- padding-right: 0.36rem;
- }
- .search .searchbox input {
- width: 100%;
- font-size: 0.3rem;
- display: block;
- color: #999;
- height: 100%;
- position: relative;
- padding-left: 5%;
- padding-right: 5%;
- background: none;
- border: 0;
- outline: none;
- margin-top: 0.1rem;
- }
- .searchbox {
- background-color: #fff;
- display: flex;
- padding: 0.1rem;
- width: 100%;
- border-radius: 5px;
- }
- .gouwuche .caigouBg .caigouBgPix {
- padding: 0;
- }
- .setp .right,
- .setp .left {
- width: 0.7rem;
- height: 0.7rem;
- }
- .setp {
- width: 2rem;
- height: 0.7rem;
- }
- </style>
- <body>
- <div id="app" style="overflow : scroll;">
- <div class="pageView gouwuche" style="padding-top : 0px;position:relative;overflow : scroll">
- <div class="caigouBg">
- <div class="fixBor cartNum" v-on:click="goCar">
- {{ cartNums }}
- </div>
- <div class="caigouBgPix flex a-center" style="flex-wrap: wrap;">
- <div class="searchSpec">
- <div class="search flex a-center">
- <div class="searchbox">
- <svg t="1589079341958" class="icon" viewBox="0 0 1024 1024" version="1.1"
- xmlns="http://www.w3.org/2000/svg" p-id="5394" width="22" height="22">
- <path
- 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"
- p-id="5395" fill="#bfbfbf"></path>
- </svg>
- <input type="search" placeholder="请输入轮胎规格" v-model="keyword">
- </div>
- </div>
- </div>
- <div class="item flex a-center j-center" v-on:click="chooseAndtion(2)"
- style="width:15%;padding-right: 10px;">
- {{ chooseHW.name || '花纹' }} <i class="iconfont icon-xia"></i>
- </div>
- <!-- <div class="item flex a-center j-center">
- {{ choosePPone || '品牌' }}
- </div>
- <div class="fgx"></div> -->
- <!-- <div class="item flex a-center j-center" v-on:click="chooseAndtion(1)">
- {{ chooseGG.name || '规格' }} <i class="iconfont icon-xia"></i>
- </div>
- <div class="fgx"></div> -->
- <!-- <div class="item flex a-center j-center" v-on:click="chooseAndtion(2)">
- {{ chooseHW.name || '花纹' }} <i class="iconfont icon-xia"></i>
- </div> -->
- </div>
- <ul style="overflow : scroll;margin-top : 0.76rem" class="mescroll" v-show="list.length > 0"
- id="mescroll">
- <li class="flex col" v-for="(item,index) in list" :key="index">
- <div class="flex libox">
- <div class="info">
- <h4>{{ item.maktx }}</h4>
- <span>{{ item.pinpai }}</span>
- <div class="flex a-center jlr">
- <!-- <div class="kuchun">
- 有货:1000
- </div> -->
- <div class="setp flex jlr a-center">
- <div class="left flex a-center j-center" v-on:click="minusSign(index,0)">
- -
- </div>
- <div class="value flex a-center j-center">
- <input type="number" style="width:0.8rem;text-align:center;border:none"
- v-model="item.purchaseNumber" />
- </div>
- <div class="right flex a-center j-center" v-on:click="minusSign(index,1)">
- +
- </div>
- </div>
- </div>
- </div>
- <div class="flex a-center">
- <div class="item flex a-center j-center active" v-on:click="addStoreCar(index)">
- <img class="downOrder" src="./image/bottombtn0202.png" />
- </div>
- <div class="item flex a-center j-center" v-on:click="buyStore(index)">
- <img class="downOrder" src="./image/downOrder.png" />
- </div>
- </div>
- </div>
- <div class="timer flex a-center">
- <!--活动倒计时: 10:20:36-->
- </div>
- </li>
- </ul>
- <div v-show="list.length == 0" style="text-align:center">
- <img src="./image/noData.png" style="margin:2rem auto" />
- </div>
- </div>
- </div>
- </div>
- </body>
- <script type="text/javascript" src="../script/aui-scroll.js"></script>
- <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">
- apiready = function () {
- new Vue({
- el: '#app',
- data: {
- list: [],
- userId: '',
- kunnr: '',
- cartNums: '', // 购物车数量
- size: 10,
- current: 1,
- totalPages: 1, // 总页数
- mescroll: '',
- frist: 1,
- mescroll: '',
- brandList: [],
- guigeList: [],
- huawenList: [],
- choosePP: {}, // 选择品牌
- chooseGG: {}, // 选择规格
- chooseHW: {}, // 选择花纹
- UIActionSelector: '',
- choosePPone: '',
- keyword: '',
- },
- watch: {
- keyword: function (nw, od) {
- this.current = 1;
- this.getStoreList();
- }
- },
- methods: {
- init: function () {
- var _this = this;
- this.choosePPone = $api.getStorage('brand');
- this.UIActionSelector = api.require("UIActionSelector");
- this.userId = $api.getStorage('userid');
- this.status = $api.getStorage('status');
- this.getStoreList();
- this.getCarList();
- this.getWuliaoAntion();
- this.addEvent("refushCarList", function () {
- _this.getCarList();
- })
- this.$set(this.list, "urchaseNumber", 1);
- },
- // 配置一下上拉和下拉
- configs: function () {
- var _this = this;
- this.frist = 2;
- this.configDownAndPull("mescroll", function (mescroll) {
- _this.mescroll = mescroll;
- _this.current = 1;
- _this.getStoreList(mescroll);
- }, function (mescroll) {
- if (_this.current < _this.totalPages) {
- _this.current = _this.current + 1;
- _this.getStoreList(mescroll, 1);
- } else {
- mescroll.endSuccess(_this.size, false);
- }
- });
- },
- // 获取筛选条件
- getWuliaoAntion: function () {
- var url = "getWuliaoAntionU",
- _this = this;
- var data = {
- storeId: this.userId,
- url: 'json',
- type: 'body'
- }
- this.$post(url, data, function (ret) {
- if (ret.code == 0 || ret.code == '0') {
- var brands = [{
- name: '全部'
- }],
- specs = [{
- name: '全部'
- }],
- pattern = [{
- name: '全部'
- }]
- ret.data.pingpaiList = ret.data.pingpaiList == null ? [] : ret.data.pingpaiList;
- ret.data.pingpaiList.map(function (pp, index) {
- brands.push({
- name: pp
- })
- })
- _this.brandList = brands;
- ret.data.guigeList = ret.data.guigeList == null ? [] : ret.data.guigeList;
- ret.data.guigeList.map(function (gg, index) {
- specs.push({
- name: gg
- })
- })
- _this.guigeList = specs;
- ret.data.huawenList = ret.data.huawenList == null ? [] : ret.data.huawenList;
- ret.data.huawenList.map(function (hw, index) {
- pattern.push({
- name: hw
- })
- })
- _this.pattern = pattern;
- if (_this.frist == 1) {
- _this.$nextTick(function () {
- _this.configs();
- })
- }
- }
- })
- },
- // 获取门店经销商对应物料
- getStoreList: function (mescroll, type) {
- var data = {
- url: 'json',
- type: 'body',
- "storeId": this.userId,
- "size": this.size,
- current: this.current,
- "pinpai": this.choosePP.name == '全部' ? '' : this.choosePP.name,
- "guige": this.keyword,
- "huawen": this.chooseHW.name == '全部' ? '' : this.chooseHW.name
- },
- _this = this,
- url = "getStoreListU";
- this.$post(url, data, function (ret) {
- // console.log(JSON.stringify(ret))
- if (ret.code == 0 || ret.code == '0') {
- ret.data.records.map(function (store, index) {
- store.purchaseNumber = 1;
- })
- _this.list = _this.current == 1 ? ret.data.records : (_this.list.concat(ret.data.records));
- _this.totalPages = ret.data.pages;
- if (mescroll) {
- mescroll.endSuccess(_this.size, true);
- }
- }
- })
- },
- // 跳转购物车
- goCar: function () {
- //this.goWin('cartList_win', 'cartList_win.html', '');
- api.closeWin({
- });
- this.sendEvent("gotocart");
-
- },
- // 控制数量
- minusSign: function (index, type) {
- var number = this.list[index].purchaseNumber ? this.list[index].purchaseNumber : 0;
- if (type == 0) {
- // -
- if (number > 0) {
- this.$set(this.list[index], "purchaseNumber", (parseInt(number) - 1));
- }
- } else {
- this.$set(this.list[index], "purchaseNumber", (parseInt(number) + 1));
- }
- },
- // 获取购物车数量
- getCarList: function () {
- var url = "getCarListU",
- _this = this,
- data = {
- "storeId": this.userId,
- "url": "json",
- "type": "body"
- };
- this.$post(url, data, function (ret) {
- if (ret.code == 0 || ret.code == '0') {
- _this.cartNums = ret.data.length;
- }
- })
- },
- getNumber: function (item) {
- if (item.purchaseNumber < 0) {
- item.purchaseNumber = 0;
- }
- },
- // 添加购物车
- addStoreCar: function (index) {
- if (this.status == 3) {
- api.alert({
- title: '系统提示',
- msg: '门店已冻结,请找相关业务经理解冻!',
- }, function (ret, err) {
- });
- return;
- }
- var storeInfo = this.list[index];
- var data = {
- "matnr": storeInfo.matnr,
- "storeId": this.userId,
- "purchaseNumber": storeInfo.purchaseNumber ? storeInfo.purchaseNumber : 0,
- "cartType": "1",
- "maktx": storeInfo.maktx,
- "brand": storeInfo.pinpai,
- "spec": storeInfo.guige,
- "pattern": storeInfo.huawen,
- "url": "json",
- "type": 'body'
- },
- _this = this,
- url = "addStoreToCarU";
- this.$post(url, data, function (ret) {
- if (ret.code == 0 || ret.code == '0') {
- if (!ret.message) {
- api.toast({
- msg: '添加购物车成功'
- });
- setTimeout(function () {
- _this.getCarList();
- }, 200);
- } else {
- api.toast({
- msg: ret.message
- });
- }
- }
- })
- },
- // 立即抢购
- buyStore: function (index) {
- if (this.status == 3) {
- api.alert({
- title: '系统提示',
- msg: '门店已冻结,请找相关业务经理解冻!',
- }, function (ret, err) {
- });
- return;
- }
- var _this = this;
- this.showModal("下单提示", "是否确认立即购买该商品?", ["确认", "取消"], function (type) {
- if (type == 1) {
- _this.buyStoreDone(index);
- }
- })
- },
- buyStoreDone: function (index) {
- var storeInfo = this.list[index];
- var _this = this,
- url = "rushToBuyU";
- var data = {
- "retarilerId": this.userId,
- "qty": storeInfo.purchaseNumber ? storeInfo.purchaseNumber : 0,
- "materialId": storeInfo.matnr,
- "orderType": "0",
- "maktx": storeInfo.maktx,
- "brand": storeInfo.pinpai,
- "spec": storeInfo.guige,
- "pattern": storeInfo.huawen,
- "url": "json",
- "type": 'body'
- }
- this.$post(url, data, function (ret) {
- if (ret.code == 0 || ret.code == '0') {
- if (!ret.message) {
- api.toast({
- msg: '下单成功'
- });
- // 跳转订单页面
- _this.goWin('orderInfo_win', 'orderInfo_win.html', {
- id: ret.data.result
- });
- } else {
- api.toast({
- msg: ret.message
- });
- }
- }
- })
- },
- // 选择筛选条件
- chooseAndtion: function (type) {
- var types = ["brandList", "guigeList", "pattern"],
- _this = this;
- var data = eval('this.' + types[type]);
- this.chooseRegion(this.UIActionSelector, 1, data, function (ret) {
- if (ret.eventType == 'ok') {
- if (type == 0) {
- _this.choosePP = ret.selectedInfo[0]
- } else if (type == 1) {
- _this.chooseGG = ret.selectedInfo[0]
- } else {
- _this.chooseHW = ret.selectedInfo[0]
- }
- }
- _this.getStoreList();
- })
- }
- },
- filters: {},
- mounted: function () {
- this.init();
- }
- })
- }
- </script>
- </html>
|