mall-deal-check.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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. <van-cell-group :border="false" title="发货仓库">
  36. <van-cell title="请选择离收货地址最近的仓库" :border="false" is-link center v-if="selectedWarehouseId === ''" @click="gowarehouse"></van-cell>
  37. <van-cell :border="false" is-link center v-if="selectedWarehouseId !== ''" @click="gowarehouse">
  38. <template #title>
  39. <div class="f14 c333">{{warehouse.StoreName}}(库存{{warehouse.LaveNum}}台)</div>
  40. </template>
  41. <template #label>
  42. <div class="f12 c999">联系人:{{warehouse.ManageName}}{{warehouse.ManageMobile}}</div>
  43. <div class="f12 c999">{{warehouse.Areas}}{{warehouse.Address}}</div>
  44. </template>
  45. </van-cell>
  46. <van-cell title="提货方式" :border="false">
  47. <template #right-icon>
  48. <van-radio-group v-model="radio" direction="horizontal">
  49. <van-radio name="1">邮寄到付
  50. <template #icon="props"> <img class="img-icon" :src="props.checked ? activeIcon : inactiveIcon" style="height:.4267rem;"></template>
  51. </van-radio>
  52. <van-radio name="2">上门自提
  53. <template #icon="props"> <img class="img-icon" :src="props.checked ? activeIcon : inactiveIcon" style="height:.4267rem;"></template>
  54. </van-radio>
  55. </van-radio-group>
  56. </template>
  57. </van-cell>
  58. <van-field v-model="dealNote" name="订单备注" label="订单备注" placeholder="默认韵达快递,选择其他快递请备注" :rules="[{ required: true, message: '请填写用户名' }]"></van-field>
  59. </van-cell-group>
  60. <van-cell-group :border="false" title="收货地址" v-if="radio === '1'">
  61. <van-cell title="请添加收货地址" :border="false" is-link v-if="selectedAddress === ''" @click="selectaddress"></van-cell>
  62. <van-cell :border="false" is-link center v-if="selectedAddress !== ''" @click="selectaddress">
  63. <template #title>
  64. <div class="f14 c333">{{address.RealName}}{{address.Mobile}}</div>
  65. </template>
  66. <template #label>
  67. <div class="f12 c999">{{address.Areas}}{{address.Address}}</div>
  68. </template>
  69. </van-cell>
  70. </van-cell-group>
  71. </div>
  72. <van-goods-action class="mall-bottom">
  73. <van-goods-action-button class="kxs-btn" type="default" color="#FFD500" style="color:#333;" text="确认订单" @click="onClickButton"></van-goods-action-button>
  74. </van-goods-action>
  75. </div>
  76. <script src="./static/js/klm-vv.min.js"></script>
  77. <script src="./static/js/appfunc.min.js"></script>
  78. <script src="./static/js/klm-axios-config.js"></script>
  79. <script src="./static/js/publicfn.js"></script>
  80. <script>
  81. function OnStart(){
  82. app.getinfo();
  83. };
  84. // 通过 CDN 引入时不会自动注册 Lazyload 组件
  85. // 可以通过下面的方式手动注册
  86. Vue.use(vant.Lazyload);
  87. // 在 #app 标签下渲染一个按钮组件
  88. let app = new Vue({
  89. el: '#app',
  90. data() {
  91. return {
  92. activeIcon:'./static/images/checked@3x.png',
  93. inactiveIcon:'./static/images/unchecked@3x.png',
  94. toptitleisshow:false,
  95. active: 0,
  96. radio: '1',
  97. dealNote: '',
  98. //- 收货地址Id
  99. selectedAddress: '',
  100. address: {
  101. },
  102. //- 仓库Id
  103. selectedWarehouseId: '',
  104. warehouse:{
  105. },
  106. products:{
  107. },
  108. ProductJson:[],
  109. };
  110. },
  111. created() {
  112. this.toptitleisshow = toptitleisshow;
  113. const mallinfo = JSON.parse(PublicLib.getCookieInfo('checkmallInfo'));
  114. this.checkmallinfo(mallinfo);
  115. this.setgroupinfo(mallinfo);
  116. this.getinfo();
  117. },
  118. methods: {
  119. getinfo(){
  120. //- 拿到仓库Id
  121. this.selectedWarehouseId = PublicLib.getCookieInfo('warehouseId');
  122. //- 如果有仓库Id,就发起请求
  123. if(this.selectedWarehouseId !== '') {
  124. this.getwarehousedetail();
  125. };
  126. //- 拿到收货地址Id
  127. this.selectedAddress = PublicLib.getCookieInfo('addressId');
  128. //- 如果有收货地址Id,就发起请求
  129. if(this.selectedAddress !== '') {
  130. this.getaddressdetail();
  131. };
  132. },
  133. //- 点击确认订单
  134. async onClickButton() {
  135. if(this.selectedWarehouseId === ''){
  136. return tips('请选择发货仓库!')
  137. };
  138. if(this.selectedAddress === '' && this.radio === '1'){
  139. return tips('请选择收货地址!')
  140. };
  141. const UserId = PublicLib.getCookieInfo('userId');
  142. 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}));
  143. if(res.status !== '1') return tips('确认订单失败,请重试!');
  144. console.log(res)
  145. PublicLib.putCookieInfo('mallorderId', res.data.Id);
  146. //- 清除仓库Id
  147. PublicLib.putCookieInfo('warehouseId', '');
  148. //- 清除收货地址Id
  149. PublicLib.putCookieInfo('addressId', '');
  150. PublicLib.Goto({Url:'mall-deal-detail'});
  151. },
  152. selectaddress(){
  153. PublicLib.Goto({Url:'mall-address-list'});
  154. },
  155. //- 返回商品详情页
  156. goback(){
  157. PublicLib.GoBack({Level:1});
  158. //- 清除仓库Id
  159. PublicLib.putCookieInfo('warehouseId', '');
  160. //- 清除收货地址Id
  161. PublicLib.putCookieInfo('addressId', '');
  162. },
  163. //- 获取商品信息
  164. async checkmallinfo(data){
  165. //- PublicLib.ShowLoading({Message:''});
  166. const res = await getRequest('api/v1/products/detail?t='+Math.random(6),JSON.stringify({Id:data.goodsId}));
  167. if(res.status !== '1') return tips('获取订单信息失败,请重试!');
  168. //- PublicLib.HideLoading();
  169. res.data.DetailPicPath = res.data.DetailPicPath.length === 0 ? './static/images/payment-type-1.png' : res.data.DetailPicPath[0].Photo;
  170. this.products = res.data;
  171. this.products.num = data.selectedNum;
  172. this.products.Price = data.selectedSkuComb.price.toFixed(2);
  173. this.products.total = data.selectedNum * this.products.Price;
  174. },
  175. //- 设置商品提交信息
  176. setgroupinfo(data){
  177. const parameter = {
  178. ProductId: data.goodsId,
  179. // 商品规格Id
  180. NormId: data.selectedSkuComb.id,
  181. BuyCount: data.selectedNum,
  182. };
  183. this.ProductJson.push(parameter);
  184. },
  185. //- 选择发货仓库
  186. gowarehouse(){
  187. PublicLib.putCookieInfo('wareBrandId', this.products.BrandId);
  188. PublicLib.Goto({Url:'mall-warehouse-list'});
  189. },
  190. //- 获取发货仓详情
  191. async getwarehousedetail(){
  192. const UserId = PublicLib.getCookieInfo('userId');
  193. const res = await getRequest('api/v1/storehouse/sendstoredetail?t='+Math.random(6),JSON.stringify({UserId,Id:this.selectedWarehouseId}));
  194. if(res.status !== '1') return tips('获取发货仓库详情失败,请重试!');
  195. this.warehouse = res.data;
  196. },
  197. //- 获取收货地址详情
  198. async getaddressdetail(){
  199. const UserId = PublicLib.getCookieInfo('userId');
  200. const res = await getRequest('api/v1/useraddress/detail?t='+Math.random(6),JSON.stringify({UserId,Id:this.selectedAddress}));
  201. if(res.status !== '1') return tips('获取收货地址详情失败,请重试!');
  202. this.address = res.data;
  203. }
  204. }
  205. });
  206. </script>
  207. </body>
  208. </html>