add_information.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  1. var domanUrl = "//" + window.location.host, base_path = "/watero/wechat", marquee = '';
  2. mui.each(document.querySelectorAll('#footer-bar .mui-tab-item'), function (index, el) {
  3. el.addEventListener('tap', function () {
  4. switch (index) {
  5. case 0:
  6. mui.openWindow({url: 'index.html'});
  7. break;
  8. case 1:
  9. mui.openWindow({url: 'shopping_cart.html'});
  10. break;
  11. case 2:
  12. mui.openWindow({url: 'order_list.html'});
  13. break;
  14. case 3:
  15. mui.openWindow({url: 'vip_center.html'});
  16. break;
  17. default:
  18. break
  19. }
  20. }, false)
  21. });
  22. function getCartNum() {
  23. $.ajax(base_path + '/cart/getCartNumByCartOpenId', {
  24. data: {openid: '230'},
  25. dataType: 'json',
  26. type: 'post',
  27. timeout: 15000,
  28. xhrFields: {
  29. withCredentials: true
  30. },
  31. crossDomain: true,
  32. success: function (dt) {
  33. if (dt.isRedirect) {
  34. location.href = dt.redirectURL;
  35. } else {
  36. if (dt.status) {
  37. if (dt.data == "0") {
  38. $('.icon-gouwuche span').hide()
  39. } else {
  40. $('.icon-gouwuche span').text(dt.data).show()
  41. }
  42. } else {
  43. console.log(dt)
  44. }
  45. }
  46. },
  47. error: function (xhr, type, errorThrown) {
  48. errorfn(xhr)
  49. }
  50. })
  51. };mui('body').on('tap', '.go_index', function () {
  52. mui.openWindow({url: 'index.html'})
  53. });
  54. mui('body').on('tap', '.go_gwc', function () {
  55. mui.openWindow({url: 'shopping_cart.html'})
  56. });
  57. mui('body').on('tap', '.go_web_shop', function () {
  58. mui.openWindow({url: 'chanpin_list.html'})
  59. });
  60. mui('body').on('tap', '.go_chanpin_details', function () {
  61. mui.openWindow({url: 'chanpin_details.html?productId=' + this.getAttribute("proid")})
  62. });
  63. mui('body').on('tap', '.go_couponList', function () {
  64. mui.openWindow({url: 'coupon_list.html'})
  65. });
  66. mui('body').on('tap', '.go-clearing', function () {
  67. var param = "productId=" + this.getAttribute("proid");
  68. $.ajax(base_path + '/cart/addProductToCart?' + param, {
  69. dataType: 'json',
  70. type: 'GET',
  71. timeout: 15000,
  72. xhrFields: {
  73. withCredentials: true
  74. },
  75. crossDomain: true,
  76. success: function (dt) {
  77. if (dt.isRedirect) {
  78. location.href = dt.redirectURL;
  79. } else {
  80. if (dt.status) {
  81. mui.openWindow({url: 'clearing.html?cartId=' + dt.data + "&tiemstamp=" + new Date().getTime()})
  82. } else {
  83. mui.alert(dt.message)
  84. }
  85. }
  86. },
  87. error: function (xhr, type, errorThrown) {
  88. errorfn(xhr)
  89. }
  90. })
  91. });
  92. mui('body').on('tap', '.go_gwc_pro', function () {
  93. var param = "productId=" + this.getAttribute("proid");
  94. $.ajax(base_path + '/cart/addProductToCart?' + param, {
  95. dataType: 'json',
  96. type: 'GET',
  97. timeout: 15000,
  98. xhrFields: {
  99. withCredentials: true
  100. },
  101. crossDomain: true,
  102. success: function (dt) {
  103. if (dt.isRedirect) {
  104. location.href = dt.redirectURL;
  105. } else {
  106. if (dt.status) {
  107. getCartNum()
  108. } else {
  109. mui.alert(dt.message)
  110. }
  111. }
  112. },
  113. error: function (xhr, type, errorThrown) {
  114. errorfn(xhr)
  115. }
  116. })
  117. });
  118. function marquee_Show() {
  119. // mui.ajax(base_path + '/coupon/checkCurrentPreferential', {
  120. // dataType: 'json',
  121. // type: 'POST',
  122. // async: false,
  123. // timeout: 15000,
  124. // success: function (dt) {
  125. // if (dt.status) {
  126. // marquee = '<span class="mui-h6">专属优惠:</span>'
  127. // } else {
  128. // marquee = ''
  129. // }
  130. // },
  131. // error: function (xhr, type, errorThrown) {
  132. // console.log(xhr)
  133. // }
  134. // })
  135. };mui('body').on('tap', '.go_order_details', function () {
  136. mui.openWindow({url: 'order_details.html?orderId=' + this.getAttribute("value")})
  137. });
  138. mui('body').on('tap', '.go_pay_count', function () {
  139. mui.openWindow({url: 'order_list.html?salesStatus=1'})
  140. });
  141. mui('body').on('tap', '.go_deliver_count', function () {
  142. mui.openWindow({url: 'order_list.html?salesStatus=2'})
  143. });
  144. mui('body').on('tap', '.go_delivered_count', function () {
  145. mui.openWindow({url: 'order_list.html?salesStatus=5'})
  146. });
  147. mui('body').on('tap', '.go_all_count', function () {
  148. mui.openWindow({url: 'order_list.html?salesStatus=-1'})
  149. });
  150. mui('body').on('tap', '.go_tixian_guize', function () {
  151. mui.openWindow({url: base_path + '/integralWechat/withdrawRule'})
  152. });
  153. mui('body').on('tap', '.go_agent_rule', function () {
  154. mui.openWindow({url: base_path + '/agentWechat/agentRule'})
  155. });
  156. mui('body').on('tap', '.go_publicity', function () {
  157. mui.openWindow({url: base_path + '/agentWechat/goPublicity?userType=' + this.getAttribute("userType") + "&isDrp=" + this.getAttribute("isDrp")})
  158. });
  159. mui('body').on('tap', '.go_daili_order_list', function () {
  160. mui.openWindow({url: base_path + '/agentWechat/order'})
  161. });
  162. mui('body').on('tap', '.go_daili_rebackOrder_list', function () {
  163. mui.openWindow({url: base_path + '/agentWechat/reback'})
  164. });
  165. mui('body').on('tap', '.go_order_list', function () {
  166. mui.openWindow({url: 'order_list.html'})
  167. });
  168. mui('body').on('tap', '.go_xiaxian_list', function () {
  169. mui.openWindow({url: base_path + '/agentWechat/agentNext'})
  170. });
  171. mui('body').on('tap', '.go_tixian_apply', function () {
  172. mui.openWindow({url: base_path + '/withdraw/index'})
  173. });
  174. mui('body').on('tap', '.go_tixian_cash', function () {
  175. mui.openWindow({url: base_path + '/withdraw/cash'})
  176. });
  177. mui('body').on('tap', '.go_daili_2wm', function () {
  178. mui.openWindow({url: base_path + '/member/showQrcode'})
  179. });
  180. mui('body').on('tap', '.go_cash_log', function () {
  181. mui.openWindow({url: base_path + '/cashWechat/log'})
  182. });
  183. mui('body').on('tap', '.go_jifen_log', function () {
  184. mui.openWindow({url: base_path + '/integralWechat/log'})
  185. });
  186. mui('body').on('tap', '.go_jifen_guize', function () {
  187. mui.openWindow({url: base_path + '/integralWechat/integralRule'})
  188. });
  189. mui('body').on('tap', '.go_tixian_log', function () {
  190. mui.openWindow({url: base_path + '/integralWechat/withdrawLog'})
  191. });
  192. mui('body').on('tap', '.go_tixian_cash_log', function () {
  193. mui.openWindow({url: base_path + '/agentWechat/withdrawCashLog'})
  194. });
  195. mui('body').on('tap', '.show_post_info', function () {
  196. var urlStr = document.domain;
  197. mui.openWindow({url: '//m.kuaidi100.com/index_all.html?type=' + this.getAttribute("postFirm") + '&postid=' + this.getAttribute("postNum") + '&callbackurl=//' + urlStr + this.getAttribute("gourl") + "&tiemstamp=" + new Date().getTime()})
  198. });
  199. mui('body').on('tap', '.go_fenxiao_tixian_apply', function () {
  200. mui.openWindow({url: base_path + '/drp/withdrawalsPage?openid='})
  201. });
  202. mui('body').on('tap', '.go_fenxiao_tixian_log', function () {
  203. mui.openWindow({url: base_path + '/drp/withdrawalsList'})
  204. });
  205. mui('body').on('tap', '.fenxiao_vip', function () {
  206. mui.openWindow({url: base_path + '/drp/rulePage'})
  207. });
  208. mui('body').on('tap', '.to-up-img', function () {
  209. mui.openWindow({url: base_path + '/sharePage/upShare?userType=1'})
  210. });
  211. mui('body').on('tap', '.fenxiao_info', function () {
  212. mui.openWindow({url: base_path + '/drp/placeInfo_detail'})
  213. });
  214. mui('body').on('tap', '.go_luck_draw', function () {
  215. mui.openWindow({url: base_path + '/activity/go_luck_draw?orderId=' + this.getAttribute("value")})
  216. });
  217. mui('body').on('tap', '.go_prize_log', function () {
  218. mui.openWindow({url: base_path + '/activity/go_prize_log?gameId=' + this.getAttribute("value")})
  219. });
  220. function errorfn(xhr) {
  221. if (xhr.readyState == 4 && xhr.status == 200) {
  222. } else {
  223. var ref = location.href.split("#")[0], src = '';
  224. if (ref.indexOf('?') != -1) {
  225. src = ref + "&date=" + new Date().getTime()
  226. } else {
  227. src = ref + "?date=" + new Date().getTime()
  228. }
  229. location.href = src;
  230. return
  231. }
  232. }
  233. function CheckImgExists(imgurl) {
  234. var ImgObj = new Image();
  235. ImgObj.src = imgurl;
  236. if (ImgObj.fileSize > 0 || (ImgObj.width > 0 && ImgObj.height > 0)) {
  237. return ImgObj
  238. } else {
  239. return false
  240. }
  241. };function gotoTop(acceleration, stime) {
  242. acceleration = acceleration || 0.1;
  243. stime = stime || 10;
  244. var x1 = 0, y1 = 0, x2 = 0, y2 = 0, x3 = 0, y3 = 0;
  245. if (document.documentElement) {
  246. x1 = document.documentElement.scrollLeft || 0;
  247. y1 = document.documentElement.scrollTop || 0
  248. }
  249. if (document.body) {
  250. x2 = document.body.scrollLeft || 0;
  251. y2 = document.body.scrollTop || 0
  252. }
  253. var x3 = window.scrollX || 0;
  254. var y3 = window.scrollY || 0;
  255. var x = Math.max(x1, Math.max(x2, x3));
  256. var y = Math.max(y1, Math.max(y2, y3));
  257. var speeding = 1 + acceleration;
  258. window.scrollTo(Math.floor(x / speeding), Math.floor(y / speeding));
  259. if (x > 0 || y > 0) {
  260. var run = "gotoTop(" + acceleration + ", " + stime + ")";
  261. window.setTimeout(run, stime)
  262. }
  263. };function accDiv(arg1, arg2) {
  264. var t1 = 0, t2 = 0, r1, r2;
  265. try {
  266. t1 = arg1.toString().split(".")[1].length
  267. } catch (e) {
  268. }
  269. try {
  270. t2 = arg2.toString().split(".")[1].length
  271. } catch (e) {
  272. }
  273. with (Math) {
  274. r1 = Number(arg1.toString().replace(".", ""));
  275. r2 = Number(arg2.toString().replace(".", ""));
  276. return (r1 / r2) * pow(10, t2 - t1)
  277. }
  278. };Number.prototype.div = function (arg) {
  279. return accDiv(this, arg)
  280. };
  281. function accAdd(arg1, arg2) {
  282. var r1, r2, m, c;
  283. try {
  284. r1 = arg1.toString().split(".")[1].length
  285. } catch (e) {
  286. r1 = 0
  287. }
  288. try {
  289. r2 = arg2.toString().split(".")[1].length
  290. } catch (e) {
  291. r2 = 0
  292. }
  293. c = Math.abs(r1 - r2);
  294. m = Math.pow(10, Math.max(r1, r2));
  295. if (c > 0) {
  296. var cm = Math.pow(10, c);
  297. if (r1 > r2) {
  298. arg1 = Number(arg1.toString().replace(".", ""));
  299. arg2 = Number(arg2.toString().replace(".", "")) * cm
  300. } else {
  301. arg1 = Number(arg1.toString().replace(".", "")) * cm;
  302. arg2 = Number(arg2.toString().replace(".", ""))
  303. }
  304. } else {
  305. arg1 = Number(arg1.toString().replace(".", ""));
  306. arg2 = Number(arg2.toString().replace(".", ""))
  307. }
  308. return (arg1 + arg2) / m
  309. };Number.prototype.add = function (arg) {
  310. return accAdd(arg, this)
  311. };
  312. function accSub(arg1, arg2) {
  313. var r1, r2, m, n;
  314. try {
  315. r1 = arg1.toString().split(".")[1].length
  316. } catch (e) {
  317. r1 = 0
  318. }
  319. try {
  320. r2 = arg2.toString().split(".")[1].length
  321. } catch (e) {
  322. r2 = 0
  323. }
  324. m = Math.pow(10, Math.max(r1, r2));
  325. n = (r1 >= r2) ? r1 : r2;
  326. return ((arg1 * m - arg2 * m) / m).toFixed(n)
  327. };Number.prototype.sub = function (arg) {
  328. return accMul(arg, this)
  329. };
  330. function accMul(arg1, arg2) {
  331. var m = 0, s1 = arg1.toString(), s2 = arg2.toString();
  332. try {
  333. m += s1.split(".")[1].length
  334. } catch (e) {
  335. }
  336. try {
  337. m += s2.split(".")[1].length
  338. } catch (e) {
  339. }
  340. return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m)
  341. };Number.prototype.mul = function (arg) {
  342. return accMul(arg, this)
  343. };
  344. function switchcolor(color) {
  345. var pro_color = "";
  346. switch (color) {
  347. case 1:
  348. pro_color = "品蓝";
  349. break;
  350. case 2:
  351. pro_color = "品黑";
  352. break;
  353. case 3:
  354. pro_color = "苹果绿";
  355. break;
  356. case 4:
  357. pro_color = "西瓜红";
  358. break;
  359. case 5:
  360. pro_color = "白色";
  361. break;
  362. default:
  363. pro_color = "品蓝";
  364. break
  365. }
  366. return pro_color
  367. };function getParam(paramName) {
  368. paramValue = "", isFound = !1;
  369. if (this.location.search.indexOf("?") == 0 && this.location.search.indexOf("=") > 1) {
  370. arrSource = unescape(this.location.search).substring(1, this.location.search.length).split("&"), i = 0;
  371. while (i < arrSource.length && !isFound) {
  372. arrSource[i].indexOf("=") > 0 && arrSource[i].split("=")[0].toLowerCase() == paramName.toLowerCase() && (paramValue = arrSource[i].split("=")[1], isFound = !0), i++
  373. }
  374. }
  375. return paramValue == "" && (paramValue = null), paramValue
  376. };function dc(objectid) {
  377. if (document.getElementById && document.getElementById(objectid)) {
  378. return document.getElementById(objectid)
  379. } else if (document.all && document.all(objectid)) {
  380. return document.all(objectid)
  381. } else if (document.layers && document.layers[objectid]) {
  382. return document.layers[objectid]
  383. } else {
  384. return false
  385. }
  386. };function formatDate(now) {
  387. now = new Date(now);
  388. var year = now.getFullYear();
  389. var month = now.getMonth() + 1;
  390. var date = now.getDate();
  391. var hour = now.getHours();
  392. var minute = now.getMinutes();
  393. var second = now.getSeconds();
  394. return year + "-" + month + "-" + date + " " + hour + ":" + minute + ":" + second
  395. };