buyRecords.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888
  1. // lionfish_comshop/pages/goods/buyRecords.js
  2. var util = require('../../utils/util.js');
  3. var status = require('../../utils/index.js');
  4. var WxParse = require('../../wxParse/wxParse.js');
  5. var app = getApp();
  6. var buyClearTime = null;
  7. function count_down(that, total_micro_second) {
  8. var second = Math.floor(total_micro_second / 1000);
  9. var days = second / 3600 / 24;
  10. var daysRound = Math.floor(days);
  11. var hours = second / 3600 - (24 * daysRound);
  12. var hoursRound = Math.floor(hours);
  13. var minutes = second / 60 - (24 * 60 * daysRound) - (60 * hoursRound);
  14. var minutesRound = Math.floor(minutes);
  15. var seconds = second - (24 * 3600 * daysRound) - (3600 * hoursRound) - (60 * minutesRound);
  16. that.setData({
  17. endtime: {
  18. days: fill_zero_prefix(daysRound),
  19. hours: fill_zero_prefix(hoursRound),
  20. minutes: fill_zero_prefix(minutesRound),
  21. seconds: fill_zero_prefix(seconds),
  22. show_detail: 1
  23. }
  24. });
  25. if (total_micro_second <= 0) {
  26. clearTimeout(buyClearTime);
  27. that.setData({
  28. endtime: {
  29. days: "00",
  30. hours: "00",
  31. minutes: "00",
  32. seconds: "00",
  33. }
  34. });
  35. return;
  36. }
  37. buyClearTime = setTimeout(function() {
  38. total_micro_second -= 1000;
  39. count_down(that, total_micro_second);
  40. }, 1000)
  41. }
  42. // 位数不足补零
  43. function fill_zero_prefix(num) {
  44. return num < 10 ? "0" + num : num
  45. }
  46. Page({
  47. /**
  48. * 页面的初始数据
  49. */
  50. data: {
  51. showData: 1,
  52. goodDetail: {},
  53. showTitle: "",
  54. endTime: "",
  55. loadText: "正在加载",
  56. showBtn: true,
  57. showSku: false,
  58. skuList: [],
  59. cartNum: 0,
  60. type: 0,
  61. goodsStatus: 0,
  62. is_login: true,
  63. goodsIndex: 1,
  64. goods_id: 0,
  65. endtime: {
  66. days: "00",
  67. hours: "00",
  68. minutes: "00",
  69. seconds: "00",
  70. },
  71. rushList: [],
  72. hasRefeshin: false,
  73. pageNum: 1,
  74. is_share_html: true,
  75. iconArr: {
  76. home: '',
  77. car: ''
  78. }
  79. },
  80. id: 0,
  81. community_id: 0,
  82. /**
  83. * 生命周期函数--监听页面加载
  84. */
  85. onLoad: function(options) {
  86. var that = this;
  87. var token = wx.getStorageSync('token');
  88. status.setIcon().then(function(iconArr) {
  89. that.setData({
  90. iconArr
  91. });
  92. });
  93. if (!util.check_login()) {
  94. this.setData({
  95. is_login: false
  96. })
  97. wx.hideLoading();
  98. }
  99. this.id = options.id;
  100. this.community_id = options.community_id;
  101. let currentCommunity = wx.getStorageSync('community');
  102. let currentCommunity_id = (currentCommunity && currentCommunity.communityId) || '';
  103. if (!currentCommunity_id) {
  104. let community = {};
  105. if (options.community_id !== void 0 && options.community_id > 0) {
  106. community.communityId = options.community_id;
  107. }
  108. util.getCommunityInfo(community).then(function(res) {
  109. console.log('step1')
  110. paramHandle();
  111. get_goods_details(res);
  112. }).catch((param) => {
  113. console.log('step4 新人')
  114. if (Object.keys(param) != '') {
  115. that.addhistory(param, true);
  116. }
  117. });
  118. } else {
  119. console.log('step3')
  120. paramHandle();
  121. get_goods_details();
  122. }
  123. if (options.share_id != 'undefined' && options.share_id > 0) wx.setStorage({
  124. key: "share_id",
  125. data: options.share_id
  126. })
  127. function paramHandle() {
  128. console.log('step2')
  129. if (options.community_id != 'undefined' && options.community_id > 0) {
  130. app.util.request({
  131. 'url': 'entry/wxapp/index',
  132. 'data': {
  133. controller: 'index.get_community_info',
  134. 'community_id': options.community_id
  135. },
  136. dataType: 'json',
  137. success: function(res) {
  138. if (res.data.code == 0) {
  139. var community = res.data.data;
  140. let hisCommunity = currentCommunity;
  141. let community_id = currentCommunity_id;
  142. if (options.community_id != community_id && that.data.is_login) {
  143. wx.showModal({
  144. title: '温馨提示',
  145. content: '是否切换为分享人所在小区“' + community.communityName,
  146. confirmColor: '#F75451',
  147. success(res) {
  148. if (res.confirm) {
  149. app.globalData.community = community;
  150. app.globalData.changedCommunity = true;
  151. wx.setStorage({
  152. key: "community",
  153. data: community
  154. })
  155. that.addhistory(community);
  156. get_goods_details(community);
  157. console.log('用户点击确定')
  158. } else if (res.cancel) {
  159. that.showNoBindCommunity();
  160. console.log('用户点击取消')
  161. }
  162. }
  163. })
  164. }
  165. }
  166. }
  167. })
  168. }
  169. that.setData({
  170. goods_id: options.id
  171. }, () => {
  172. that.load_buy_record();
  173. })
  174. }
  175. function get_goods_details(communityInfo) {
  176. if (communityInfo) currentCommunity_id = communityInfo.communityId;
  177. app.util.request({
  178. 'url': 'entry/wxapp/index',
  179. 'data': {
  180. controller: 'goods.get_goods_detail',
  181. 'token': token,
  182. 'id': options.id,
  183. community_id: currentCommunity_id
  184. },
  185. dataType: 'json',
  186. success: function(res) {
  187. wx.hideLoading();
  188. let goods = res.data.data.goods;
  189. // 商品不存在
  190. if (!goods || goods.length == 0 || Object.keys(goods) == '') {
  191. wx.showModal({
  192. title: '提示',
  193. content: '该商品不存在,回首页',
  194. showCancel: false,
  195. confirmColor: '#F75451',
  196. success(res) {
  197. if (res.confirm) {
  198. wx.switchTab({
  199. url: '/lionfish_comshop/pages/index/index',
  200. })
  201. }
  202. }
  203. })
  204. }
  205. let comment_list = res.data.comment_list;
  206. comment_list.map(function(item) {
  207. 14 * item.content.length / app.globalData.systemInfo.windowWidth > 3 && (item.showOpen = true), item.isOpen = true;
  208. })
  209. that.setData({
  210. order_comment_count: res.data.order_comment_count,
  211. order_comment_images: res.data.order_comment_images,
  212. comment_list: comment_list,
  213. loadover: true,
  214. goods: goods,
  215. buy_record_arr: res.data.data.buy_record_arr,
  216. site_name: res.data.data.site_name,
  217. share_title: goods.share_title,
  218. options: res.data.data.options,
  219. goods_image: res.data.data.goods_image,
  220. goods_image_length: res.data.data.goods_image.length,
  221. service: goods.tag,
  222. favgoods: goods.favgoods,
  223. cur_time: res.data.data.cur_time,
  224. order: {
  225. goods_id: res.data.data.goods.goods_id,
  226. pin_id: res.data.data.pin_id,
  227. },
  228. showSkeleton: false,
  229. is_comunity_rest: res.data.is_comunity_rest,
  230. goodsdetails_addcart_bg_color: res.data.goodsdetails_addcart_bg_color || 'linear-gradient(270deg, #f9c706 0%, #feb600 100%)',
  231. goodsdetails_buy_bg_color: res.data.goodsdetails_buy_bg_color || 'linear-gradient(90deg, #ff5041 0%, #ff695c 100%)'
  232. })
  233. if (res.data.is_comunity_rest == 1) {
  234. wx.showModal({
  235. title: '温馨提示',
  236. content: '团长休息中,欢迎下次光临!',
  237. showCancel: false,
  238. confirmColor: '#F75451',
  239. confirmText: '好的',
  240. success(res) {}
  241. })
  242. }
  243. let over_type = goods.over_type;
  244. var seconds = 0;
  245. if (over_type == 0) {
  246. seconds = (goods.begin_time - res.data.data.cur_time) * 1000;
  247. } else {
  248. seconds = (goods.end_time - res.data.data.cur_time) * 1000;
  249. }
  250. if (seconds > 0) {
  251. count_down(that, seconds);
  252. }
  253. var article = res.data.data.goods.description;
  254. WxParse.wxParse('article', 'html', article, that, 0);
  255. }
  256. })
  257. }
  258. },
  259. //未绑定提示
  260. showNoBindCommunity: function() {
  261. wx.showModal({
  262. title: '提示',
  263. content: '您未绑定该小区,请切换后下单!',
  264. showCancel: false,
  265. confirmColor: '#F75451',
  266. success(res) {
  267. if (res.confirm) {
  268. wx.redirectTo({
  269. url: '/lionfish_comshop/pages/position/community',
  270. })
  271. }
  272. }
  273. })
  274. },
  275. /**
  276. * 历史社区
  277. */
  278. addhistory: function(community, isNew = false) {
  279. var community_id = community.communityId;
  280. console.log('addhistory');
  281. var token = wx.getStorageSync('token');
  282. app.util.request({
  283. 'url': 'entry/wxapp/index',
  284. 'data': {
  285. controller: 'index.addhistory_community',
  286. community_id: community_id,
  287. 'token': token
  288. },
  289. dataType: 'json',
  290. success: function(res) {
  291. if (isNew) {
  292. console.log('新人 社区')
  293. app.util.request({
  294. 'url': 'entry/wxapp/index',
  295. 'data': {
  296. controller: 'index.get_community_info',
  297. community_id: community_id
  298. },
  299. dataType: 'json',
  300. success: function(result) {
  301. if (result.data.code == 0) {
  302. let community = result.data.data;
  303. app.globalData.community = community;
  304. app.globalData.changedCommunity = true;
  305. wx.setStorage({
  306. key: "community",
  307. data: community
  308. })
  309. }
  310. }
  311. })
  312. }
  313. }
  314. })
  315. },
  316. /**
  317. * 授权成功回调
  318. */
  319. authSuccess: function() {
  320. var id = this.id;
  321. var community_id = this.community_id;
  322. wx.redirectTo({
  323. url: '/lionfish_comshop/pages/goods/buyRecords?id=' + id + '&community_id' + community_id,
  324. })
  325. },
  326. load_buy_record: function() {
  327. var that = this;
  328. var goods_id = this.data.goods_id;
  329. if (!that.data.hasRefeshin) {
  330. that.setData({
  331. hasRefeshin: true,
  332. loadMore: true
  333. });
  334. app.util.request({
  335. 'url': 'entry/wxapp/index',
  336. 'data': {
  337. controller: 'goods.load_buy_recordlist',
  338. goods_id: goods_id,
  339. pageNum: that.data.pageNum,
  340. },
  341. dataType: 'json',
  342. success: function(res) {
  343. if (res.data.code == 0) {
  344. let rushList = that.data.rushList.concat(res.data.data);
  345. that.setData({
  346. rushList: rushList,
  347. pageNum: that.data.pageNum + 1,
  348. loadMore: false,
  349. hasRefeshin: false,
  350. tip: ''
  351. });
  352. } else if (res.data.code == 1) {
  353. //go data
  354. that.setData({
  355. loadMore: false,
  356. tip: '^_^已经到底了'
  357. })
  358. } else if (res.data.code == 2) {
  359. //no login
  360. }
  361. }
  362. })
  363. }
  364. },
  365. returnTop: function() {
  366. this.setData({
  367. stickyFlag: !1,
  368. showTop: !1,
  369. tabCur: 0
  370. }), wx.pageScrollTo({
  371. scrollTop: 0,
  372. duration: 500
  373. });
  374. },
  375. addToCart: function(e) {
  376. var that = this;
  377. var from_id = e.detail.formId;
  378. var token = wx.getStorageSync('token');
  379. app.util.request({
  380. 'url': 'entry/wxapp/user',
  381. 'data': {
  382. controller: 'user.get_member_form_id',
  383. 'token': token,
  384. "from_id": from_id
  385. },
  386. dataType: 'json',
  387. success: function(res) {}
  388. })
  389. that.setData({
  390. is_just_addcar: 1
  391. })
  392. //加入购物车
  393. that.openSku();
  394. },
  395. openSku: function() {
  396. var that = this;
  397. var goods_id = this.data.goods_id;
  398. var options = this.data.options;
  399. that.setData({
  400. addCar_goodsid: goods_id
  401. })
  402. let list = options.list || [];
  403. let arr = [];
  404. if (list.length > 0) {
  405. for (let i = 0; i < list.length; i++) {
  406. let sku = list[i]['option_value'][0];
  407. let temp = {
  408. name: sku['name'],
  409. id: sku['option_value_id'],
  410. index: i,
  411. idx: 0
  412. };
  413. arr.push(temp);
  414. }
  415. //把单价剔除出来begin
  416. var id = '';
  417. for (let i = 0; i < arr.length; i++) {
  418. if (i == arr.length - 1) {
  419. id = id + arr[i]['id'];
  420. } else {
  421. id = id + arr[i]['id'] + "_";
  422. }
  423. }
  424. var cur_sku_arr = options.sku_mu_list[id];
  425. that.setData({
  426. sku: arr,
  427. sku_val: 1,
  428. cur_sku_arr: cur_sku_arr,
  429. skuList: options,
  430. visible: true,
  431. showSku: true
  432. });
  433. } else {
  434. let goods = this.data.goods;
  435. let cur_sku_arr = {
  436. canBuyNum: goods.total,
  437. spuName: goods.goodsname,
  438. actPrice: goods.actPrice,
  439. marketPrice: goods.marketPrice,
  440. stock: goods.total,
  441. skuImage: goods.image_thumb
  442. }
  443. that.setData({
  444. sku: [],
  445. sku_val: 1,
  446. cur_sku_arr: cur_sku_arr,
  447. skuList: []
  448. })
  449. let formIds = {
  450. detail: {
  451. formId: ""
  452. }
  453. };
  454. formIds.detail.formId = "the formId is a mock one";
  455. that.gocarfrom(formIds);
  456. //todo...addcart
  457. }
  458. },
  459. gocarfrom: function(e) {
  460. var that = this;
  461. var is_just_addcar = this.data.is_just_addcar;
  462. wx.showLoading();
  463. var token = wx.getStorageSync('token');
  464. app.util.request({
  465. 'url': 'entry/wxapp/user',
  466. 'data': {
  467. controller: 'user.get_member_form_id',
  468. 'token': token,
  469. "from_id": e.detail.formId
  470. },
  471. dataType: 'json',
  472. success: function(res) {}
  473. })
  474. that.goOrder();
  475. },
  476. closeSku: function() {
  477. this.setData({
  478. visible: 0,
  479. stopClick: false,
  480. });
  481. },
  482. goOrder: function() {
  483. var that = this;
  484. if (that.data.can_car) {
  485. that.data.can_car = false;
  486. }
  487. var token = wx.getStorageSync('token');
  488. var community = wx.getStorageSync('community');
  489. var goods_id = that.data.goods_id;
  490. var community_id = community.communityId;
  491. var quantity = that.data.sku_val;
  492. var cur_sku_arr = that.data.cur_sku_arr;
  493. var sku_str = '';
  494. var is_just_addcar = that.data.is_just_addcar;
  495. if (cur_sku_arr && cur_sku_arr.option_item_ids) {
  496. sku_str = cur_sku_arr.option_item_ids;
  497. }
  498. //addCar_goodsid: goods_id
  499. app.util.request({
  500. 'url': 'entry/wxapp/user',
  501. 'data': {
  502. controller: 'car.add',
  503. 'token': token,
  504. "goods_id": goods_id,
  505. "community_id": community_id,
  506. "quantity": quantity,
  507. "sku_str": sku_str,
  508. "buy_type": 'dan',
  509. "pin_id": 0,
  510. "is_just_addcar": is_just_addcar
  511. },
  512. dataType: 'json',
  513. method: 'POST',
  514. success: function(res) {
  515. //console.log(res);
  516. if (res.data.code == 3) {
  517. wx.showToast({
  518. title: res.data.msg,
  519. icon: 'none',
  520. duration: 2000
  521. })
  522. } else if (res.data.code == 4) {
  523. wx.showToast({
  524. title: '您未登录',
  525. duration: 2000,
  526. })
  527. } else if (res.data.code == 6) {
  528. var msg = res.data.msg;
  529. let max_quantity = res.data.max_quantity || '';
  530. (max_quantity > 0) && that.setData({
  531. sku_val: max_quantity
  532. })
  533. wx.showToast({
  534. title: msg,
  535. icon: 'none',
  536. duration: 2000
  537. })
  538. } else {
  539. if (is_just_addcar == 1) {
  540. that.closeSku();
  541. wx.showToast({
  542. title: "已加入购物车",
  543. image: "../../images/addShopCart.png"
  544. })
  545. app.globalData.cartNum = res.data.total
  546. that.setData({
  547. cartNum: res.data.total
  548. });
  549. status.indexListCarCount(goods_id);
  550. } else {
  551. var pages_all = getCurrentPages();
  552. if (pages_all.length > 3) {
  553. wx.redirectTo({
  554. url: '/lionfish_comshop/pages/order/placeOrder?type=dan'
  555. })
  556. } else {
  557. wx.navigateTo({
  558. url: '/lionfish_comshop/pages/order/placeOrder?type=dan'
  559. })
  560. }
  561. }
  562. }
  563. }
  564. })
  565. },
  566. selectSku: function(event) {
  567. var that = this;
  568. let str = event.currentTarget.dataset.type;
  569. let obj = str.split("_");
  570. let arr = that.data.sku;
  571. let temp = {
  572. name: obj[3],
  573. id: obj[2],
  574. index: obj[0],
  575. idx: obj[1]
  576. };
  577. arr.splice(obj[0], 1, temp);
  578. that.setData({
  579. sku: arr
  580. })
  581. var id = '';
  582. for (let i = 0; i < arr.length; i++) {
  583. if (i == arr.length - 1) {
  584. id = id + arr[i]['id'];
  585. } else {
  586. id = id + arr[i]['id'] + "_";
  587. }
  588. }
  589. var options = this.data.skuList;
  590. var cur_sku_arr = options.sku_mu_list[id];
  591. that.setData({
  592. cur_sku_arr: cur_sku_arr
  593. });
  594. console.log(id);
  595. },
  596. submit: function(e) {
  597. var from_id = e.detail.formId;
  598. var token = wx.getStorageSync('token');
  599. app.util.request({
  600. 'url': 'entry/wxapp/user',
  601. 'data': {
  602. controller: 'user.get_member_form_id',
  603. 'token': token,
  604. "from_id": from_id
  605. },
  606. dataType: 'json',
  607. success: function(res) {}
  608. })
  609. },
  610. balance: function(e) {
  611. console.log(3);
  612. this.setData({
  613. is_just_addcar: 0
  614. })
  615. //加入购物车
  616. this.openSku();
  617. },
  618. setNum: function(event) {
  619. let types = event.currentTarget.dataset.type;
  620. var that = this;
  621. var num = 1;
  622. let sku_val = this.data.sku_val * 1;
  623. if (types == 'add') {
  624. num = sku_val + 1;
  625. } else if (types == 'decrease') {
  626. if (sku_val > 1) {
  627. num = sku_val - 1;
  628. }
  629. }
  630. let arr = that.data.sku;
  631. var options = this.data.skuList;
  632. var id = '';
  633. for (let i = 0; i < arr.length; i++) {
  634. if (i == arr.length - 1) {
  635. id = id + arr[i]['id'];
  636. } else {
  637. id = id + arr[i]['id'] + "_";
  638. }
  639. }
  640. var cur_sku_arr = options.sku_mu_list[id];
  641. if (num > cur_sku_arr['canBuyNum']) {
  642. num = num - 1;
  643. }
  644. this.setData({
  645. sku_val: num
  646. })
  647. },
  648. scrollImagesChange: function(t) {
  649. this.setData({
  650. goodsIndex: t.detail.current + 1
  651. });
  652. },
  653. share_handler: function() {
  654. this.setData({
  655. is_share_html: false
  656. })
  657. },
  658. hide_share_handler: function() {
  659. this.setData({
  660. is_share_html: true
  661. })
  662. },
  663. share_quan: function() {
  664. wx.showLoading({
  665. title: '获取中',
  666. })
  667. var token = wx.getStorageSync('token');
  668. var community = wx.getStorageSync('community');
  669. var goods_id = this.data.order.goods_id;
  670. var community_id = community.communityId;
  671. var that = this;
  672. app.util.request({
  673. 'url': 'entry/wxapp/index',
  674. 'data': {
  675. controller: 'goods.get_user_goods_qrcode',
  676. "token": token,
  677. community_id: community_id,
  678. "goods_id": goods_id
  679. },
  680. dataType: 'json',
  681. success: function(res) {
  682. if (res.data.code == 0) {
  683. setTimeout(function() {
  684. wx.hideLoading()
  685. }, 2000)
  686. var image_path = res.data.image_path;
  687. wx.getImageInfo({
  688. src: image_path,
  689. success: function(res) {
  690. var real_path = res.path;
  691. wx.saveImageToPhotosAlbum({
  692. filePath: real_path,
  693. success(res) {
  694. wx.showToast({
  695. title: '图片保存成功,可以分享了',
  696. icon: 'none',
  697. duration: 2000
  698. })
  699. that.setData({
  700. is_share_html: true
  701. });
  702. }
  703. })
  704. }
  705. })
  706. }
  707. }
  708. })
  709. },
  710. /**
  711. * 生命周期函数--监听页面初次渲染完成
  712. */
  713. onReady: function() {
  714. },
  715. /**
  716. * 生命周期函数--监听页面显示
  717. */
  718. onShow: function() {
  719. this.setData({
  720. cartNum: app.globalData.cartNum
  721. });
  722. },
  723. /**
  724. * 打开立即购买
  725. */
  726. openSkuModalBalance: function() {
  727. if (this.$data.flag) {
  728. wx.showLoading({
  729. title: "加载中...",
  730. mask: true
  731. });
  732. this.setData({
  733. type: 1
  734. })
  735. this.skuData()
  736. } else {
  737. this.setData({
  738. showSku: true,
  739. type: 1
  740. })
  741. }
  742. },
  743. /**
  744. * 打开加入购物车
  745. */
  746. openSkuModalAddToCart: function() {
  747. if (this.$data.flag) {
  748. wx.showLoading({
  749. title: "加载中...",
  750. mask: true
  751. })
  752. this.setData({
  753. type: 0
  754. })
  755. this.skuData()
  756. } else {
  757. this.setData({
  758. showSku: true,
  759. type: 0
  760. })
  761. }
  762. },
  763. skuData: function() {
  764. console.log(111)
  765. },
  766. /**
  767. * 提交购物车
  768. */
  769. confirmSku: function() {
  770. var t = this;
  771. this.closeSku();
  772. // 处理购物车
  773. // (0, d.cartNum)().then(function () {
  774. // t.setData({
  775. // cartNum: app.globalData.cartNum
  776. // });
  777. // });
  778. },
  779. /**
  780. * 生命周期函数--监听页面隐藏
  781. */
  782. onHide: function() {
  783. },
  784. /**
  785. * 生命周期函数--监听页面卸载
  786. */
  787. onUnload: function() {
  788. clearTimeout(buyClearTime);
  789. console.log('onUload')
  790. this.setData({
  791. showSku: false
  792. });
  793. },
  794. /**
  795. * 页面相关事件处理函数--监听用户下拉动作
  796. */
  797. onPullDownRefresh: function() {
  798. },
  799. /**
  800. * 页面上拉触底事件的处理函数
  801. */
  802. onReachBottom: function() {
  803. this.load_buy_record();
  804. }
  805. })