product-machine-apply-2.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>机具申请2-产品中心-创业帮</title>
  6. <meta name="keywords" content="机具申请2-产品中心-创业帮">
  7. <meta name="description" content="机具申请2-产品中心-创业帮">
  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="机具申请2-产品中心-创业帮">
  14. <meta http-equiv="Cache-Control" content="no-siteapp">
  15. <link rel="stylesheet" href="./static/css/main.css">
  16. <style>
  17. .mall-bottom{padding:0 .3733rem;height:54px;}
  18. .mall-bottom button{border-radius:999px !important; height:80% !important;}
  19. </style>
  20. </head>
  21. <body class="bgc-back apply pb0 pt0" style="padding-top:0;">
  22. <div id="app">
  23. <van-nav-bar class="user_rank_explan_title user_title_normal rightc333" left-arrow :title="'机具申请-'+title" v-if="toptitleisshow" @click-left="goback" @click-right="applyrecord" right-text="申请记录">
  24. <template #left> <img src="./static/images/left.png" alt=""></template>
  25. </van-nav-bar>
  26. <div class="deal-check" v-cloak style="padding-bottom:50px;">
  27. <van-cell-group class="deal-check1" :border="false">
  28. <van-card centered>
  29. <template #title>
  30. <van-cell-group :border="false">
  31. <van-cell class="machine-list machine-list1" v-for="item,index in transactions" :key="item.SnId" :value="item.MachineType" value-class="f14 c999" @click="toggle(index)" center :border="false">
  32. <template #title>
  33. <div class="f14 c333" v-if="!item.Type"><span class="vm">SN:</span><span class="vm pr16" :id="'sn'+index">{{item.SnNo}}</span></div>
  34. <div class="f14 c333" v-else><span class="vm">兑换券:</span><span class="vm pr16" :id="'sn'+index">{{item.SnNo}}</span></div>
  35. </template>
  36. </van-cell>
  37. </van-cell-group>
  38. </template>
  39. <template #footer>
  40. <div class="tl van-hairline--top pt8 mt8"><span class="f12 c666">申请数量总计:</span><span class="f14 c333">{{transactions.length}}</span></div>
  41. </template>
  42. </van-card>
  43. </van-cell-group>
  44. <div>
  45. <van-cell-group :border="false" title="预发机">
  46. <van-cell title="请选择预发机" :border="false" is-link v-if="getsetlist.length === 0" @click="gogetset"></van-cell>
  47. <van-cell :border="false" is-link center v-if="getsetlist.length !== 0" @click="gogetset">
  48. <template #title>
  49. <div class="f14 c333" v-for="item,index in getsetlist" :key="item.Id">{{item.SnNo}}</div>
  50. </template>
  51. </van-cell>
  52. </van-cell-group>
  53. </div>
  54. <div v-if="getsetlist.length === 0">
  55. <van-cell-group :border="false" title="发货仓库">
  56. <van-cell title="请选择离收货地址最近的仓库" :border="false" is-link center v-if="selectedWarehouseId === ''" @click="gowarehouse"></van-cell>
  57. <van-cell :border="false" is-link center v-if="selectedWarehouseId !== ''" @click="gowarehouse">
  58. <template #title>
  59. <div class="f14 c333">{{warehouse.StoreName}}(库存{{warehouse.LaveNum}}台)</div>
  60. </template>
  61. <template #label>
  62. <div class="f12 c999">联系人:{{warehouse.ManageName}}{{warehouse.ManageMobile}}</div>
  63. <div class="f12 c999">地址:{{warehouse.Areas}}{{warehouse.Address}}</div>
  64. </template>
  65. </van-cell>
  66. <van-cell title="提货方式" :border="false">
  67. <template #right-icon>
  68. <van-radio-group v-model="radio" direction="horizontal">
  69. <van-radio name="1">邮寄到付</van-radio>
  70. <van-radio name="2">上门自提</van-radio>
  71. </van-radio-group>
  72. </template>
  73. </van-cell>
  74. <van-field v-model="dealNote" name="订单备注" label="订单备注" placeholder="默认韵达快递,选择其他快递请备注" :rules="[{ required: true, message: '请填写用户名' }]"></van-field>
  75. </van-cell-group>
  76. <van-cell-group :border="false" title="收货信息">
  77. <van-cell title="请选择收货地址" :border="false" is-link v-if="selectedAddressId === '' &amp;&amp; radio === '1'" @click="goaddress"></van-cell>
  78. <van-cell title="请选择提货人信息" :border="false" is-link v-if="selectedAddressId === '' &amp;&amp; radio === '2'" @click="goaddress"></van-cell>
  79. <van-cell :border="false" is-link center v-if="selectedAddressId !== ''" @click="goaddress">
  80. <template #title>
  81. <div class="f14 c333">{{address.RealName}}{{address.Mobile}}</div>
  82. </template>
  83. <template #label>
  84. <div class="f12 c999">{{address.Areas}}{{address.Address}}</div>
  85. </template>
  86. </van-cell>
  87. </van-cell-group>
  88. </div>
  89. </div>
  90. <van-goods-action class="mall-bottom">
  91. <van-goods-action-button type="default" color="#FFD500" style="color:#333;" text="确认申请" @click="onClickButton"></van-goods-action-button>
  92. </van-goods-action>
  93. </div>
  94. <script src="./static/js/klm-vv.min.js"></script>
  95. <script src="./static/js/appfunc.min.js"></script>
  96. <script src="./static/js/klm-axios-config.js"></script>
  97. <script src="./static/js/publicfn.js"></script>
  98. <script>
  99. function OnStart(){
  100. app.getinfo();
  101. app.getsetinfo();
  102. };
  103. // 通过 CDN 引入时不会自动注册 Lazyload 组件
  104. // 可以通过下面的方式手动注册
  105. Vue.use(vant.Lazyload);
  106. PublicLib.SetStatusBarBgColor({bgcolor:'ffffff'});
  107. // 在 #app 标签下渲染一个按钮组件
  108. let app = new Vue({
  109. el: '#app',
  110. data() {
  111. return {
  112. toptitleisshow:false,
  113. getsetlist:[],
  114. active: 0,
  115. radio: '1',
  116. dealNote: '',
  117. selectedAddressId: '',
  118. address: {
  119. },
  120. selectedWarehouseId: '',
  121. warehouse:{
  122. },
  123. transactions: [
  124. ],
  125. productType:'',
  126. toKind:'',
  127. };
  128. },
  129. created() {
  130. this.toptitleisshow = toptitleisshow;
  131. this.title = JSON.parse(PublicLib.getCookieInfo('chooseProductId')).Name;
  132. PublicLib.SetTitle({Title:'机具申请-'+ JSON.parse(PublicLib.getCookieInfo('chooseProductId')).Name});
  133. this.showsnlist();
  134. this.getinfo();
  135. this.getsetinfo();
  136. },
  137. methods: {
  138. gogetset(){
  139. PublicLib.Goto({Url:'warehouse-mini'});
  140. },
  141. getinfo(){
  142. //- 拿到仓库Id
  143. this.selectedWarehouseId = PublicLib.getCookieInfo('warehouseId');
  144. //- 如果有仓库Id,就发起请求
  145. if(this.selectedWarehouseId !== '') {
  146. this.getwarehousedetail();
  147. };
  148. //- 拿到收货地址Id
  149. this.selectedAddressId = PublicLib.getCookieInfo('addressId');
  150. //- 如果有收货地址Id,就发起请求
  151. if(this.selectedAddressId !== '') {
  152. this.getaddressdetail();
  153. };
  154. },
  155. getsetinfo(){
  156. const list = JSON.parse(PublicLib.getCookieInfo('getSetSnList'));
  157. if(list.length !== 0){
  158. this.getsetlist = list;
  159. PublicLib.putCookieInfo('getSetSnList','');
  160. }else{
  161. this.getsetlist = [];
  162. };
  163. },
  164. showsnlist(){
  165. //- let list = [];
  166. list = JSON.parse(PublicLib.getCookieInfo('SNIDinfo'));
  167. //- PublicLib.putCookieInfo('SNIDinfo', JSON.stringify({}));
  168. //- this.transactions = list.map(item=>{return{SnId:item.SnId,SnNo:item.SnNo,MachineType:item.MachineType}});
  169. this.toKind = list[0].Kind;
  170. this.transactions = list.map(item=>{return{SnId:item.SnId ? item.SnId : item.Id,SnNo:item.SnNo? item.SnNo : item.ExchangeCode,MachineType:item.MachineType,Type:item.Kind ? true : false}});
  171. this.productType = JSON.parse(PublicLib.getCookieInfo('chooseProductId')).Id;
  172. },
  173. snnolist(){
  174. return this.getsetlist.map(item=>item.Id).join(',');
  175. },
  176. onClickButton:undebounce(async function() {
  177. if(this.getsetlist.length === 0){
  178. if(this.selectedWarehouseId === ''){
  179. return tips('请选择发货仓库!')
  180. };
  181. if(this.selectedAddressId === ''){
  182. return tips('请选择收货地址!')
  183. };
  184. }else{
  185. if(this.transactions.length !== this.getsetlist.length) return tips('请选择兑换数量相等的预发机!')
  186. }
  187. const UserId = PublicLib.getCookieInfo('userId');
  188. let Kind = PublicLib.getCookieInfo('sendKind'); // 1 : SN 2 : code 200 3: CODE 300
  189. if(Kind === '0'){
  190. Kind = 1;
  191. }else{
  192. Kind = this.toKind === 1 ? 2 : 3;
  193. };
  194. const SendSn = this.transactions.map(item=>item.SnId).join(',');
  195. const ProductType = this.productType;
  196. const StoreId = this.selectedWarehouseId;
  197. const AddressId = this.selectedAddressId;
  198. const DeliveryType = Number(this.radio);
  199. const Remark = this.dealNote;
  200. const IsPre = this.getsetlist.length === 0 ? 0:1;
  201. const res = await postRequest('api/v1/pos/machineapply/confirmapply2?t='+Math.random(6),JSON.stringify({UserId,SendSn,ProductType,StoreId,AddressId,DeliveryType,Remark,Kind,IsPre,SnIds:this.snnolist()}));
  202. if(res.status === '-1'){
  203. tips(res.info);
  204. }else if(res.status === '1'){
  205. tips('机具申请发起成功!');
  206. setTimeout(()=>{
  207. this.goback();
  208. },2000);
  209. }
  210. }),
  211. goback(){
  212. PublicLib.GoBack({Level:1});
  213. //- 清除仓库Id
  214. PublicLib.putCookieInfo('warehouseId', '');
  215. //- 清除收货地址Id
  216. PublicLib.putCookieInfo('addressId', '');
  217. PublicLib.putCookieInfo('isApplyBack','true');
  218. },
  219. gowarehouse(){
  220. PublicLib.putCookieInfo('wareBrandId', JSON.parse(PublicLib.getCookieInfo('chooseProductId')).Id);
  221. PublicLib.Goto({Url:'mall-warehouse-list'});
  222. },
  223. goaddress(){
  224. PublicLib.Goto({Url:'mall-address-list'});
  225. },
  226. //- 获取发货仓详情
  227. async getwarehousedetail(){
  228. const UserId = PublicLib.getCookieInfo('userId');
  229. const res = await getRequest('api/v1/storehouse/sendstoredetail?t='+Math.random(6),JSON.stringify({UserId,Id:this.selectedWarehouseId}));
  230. if(res.status !== '1') return tips('获取发货仓库详情失败,请重试!');
  231. this.warehouse = res.data;
  232. },
  233. //- 获取收货地址详情
  234. async getaddressdetail(){
  235. const UserId = PublicLib.getCookieInfo('userId');
  236. const res = await getRequest('api/v1/useraddress/detail?t='+Math.random(6),JSON.stringify({UserId,Id:this.selectedAddressId}));
  237. if(res.status !== '1') return tips('获取收货信息失败,请重试!');
  238. this.address = res.data;
  239. },
  240. applyrecord(){
  241. PublicLib.Goto({Url:'product-machine-apply-record'});
  242. }
  243. }
  244. });
  245. </script>
  246. </body>
  247. </html>