123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>机具申请2-产品中心-创业帮</title>
- <meta name="keywords" content="机具申请2-产品中心-创业帮">
- <meta name="description" content="机具申请2-产品中心-创业帮">
- <meta content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,shrink-to-fit=no,user-scalable=no" name="viewport" viewport="cover">
- <meta name="apple-mobile-web-app-capable" content="yes">
- <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
- <meta content="telephone=no" name="format-detection">
- <meta content="email=no" name="format-detection">
- <meta name="apple-mobile-web-app-title" content="机具申请2-产品中心-创业帮">
- <meta http-equiv="Cache-Control" content="no-siteapp">
- <link rel="stylesheet" href="./static/css/main.css">
- <style>
- .mall-bottom{padding:0 .3733rem;height:54px;}
- .mall-bottom button{border-radius:999px !important; height:80% !important;}
- </style>
- </head>
- <body class="bgc-back apply pb0 pt0" style="padding-top:0;">
- <div id="app">
- <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="申请记录">
- <template #left> <img src="./static/images/left.png" alt=""></template>
- </van-nav-bar>
- <div class="deal-check" v-cloak style="padding-bottom:50px;">
- <van-cell-group class="deal-check1" :border="false">
- <van-card centered>
- <template #title>
- <van-cell-group :border="false">
- <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">
- <template #title>
- <div class="f14 c333" v-if="!item.Type"><span class="vm">SN:</span><span class="vm pr16" :id="'sn'+index">{{item.SnNo}}</span></div>
- <div class="f14 c333" v-else><span class="vm">兑换券:</span><span class="vm pr16" :id="'sn'+index">{{item.SnNo}}</span></div>
- </template>
- </van-cell>
- </van-cell-group>
- </template>
- <template #footer>
- <div class="tl van-hairline--top pt8 mt8"><span class="f12 c666">申请数量总计:</span><span class="f14 c333">{{transactions.length}}</span></div>
- </template>
- </van-card>
- </van-cell-group>
- <div>
- <van-cell-group :border="false" title="预发机">
- <van-cell title="请选择预发机" :border="false" is-link v-if="getsetlist.length === 0" @click="gogetset"></van-cell>
- <van-cell :border="false" is-link center v-if="getsetlist.length !== 0" @click="gogetset">
- <template #title>
- <div class="f14 c333" v-for="item,index in getsetlist" :key="item.Id">{{item.SnNo}}</div>
- </template>
- </van-cell>
- </van-cell-group>
- </div>
- <div v-if="getsetlist.length === 0">
- <van-cell-group :border="false" title="发货仓库">
- <van-cell title="请选择离收货地址最近的仓库" :border="false" is-link center v-if="selectedWarehouseId === ''" @click="gowarehouse"></van-cell>
- <van-cell :border="false" is-link center v-if="selectedWarehouseId !== ''" @click="gowarehouse">
- <template #title>
- <div class="f14 c333">{{warehouse.StoreName}}(库存{{warehouse.LaveNum}}台)</div>
- </template>
- <template #label>
- <div class="f12 c999">联系人:{{warehouse.ManageName}}{{warehouse.ManageMobile}}</div>
- <div class="f12 c999">地址:{{warehouse.Areas}}{{warehouse.Address}}</div>
- </template>
- </van-cell>
- <van-cell title="提货方式" :border="false">
- <template #right-icon>
- <van-radio-group v-model="radio" direction="horizontal">
- <van-radio name="1">邮寄到付</van-radio>
- <van-radio name="2">上门自提</van-radio>
- </van-radio-group>
- </template>
- </van-cell>
- <van-field v-model="dealNote" name="订单备注" label="订单备注" placeholder="默认韵达快递,选择其他快递请备注" :rules="[{ required: true, message: '请填写用户名' }]"></van-field>
- </van-cell-group>
- <van-cell-group :border="false" title="收货信息">
- <van-cell title="请选择收货地址" :border="false" is-link v-if="selectedAddressId === '' && radio === '1'" @click="goaddress"></van-cell>
- <van-cell title="请选择提货人信息" :border="false" is-link v-if="selectedAddressId === '' && radio === '2'" @click="goaddress"></van-cell>
- <van-cell :border="false" is-link center v-if="selectedAddressId !== ''" @click="goaddress">
- <template #title>
- <div class="f14 c333">{{address.RealName}}{{address.Mobile}}</div>
- </template>
- <template #label>
- <div class="f12 c999">{{address.Areas}}{{address.Address}}</div>
- </template>
- </van-cell>
- </van-cell-group>
- </div>
- </div>
- <van-goods-action class="mall-bottom">
- <van-goods-action-button type="default" color="#FFD500" style="color:#333;" text="确认申请" @click="onClickButton"></van-goods-action-button>
- </van-goods-action>
- </div>
- <script src="./static/js/klm-vv.min.js"></script>
- <script src="./static/js/appfunc.min.js"></script>
- <script src="./static/js/klm-axios-config.js"></script>
- <script src="./static/js/publicfn.js"></script>
- <script>
- function OnStart(){
- app.getinfo();
- app.getsetinfo();
- };
- // 通过 CDN 引入时不会自动注册 Lazyload 组件
- // 可以通过下面的方式手动注册
- Vue.use(vant.Lazyload);
- PublicLib.SetStatusBarBgColor({bgcolor:'ffffff'});
- // 在 #app 标签下渲染一个按钮组件
- let app = new Vue({
- el: '#app',
- data() {
- return {
- toptitleisshow:false,
- getsetlist:[],
- active: 0,
- radio: '1',
- dealNote: '',
- selectedAddressId: '',
- address: {
- },
- selectedWarehouseId: '',
- warehouse:{
- },
- transactions: [
- ],
- productType:'',
- toKind:'',
-
- };
- },
- created() {
- this.toptitleisshow = toptitleisshow;
- this.title = JSON.parse(PublicLib.getCookieInfo('chooseProductId')).Name;
- PublicLib.SetTitle({Title:'机具申请-'+ JSON.parse(PublicLib.getCookieInfo('chooseProductId')).Name});
- this.showsnlist();
- this.getinfo();
- this.getsetinfo();
- },
- methods: {
- gogetset(){
- PublicLib.Goto({Url:'warehouse-mini'});
- },
- getinfo(){
- //- 拿到仓库Id
- this.selectedWarehouseId = PublicLib.getCookieInfo('warehouseId');
- //- 如果有仓库Id,就发起请求
- if(this.selectedWarehouseId !== '') {
- this.getwarehousedetail();
- };
- //- 拿到收货地址Id
- this.selectedAddressId = PublicLib.getCookieInfo('addressId');
- //- 如果有收货地址Id,就发起请求
- if(this.selectedAddressId !== '') {
- this.getaddressdetail();
- };
- },
- getsetinfo(){
- const list = JSON.parse(PublicLib.getCookieInfo('getSetSnList'));
- if(list.length !== 0){
- this.getsetlist = list;
- PublicLib.putCookieInfo('getSetSnList','');
- }else{
- this.getsetlist = [];
- };
- },
- showsnlist(){
- //- let list = [];
- list = JSON.parse(PublicLib.getCookieInfo('SNIDinfo'));
- //- PublicLib.putCookieInfo('SNIDinfo', JSON.stringify({}));
- //- this.transactions = list.map(item=>{return{SnId:item.SnId,SnNo:item.SnNo,MachineType:item.MachineType}});
- this.toKind = list[0].Kind;
- 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}});
- this.productType = JSON.parse(PublicLib.getCookieInfo('chooseProductId')).Id;
- },
- snnolist(){
- return this.getsetlist.map(item=>item.Id).join(',');
- },
- onClickButton:undebounce(async function() {
- if(this.getsetlist.length === 0){
- if(this.selectedWarehouseId === ''){
- return tips('请选择发货仓库!')
- };
- if(this.selectedAddressId === ''){
- return tips('请选择收货地址!')
- };
- }else{
- if(this.transactions.length !== this.getsetlist.length) return tips('请选择兑换数量相等的预发机!')
- }
- const UserId = PublicLib.getCookieInfo('userId');
- let Kind = PublicLib.getCookieInfo('sendKind'); // 1 : SN 2 : code 200 3: CODE 300
- if(Kind === '0'){
- Kind = 1;
- }else{
- Kind = this.toKind === 1 ? 2 : 3;
- };
- const SendSn = this.transactions.map(item=>item.SnId).join(',');
- const ProductType = this.productType;
- const StoreId = this.selectedWarehouseId;
- const AddressId = this.selectedAddressId;
- const DeliveryType = Number(this.radio);
- const Remark = this.dealNote;
- const IsPre = this.getsetlist.length === 0 ? 0:1;
- 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()}));
- if(res.status === '-1'){
- tips(res.info);
- }else if(res.status === '1'){
- tips('机具申请发起成功!');
- setTimeout(()=>{
- this.goback();
- },2000);
- }
- }),
- goback(){
- PublicLib.GoBack({Level:1});
- //- 清除仓库Id
- PublicLib.putCookieInfo('warehouseId', '');
- //- 清除收货地址Id
- PublicLib.putCookieInfo('addressId', '');
- PublicLib.putCookieInfo('isApplyBack','true');
- },
- gowarehouse(){
- PublicLib.putCookieInfo('wareBrandId', JSON.parse(PublicLib.getCookieInfo('chooseProductId')).Id);
- PublicLib.Goto({Url:'mall-warehouse-list'});
- },
- goaddress(){
- PublicLib.Goto({Url:'mall-address-list'});
- },
- //- 获取发货仓详情
- async getwarehousedetail(){
- const UserId = PublicLib.getCookieInfo('userId');
- const res = await getRequest('api/v1/storehouse/sendstoredetail?t='+Math.random(6),JSON.stringify({UserId,Id:this.selectedWarehouseId}));
- if(res.status !== '1') return tips('获取发货仓库详情失败,请重试!');
- this.warehouse = res.data;
- },
- //- 获取收货地址详情
- async getaddressdetail(){
- const UserId = PublicLib.getCookieInfo('userId');
- const res = await getRequest('api/v1/useraddress/detail?t='+Math.random(6),JSON.stringify({UserId,Id:this.selectedAddressId}));
- if(res.status !== '1') return tips('获取收货信息失败,请重试!');
- this.address = res.data;
- },
- applyrecord(){
- PublicLib.Goto({Url:'product-machine-apply-record'});
- }
-
- }
- });
- </script>
- </body>
- </html>
|