one.php 20 KB

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