storeChoose_body.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/>
  6. <title>无标题文档</title>
  7. <link rel="stylesheet" href="../../css/styleChoose.css">
  8. <link rel="stylesheet" href="../../css/html.css">
  9. <style>
  10. body, html {
  11. background-color: transparent !important;
  12. border: 1px solid #ddd;
  13. }
  14. .up, .up1 {
  15. height: 30%;
  16. }
  17. .down {
  18. height: 70%;
  19. border-top: 1px solid #ddd;
  20. padding-bottom: 1rem;
  21. }
  22. .foot {
  23. background-color: #007f86 !important;
  24. }
  25. </style>
  26. </head>
  27. <body>
  28. <div class="subFly" id="app" v-cloak>
  29. <div class="up" v-on:click="closeFrame"></div>
  30. <div class="down">
  31. <a class="close" href="javascript:" v-on:click="closeFrame"> <img src="../../image/close.png" alt=""> </a>
  32. <dl class="subName">
  33. <dd>
  34. <p data-icon=""></p>
  35. <!--<p style="height: 20px" v-show = "agent != {}">
  36. <span></span>
  37. </p>-->
  38. <p style="margin-top: 25px">
  39. <span>已选:“</span>
  40. <span class="choseValue">{{info.material_name ? info.material_name : info.materialName}}</span>
  41. <span>”</span>
  42. </p>
  43. </dd>
  44. </dl>
  45. <dl class="subChose">
  46. <dt>
  47. 主要参数
  48. </dt>
  49. <dd>
  50. {{info.brand}}
  51. </dd>
  52. <dd>
  53. {{info.specs}}
  54. </dd>
  55. <dd>
  56. {{info.pattern}}
  57. </dd>
  58. <dd>
  59. {{info.level}}
  60. </dd>
  61. </dl>
  62. <dl class="subChose" v-show="agent != ''">
  63. <dt>
  64. 经销商
  65. </dt>
  66. <dd>
  67. {{agent.name}}
  68. </dd>
  69. </dl>
  70. <dl class="subCount">
  71. <dt>
  72. 购买数量
  73. </dt>
  74. <dd>
  75. <div class="btn" style="text-align: right;margin-top: -2px">
  76. <button class="ms" style="display: inline-block;" v-on:click="changeNum('-')">
  77. <strong></strong>
  78. </button>
  79. <input class="zmq-input-number" v-model="number">
  80. </input>
  81. <button class="ad" v-on:click="changeNum('+')">
  82. <strong></strong>
  83. </button>
  84. <!--<i class="price">25</i>-->
  85. </div>
  86. </dd>
  87. </dl>
  88. <div class="foot" v-if="btnType == 'order'" v-on:click = "downOrder">
  89. <span>立即下单</span>
  90. </div>
  91. <div class="foot" v-else v-on:click = "clickBrn">
  92. <span>添加到订单</span>
  93. </div>
  94. </div>
  95. </div>
  96. <script src="../../script/api.js" type="text/javascript"></script>
  97. <script type="text/javascript" src="../../script/aui-scroll.js"></script>
  98. <script type="text/javascript" src="../../script/vue.js"></script>
  99. <script type="text/javascript" src="../../script/httpRequest.js"></script>
  100. <script type="text/javascript" src="../../script/vue_plugins.js"></script>
  101. <script type="text/javascript">
  102. apiready = function() {
  103. var info = api.pageParam.info;
  104. var btnType = api.pageParam.type;
  105. var agent = api.pageParam.agent;
  106. var agentId = api.pageParam.agentId;
  107. var aid = api.pageParam.aid;
  108. new Vue({
  109. el : '#app',
  110. data : {
  111. info : JSON.parse(info),
  112. retariler_id : '',
  113. /// 添加购物车
  114. addCarUrl : 'addCarUrl',
  115. // 购买的数量
  116. number : 1,
  117. // 按钮标题
  118. btnType : btnType,
  119. // 下单
  120. downOrderUrl : 'downOrderUrl',
  121. // 选择的经销商id
  122. agent : typeof agent == 'undefined' ? '' : JSON.parse(agent),
  123. agentId : agentId,
  124. },
  125. methods : {
  126. init : function() {
  127. this.retariler_id = $api.getStorage("retailerid");
  128. },
  129. closeFrame : function() {
  130. api.closeFrame({
  131. });
  132. },
  133. // 点击
  134. clickBrn : function() {
  135. if (this.btnType == 'car') {
  136. this.addCar();
  137. } else {
  138. this.addCar();
  139. }
  140. },
  141. // 改变数量
  142. changeNum : function(type) {
  143. if (type == '-') {
  144. if (this.number == 1) {
  145. api.toast({
  146. msg : '数量不能小于1'
  147. });
  148. } else {
  149. this.number = this.number - 1;
  150. }
  151. } else {
  152. this.number = this.number + 1;
  153. }
  154. },
  155. downOrder : function() {
  156. var data = {
  157. materialId : (this.info.id).toString(),
  158. materialCode : this.info.materialCode,
  159. retailerId : this.retariler_id,
  160. amount : (this.number).toString(),
  161. agentId : this.agent.id,
  162. activityId : aid,
  163. orderType : 1,
  164. cartType : 0,
  165. type : 'body',
  166. url : 'json',
  167. }, url = this.addCarUrl, _this = this;
  168. this.$post(url, data, function(ret) {
  169. if (ret.code == 0) {
  170. _this.showToast("添加到订单成功");
  171. _this.sendEvent("refushCar");
  172. setTimeout(function() {
  173. _this.closeFrame();
  174. }, 300);
  175. }
  176. })
  177. },
  178. // 下单
  179. // downOrder : function() {
  180. // // 将这个商品的数量换一下
  181. // var data = {
  182. // retailerId : this.retariler_id,
  183. // amount : this.number,
  184. // bizCartDtoList : [this.info],
  185. // agentId : this.agent.id,
  186. // activityId : aid,
  187. // orderType : 1,
  188. // url : 'json',
  189. // type : 'body',
  190. // }, url = this.downOrderUrl, _this = this;
  191. // this.$post(url, data, function(ret) {
  192. // if (ret.code == 0) {
  193. // _this.showToast("下单成功");
  194. // // 跳转订单列表
  195. // _this.goWin("orderList_win", "orderList_win.html", "");
  196. // }
  197. // });
  198. // },
  199. // 添加购物车
  200. addCar : function() {
  201. var data = {
  202. materialId : (this.info.id).toString(),
  203. materialCode : this.info.materialCode,
  204. retailerId : this.retariler_id,
  205. amount : (this.number).toString(),
  206. agentId : this.agentId,
  207. type : 'body',
  208. url : 'json',
  209. }, url = this.addCarUrl, _this = this;
  210. this.$post(url, data, function(ret) {
  211. if (ret.code == 0) {
  212. _this.showToast("添加到订单成功");
  213. _this.sendEvent("refushCar");
  214. setTimeout(function() {
  215. _this.closeFrame();
  216. }, 300);
  217. }
  218. })
  219. }
  220. },
  221. mounted : function() {
  222. this.init();
  223. }
  224. })
  225. }
  226. </script>
  227. </body>
  228. </html>