mall-deal-check-coupon.html 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>确认-订单-创业帮</title>
  6. <meta name="keywords" content="确认-订单-创业帮">
  7. <meta name="description" content="确认-订单-创业帮">
  8. <meta content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,shrink-to-fit=no,user-scalable=no" name="viewport" viewport="cover">
  9. <meta name="apple-mobile-web-app-capable" content="yes">
  10. <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
  11. <meta content="telephone=no" name="format-detection">
  12. <meta content="email=no" name="format-detection">
  13. <meta name="apple-mobile-web-app-title" content="确认-订单-创业帮">
  14. <meta http-equiv="Cache-Control" content="no-siteapp">
  15. <link rel="stylesheet" href="./static/css/main.css">
  16. <style>
  17. .van-ellipsis{overflow:hidden;}
  18. .mall-bottom{padding:0 .3733rem;height:54px;}
  19. .mall-bottom button{border-radius:999px !important; height:80% !important;}
  20. </style>
  21. </head>
  22. <body class="bgc-back pt0" style="padding-top:0;">
  23. <div id="app" v-cloak>
  24. <van-nav-bar class="user_rank_explan_title user_title_normal f16 rightbtn" title="确认订单" left-arrow @click-left="goback" v-if="toptitleisshow" v-cloak>
  25. <template #left><img src="./static/images/icon-comback@2x.png" alt=""></template>
  26. </van-nav-bar>
  27. <div class="deal-check" v-cloak>
  28. <van-cell-group :border="false">
  29. <van-card class="suremall" :price="products.Price" :desc="products.Details" :title="products.ProductName" :num="products.num" :thumb="products.DetailPicPath" :lazy-load="true" centered>
  30. <template #footer>
  31. <div class="tr van-hairline--top pt8 mt8"><span class="f12 c666">共{{products.num}}件商品 实付金额:</span><span class="f14 c333 more b" v-if="products.Price">¥{{products.total | tofixed2}}</span></div>
  32. </template>
  33. </van-card>
  34. </van-cell-group>
  35. </div>
  36. <van-goods-action class="mall-bottom">
  37. <van-goods-action-button class="kxs-btn" type="default" color="#FFD500" style="color:#333;" text="确认订单" @click="onClickButton"></van-goods-action-button>
  38. </van-goods-action>
  39. </div>
  40. <script src="./static/js/klm-vv.min.js"></script>
  41. <script src="./static/js/appfunc.min.js"></script>
  42. <script src="./static/js/klm-axios-config.js"></script>
  43. <script src="./static/js/publicfn.js"></script>
  44. <script>
  45. function OnStart(){
  46. app.getinfo();
  47. };
  48. // 通过 CDN 引入时不会自动注册 Lazyload 组件
  49. // 可以通过下面的方式手动注册
  50. Vue.use(vant.Lazyload);
  51. // 在 #app 标签下渲染一个按钮组件
  52. let app = new Vue({
  53. el: '#app',
  54. data() {
  55. return {
  56. activeIcon:'./static/images/checked@3x.png',
  57. inactiveIcon:'./static/images/unchecked@3x.png',
  58. toptitleisshow:false,
  59. active: 0,
  60. radio: '1',
  61. dealNote: '',
  62. //- 收货地址Id
  63. selectedAddress: '',
  64. address: {
  65. },
  66. //- 仓库Id
  67. selectedWarehouseId: '',
  68. warehouse:{
  69. },
  70. products:{
  71. },
  72. ProductJson:[],
  73. };
  74. },
  75. created() {
  76. this.toptitleisshow = toptitleisshow;
  77. const mallinfo = JSON.parse(PublicLib.getCookieInfo('checkmallInfo'));
  78. this.checkmallinfo(mallinfo);
  79. this.setgroupinfo(mallinfo);
  80. //- this.getinfo();
  81. },
  82. methods: {
  83. getinfo(){
  84. //- 拿到仓库Id
  85. this.selectedWarehouseId = PublicLib.getCookieInfo('warehouseId');
  86. //- 如果有仓库Id,就发起请求
  87. if(this.selectedWarehouseId !== '') {
  88. this.getwarehousedetail();
  89. };
  90. //- 拿到收货地址Id
  91. this.selectedAddress = PublicLib.getCookieInfo('addressId');
  92. //- 如果有收货地址Id,就发起请求
  93. if(this.selectedAddress !== '') {
  94. this.getaddressdetail();
  95. };
  96. },
  97. //- 点击确认订单
  98. async onClickButton() {
  99. //- if(this.selectedWarehouseId === ''){
  100. //- return tips('请选择发货仓库!')
  101. //- };
  102. //- if(this.selectedAddress === '' && this.radio === '1'){
  103. //- return tips('请选择收货地址!')
  104. //- };
  105. const UserId = PublicLib.getCookieInfo('userId');
  106. const res = await postRequest('api/v1/orders/confirmorder2?t='+Math.random(6),JSON.stringify({UserId,Remark:this.dealNote,ProductJson:this.ProductJson}));
  107. //- const res = await postRequest('api/v1/orders/confirmorder?t='+Math.random(6),JSON.stringify({UserId,DeliveryType:this.radio,StoreId:this.selectedWarehouseId,Remark:this.dealNote,AddressId:this.selectedAddress,ProductJson:this.ProductJson}));
  108. if(res.status !== '1') return tips(res.info);
  109. console.log(res)
  110. PublicLib.putCookieInfo('mallorderId', res.data.Id);
  111. //- 清除仓库Id
  112. PublicLib.putCookieInfo('warehouseId', '');
  113. //- 清除收货地址Id
  114. PublicLib.putCookieInfo('addressId', '');
  115. PublicLib.Goto({Url:'mall-deal-detail'});
  116. },
  117. selectaddress(){
  118. PublicLib.Goto({Url:'mall-address-list'});
  119. },
  120. //- 返回商品详情页
  121. goback(){
  122. PublicLib.GoBack({Level:1});
  123. //- 清除仓库Id
  124. PublicLib.putCookieInfo('warehouseId', '');
  125. //- 清除收货地址Id
  126. PublicLib.putCookieInfo('addressId', '');
  127. },
  128. //- 获取商品信息
  129. async checkmallinfo(data){
  130. //- PublicLib.ShowLoading({Message:''});
  131. const res = await getRequest('api/v1/products/detail?t='+Math.random(6),JSON.stringify({Id:data.goodsId}));
  132. if(res.status !== '1') return tips('获取订单信息失败,请重试!');
  133. //- PublicLib.HideLoading();
  134. res.data.DetailPicPath = res.data.DetailPicPath.length === 0 ? './static/images/payment-type-1.png' : res.data.DetailPicPath[0].Photo;
  135. this.products = res.data;
  136. this.products.num = data.selectedNum;
  137. this.products.Price = data.selectedSkuComb.price.toFixed(2);
  138. this.products.total = data.selectedNum * this.products.Price;
  139. },
  140. //- 设置商品提交信息
  141. setgroupinfo(data){
  142. const parameter = {
  143. ProductId: data.goodsId,
  144. // 商品规格Id
  145. NormId: data.selectedSkuComb.id,
  146. BuyCount: data.selectedNum,
  147. };
  148. console.log(data);
  149. this.ProductJson.push(parameter);
  150. },
  151. //- 选择发货仓库
  152. gowarehouse(){
  153. PublicLib.putCookieInfo('wareBrandId', this.products.BrandId);
  154. PublicLib.Goto({Url:'mall-warehouse-list'});
  155. },
  156. //- 获取发货仓详情
  157. async getwarehousedetail(){
  158. const UserId = PublicLib.getCookieInfo('userId');
  159. const res = await getRequest('api/v1/storehouse/sendstoredetail?t='+Math.random(6),JSON.stringify({UserId,Id:this.selectedWarehouseId}));
  160. if(res.status !== '1') return tips('获取发货仓库详情失败,请重试!');
  161. this.warehouse = res.data;
  162. },
  163. //- 获取收货地址详情
  164. async getaddressdetail(){
  165. const UserId = PublicLib.getCookieInfo('userId');
  166. const res = await getRequest('api/v1/useraddress/detail?t='+Math.random(6),JSON.stringify({UserId,Id:this.selectedAddress}));
  167. if(res.status !== '1') return tips('获取收货地址详情失败,请重试!');
  168. this.address = res.data;
  169. }
  170. }
  171. });
  172. </script>
  173. </body>
  174. </html>