抖音c端
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

před 2 roky
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. const navigationBarHeight = (getApp().statusBarHeight + 50) + 'px'
  2. let config = require("../../../config/config.js");
  3. let Http = require("../../../utils/HttpBasics");
  4. const util = require("../../../utils/util");
  5. let app = getApp();
  6. const imgurl = require("../../../utils/imgurl");
  7. Page({
  8. data: {
  9. showBox: false,//显示授权手机框
  10. navigationBarHeight,
  11. noOrdersUrl: imgurl.noOrders.url,
  12. loadingUrl: imgurl.loading.url,
  13. wmhome: imgurl.wmhome.url,
  14. wmdiscount: imgurl.wmdiscount.url,
  15. wmgive: imgurl.wmgive.url,
  16. boatFlag: "all",
  17. tabs: [{
  18. key: "all",
  19. name: "全部"
  20. },
  21. {
  22. key: 0,
  23. name: "待付款"
  24. },
  25. {
  26. key: 1,
  27. name: "已完成"
  28. },
  29. {
  30. key: 3,
  31. name: "售后"
  32. }
  33. ],
  34. list: [],
  35. current: "",
  36. loading: true, //"上拉加载"的变量,默认false,隐藏
  37. // current_scroll: "1",
  38. allow_load: true,
  39. page: 1,
  40. content: "",
  41. canIUse: tt.canIUse("button.open-type.getPhoneNumber"),//判断小程序是否能用获取手机插件
  42. ifshowtab:null,
  43. },
  44. setPhone(paramData) {//子组件调用这个方法说明手机号已经授权成功
  45. this.setData({
  46. showBox: paramData.detail,
  47. })
  48. this.getList('all', 1)
  49. tt.showToast({
  50. title: '授权成功', // 内容
  51. icon: 'none', // 图标
  52. success: (res) => {
  53. },
  54. fail: (res) => {
  55. },
  56. });
  57. },
  58. setBox(paramData) {
  59. this.setData({
  60. showBox: paramData.detail,
  61. })
  62. tt.showToast({
  63. title: '取消授权', // 内容
  64. icon: 'none', // 图标
  65. success: (res) => {
  66. },
  67. fail: (res) => {
  68. },
  69. });
  70. },
  71. goback: function () {
  72. tt.reLaunch({
  73. url: '/index/index',
  74. })
  75. },
  76. onLoad(e) {
  77. // this.setData({
  78. // current_scroll: e.id
  79. // });
  80. },
  81. onShow() {
  82. Http.get({
  83. url: config.api.checkUserStatus,
  84. data: {
  85. token: app.globalData.token
  86. }
  87. }).then(res => {
  88. Http.get({
  89. url: config.api.checkPhoneStatus,
  90. }).then(res => {
  91. }).catch(err => {
  92. if (app.globalData.ifCongPh==1) {
  93. app.globalData.skip = 'navigateBack'
  94. tt.navigateTo({
  95. url: `/pages/getPhone/getPhone?skipUrl=1`,
  96. })
  97. }else{
  98. this.setData({
  99. showBox:true
  100. })
  101. }
  102. })
  103. }).catch(err => {
  104. if (err.code == 11004) {//未授权抖音
  105. app.globalData.type = 'mo'
  106. tt.navigateTo({
  107. url: '/pages/getuserinfo/getuserinfo',
  108. });
  109. }
  110. })
  111. this.setData({
  112. ifshowtab : app.globalData.ifshowtab,
  113. allow_load: true
  114. })
  115. this.getList(this.data.boatFlag, 1);
  116. },
  117. /**
  118. * 砍价中的状态
  119. * 跳转到砍价详情页面
  120. */
  121. gotoDiscount: function (e) {
  122. tt.navigateTo({
  123. url: `/pages/bargain/bargainDatail/bargainDatail?orderId=${e.currentTarget.dataset.id}`
  124. })
  125. },
  126. cancel(e){//取消订单
  127. tt.showModal({
  128. title: '提示',
  129. content: '您是否要取消该订单',
  130. confirmText: "确定",
  131. success: (res) => {
  132. if(res.confirm){
  133. Http.post({
  134. url:config.api.orderCancel,
  135. data:{
  136. orderId: e.currentTarget.dataset.id
  137. }
  138. }).then(res=>{
  139. this.getList(this.data.boatFlag, 1);
  140. tt.showToast({
  141. title: "取消订单成功!",
  142. icon: 'none',
  143. duration: 2000,
  144. mask: false
  145. });
  146. }).catch(err=>{
  147. tt.showToast({
  148. title: err.message?err.message:err.data,
  149. icon: 'none',
  150. duration: 2000,
  151. mask: false
  152. });
  153. })
  154. } else if (res.cancel) {
  155. console.log("取消");
  156. }
  157. },
  158. fail(err) {
  159. console.log(`showModal 调用失败`, err);
  160. },
  161. });
  162. },
  163. gotopay: function (e) {
  164. let level = e.currentTarget.dataset.level
  165. if (level == 0) {
  166. tt.navigateTo({
  167. url: `/pages/order/detail/index?orderId=${e.currentTarget.dataset.id}&flag='pay'`
  168. })
  169. } else {
  170. tt.navigateTo({
  171. url: `/pages/order/detail/index?orderId=${e.currentTarget.dataset.id}&dingdan=order&flag='pay'`
  172. })
  173. }
  174. },
  175. //再次购买
  176. gotopayAgain: function (e) {
  177. tt.navigateTo({
  178. url: `/pages/coupon/detail/index?couponChannelId=${e.currentTarget.dataset.couponchannelid
  179. }&couponId=${e.currentTarget.dataset.couponid}`
  180. });
  181. },
  182. // gotoSpellPay(e) {
  183. // console.log(e, 333)
  184. // let data = e.currentTarget.dataset.data
  185. // tt.navigateTo({
  186. // url: `/pages/spellGroup/paySpellGroup/index?orderId=${data.orderId}&couponId=${data.couponId}&orderGroupId=${data.orderGroupId}&couponChannelId=${data.couponChannelId}`,
  187. // })
  188. // },
  189. getList(key, pageNum) {
  190. let that = this;
  191. if (key == undefined) {
  192. key = 'all'
  193. }
  194. /**
  195. * key==0
  196. * 不发送该字段
  197. */
  198. if (key == 'all') {
  199. var variable = {
  200. pageNum: pageNum,
  201. pageSize: 10,
  202. paymentType: 0
  203. };
  204. } else {
  205. var variable = {
  206. pageNum: pageNum,
  207. pageSize: 10,
  208. orderStatus: key,
  209. paymentType: 0
  210. };
  211. }
  212. if (that.data.allow_load) {
  213. that.setData({
  214. loading: true,
  215. content: '小主,我在玩命加载中...'
  216. })
  217. Http.get({
  218. url: config.api.orderList,
  219. data: variable
  220. }).then(res => {
  221. if (pageNum >= res.data.pages) {
  222. that.setData({
  223. allow_load: false
  224. });
  225. setTimeout(function () {
  226. that.setData({
  227. loading: false,
  228. })
  229. }, 1400);
  230. }
  231. setTimeout(function () {
  232. that.setData({
  233. loading: false,
  234. })
  235. }, 1400);
  236. if (pageNum == 1) {
  237. that.setData({
  238. list: []
  239. })
  240. }
  241. var tmpArr = that.data.list;
  242. tmpArr.push.apply(tmpArr, res.data.list);
  243. // 将砍价的状态过滤出来
  244. console.log(tmpArr)
  245. tmpArr.map(item => {
  246. item.orders.map(itemChild => {
  247. itemChild.createDate = util.formatTime(itemChild.createDate, "yyyy-MM-dd hh:mm:ss");
  248. })
  249. })
  250. that.setData({
  251. list: tmpArr
  252. })
  253. for (let i = 0; i < that.data.list.length; i++) {
  254. var createDate1 = util.formatTime(that.data.list[i].createDate, "yyyy-MM-dd hh:mm:ss");
  255. /**
  256. * 修改list的endtime
  257. * 渲染到页面
  258. */
  259. var createDate = 'list[' + i + '].createDate'
  260. that.setData({
  261. [createDate]: createDate1
  262. });
  263. }
  264. })
  265. .catch(err => {
  266. tt.showModal({
  267. title: '提示',
  268. content: err.message ? err.message : err.data,
  269. showCancel: false
  270. })
  271. })
  272. }
  273. else {
  274. that.setData({
  275. loading: true,
  276. content: "——— 再拉裤子就掉了啦 ———"
  277. })
  278. setTimeout(function () {
  279. that.setData({
  280. loading: false,
  281. })
  282. }, 1400)
  283. }
  284. },
  285. handleChange({
  286. detail
  287. }) {
  288. this.setData({
  289. current: detail.key
  290. });
  291. },
  292. setBoatFlag(e) {
  293. if (app.globalData.ifCongPh==1) {
  294. let index = e.currentTarget.dataset.index
  295. console.log(index);
  296. this.setData({
  297. boatFlag: index,
  298. pageNum: 1,
  299. allow_load: true,
  300. })
  301. this.getList(index, 1)
  302. } else {
  303. this.setData({
  304. showBox: true
  305. })
  306. }
  307. },
  308. // handleChangeScroll({
  309. // detail
  310. // }) {
  311. // this.setData({
  312. // list: [],
  313. // allow_load: true,
  314. // current_scroll: detail.key,
  315. // page: 1
  316. // })
  317. // this.getList(detail.key, 1);
  318. // },
  319. onReachBottom: function () {
  320. var that = this;
  321. that.data.page++;
  322. that.setData({
  323. page: that.data.page
  324. });
  325. that.getList(that.data.boatFlag, that.data.page);
  326. },
  327. });