one.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  1. <?php
  2. // 获取传递的ID
  3. $id = $_GET['id'];
  4. include_once("./untils/conn.php");// 引入数据库连接配置文件
  5. // 查询与传递的id相匹配的数据
  6. $sql = "SELECT * FROM list WHERE id =".$id;
  7. $result = mysqli_query($con, $sql);
  8. if ($result->num_rows > 0) {
  9. // 输出数据
  10. while($row = $result->fetch_assoc()) {
  11. // 获取每个字段的值
  12. $zhutu = $row["zhutu"];
  13. $goods = $row["name"];
  14. $link = $row["link"];
  15. $price =$row["price"];
  16. $state = $row["state"];
  17. $haokaid = $row['haokaid'];
  18. $apiType = $row['api_type'];
  19. $se_num = $row['se_num'];
  20. if ($state == 1) {
  21. // 商品已下架,弹窗提示并跳转到 index.php 页面
  22. echo "<script>alert('商品已下架'); window.location.href='index.php';</script>";
  23. exit;
  24. }
  25. }
  26. } else {
  27. echo "<script>alert('商品不存在'); setTimeout(function() { window.location.href = '../index.php'; }, 1000);</script>";
  28. exit;
  29. }
  30. // $sql = "SELECT * FROM oder WHERE uid = $uid";
  31. // $result = mysqli_query($con, $sql);
  32. $time = time();
  33. $heder = 'KJKJ';
  34. $prefix = date("Ymd"); // 获取当前日期,例如20220101
  35. $oderid = $heder . $prefix . rand(100000, 999999); // 生成6位随机数作为订单号后缀
  36. // echo $oderid;
  37. ?>
  38. <!DOCTYPE html>
  39. <html lang="en">
  40. <head>
  41. <meta charset="UTF-8">
  42. <title>申请号卡</title>
  43. <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport" />
  44. <meta content="yes" name="apple-mobile-web-app-capable" />
  45. <meta content="black" name="apple-mobile-web-app-status-bar-style" />
  46. <meta content="telephone=no" name="format-detection" />
  47. <META HTTP-EQUIV="pragma" CONTENT="no-cache">
  48. <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
  49. <META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
  50. <META HTTP-EQUIV="expires" CONTENT="0">
  51. <link rel="stylesheet" href="./other/index.css?v=2022" />
  52. <style>
  53. img {
  54. max-width: 100%;
  55. height: auto;
  56. display: block;
  57. margin: auto;
  58. }
  59. input[type="checkbox"]:checked {
  60. background-color: #2F7AFA;
  61. border-color: #2F7AFA;
  62. }
  63. label {
  64. margin-left:2px ;
  65. font-size: 12px;
  66. display: flex;
  67. align-items: center;
  68. }
  69. label p {
  70. margin: 0 0px 5px 5px;
  71. }
  72. label a {
  73. color: #2F7AFA;
  74. text-decoration: none;
  75. }
  76. .phone-numbers {
  77. display: flex;
  78. flex-wrap: wrap;
  79. justify-content: space-between;
  80. align-items: center;
  81. }
  82. .phone-number {
  83. width: 45%;
  84. margin-bottom: 10px;
  85. display: flex;
  86. justify-content: flex-start;
  87. align-items: center;
  88. padding: 5px;
  89. box-sizing: border-box;
  90. border: 1px solid #D6D6D6;
  91. border-radius: 10px;
  92. cursor: pointer;
  93. box-shadow: 1 3px 6px rgba(0, 0, 0, 0.93);
  94. /*box-shadow: 18px 22px 71px rgba(0, 0, 0, 0.93);*/
  95. }
  96. .phone-number span {
  97. margin-right: 10px;
  98. }
  99. .popup-content {
  100. padding: 16px;
  101. }
  102. .change-button {
  103. display: flex;
  104. justify-content: center;
  105. align-items: center;
  106. margin: 0 auto;
  107. height: 30px;
  108. width: 100px;
  109. border-radius: 10px;
  110. }
  111. .close-icon {
  112. position: absolute;
  113. top: 10px;
  114. right: 10px;
  115. font-size: 20px;
  116. cursor: pointer;
  117. }
  118. .red-label {
  119. color: red;
  120. }
  121. </style>
  122. </head>
  123. <body>
  124. <div id="app">
  125. <!--<van-nav-bar title="申请号卡">-->
  126. <!--</van-nav-bar>-->
  127. <img style="width:100%" src="<?php echo $zhutu; ?>" alt="">
  128. <?php
  129. $sqlpz = "SELECT * FROM kefu";
  130. $resultpz = mysqli_query($con, $sqlpz);
  131. if ($resultpz->num_rows > 0) {
  132. // 输出数据
  133. while($rowpz = $resultpz->fetch_assoc()) {
  134. // 获取每个字段的值
  135. $color = $rowpz["link_color"];
  136. echo '<div class="fu" style="background: ' . $color . ';">';
  137. }
  138. } else {
  139. // echo "未找到匹配的记录";
  140. }
  141. ?>
  142. <div class="zi" style="background:#fff;width:90%;margin-left:5%;border-radius: 12px;height:auto;">
  143. <van-popup v-model="showthirdphone" round style="width: 90%">
  144. <div class="popup-content">
  145. <van-search v-model="searchValue" placeholder="请输入需要的号码" @search="onSearch" show-action>
  146. <template #action>
  147. <div @click="onSearch(searchValue)">搜索</div>
  148. </template>
  149. </van-search>
  150. <h3>精品靓号限时免费领取</h3>
  151. <div class="phone-numbers">
  152. <div v-for="(number, index) in phoneNumbers" :key="index" class="phone-number" @click="selectNumber(number)">
  153. <span class="number">{{ number }}</span>
  154. <van-image
  155. width ="20px"
  156. height ="20px"
  157. src="img/ioc.png"
  158. />
  159. <!--<van-icon name="success" v-if="selectedNumber === number"></van-icon>-->
  160. </div>
  161. </div>
  162. <van-button plain type="primary" @click="fetchNewNumbers" class="change-button">换一批</van-button>
  163. <van-icon name="cross" class="close-icon" @click="showthirdphone = false"></van-icon>
  164. </div>
  165. </van-popup>
  166. <van-divider style="font-size: 11px;color: #2F7AFA;float: left;">根据国家实名制要求,请准确提供申办人身份证信息。</van-divider>
  167. <van-form @submit="onSubmit" style="width: 90%; margin-left: 5%;">
  168. <van-field type="text" id="goods" name="goods" label="套餐名称" value="<?php echo $goods; ?>"></van-field>
  169. <van-field style="display: none;" type="hidden" id="oderid" name="oderid" value="<?php echo $oderid; ?>"></van-field>
  170. <van-field style="display: none;" type="hidden" id="time" name="time" value="<?php echo $time; ?>"></van-field>
  171. <van-field style="display: none;" type="hidden" id="price" name="price" value="<?php echo $price; ?>"></van-field>
  172. <van-field v-model="userinfo.username" name="username" label="姓名" placeholder="请输入姓名"></van-field>
  173. <van-field v-model="userinfo.useridno" name="useridno" label="身份证" placeholder="请输入身份证"></van-field>
  174. <van-field v-model="userinfo.phone" name="phone" label="电话" placeholder="请输入电话"></van-field>
  175. <van-field
  176. readonly
  177. clickable
  178. name="thirdphone"
  179. :value="userinfo.thirdphone"
  180. label="办理号码"
  181. placeholder="点击选号"
  182. @click="loadPhoneList"
  183. class="red-label"
  184. v-if="seNum === 1"
  185. ></van-field>
  186. <van-divider style="font-size: 11px; color: #2F7AFA; float: left;">请填写配送地址(支持全国配送,地址不详细不发货)</van-divider>
  187. <van-field readonly clickable name="distribution" :value="userinfo.distribution" label="配送地区" placeholder="请选择省市地区" @click="showArea = true"></van-field>
  188. <van-popup v-model="showArea" position="bottom">
  189. <van-area :area-list="areaList" :columns-placeholder="['请选择', '请选择', '请选择']" @confirm="onConfirm" @cancel="showArea = false"></van-area>
  190. </van-popup>
  191. <van-field v-model="userinfo.address" name="address" label="详细地址" placeholder="街道/小区/门牌号"></van-field>
  192. <input type="hidden" name="oderid" value="<?php echo $oderid; ?>">
  193. <input type="hidden" name="haokaid" value="<?php echo $haokaid; ?>">
  194. <input type="hidden" name="apiType" value="<?php echo $apiType; ?>">
  195. <div style="margin: 16px; margin-bottom: 10px;">
  196. <van-button round block type="info" :loading="disabled1" native-type="submit">提交</van-button>
  197. </div>
  198. </van-form>
  199. <label >
  200. <p>提交信息代表您已经阅读并同意<a href="./ruwang.html" >《入网协议》</a>和<a href="./xieyi.html">《用户信息收集协议》</a></p>
  201. </label>
  202. </div>
  203. </div>
  204. <img style="width:100%;" src="<?php echo $link; ?>" alt="">
  205. </body>
  206. <script src="/vue/vue2.min.js"></script>
  207. <script src="/vue/vant2.min.js"></script>
  208. <!-- 引入组件库 -->
  209. <script src="/other/js/jquery.min.js"></script>
  210. <script src="/other/js/jquery.cookie.js"></script>
  211. <script src="/other/js/galogr.js?v=222"></script>
  212. <script type="text/javascript">
  213. new Vue({
  214. el: '#app',
  215. data() {
  216. return {
  217. showthirdphone: false,
  218. searchValue: '',
  219. phoneNumbers: [],
  220. selectedNumber: null,
  221. disabled1: false,
  222. finished: false,
  223. refreshing: false,
  224. areaList: areaList,
  225. showArea: false,
  226. seNum: <?php echo $se_num; ?>,
  227. userinfo: {
  228. distribution: '',
  229. address: '',
  230. username: '',
  231. useridno: '',
  232. phone: '',
  233. thirdphone: ''
  234. },
  235. addresslist: {},
  236. searchValue: ''
  237. };
  238. },
  239. created() {},
  240. methods: {
  241. loadPhoneList(){
  242. this.showthirdphone = true;
  243. this.fetchNewNumbers();
  244. },
  245. onClickLeft() {
  246. window.history.go(-1);
  247. },
  248. onSearch(value) {
  249. // 搜索逻辑
  250. this.fetchNewNumbers(value)
  251. },
  252. fetchNewNumbers(val) {
  253. var vm = this;
  254. $.ajax({
  255. url: 'api/open/Router.php',
  256. method: 'POST',
  257. data: {
  258. searchValue: this.searchValue,
  259. haokaid: $('input[name="haokaid"]').val(),
  260. apiType: $('input[name="apiType"]').val(),
  261. },
  262. success: function(response) {
  263. vm.phoneNumbers = response.data;
  264. },
  265. error: function(error) {
  266. console.error(error);
  267. },
  268. });
  269. },
  270. mounted() {
  271. this.fetchNewNumbers();
  272. },
  273. selectNumber(number) {
  274. this.userinfo.thirdphone = number;
  275. this.showthirdphone = false;
  276. },
  277. //校验表单
  278. validatefrom(values) {
  279. if (values.username == '' || values.username == null) {
  280. this.$toast('请输入姓名');
  281. return false;
  282. } else if (values.useridno == '' || values.useridno == null) {
  283. this.$toast('请输入身份证号');
  284. return false;
  285. } else if (this.verifyidcard(values.useridno) == false) {
  286. return false;
  287. } else if (values.phone == '' || values.phone == null) {
  288. this.$toast('请输入联系电话');
  289. return false;
  290. } else if (this.checkphone(values.phone) == false) {
  291. return false;
  292. } else if (values.distribution == '' || values.distribution == null) {
  293. this.$toast('请选择配送地区');
  294. return false;
  295. } else if (values.address == '' || values.address == null) {
  296. this.$toast('请输入详细地址');
  297. return false;
  298. } else {
  299. return true;
  300. }
  301. },
  302. //校验联系电话
  303. checkphone(value) {
  304. const reg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
  305. if (value == '' || value == undefined || value == null) {
  306. this.$toast('请输入电话号码');
  307. return false;
  308. } else {
  309. if ((!reg.test(value)) && value != '') {
  310. this.$toast('请输入正确电话号码');
  311. return false;
  312. } else {
  313. return true;
  314. }
  315. }
  316. },
  317. //验证身份证号码
  318. verifyidcard(idCard) {
  319. var flag = false;
  320. //15位和18位身份证号码的正则表达式
  321. 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])$)$/;
  322. //如果通过该验证,说明身份证格式正确,但准确性还需计算
  323. if (regIdCard.test(idCard)) {
  324. if (idCard.length == 18) {
  325. var idCardWi = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2); //将前17位加权因子保存在数组里
  326. var idCardY = new Array(1, 0, 10, 9, 8, 7, 6, 5, 4, 3, 2); //这是除以11后,可能产生的11位余数、验证码,也保存成数组
  327. var idCardWiSum = 0; //用来保存前17位各自乖以加权因子后的总和
  328. for (var i = 0; i < 17; i++) {
  329. idCardWiSum += idCard.substring(i, i + 1) * idCardWi[i];
  330. }
  331. var idCardMod = idCardWiSum % 11; //计算出校验码所在数组的位置
  332. var idCardLast = idCard.substring(17); //得到最后一位身份证号码
  333. //如果等于2,则说明校验码是10,身份证号码最后一位应该是X
  334. if (idCardMod == 2) {
  335. if (idCardLast == "X" || idCardLast == "x") {
  336. flag = true;
  337. } else {
  338. this.$toast('身份证最后一位输入错误');
  339. flag = false;
  340. }
  341. } else {
  342. //用计算出的验证码与最后一位身份证号码匹配,如果一致,说明通过,否则是无效的身份证号码
  343. if (idCardLast == idCardY[idCardMod]) {
  344. flag = true;
  345. } else {
  346. this.$toast('请输入正确身份证号码');
  347. flag = false;
  348. }
  349. }
  350. } else if (idCard.length == 15) {
  351. var id17 = idCard.substring(0, 6) + '19' + idCard.substring(6);
  352. var parityBit = getParityBit(id17);
  353. var tempIdCard = id17 + parityBit;
  354. flag = validateIdCard(tempIdCard);
  355. }
  356. } else {
  357. this.$toast('身份证号码有误,请重新输入');
  358. flag = false;
  359. }
  360. return flag;
  361. },
  362. //提交表单
  363. onSubmit(values) {
  364. if (this.validatefrom(values)) {
  365. var vm = this;
  366. $.ajax({
  367. type: "POST",
  368. dataType: "json",
  369. url: "kzq/Router.php",
  370. data: {
  371. goods: values.goods,
  372. name: values.username,
  373. uid: values.useridno,
  374. phone: values.phone,
  375. sf: vm.addresslist[0].name,
  376. city: vm.addresslist[1].name,
  377. xian: vm.addresslist[2].name,
  378. dizhi: values.address,
  379. oderid: values.oderid,
  380. time: values.time,
  381. price: values.price,
  382. thirdphone: $('input[name="thirdphone"]').val(),
  383. apiType: $('input[name="apiType"]').val()
  384. },
  385. success: function (data) {
  386. console.log(data);
  387. // 根据服务器返回的状态码弹出提示信息
  388. if (data.status === 0) {
  389. alert(data.msg);
  390. // 延迟1秒后跳转回上一页
  391. setTimeout(function () {
  392. history.go(-1);
  393. }, 1000);
  394. } else if (data.status === 1) {
  395. alert(data.msg);
  396. } else {
  397. alert(data.msg);
  398. history.back();
  399. }
  400. }
  401. });
  402. }
  403. },
  404. //选择配送地址
  405. onConfirm(values) {
  406. var vm = this;
  407. if (values[0]['name'] == '') {
  408. this.$toast('请选择省份');
  409. } else if (values[1]['name'] == '') {
  410. this.$toast('请选择市区');
  411. } else if (values[2]['name'] == '') {
  412. this.$toast('请选择区域');
  413. } else {
  414. this.userinfo.distribution = values[0]['name'] + '/' + values[1]['name'] + '/' + values[2]['name']
  415. this.showArea = false;
  416. this.addresslist = values;
  417. }
  418. },
  419. },
  420. });
  421. </script>
  422. </html>