mall-deal-check-other.html 9.9 KB

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