links.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. <?php
  2. // 获取传递的ID
  3. $id = $_GET['id'];
  4. $channel = $_GET['channel_id'];
  5. include_once("./untils/conn.php");// 引入数据库连接配置文件
  6. // $sql = "select * from list"; // 查询语句
  7. // // $sql = "SELECT * FROM list WHERE id = $id";
  8. // $result = mysqli_query($con, $sql); // 执行查询
  9. // $row = mysqli_fetch_assoc($result);
  10. // $zhutu = $row["zhutu"];
  11. // $link = $row["link"];
  12. // $goods =$row["name"]
  13. // echo "传回来的ID是:" . $id;
  14. // 使用准备语句防止 SQL 注入攻击
  15. // 查询与传递的id相匹配的数据
  16. $sql = "SELECT * FROM list WHERE id =".$id;
  17. $result = mysqli_query($con, $sql);
  18. if ($result->num_rows > 0) {
  19. // 输出数据
  20. while($row = $result->fetch_assoc()) {
  21. // 获取每个字段的值
  22. $zhutu = $row["zhutu"];
  23. $goods = $row["name"];
  24. $link = $row["link"];
  25. // 使用 <p> 标签渲染信息
  26. // echo "<p>主图: ".$zhutu."<br>名称: ".$name."<br>链接: ".$link."</p>";
  27. }
  28. } else {
  29. echo "<script>alert('商品不存在'); setTimeout(function() { window.location.href = '../index.php'; }, 1000);</script>";
  30. exit;
  31. }
  32. // $sql = "SELECT * FROM oder WHERE uid = $uid";
  33. // $result = mysqli_query($con, $sql);
  34. $time = time();
  35. $heder = 'KJKJ';
  36. $prefix = date("Ymd"); // 获取当前日期,例如20220101
  37. $oderid = $heder . $prefix . rand(100000, 999999); // 生成6位随机数作为订单号后缀
  38. // echo $oderid;
  39. ?>
  40. <!DOCTYPE html>
  41. <html lang="en">
  42. <head>
  43. <meta charset="UTF-8">
  44. <title>申请号卡</title>
  45. <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport" />
  46. <meta content="yes" name="apple-mobile-web-app-capable" />
  47. <meta content="black" name="apple-mobile-web-app-status-bar-style" />
  48. <meta content="telephone=no" name="format-detection" />
  49. <META HTTP-EQUIV="pragma" CONTENT="no-cache">
  50. <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
  51. <META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
  52. <META HTTP-EQUIV="expires" CONTENT="0">
  53. <link rel="stylesheet" href="./other/index.css?v=2022" />
  54. <style>
  55. img {
  56. max-width: 100%;
  57. height: auto;
  58. display: block;
  59. margin: auto;
  60. }
  61. input[type="checkbox"]:checked {
  62. background-color: #2F7AFA;
  63. border-color: #2F7AFA;
  64. }
  65. label {
  66. margin-left:2px ;
  67. font-size: 12px;
  68. display: flex;
  69. align-items: center;
  70. }
  71. label p {
  72. margin: 0 0px 5px 5px;
  73. }
  74. label a {
  75. color: #2F7AFA;
  76. text-decoration: none;
  77. }
  78. </style>
  79. </head>
  80. <body>
  81. <div id="app">
  82. <!--<van-nav-bar title="申请号卡">-->
  83. <!--</van-nav-bar>-->
  84. <img style="width:100%" src="<?php echo $zhutu; ?>" alt="">
  85. <?php
  86. $sqlpz = "SELECT * FROM kefu";
  87. $resultpz = mysqli_query($con, $sqlpz);
  88. if ($resultpz->num_rows > 0) {
  89. // 输出数据
  90. while($rowpz = $resultpz->fetch_assoc()) {
  91. // 获取每个字段的值
  92. $color = $rowpz["link_color"];
  93. echo '<div class="fu" style="background: ' . $color . ';">';
  94. }
  95. } else {
  96. // echo "未找到匹配的记录";
  97. }
  98. ?>
  99. <div class="zi" style="background:#fff;width:90%;margin-left:5%;border-radius: 12px;height:480px;">
  100. <van-divider style="font-size: 11px;color: #2F7AFA;float: left;">根据国家实名制要求,请准确提供申办人身份证信息。</van-divider>
  101. <van-form @submit="onSubmit" style=" width:90%;margin-left:5%;">
  102. <van-field type="text" id="goods" name="goods" label="套餐名称" value="<?php echo $goods; ?>"></van-field>
  103. <van-field style="display: none;" type="hidden" id="oderid" name="oderid" value="<?php echo $oderid; ?>"></van-field>
  104. <van-field style="display: none;" type="hidden" id="time" name="time" value="<?php echo $time; ?>"></van-field>
  105. <van-field style="display: none;" type="hidden" id="channel" name="channel" value="<?php echo $channel; ?>"></van-field>
  106. <van-field v-model="userinfo.username" name="username" label="姓名" placeholder="请输入姓名"></van-field>
  107. <van-field v-model="userinfo.useridno" name="useridno" label="身份证" placeholder="请输入身份证"></van-field>
  108. <van-field v-model="userinfo.phone" name="phone" label="电话" placeholder="请输入电话"></van-field>
  109. <!--<van-field v-model="userinfo.oidcard" name="oidcard" label="旧卡" placeholder="请输入旧卡"></van-field>-->
  110. <van-divider style="font-size: 11px;color: #2F7AFA;float: left;">请填写配送地址(支持全国配送,地址不详细不发货)</van-divider>
  111. <van-field readonly clickable name="distribution" :value="userinfo.distribution" label="配送地区"
  112. placeholder="请选择省市地区" @click="showArea = true"></van-field>
  113. <van-popup v-model="showArea" position="bottom">
  114. <van-area :area-list="areaList" :columns-placeholder="['请选择', '请选择', '请选择']" @confirm="onConfirm"
  115. @cancel="showArea = false"></van-area>
  116. </van-popup>
  117. <van-field v-model="userinfo.address" name="address" label="详细地址" placeholder="街道/小区/门牌号"></van-field>
  118. <!-- 隐藏订单编号的输入框 -->
  119. <input type="hidden" name="oderid" value="<?php echo $oderid; ?>">
  120. <div style="margin: 16px;margin-bottom: 10px;">
  121. <van-button round block type="info" :loading="disabled1" native-type="submit">
  122. 提交
  123. </van-button>
  124. </div>
  125. </van-form>
  126. <label >
  127. <p>提交信息代表您已经阅读并同意<a href="./ruwang.html" >《入网协议》</a>和<a href="./xieyi.html">《用户信息收集协议》</a></p>
  128. </label>
  129. </div>
  130. </div>
  131. <img style="width:100%" src="<?php echo $link; ?>" alt="">
  132. </body>
  133. <script src="/vue/vue2.min.js"></script>
  134. <script src="/vue/vant2.min.js"></script>
  135. <!-- 引入组件库 -->
  136. <script src="/other/js/jquery.min.js"></script>
  137. <script src="/other/js/jquery.cookie.js"></script>
  138. <script src="/other/js/galogr.js?v=222"></script>
  139. <script type="text/javascript">
  140. new Vue({
  141. el: '#app',
  142. filters: {
  143. ellipsis(value) {
  144. if (!value) return ''
  145. if (value.length > 8) {
  146. return value.slice(0, 8) + '...'
  147. }
  148. return value
  149. },
  150. time: function time(value) {
  151. var now = new Date(value * 1000);
  152. y = now.getFullYear();
  153. m = now.getMonth() + 1;
  154. d = now.getDate();
  155. return y + "-" + (m < 10 ? "0" + m : m) + "-" + (d < 10 ? "0" + d : d) + " " + now.toTimeString().substr(0, 8);
  156. },
  157. delcnes(value) {
  158. var reg = /[\u4E00-\u9FA5]/g;
  159. var result = value.replace(reg, '');
  160. return result;
  161. },
  162. originalprice(value) {
  163. return parseFloat(value) + 10;
  164. }
  165. },
  166. data() {
  167. return {
  168. disabled1: false,
  169. finished: false,
  170. refreshing: false,
  171. areaList: areaList, //配送地区
  172. showArea: false,//配送地区框是否显示
  173. userinfo: {
  174. distribution: '',//配送地区
  175. address: '',//详细地址
  176. username: '',//用户姓名
  177. useridno: '',//用户身份证
  178. phone: '',//联系号码
  179. // oidcard: ''//旧卡号码
  180. },
  181. distributionarea: {
  182. province: [],//省
  183. city: [],//市。
  184. area: [],//区
  185. },//配送地址码
  186. addresslist: {},
  187. };
  188. },
  189. created() {
  190. },
  191. methods: {
  192. //返回
  193. onClickLeft() {
  194. window.history.go(-1)
  195. },
  196. //联系客服
  197. // onClickRight() {
  198. // window.location.href = "../homepage/kefu.html";
  199. // },
  200. //校验表单
  201. validatefrom(values) {
  202. if (values.username == '' || values.username == null) {
  203. this.$toast('请输入姓名');
  204. return false;
  205. } else if (values.useridno == '' || values.useridno == null) {
  206. this.$toast('请输入身份证号');
  207. return false;
  208. } else if (this.verifyidcard(values.useridno) == false) {
  209. return false;
  210. } else if (values.phone == '' || values.phone == null) {
  211. this.$toast('请输入联系电话');
  212. return false;
  213. } else if (this.checkphone(values.phone) == false) {
  214. return false;
  215. } else if (values.distribution == '' || values.distribution == null) {
  216. this.$toast('请选择配送地区');
  217. return false;
  218. } else if (values.address == '' || values.address == null) {
  219. this.$toast('请输入详细地址');
  220. return false;
  221. } else {
  222. return true;
  223. }
  224. },
  225. //校验联系电话
  226. checkphone(value) {
  227. const reg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
  228. if (value == '' || value == undefined || value == null) {
  229. this.$toast('请输入电话号码');
  230. return false;
  231. } else {
  232. if ((!reg.test(value)) && value != '') {
  233. this.$toast('请输入正确电话号码');
  234. return false;
  235. } else {
  236. return true;
  237. }
  238. }
  239. },
  240. //验证身份证号码
  241. verifyidcard(idCard) {
  242. var flag = false;
  243. //15位和18位身份证号码的正则表达式
  244. var regIdCard = /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/;
  245. //如果通过该验证,说明身份证格式正确,但准确性还需计算
  246. if (regIdCard.test(idCard)) {
  247. if (idCard.length == 18) {
  248. var idCardWi = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2); //将前17位加权因子保存在数组里
  249. var idCardY = new Array(1, 0, 10, 9, 8, 7, 6, 5, 4, 3, 2); //这是除以11后,可能产生的11位余数、验证码,也保存成数组
  250. var idCardWiSum = 0; //用来保存前17位各自乖以加权因子后的总和
  251. for (var i = 0; i < 17; i++) {
  252. idCardWiSum += idCard.substring(i, i + 1) * idCardWi[i];
  253. }
  254. var idCardMod = idCardWiSum % 11;//计算出校验码所在数组的位置
  255. var idCardLast = idCard.substring(17);//得到最后一位身份证号码
  256. //如果等于2,则说明校验码是10,身份证号码最后一位应该是X
  257. if (idCardMod == 2) {
  258. if (idCardLast == "X" || idCardLast == "x") {
  259. flag = true;
  260. } else {
  261. this.$toast('身份证最后一位输入错误');
  262. flag = false;
  263. }
  264. } else {
  265. //用计算出的验证码与最后一位身份证号码匹配,如果一致,说明通过,否则是无效的身份证号码
  266. if (idCardLast == idCardY[idCardMod]) {
  267. flag = true;
  268. } else {
  269. this.$toast('请输入正确身份证号码');
  270. flag = false;
  271. }
  272. }
  273. } else if (idCard.length == 15) {
  274. var id17 = idCard.substring(0, 6) + '19' + idCard.substring(6);
  275. var parityBit = getParityBit(id17);
  276. var tempIdCard = id17 + parityBit;
  277. flag = validateIdCard(tempIdCard);
  278. }
  279. } else {
  280. this.$toast('身份证号码有误,请重新输入');
  281. flag = false;
  282. }
  283. return flag;
  284. },
  285. //提交表单
  286. onSubmit(values) {
  287. if (this.validatefrom(values)) {
  288. var vm = this;
  289. $.ajax({
  290. type: "POST",
  291. dataType: "json",
  292. url: "./kzq/tjoder.php",
  293. data: {
  294. goods: values.goods,
  295. name: values.username,
  296. uid: values.useridno,
  297. phone: values.phone,
  298. sf: vm.addresslist[0].name,
  299. city: vm.addresslist[1].name,
  300. xian: vm.addresslist[2].name,
  301. dizhi: values.address,
  302. oderid: values.oderid,
  303. time: values.time,
  304. channel:values.channel,
  305. },
  306. success: function (data) {
  307. console.log(data);
  308. // 根据服务器返回的状态码弹出提示信息
  309. if(data.status === 0) {
  310. alert(data.msg);
  311. // 延迟1秒后跳转回上一页
  312. setTimeout(function(){
  313. history.go(-1);
  314. }, 1000);
  315. } else if(data.status === 1) {
  316. alert(data.msg);
  317. } else {
  318. alert(data.msg);
  319. history.back();
  320. }
  321. }
  322. });
  323. }
  324. },
  325. //选择配送地址
  326. onConfirm(values) {
  327. var vm = this;
  328. if (values[0]['name'] == '') {
  329. this.$toast('请选择省份');
  330. } else if (values[1]['name'] == '') {
  331. this.$toast('请选择市区');
  332. } else if (values[2]['name'] == '') {
  333. this.$toast('请选择区域');
  334. } else {
  335. this.userinfo.distribution = values[0]['name'] + '/' + values[1]['name'] + '/' + values[2]['name']
  336. this.showArea = false;
  337. this.addresslist = values;
  338. }
  339. },
  340. }
  341. });
  342. </script>
  343. </html>