product-machine-apply-1.html 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>机具申请1-产品中心-创业帮</title>
  6. <meta name="keywords" content="机具申请1-产品中心-创业帮">
  7. <meta name="description" content="机具申请1-产品中心-创业帮">
  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="机具申请1-产品中心-创业帮">
  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. .machine-list .van-cell__value{
  20. flex:.2;
  21. text-align:center;
  22. }
  23. .van-radio__icon--checked .van-icon,
  24. .van-checkbox__icon--checked .van-icon-success{
  25. color:#333 !important;
  26. }
  27. .apply .checkbox{
  28. color :#333;
  29. }
  30. .dialog .scroll {
  31. overflow-y: scroll;
  32. overflow-x:hidden;
  33. }
  34. .scroll .machine-list {
  35. width:96%;
  36. }
  37. .ismeng{font-size:4px;border:.5px solid #FFD6D6;color:#FF7D7D;padding:0 2px;margin-right:5px;}
  38. </style>
  39. </head>
  40. <body class="h100p ovh apply pb0 pt0" style="padding-top:0;">
  41. <div id="app" v-cloak>
  42. <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="申请记录">
  43. <template #left><img src="./static/images/icon-comback@2x.png" alt=""></template>
  44. </van-nav-bar>
  45. <div class="pt16 pb16 pl16 pr16 bgcfff bb8f7f7f7" v-cloak>
  46. <div class="f14 c333">尊敬的创客:</div>
  47. <div class="f14 c333" style="text-indent:2em">您已满足参加循环送活动资质。已经领取过循环送机器的除外,到目前为止您已经激活{{ActCount}}台,除去{{ExpiredCount}}台过期不可循环机,您本次最多领取{{ActCount - ExpiredCount}}台,最少领取{{MinCount}}台。循环送的机器不支持划拨他人。</div>
  48. </div>
  49. <div class="bgcfff">
  50. <div class="pt16 pb16 pl16 pr16"><span class="f14 c333 vm pr16">请在下方选择需要兑换的机器</span>
  51. <van-popover v-model="tipsisshow" overlay trigger="click" placement="bottom-end">
  52. <template #reference><img class="vm" src="./static/images/icon-help@2x.png" alt="" width="26" height="26"></template>
  53. <template #default>
  54. <div class="tc f14 c333">每个SN后面的标签代表可兑换的机具类型:</div>
  55. <div class="mt12"><span class="dib vm tag tag-1">金</span><span>: 创业帮-金控</span><span v-if="productId === '1' || productId === '2' || productId === '4' || productId === '6' || productId === '7' || productId === '8'">电签</span><span v-else>大POS</span></div>
  56. <div class="mt6" v-if="productId === '1' || productId === '2' || productId === '4' || productId === '6' || productId === '7' || productId === '8'"><span class="dib vm tag tag-2">开</span><span>: 创业帮-开店宝</span><span>电签</span></div>
  57. <div class="mt6"><span class="dib vm tag tag-3">乐</span><span>: 创业帮-乐刷</span><span v-if="productId === '1' || productId === '2' || productId === '4' || productId === '6' || productId === '7' || productId === '8'">电签</span><span v-else>大POS</span></div>
  58. <div class="mt6" v-if="productId === '1' || productId === '2' || productId === '4' || productId === '6' || productId === '7' || productId === '8'"><span class="dib vm tag tag-1">立</span><span>: 创业帮-立刷</span><span>云电签</span></div>
  59. <div class="mt6" v-if="productId === '1' || productId === '2' || productId === '4' || productId === '6' || productId === '7' || productId === '8'"><span class="dib vm tag tag-2">盛</span><span>: 创业帮-盛付通</span><span>电签</span></div>
  60. <div class="mt6"><span class="dib vm tag tag-3">海</span><span>: 创业帮-海科</span><span v-if="productId === '1' || productId === '2' || productId === '4' || productId === '6' || productId === '7' || productId === '8'">电签</span><span v-else>大POS</span></div>
  61. </template>
  62. </van-popover>
  63. </div>
  64. <van-tabs v-model="active" swipeable animated @change="changetab">
  65. <van-tab title="SN循环">
  66. <div class="ovh-x" ref="wrapper2" v-if="active === 0">
  67. <van-empty class="custom-image" image="./static/images/empty-img.png" description="暂无数据" v-if="transactions.length === 0"></van-empty>
  68. <van-checkbox-group v-model="result">
  69. <van-cell-group>
  70. <van-cell class="machine-list" v-for="item,index in transactions" clickable :key="item.SnId" :value="item.MachineType" value-class="f14 c333" @click="toggle(index)" center>
  71. <template #title>
  72. <div class="f14 c333 warp"><span class="ismeng" v-if="item.IsLeader === 1">盟</span><span class="vm">SN:</span><span class="vm pr16" :id="'sn'+index">{{item.SnNo}}</span></div>
  73. </template>
  74. <template #icon>
  75. <van-checkbox class="mr16" :name="item" ref="checkboxes" checked-color="#FFD500"></van-checkbox>
  76. </template>
  77. <template #label>
  78. <div class="f12 more" v-if="item.last !== ''">循环剩余{{item.RecycDays}}天(截止{{item.EndDate}})</div>
  79. <div><span class="dib vm tag tag-1" v-if="item.king">金</span><span class="dib vm tag tag-2" v-if="item.open">开</span><span class="dib vm tag tag-3" v-if="item.leshua">乐</span><span class="dib vm tag tag-1" v-if="item.bigking">金</span><span class="dib vm tag tag-3" v-if="item.leshuabig">乐</span><span class="dib vm tag tag-1" v-if="item.lishua">立</span><span class="dib vm tag tag-2" v-if="item.sheng">盛</span><span class="dib vm tag tag-3" v-if="item.haikes">海</span><span class="dib vm tag tag-3" v-if="item.haikeb">海</span></div>
  80. </template>
  81. </van-cell>
  82. </van-cell-group>
  83. </van-checkbox-group>
  84. </div>
  85. </van-tab>
  86. <van-tab title="电签兑换券" v-if="is200">
  87. <div class="ovh-x" ref="wrapper2" v-if="active === 1">
  88. <van-pull-refresh v-model="refreshing" @refresh="onRefresh" :class="transactions.length === 0 ? 'isnodata':''" style="height: 100%;min-height:20vh;">
  89. <van-list v-model="loading" :finished="finished" finished-text="没有更多数据了" @load="onLoad" :immediate-check="false">
  90. <van-empty class="custom-image" image="./static/images/empty-img.png" description="暂无数据" v-if="transactions.length === 0"></van-empty>
  91. <van-checkbox-group v-model="result">
  92. <van-cell-group>
  93. <van-cell class="machine-list" v-for="item,index in transactions" clickable :key="item.Id" :value="item.Kind === 1 ? '电签兑换券' : '大机兑换券'" value-class="f14 c333" @click="toggle(index)" center>
  94. <template #title>
  95. <div class="f14 c333 warp"><span class="ismeng" v-if="item.IsLeader === 1">盟</span><span class="vm">兑换码:</span><span class="vm pr16" :id="'sn'+index">{{item.ExchangeCode}}</span></div>
  96. </template>
  97. <template #icon>
  98. <van-checkbox class="mr16" :name="item" ref="checkboxes" checked-color="#FFD500"></van-checkbox>
  99. </template>
  100. <template #label>
  101. <div><span class="dib vm tag tag-1" v-if="item.king">金</span><span class="dib vm tag tag-2" v-if="item.open">开</span><span class="dib vm tag tag-3" v-if="item.leshua">乐</span><span class="dib vm tag tag-1" v-if="item.lishua">立</span><span class="dib vm tag tag-2" v-if="item.sheng">盛</span><span class="dib vm tag tag-3" v-if="item.haikes">海</span></div>
  102. </template>
  103. </van-cell>
  104. </van-cell-group>
  105. </van-checkbox-group>
  106. </van-list>
  107. </van-pull-refresh>
  108. </div>
  109. </van-tab>
  110. <van-tab title="大机兑换券" v-if="!is200">
  111. <div class="ovh-x" ref="wrapper2" v-if="active === 1">
  112. <van-pull-refresh v-model="refreshing" @refresh="onRefresh" :class="transactions.length === 0 ? 'isnodata':''" style="height: 100%;min-height:20vh;">
  113. <van-list v-model="loading" :finished="finished" finished-text="没有更多数据了" @load="onLoad" :immediate-check="false">
  114. <van-empty class="custom-image" image="./static/images/empty-img.png" description="暂无数据" v-if="transactions.length === 0"></van-empty>
  115. <van-checkbox-group v-model="result">
  116. <van-cell-group>
  117. <van-cell class="machine-list" v-for="item,index in transactions" clickable :key="item.Id" :value="item.Kind === 1 ? '电签兑换券' : '大机兑换券'" value-class="f14 c333" @click="toggle(index)" center>
  118. <template #title>
  119. <div class="f14 c333 warp"><span class="ismeng" v-if="item.IsLeader === 1">盟</span><span class="vm">兑换码:</span><span class="vm pr16" :id="'sn'+index">{{item.ExchangeCode}}</span>
  120. <div><span class="dib vm tag tag-1" v-if="item.bigking">金</span><span class="dib vm tag tag-3" v-if="item.leshuabig">乐</span><span class="dib vm tag tag-3" v-if="item.haikeb">海</span></div>
  121. </div>
  122. </template>
  123. <template #icon>
  124. <van-checkbox class="mr16" :name="item" ref="checkboxes" checked-color="#FFD500"></van-checkbox>
  125. </template>
  126. <template #label></template>
  127. </van-cell>
  128. </van-cell-group>
  129. </van-checkbox-group>
  130. </van-list>
  131. </van-pull-refresh>
  132. </div>
  133. </van-tab>
  134. </van-tabs>
  135. </div>
  136. <div class="machine_appli_checkall fixed">
  137. <van-cell title="全选" :value="'已选'+ result.length + '台'" clickable @click="toggleSelectAll">
  138. <template #icon>
  139. <van-checkbox class="mr16" name="selectedNum" v-model="SelectedAll" checked-color="#FFD500"></van-checkbox>
  140. </template>
  141. </van-cell>
  142. </div>
  143. <van-goods-action class="mall-bottom">
  144. <van-goods-action-button class="kxs-btn" type="default" color="#FFD500" style="color:#333;" text="确认申请" :disabled="result.length === 0" @click="onClickButton"></van-goods-action-button>
  145. </van-goods-action>
  146. <van-dialog class="dialog selectProductType" v-model="showSuccess" show-cancel-button confirm-button-text="确认兑换" @confirm="surebtn" :before-close="isclose" @close="closedialog">
  147. <div class="pt16 pl16 pr16 tc mb8">
  148. <div class="f14 c333 b">请选择需要兑换的产品类型</div>
  149. <div class="pt16 f12 c999 tl">
  150. <p>1、选择的产品类型一旦申请兑换成功,不可更改;</p>
  151. <p>2、若某产品类型不可选择,则表示申请的机具中含不满足条件机具,请重新选择。</p>
  152. </div>
  153. <van-radio-group v-model="typeResult">
  154. <van-cell-group class="scroll" :border="false" style="height:40vh;">
  155. <van-cell class="machine-list" v-for="item,index in productTypes" clickable :key="index" value-class="f14" @click="typeToggle(item,index)" center>
  156. <template #title>
  157. <div class="f14 c333 tl"><span class="vm pr16 disable" :class="typeResult.Id === item.Id ? 'checkbox':''">{{item.Name}}</span></div>
  158. </template>
  159. <template #icon>
  160. <van-radio class="mr16" :name="item" ref="radios" :disabled="!item.status" checked-color="#FFD500"></van-radio>
  161. </template>
  162. </van-cell>
  163. </van-cell-group>
  164. </van-radio-group>
  165. </div>
  166. </van-dialog>
  167. </div>
  168. <script src="./static/js/klm-vv.min.js"></script>
  169. <script src="./static/js/appfunc.min.js"></script>
  170. <script src="./static/js/klm-axios-config.js"></script>
  171. <script src="./static/js/publicfn.js"></script>
  172. <script>
  173. function OnStart(){
  174. if(PublicLib.getCookieInfo('isApplyBack') === 'true'){
  175. app.changetab();
  176. PublicLib.putCookieInfo('isApplyBack','');
  177. }
  178. };
  179. // 通过 CDN 引入时不会自动注册 Lazyload 组件
  180. // 可以通过下面的方式手动注册
  181. Vue.use(vant.Lazyload);
  182. PublicLib.SetStatusBarBgColor({bgcolor:'ffffff'});
  183. // 在 #app 标签下渲染一个按钮组件
  184. let app = new Vue({
  185. el: '#app',
  186. data() {
  187. return {
  188. active:0,
  189. loading: false,
  190. finished: false,
  191. refreshing:false,
  192. productId:0,
  193. toptitleisshow:false,
  194. title:'ad',
  195. ExpiredCount:0,
  196. MinCount:0,
  197. ActCount:0,
  198. showSuccess: false,
  199. tipsisshow:false,
  200. result: [],
  201. typeResult: [
  202. ],
  203. pageinfo:{
  204. PageSize:30,
  205. PageNum:1
  206. },
  207. productTypes: [
  208. ],
  209. transactions: [
  210. ],
  211. value: '',
  212. SelectedAll: false,
  213. ischeck:true,
  214. king:{
  215. Id:[],
  216. status:true
  217. },
  218. bigking:{
  219. Id:[],
  220. status:true
  221. },
  222. open:{
  223. Id:[],
  224. status:true
  225. },
  226. leshua:{
  227. Id:[],
  228. status:true
  229. },
  230. leshuabig:{
  231. Id:[],
  232. status:true
  233. },
  234. lishua:{
  235. Id:[],
  236. status:true
  237. },
  238. sheng:{
  239. Id:[],
  240. status:true
  241. },
  242. haikes:{
  243. Id:[],
  244. status:true
  245. },
  246. haikeb:{
  247. Id:[],
  248. status:true
  249. },
  250. is200:true,
  251. };
  252. },
  253. async created() {
  254. this.toptitleisshow = toptitleisshow;
  255. this.getproductlist();
  256. this.getproducttypelist();
  257. this.title = PublicLib.getCookieInfo('productMachineType');
  258. this.productId = PublicLib.getCookieInfo('productMachineId');
  259. if(this.productId === '1' || this.productId === '2' || this.productId === '4' || this.productId === '6' || this.productId === '7' || this.productId === '8'){
  260. this.is200 = true;
  261. }else{
  262. this.is200 = false;
  263. };
  264. PublicLib.SetTitle({Title:'机具申请-'+ PublicLib.getCookieInfo('productMachineType')});
  265. },
  266. beforeUpdate(){
  267. this.$nextTick(() => {
  268. this.$refs.wrapper2.style.height = `${document.documentElement.clientHeight - 314}px`;
  269. });
  270. },
  271. methods: {
  272. changetab(){
  273. this.transactions = [];
  274. this.getnewinfo();
  275. },
  276. getnewinfo:undebounce(async function(){
  277. this.pageinfo.PageNum = 1;
  278. this.finished = false;
  279. this.result = [];
  280. if(this.active === 0){
  281. this.getproductlist('refresh');
  282. }else{
  283. this.getexchangelist('refresh');
  284. };
  285. },500),
  286. onRefresh() {
  287. // 清空列表数据
  288. this.finished = false;
  289. this.loading = true;
  290. // 重新加载数据
  291. // 将 loading 设置为 true,表示处于加载状态
  292. this.pageinfo.PageNum = 1;
  293. if(this.active === 0){
  294. this.getproductlist('refresh');
  295. }else{
  296. this.getexchangelist('refresh');
  297. };
  298. },
  299. onLoad() {
  300. if(this.refreshing){
  301. this.refreshing = false;
  302. };
  303. this.pageinfo.PageNum++;
  304. if(this.active !== 0){
  305. this.getexchangelist();
  306. };
  307. },
  308. giveToast(str){
  309. vant.Toast(str);
  310. },
  311. typeToggle(item,index) {
  312. const that = this;
  313. if(item.status){
  314. that.typeResult = item;
  315. };
  316. },
  317. toggle(index) {
  318. const that = this;
  319. this.$refs.checkboxes[index].toggle();
  320. //- 选择逻辑
  321. setTimeout(() => {
  322. this.choose();
  323. if(!this.ischeck){
  324. this.$refs.checkboxes[index].toggle();
  325. this.ischeck = true;
  326. return;
  327. };
  328. if(that.result.length == that.transactions.length){
  329. that.SelectedAll = true;
  330. }else{
  331. that.SelectedAll = false;
  332. };
  333. }, 10);
  334. },
  335. //- 选择逻辑
  336. choose(){
  337. this.king.status = true;
  338. this.open.status = true;
  339. this.bigking.status = true;
  340. this.leshua.status = true;
  341. this.leshuabig.status = true;
  342. this.lishua.status = true;
  343. this.sheng.status = true;
  344. this.haikes.status = true;
  345. this.haikeb.status = true;
  346. let king = true;
  347. let bigking = true;
  348. let open = true;
  349. let leshua = true;
  350. let leshuabig = true;
  351. let lishua = true;
  352. let sheng = true;
  353. let haikes = true;
  354. let haikeb = true;
  355. this.result.forEach(item=>{
  356. open = item.open;
  357. bigking = item.bigking;
  358. king = item.king;
  359. leshua = item.leshua;
  360. leshuabig = item.leshuabig;
  361. lishua = item.lishua;
  362. sheng = item.sheng;
  363. haikes = item.haikes;
  364. haikeb = item.haikeb;
  365. });
  366. if(this.result.length !== 0) {
  367. this.result.forEach(item=>{
  368. if(!(king === item.king || bigking === item.bigking || open === item.open || leshuabig === item.leshuabig || leshua === item.leshua || lishua === item.lishua || sheng === item.sheng)) {
  369. this.ischeck = false;
  370. };
  371. if(this.king.status) {
  372. this.king.status = item.king;
  373. };
  374. if(this.open.status) {
  375. this.open.status = item.open;
  376. };
  377. if(this.bigking.status) {
  378. this.bigking.status = item.bigking ;
  379. };
  380. if(this.leshuabig.status) {
  381. this.leshuabig.status = item.leshuabig ;
  382. };
  383. if(this.lishua.status) {
  384. this.lishua.status = item.lishua ;
  385. };
  386. if(this.sheng.status) {
  387. this.sheng.status = item.sheng ;
  388. };
  389. if(this.haikes.status) {
  390. this.haikes.status = item.haikes ;
  391. };
  392. if(this.haikeb.status) {
  393. this.haikeb.status = item.haikeb ;
  394. };
  395. if(this.leshua.status) {
  396. this.leshua.status = item.leshua ;
  397. };
  398. });
  399. };
  400. },
  401. toggleSelectAll(){
  402. const that = this;
  403. that.SelectedAll = !that.SelectedAll;
  404. if(that.SelectedAll){
  405. that.result = that.transactions;
  406. }else{
  407. that.result = [];
  408. };
  409. },
  410. onClickButton:undebounce(function(){
  411. if(PublicLib.getCookieInfo('userId') === '124473'){
  412. return tips('账号异常,请联系客服');
  413. };
  414. this.choose();
  415. this.chosefn();
  416. this.showSuccess = true;
  417. }),
  418. goback(){
  419. PublicLib.GoBack({Level:1});
  420. },
  421. //- 获取循环SN列表
  422. async getproductlist(){
  423. const ProductType = PublicLib.getCookieInfo('productMachineId');
  424. const UserId = PublicLib.getCookieInfo('userId');
  425. const res = await getRequest('api/v1/pos/orders/exchangemachines2?t='+Math.random(6),JSON.stringify({...this.pageinfo,ProductType,UserId}));
  426. if(res.status !== '1')return tips('机具列表获取失败!');
  427. res.data.forEach((obj,index)=>{
  428. //- TODO:删除赋值start
  429. //- if(index === 0) {
  430. //- obj.ProductType = [1,2,4,6];
  431. //- } else if(index === 1){
  432. //- obj.ProductType = [1];
  433. //- } else if(index === 2){
  434. //- obj.ProductType = [4];
  435. //- } else {
  436. //- obj.ProductType = [1,2,3];
  437. //- };
  438. // end
  439. obj.king = false;
  440. obj.open = false;
  441. obj.bigking = false;
  442. obj.leshua = false;
  443. obj.leshuabig = false;
  444. obj.lishua = false;
  445. obj.sheng = false;
  446. obj.haikes = false;
  447. obj.haikeb = false;
  448. const typearray = obj.ProductType;
  449. typearray.forEach(i=>{
  450. if(i === 1) {
  451. this.king.Id.push(i);
  452. obj.king = true;
  453. };
  454. if(i === 2) {
  455. this.open.Id.push(i);
  456. obj.open = true;
  457. };
  458. if(i === 3) {
  459. this.bigking.Id.push(i);
  460. obj.bigking = true;
  461. };
  462. if(i === 4) {
  463. this.leshua.Id.push(i);
  464. obj.leshua = true;
  465. };
  466. if(i === 5) {
  467. this.leshuabig.Id.push(i);
  468. obj.leshuabig = true;
  469. };
  470. if(i === 6) {
  471. this.lishua.Id.push(i);
  472. obj.lishua = true;
  473. };
  474. if(i === 7) {
  475. this.sheng.Id.push(i);
  476. obj.sheng = true;
  477. };
  478. if(i === 8) {
  479. this.haikes.Id.push(i);
  480. obj.haikes = true;
  481. };
  482. if(i === 9) {
  483. this.haikeb.Id.push(i);
  484. obj.haikeb = true;
  485. };
  486. });
  487. });
  488. if(res.data.length < 10){
  489. this.finished = true;
  490. };
  491. //- this.transactions.push(...res.data);
  492. this.transactions = res.data;
  493. this.ActCount = res.other.ActCount;
  494. this.ExpiredCount = res.other.ExpiredCount;
  495. this.MinCount = res.other.MinCount;
  496. this.loading = false;
  497. },
  498. //- 获取兑换码列表
  499. async getexchangelist(type = 'onload'){
  500. const Kind = this.is200 ? 1 : 2;
  501. const UserId = PublicLib.getCookieInfo('userId');
  502. const res = await getRequest('api/v1/pos/poscoupons/exchangecoupons?t='+Math.random(6),JSON.stringify({...this.pageinfo,UserId,Kind}));
  503. if(res.status !== '1')return tips('机具列表获取失败!');
  504. res.data.forEach((obj,index)=>{
  505. //- TODO:删除赋值start
  506. //- if(index === 0) {
  507. //- obj.ProductType = [1,2,4,6,7];
  508. //- } else if(index === 1){
  509. //- obj.ProductType = [1,2,4,6];
  510. //- } else if(index === 2){
  511. //- obj.ProductType = [1,2,4,6];
  512. //- } else {
  513. //- obj.ProductType = [1,2,7];
  514. //- };
  515. // end
  516. obj.king = false;
  517. obj.open = false;
  518. obj.bigking = false;
  519. obj.leshua = false;
  520. obj.leshuabig = false;
  521. obj.lishua = false;
  522. obj.sheng = false;
  523. obj.haikes = false;
  524. obj.haikeb = false;
  525. const typearray = obj.ProductType;
  526. typearray.forEach(i=>{
  527. if(i === 1) {
  528. this.king.Id.push(i);
  529. obj.king = true;
  530. };
  531. if(i === 2) {
  532. this.open.Id.push(i);
  533. obj.open = true;
  534. };
  535. if(i === 3) {
  536. this.bigking.Id.push(i);
  537. obj.bigking = true;
  538. };
  539. if(i === 4) {
  540. this.leshua.Id.push(i);
  541. obj.leshua = true;
  542. };
  543. if(i === 5) {
  544. this.leshuabig.Id.push(i);
  545. obj.leshuabig = true;
  546. };
  547. if(i === 6) {
  548. this.lishua.Id.push(i);
  549. obj.lishua = true;
  550. };
  551. if(i === 7) {
  552. this.sheng.Id.push(i);
  553. obj.sheng = true;
  554. };
  555. if(i === 8) {
  556. this.haikes.Id.push(i);
  557. obj.haikes = true;
  558. };
  559. if(i === 9) {
  560. this.haikeb.Id.push(i);
  561. obj.haikeb = true;
  562. };
  563. });
  564. });
  565. if(res.data.length < 10){
  566. this.finished = true;
  567. };
  568. if(type === 'refresh'){
  569. this.transactions = res.data
  570. this.refreshing = false;
  571. }else{
  572. this.transactions.push(...res.data);
  573. }
  574. this.loading = false;
  575. //- this.ActCount = res.other.ActCount;
  576. //- this.ExpiredCount = res.other.ExpiredCount;
  577. //- this.MinCount = res.other.MinCount;
  578. },
  579. async getproducttypelist(type = 'onload'){
  580. const res = await getRequest('api/v1/pos/kqproducts/list?t='+Math.random(6),JSON.stringify({PageSize:10,PageNum:1}));
  581. if(res.status !== '1')return tips('产品列表获取失败!');
  582. //- res.data.push({Name: "盛付通", Id: 7});
  583. if(type === 'refresh'){
  584. this.productTypes = res.data
  585. this.refreshing = false;
  586. }else{
  587. this.productTypes.push(...res.data);
  588. }
  589. },
  590. chosefn(){
  591. this.productTypes.forEach(item=>{
  592. if(this.typefn(item.Id,this.king.Id)){
  593. item.status = this.king.status;
  594. }else if(this.typefn(item.Id,this.open.Id)){
  595. item.status = this.open.status;
  596. }else if(this.typefn(item.Id,this.bigking.Id)){
  597. item.status = this.bigking.status;
  598. }else if(this.typefn(item.Id,this.leshua.Id)){
  599. item.status = this.leshua.status;
  600. }else if(this.typefn(item.Id,this.leshuabig.Id)){
  601. item.status = this.leshuabig.status;
  602. }else if(this.typefn(item.Id,this.lishua.Id)){
  603. item.status = this.lishua.status;
  604. }else if(this.typefn(item.Id,this.sheng.Id)){
  605. item.status = this.sheng.status;
  606. }else if(this.typefn(item.Id,this.haikes.Id)){
  607. item.status = this.haikes.status;
  608. }else if(this.typefn(item.Id,this.haikeb.Id)){
  609. item.status = this.haikeb.status;
  610. }else {
  611. item.status = false;
  612. };
  613. });
  614. },
  615. typefn(Id,arr){
  616. const result = arr.find(item=>{
  617. return item === Id
  618. })
  619. return result;
  620. },
  621. isclose(action, done){
  622. if(action === 'confirm'){
  623. return done(false);
  624. }else{
  625. return done();
  626. };
  627. },
  628. surebtn(){
  629. let isRepeat = false;
  630. if(this.active === 0){
  631. this.result.forEach((obj,i)=>{
  632. this.result.forEach((item,index)=>{
  633. if(obj.SnNo === item.SnNo && i !== index){
  634. isRepeat = true;
  635. };
  636. });
  637. });
  638. if(isRepeat){
  639. return tips('请勿选择相同SN号!')
  640. };
  641. }else{
  642. this.result.forEach((obj,i)=>{
  643. this.result.forEach((item,index)=>{
  644. if(obj.ExchangeCode === item.ExchangeCode && i !== index){
  645. isRepeat = true;
  646. };
  647. });
  648. });
  649. if(isRepeat){
  650. return tips('请勿选择相同兑换码!')
  651. };
  652. };
  653. if(this.typeResult.length === 0){
  654. return tips('请选择循环机具类型!');
  655. };
  656. PublicLib.putCookieInfo('SNIDinfo', JSON.stringify(this.result));
  657. PublicLib.putCookieInfo('chooseProductId', JSON.stringify(this.typeResult));
  658. PublicLib.putCookieInfo('sendKind', JSON.stringify(this.active));
  659. this.result = [];
  660. this.SelectedAll = false;
  661. //- 清除仓库Id
  662. PublicLib.putCookieInfo('warehouseId', '');
  663. //- 清除收货地址Id
  664. PublicLib.putCookieInfo('addressId', '');
  665. this.showSuccess = false;
  666. setTimeout(()=>{
  667. PublicLib.Goto({Url:'product-machine-apply-2'});
  668. },50)
  669. },
  670. closedialog(){
  671. this.typeResult = [];
  672. },
  673. applyrecord(){
  674. PublicLib.Goto({Url:'product-machine-apply-record'});
  675. }
  676. }
  677. });
  678. </script>
  679. </body>
  680. </html>