123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/>
- <title>无标题文档</title>
- <link rel="stylesheet" href="../../css/styleChoose.css">
- <link rel="stylesheet" href="../../css/html.css">
- <style>
- body, html {
- background-color: transparent !important;
- border: 1px solid #ddd;
- }
- .up, .up1 {
- height: 30%;
- }
- .down {
- height: 70%;
- border-top: 1px solid #ddd;
- padding-bottom: 1rem;
- }
- .foot {
- background-color: #007f86 !important;
- }
- </style>
- </head>
- <body>
- <div class="subFly" id="app" v-cloak>
- <div class="up" v-on:click="closeFrame"></div>
- <div class="down">
- <a class="close" href="javascript:" v-on:click="closeFrame"> <img src="../../image/close.png" alt=""> </a>
- <dl class="subName">
- <dd>
- <p data-icon=""></p>
- <!--<p style="height: 20px" v-show = "agent != {}">
- <span></span>
- </p>-->
- <p style="margin-top: 25px">
- <span>已选:“</span>
- <span class="choseValue">{{info.material_name ? info.material_name : info.materialName}}</span>
- <span>”</span>
- </p>
- </dd>
- </dl>
- <dl class="subChose">
- <dt>
- 主要参数
- </dt>
- <dd>
- {{info.brand}}
- </dd>
- <dd>
- {{info.specs}}
- </dd>
- <dd>
- {{info.pattern}}
- </dd>
- <dd>
- {{info.level}}
- </dd>
- </dl>
- <dl class="subChose" v-show="agent != ''">
- <dt>
- 经销商
- </dt>
- <dd>
- {{agent.name}}
- </dd>
- </dl>
- <dl class="subCount">
- <dt>
- 购买数量
- </dt>
- <dd>
- <div class="btn" style="text-align: right;margin-top: -2px">
- <button class="ms" style="display: inline-block;" v-on:click="changeNum('-')">
- <strong></strong>
- </button>
- <input class="zmq-input-number" v-model="number">
- </input>
- <button class="ad" v-on:click="changeNum('+')">
- <strong></strong>
- </button>
- <!--<i class="price">25</i>-->
- </div>
- </dd>
- </dl>
- <div class="foot" v-if="btnType == 'order'" v-on:click = "downOrder">
- <span>立即下单</span>
- </div>
- <div class="foot" v-else v-on:click = "clickBrn">
- <span>添加到订单</span>
- </div>
- </div>
- </div>
- <script src="../../script/api.js" type="text/javascript"></script>
- <script type="text/javascript" src="../../script/aui-scroll.js"></script>
- <script type="text/javascript" src="../../script/vue.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() {
- var info = api.pageParam.info;
- var btnType = api.pageParam.type;
- var agent = api.pageParam.agent;
- var agentId = api.pageParam.agentId;
- var aid = api.pageParam.aid;
- new Vue({
- el : '#app',
- data : {
- info : JSON.parse(info),
- retariler_id : '',
- /// 添加购物车
- addCarUrl : 'addCarUrl',
- // 购买的数量
- number : 1,
- // 按钮标题
- btnType : btnType,
- // 下单
- downOrderUrl : 'downOrderUrl',
- // 选择的经销商id
- agent : typeof agent == 'undefined' ? '' : JSON.parse(agent),
- agentId : agentId,
- },
- methods : {
- init : function() {
- this.retariler_id = $api.getStorage("retailerid");
- },
- closeFrame : function() {
- api.closeFrame({
- });
- },
- // 点击
- clickBrn : function() {
- if (this.btnType == 'car') {
- this.addCar();
- } else {
- this.addCar();
- }
- },
- // 改变数量
- changeNum : function(type) {
- if (type == '-') {
- if (this.number == 1) {
- api.toast({
- msg : '数量不能小于1'
- });
- } else {
- this.number = this.number - 1;
- }
- } else {
- this.number = this.number + 1;
- }
- },
- downOrder : function() {
- var data = {
- materialId : (this.info.id).toString(),
- materialCode : this.info.materialCode,
- retailerId : this.retariler_id,
- amount : (this.number).toString(),
- agentId : this.agent.id,
- activityId : aid,
- orderType : 1,
- cartType : 0,
- type : 'body',
- url : 'json',
- }, url = this.addCarUrl, _this = this;
- this.$post(url, data, function(ret) {
- if (ret.code == 0) {
- _this.showToast("添加到订单成功");
- _this.sendEvent("refushCar");
- setTimeout(function() {
- _this.closeFrame();
- }, 300);
- }
- })
- },
- // 下单
- // downOrder : function() {
- // // 将这个商品的数量换一下
- // var data = {
- // retailerId : this.retariler_id,
- // amount : this.number,
- // bizCartDtoList : [this.info],
- // agentId : this.agent.id,
- // activityId : aid,
- // orderType : 1,
- // url : 'json',
- // type : 'body',
- // }, url = this.downOrderUrl, _this = this;
- // this.$post(url, data, function(ret) {
- // if (ret.code == 0) {
- // _this.showToast("下单成功");
- // // 跳转订单列表
- // _this.goWin("orderList_win", "orderList_win.html", "");
- // }
- // });
- // },
- // 添加购物车
- addCar : function() {
-
- var data = {
- materialId : (this.info.id).toString(),
- materialCode : this.info.materialCode,
- retailerId : this.retariler_id,
- amount : (this.number).toString(),
- agentId : this.agentId,
- type : 'body',
- url : 'json',
- }, url = this.addCarUrl, _this = this;
- this.$post(url, data, function(ret) {
- if (ret.code == 0) {
- _this.showToast("添加到订单成功");
- _this.sendEvent("refushCar");
- setTimeout(function() {
- _this.closeFrame();
- }, 300);
- }
- })
- }
- },
- mounted : function() {
- this.init();
- }
- })
- }
- </script>
- </body>
- </html>
|