123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704 |
- <!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/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>
- .box-main {
- position: relative;
- top: -4rem;
- padding-top: .5rem;
- }
- .card {
- display: flex;
- justify-content: center;
- margin-bottom: 2rem;
- }
- .card-list {
- width: 7rem;
- background-color: #fff;
- border-radius: .3rem;
- display: flex;
- flex-direction: column;
- }
- .card-box {
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- border-bottom: 1px solid #F1F1F1;
- margin: 0 .2rem;
- padding: .2rem 0;
- }
- .card-box:last-child {
- border-bottom: 0px solid #F1F1F1;
- }
- .card-list-left {
- display: flex;
- flex-direction: row;
- }
- .card-check {
- display: flex;
- align-items: center;
- margin: 0 .2rem;
- }
- .card-img {
- margin: .2rem .2rem .2rem .4rem;
- }
- .card-text {
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- margin: .2rem 0;
- }
- .card-title {
- width: 2.5rem;
- }
- .card-title-p {
- font-size: .3rem;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- overflow: hidden;
- }
- .shop-add-left {
- display: flex;
- font-size: .28rem;
- }
- .shop-add-left input {
- width: .6rem;
- border: 1px solid rgba(229, 229, 229, 1);
- text-align: center;
- }
- .but-sub {
- border-top: 1px solid rgba(229, 229, 229, 1);
- border-left: 1px solid rgba(229, 229, 229, 1);
- border-bottom: 1px solid rgba(229, 229, 229, 1);
- width: .45rem;
- text-align: center;
- border-top-left-radius: .05rem;
- border-bottom-left-radius: .05rem;
- }
- .but-add {
- border-top: 1px solid rgba(229, 229, 229, 1);
- border-right: 1px solid rgba(229, 229, 229, 1);
- border-bottom: 1px solid rgba(229, 229, 229, 1);
- width: .45rem;
- text-align: center;
- border-top-right-radius: .05rem;
- border-bottom-right-radius: .05rem;
- }
- .card-del {
- margin: .3rem;
- width: .3rem;
- height: .3rem;
- }
- .card-del img {
- width: .3rem;
- height: .3rem;
- }
- .settle {
- position: absolute;
- bottom: 0;
- background-color: #fff;
- width: 100%
- }
- .settle-main {
- display: flex;
- justify-content: space-between;
- margin: .15rem 0;
- }
- .settle-left {
- margin: 0 .2rem;
- display: flex;
- flex-direction: row;
- }
- .settle-right {
- display: flex;
- flex-direction: row;
- }
- .settle-compute {
- color: rgba(0, 159, 233, 1);
- display: flex;
- align-items: center;
- margin: 0 .2rem;
- }
- .settle-button {
- display: flex;
- justify-content: center;
- align-items: center;
- background-color: rgba(0, 158, 232, 1);
- border-radius: .5rem;
- height: .6rem;
- width: 2rem;
- color: #fff;
- margin: 0 .2rem;
- }
- .color-c2c2c2 {
- background-color: #C2C2C2;
- }
- .settle-check {
- display: flex;
- align-items: center;
- }
- .check-text {
- margin-left: .2rem;
- display: flex;
- align-items: center;
- color: rgba(102, 102, 102, 1);
- }
- .buttom-buy {
- background-color: #E01212;
- color: #ffffff;
- display: flex;
- justify-content: center;
- align-items: center;
- border-radius: 1rem;
- width: 70%;
- height: .7rem;
- }
- .upwarp-nodata {
- display: none !important;
- }
- .mescroll {
- position: relative;
- height: 85%;
- }
- </style>
- <body>
- <div id="app" style="background-color:#F5F5F5">
- <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" id="aui-title">
- 购物车
- </div>
- <div
- style="display:flex;justify-content:flex-end;font-size:.3rem;align-items:center;margin-right:.2rem;">
- <div v-on:click="setEdit" v-show="inEdit">
- 编辑
- </div>
- <div v-on:click="getEdit" v-show="outEdit">
- 完成
- </div>
- </div>
- <!-- <div v-on:click="getEdit" v-show="outEdit" style="display:flex;justify-content:flex-end;font-size:.3rem;align-item:center;margin-right:.2rem;">
- 完成
- </div> -->
- </div>
- </header>
- <div class="banner">
- </div>
- <div class="box-main mescroll-touch-y mescroll" id="mescroll">
- <div class="card-main">
- <div class="card">
- <div class="card-list">
- <div class="card-box" v-for="(item,index) in Shopcarts" :key="index">
- <div class="card-list-left">
- <div class="card-check">
- <span>
- <van-checkbox v-model="item.checked" v-on:change="numCheck(item)">
- </van-checkbox>
- </span>
- </div>
- <div class="card-img">
- <img v-if="item.productImage==null" src="img/nothing.png"
- style="width:1.8rem;height:1.8rem">
- <img v-else :src="item.productImage" style="width:1.8rem;height:1.8rem">
- </div>
- <div class="card-text">
- <div class="card-title">
- <p class="card-title-p">{{item.productIntroduction}}</p>
- </div>
- <div class="shop-add-left">
- <van-stepper v-model="item.cartQty" input-width=".6rem" button-size=".4rem"
- integer min="1" max="999" v-on:change="inputNum(item)" />
- <!-- <div class="but-sub" v-on:click="subQuantity(item)">-</div>
- <input type="number" v-model="item.cartQty" v-on:input="inputNum(item)" v-on:Blur='outBlur(item)'>
- <div class="but-add" v-on:click="addQuantity(item)">+</div> -->
- </div>
- </div>
- </div>
- <div class="card-del" v-on:click="delCart(item)">
- <img src="./img/images/slices.png" alt="">
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="settle">
- <div class="settle-main">
- <div class="settle-left">
- <div class="settle-check">
- <van-checkbox v-model="allCheck" v-on:click="changeAllCheck"></van-checkbox>
- </div>
- <div class="check-text">
- 全选
- </div>
- </div>
- <div class="settle-right">
- <div class="settle-compute" ref="updateTotal">
- 总计: {{totalSumAll}}积分
- </div>
- <div class="settle-button" v-show="inEdit" v-on:click="showPopup">
- 结算
- </div>
- <div class="settle-button color-c2c2c2" v-show="outEdit" v-on:click="allDelCart()">
- 删除
- </div>
- </div>
- </div>
- </div>
- <van-popup v-model="show" closeable position="bottom" :style="{ height: '40%' }">
- <div v-if="addresslist.length!=0" style="margin-top:1rem;height:65%" class="mescroll-touch-y mescroll">
- <van-radio-group v-model="radio" v-for="(ab,index) in addresslist" :key="index"
- style="padding:.2rem .4rem">
- <van-radio :name="ab.mainId">
- <div>
- <div>
- {{ab.contactsName}}
- </div>
- <div style="font-size:.25rem">
- {{ab.province}}{{ab.city}}{{ab.county}}{{ab.address}}
- </div>
- </div>
- </van-radio>
- </van-radio-group>
- </div>
- <div v-else>
- <div style="display:flex;justify-content:center;margin-top:.8rem;color:#ccc">
- 暂无收货地址
- </div>
- <div style="display:flex;justify-content:center;margin-top:.8rem;color:#00a0ea" v-on:click="goaddress">
- 点击去添加
- </div>
- </div>
- <div style="position: fixed;bottom: .2rem;width:100%;display:flex;justify-content:center">
- <div class="buttom-buy" v-on:click="addOrder">
- 立即下单
- </div>
- </div>
- </van-popup>
- </div>
- </body>
- <link rel="stylesheet" href="./mescroll/mescroll.min.css">
- <script type="text/javascript" src="./js/qrcode.min.js"></script>
- <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">
- function closeWin() {
- api.closeWin({});
- }
- apiready = function () {
- api.parseTapmode();
- var header = $api.byId('aui-header');
- $api.fixStatusBar(header);
- new Vue({
- el: '#app',
- data: {
- checkBox: [],
- inEdit: true,
- outEdit: false,
- Shopcarts: [],
- total: '',
- allCheck: false,
- current: 1,
- size: 10, // 订单状态 0,新创建,1已接单,2,驳回,3完成 经销商审核 0 待审核 1 同意 2 拒绝
- frist: 1,
- totalPages: 1,
- hasOther: false,
- mescroll: '',
- show: false,
- addresslist: [],
- radio: '',
- },
- methods: {
- init: function () {
- this.storeId = $api.getStorage('userid');
- this.loginId = $api.getStorage('loginid');
- this.status = $api.getStorage('status');
- this.getShopCart();
- var _this = this;
- this.addEvent("refreshshop", function () {
- _this.getShopCart();
- _this.show = false;
- });
- // this.configDownAndPull("mescroll", function(mescroll) {
- // _this.getShopCart(mescroll);
- // }, function() {
- //
- // }, false);
- },
- configs: function () {
- var _this = this;
- this.frist = 2;
- this.configDownAndPull("mescroll", function (mescroll) {
- _this.mescroll = mescroll;
- _this.current = 1;
- _this.getShopCart(mescroll);
- }, function (mescroll) {
- if (_this.current < _this.totalPages) {
- _this.current = _this.current + 1;
- _this.getShopCart(mescroll, 1);
- } else {
- mescroll.endSuccess(_this.size, false);
- }
- })
- },
- addMore: function () {
- var _this = this;
- if (_this.current < _this.totalPages) {
- _this.current = _this.current + 1;
- _this.getCouponList(_this.mescroll, 1);
- } else {
- _this.hasOther = true;
- }
- },
- inputNum: function (item) {
- if (item.cartQty > 999) {
- this.showToast("最多购买999件")
- item.cartQty = "999";
- } else if (item.cartQty < 0) {
- this.showToast("最少购买1件")
- item.cartQty = "1";
- }
- if (item.cartQty != '') {
- var data = {
- "url": "json",
- "type": "body",
- "mainId": item.mainId,
- "cartQty": Number(item.cartQty)
- }
- _this = this,
- url = "fixCartNum";
- this.$post(url, data, function (ret) { })
- }
- },
- setEdit: function () {
- if (this.inEdit) {
- this.inEdit = false;
- this.outEdit = true;
- } else {
- this.inEdit = true;
- this.outEdit = false;
- }
- },
- getEdit: function () {
- if (this.outEdit) {
- this.outEdit = false;
- this.inEdit = true;
- } else {
- this.inEdit = false;
- this.outEdit = true;
- }
- },
- getShopCart: function (mescroll) {
- var data = {
- "url": "json",
- "type": "body",
- "storeId": this.storeId,
- "size": this.size,
- "current": this.current
- },
- _this = this,
- url = "getShopCart";
- setTimeout(function () {
- if (mescroll) {
- mescroll.endSuccess();
- }
- }, 1000);
- this.$post(url, data, function (ret) {
- if (ret.code == 0 || ret.code == '0') {
- ret.data.records.map(function (store, index) {
- store.checked = false;
- })
- _this.Shopcarts = _this.current == 1 ? ret.data.records : _this.Shopcarts.concat(ret.data.records);
- _this.totalPages = ret.data.pages;
- if (mescroll) {
- mescroll.endSuccess(_this.size, true)
- }
- if (_this.frist == 1) {
- _this.$nextTick(function () {
- _this.configs();
- })
- }
- }
- })
- },
- changeAllCheck: function () {
- if (this.allCheck == false) {
- this.Shopcarts.map(function (cart, index) {
- cart.checked = false;
- })
- } else {
- this.Shopcarts.map(function (cart, index) {
- cart.checked = true;
- })
- }
- },
- numCheck: function (item) {
- var i = 0;
- this.Shopcarts.forEach(function (item) {
- if (item.checked === true) i++
- })
- if (i != this.Shopcarts.length) {
- this.allCheck = false
- } else {
- this.allCheck = true
- }
- },
- delCart: function (item) {
- var arr = [];
- var add = item.mainId;
- arr.push(add);
- var data = {
- "url": "json",
- "type": "body",
- "ids": arr,
- },
- _this = this,
- url = "delCart";
- _this.showModal('温馨提示', '是否确认删除?', ["取消", "确认"], function (res) {
- if (res == 2) {
- _this.$post(url, data, function (ret) {
- if (ret.code == 0 || ret.code == '0') {
- _this.showToast("已成功删除")
- } else {
- _this.showToast("删除失败")
- }
- setTimeout(function () {
- _this.getShopCart();
- }, 200)
- })
- }
- })
- },
- showPopup: function () {
- var arr = [];
- this.Shopcarts.map(function (cart, index) {
- if (cart.checked == true) {
- arr.push(cart.mainId);
- }
- })
- if (arr.length == 0) {
- this.showToast('至少选择一件商品');
- return;
- }
- if (this.status == 3) {
- api.alert({
- title: '系统提示',
- msg: '门店已冻结,请找相关业务经理解冻!'
- });
- return;
- }
- this.show = true;
- var data = {
- "url": "json",
- "type": "body",
- "storeId": this.storeId,
- "addressType": "1",
- "isDel": 0
- },
- _this = this,
- url = "getReceiptAddress";
- this.$post(url, data, function (ret) {
- if (ret.code == 0 || ret.code == '0') {
- _this.addresslist = ret.list;
- for (var i = 0; i < _this.addresslist.length; i++) {
- if (_this.addresslist[i].beDefault == 1) {
- _this.radio = _this.addresslist[i].mainId
- } else {
- _this.radio = _this.addresslist[0].mainId
- }
- }
- }
- })
- },
- addOrder: function () {
- var hasChoose = [];
- this.Shopcarts.map(function (cart, index) {
- if (cart.checked == true) {
- hasChoose.push({
- "mainId": cart.mainId,
- "productId": cart.productId,
- "storeId": cart.storeId,
- "cartQty": cart.cartQty,
- "cartType": cart.cartType,
- "status": cart.status,
- "productIntroduction": cart.productIntroduction,
- "brand": cart.brand,
- "spec": cart.spec,
- "pattern": cart.pattern,
- "createTime": cart.createTime,
- "productPrice": cart.productPrice,
- "isDelete": cart.isDelete,
- "productImage": cart.productImage,
- "size": null,
- "current": null
- });
- }
- })
- if (this.radio == "") {
- this.showToast('请选择收货地址');
- return;
- }
- var data = {
- "url": "json",
- "type": "body",
- "bizIntegralCartDtoList": hasChoose,
- "shopId": this.storeId,
- "receiptAddressId": this.radio
- },
- _this = this,
- url = "addOrder";
- _this.showModal('温馨提示', '是否确认下单?', ["取消", "确认"], function (res) {
- if (res == 2) {
- _this.$post(url, data, function (ret) {
- if (ret.code == 0 || ret.code == '0') {
- if (!ret.message) {
- _this.showToast("成功下单")
- _this.allCheck = false;
- _this.show = false;
- setTimeout(function () {
- _this.goWin('annal', 'annal_win.html');
- }, 1000);
- } else {
- api.toast({
- msg: ret.message
- });
- _this.allCheck = false;
- _this.show = false;
- return
- }
- } else {
- _this.showToast("下单失败")
- }
- setTimeout(function () {
- _this.getShopCart();
- }, 200)
- })
- } else {
- _this.show = false;
- }
- })
- },
- allDelCart: function () {
- var arr = [];
- this.Shopcarts.map(function (cart, index) {
- if (cart.checked == true) {
- arr.push(cart.mainId);
- }
- })
- if (arr.length == 0) {
- this.showToast('至少选择一件商品');
- return;
- }
- var data = {
- "url": "json",
- "type": "body",
- "ids": arr,
- },
- _this = this,
- url = "delCart";
- _this.showModal('温馨提示', '是否确认删除?', ["取消", "确认"], function (res) {
- if (res == 2) {
- _this.$post(url, data, function (ret) {
- if (ret.code == 0 || ret.code == '0') {
- _this.showToast("已成功删除")
- _this.allCheck = false
- } else {
- _this.showToast("删除失败")
- }
- setTimeout(function () {
- _this.getShopCart();
- _this.current = 1;
- }, 200)
- })
- }
- })
- },
- goaddress: function () {
- this.goWin('address', 'address_win.html');
- this.show = false
- }
- },
- watch: {
- },
- computed: {
- totalSumAll: function () {
- var totalSumAll = 0;
- this.Shopcarts.map(function (cart, index) {
- if (cart.checked == true) {
- totalSumAll += cart.productPrice * Number(cart.cartQty)
- }
- })
- return totalSumAll
- },
- },
- mounted: function () {
- this.init();
- }
- })
- }
- </script>
- </html>
|