123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383 |
- <?php
- // 获取传递的ID
- $id = $_GET['id'];
- $channel = $_GET['channel_id'];
- include_once("./untils/conn.php");// 引入数据库连接配置文件
- // $sql = "select * from list"; // 查询语句
- // // $sql = "SELECT * FROM list WHERE id = $id";
- // $result = mysqli_query($con, $sql); // 执行查询
- // $row = mysqli_fetch_assoc($result);
- // $zhutu = $row["zhutu"];
- // $link = $row["link"];
- // $goods =$row["name"]
- // echo "传回来的ID是:" . $id;
- // 使用准备语句防止 SQL 注入攻击
- // 查询与传递的id相匹配的数据
- $sql = "SELECT * FROM list WHERE id =".$id;
- $result = mysqli_query($con, $sql);
-
-
- if ($result->num_rows > 0) {
- // 输出数据
- while($row = $result->fetch_assoc()) {
- // 获取每个字段的值
- $zhutu = $row["zhutu"];
- $goods = $row["name"];
- $link = $row["link"];
- // 使用 <p> 标签渲染信息
- // echo "<p>主图: ".$zhutu."<br>名称: ".$name."<br>链接: ".$link."</p>";
- }
- } else {
- echo "<script>alert('商品不存在'); setTimeout(function() { window.location.href = '../index.php'; }, 1000);</script>";
- exit;
- }
-
-
- // $sql = "SELECT * FROM oder WHERE uid = $uid";
- // $result = mysqli_query($con, $sql);
- $time = time();
- $heder = 'KJKJ';
- $prefix = date("Ymd"); // 获取当前日期,例如20220101
- $oderid = $heder . $prefix . rand(100000, 999999); // 生成6位随机数作为订单号后缀
- // echo $oderid;
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>申请号卡</title>
- <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport" />
- <meta content="yes" name="apple-mobile-web-app-capable" />
- <meta content="black" name="apple-mobile-web-app-status-bar-style" />
- <meta content="telephone=no" name="format-detection" />
- <META HTTP-EQUIV="pragma" CONTENT="no-cache">
- <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
- <META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
- <META HTTP-EQUIV="expires" CONTENT="0">
- <link rel="stylesheet" href="./other/index.css?v=2022" />
- <style>
- img {
- max-width: 100%;
- height: auto;
- display: block;
- margin: auto;
- }
-
- input[type="checkbox"]:checked {
- background-color: #2F7AFA;
- border-color: #2F7AFA;
- }
-
- label {
- margin-left:2px ;
- font-size: 12px;
- display: flex;
- align-items: center;
- }
-
- label p {
- margin: 0 0px 5px 5px;
- }
-
- label a {
- color: #2F7AFA;
- text-decoration: none;
- }
- </style>
- </head>
- <body>
- <div id="app">
- <!--<van-nav-bar title="申请号卡">-->
-
- <!--</van-nav-bar>-->
- <img style="width:100%" src="<?php echo $zhutu; ?>" alt="">
-
- <?php
- $sqlpz = "SELECT * FROM kefu";
- $resultpz = mysqli_query($con, $sqlpz);
-
-
- if ($resultpz->num_rows > 0) {
- // 输出数据
- while($rowpz = $resultpz->fetch_assoc()) {
- // 获取每个字段的值
- $color = $rowpz["link_color"];
- echo '<div class="fu" style="background: ' . $color . ';">';
-
- }
- } else {
- // echo "未找到匹配的记录";
- }
-
- ?>
- <div class="zi" style="background:#fff;width:90%;margin-left:5%;border-radius: 12px;height:480px;">
- <van-divider style="font-size: 11px;color: #2F7AFA;float: left;">根据国家实名制要求,请准确提供申办人身份证信息。</van-divider>
-
- <van-form @submit="onSubmit" style=" width:90%;margin-left:5%;">
- <van-field type="text" id="goods" name="goods" label="套餐名称" value="<?php echo $goods; ?>"></van-field>
- <van-field style="display: none;" type="hidden" id="oderid" name="oderid" value="<?php echo $oderid; ?>"></van-field>
- <van-field style="display: none;" type="hidden" id="time" name="time" value="<?php echo $time; ?>"></van-field>
- <van-field style="display: none;" type="hidden" id="channel" name="channel" value="<?php echo $channel; ?>"></van-field>
- <van-field v-model="userinfo.username" name="username" label="姓名" placeholder="请输入姓名"></van-field>
- <van-field v-model="userinfo.useridno" name="useridno" label="身份证" placeholder="请输入身份证"></van-field>
- <van-field v-model="userinfo.phone" name="phone" label="电话" placeholder="请输入电话"></van-field>
- <!--<van-field v-model="userinfo.oidcard" name="oidcard" label="旧卡" placeholder="请输入旧卡"></van-field>-->
- <van-divider style="font-size: 11px;color: #2F7AFA;float: left;">请填写配送地址(支持全国配送,地址不详细不发货)</van-divider>
- <van-field readonly clickable name="distribution" :value="userinfo.distribution" label="配送地区"
- placeholder="请选择省市地区" @click="showArea = true"></van-field>
- <van-popup v-model="showArea" position="bottom">
- <van-area :area-list="areaList" :columns-placeholder="['请选择', '请选择', '请选择']" @confirm="onConfirm"
- @cancel="showArea = false"></van-area>
- </van-popup>
- <van-field v-model="userinfo.address" name="address" label="详细地址" placeholder="街道/小区/门牌号"></van-field>
-
- <!-- 隐藏订单编号的输入框 -->
- <input type="hidden" name="oderid" value="<?php echo $oderid; ?>">
-
- <div style="margin: 16px;margin-bottom: 10px;">
- <van-button round block type="info" :loading="disabled1" native-type="submit">
- 提交
- </van-button>
- </div>
- </van-form>
- <label >
- <p>提交信息代表您已经阅读并同意<a href="./ruwang.html" >《入网协议》</a>和<a href="./xieyi.html">《用户信息收集协议》</a></p>
- </label>
- </div>
-
- </div>
- <img style="width:100%" src="<?php echo $link; ?>" alt="">
- </body>
-
- <script src="/vue/vue2.min.js"></script>
- <script src="/vue/vant2.min.js"></script>
- <!-- 引入组件库 -->
- <script src="/other/js/jquery.min.js"></script>
- <script src="/other/js/jquery.cookie.js"></script>
- <script src="/other/js/galogr.js?v=222"></script>
- <script type="text/javascript">
- new Vue({
- el: '#app',
- filters: {
- ellipsis(value) {
- if (!value) return ''
- if (value.length > 8) {
- return value.slice(0, 8) + '...'
- }
- return value
- },
- time: function time(value) {
- var now = new Date(value * 1000);
- y = now.getFullYear();
- m = now.getMonth() + 1;
- d = now.getDate();
- return y + "-" + (m < 10 ? "0" + m : m) + "-" + (d < 10 ? "0" + d : d) + " " + now.toTimeString().substr(0, 8);
- },
- delcnes(value) {
- var reg = /[\u4E00-\u9FA5]/g;
- var result = value.replace(reg, '');
- return result;
- },
- originalprice(value) {
- return parseFloat(value) + 10;
- }
- },
- data() {
- return {
- disabled1: false,
- finished: false,
- refreshing: false,
- areaList: areaList, //配送地区
- showArea: false,//配送地区框是否显示
- userinfo: {
- distribution: '',//配送地区
- address: '',//详细地址
- username: '',//用户姓名
- useridno: '',//用户身份证
- phone: '',//联系号码
- // oidcard: ''//旧卡号码
- },
- distributionarea: {
- province: [],//省
- city: [],//市。
- area: [],//区
- },//配送地址码
- addresslist: {},
- };
- },
- created() {
- },
- methods: {
- //返回
- onClickLeft() {
- window.history.go(-1)
- },
- //联系客服
- // onClickRight() {
- // window.location.href = "../homepage/kefu.html";
- // },
- //校验表单
- validatefrom(values) {
- if (values.username == '' || values.username == null) {
- this.$toast('请输入姓名');
- return false;
- } else if (values.useridno == '' || values.useridno == null) {
- this.$toast('请输入身份证号');
- return false;
- } else if (this.verifyidcard(values.useridno) == false) {
- return false;
- } else if (values.phone == '' || values.phone == null) {
- this.$toast('请输入联系电话');
- return false;
- } else if (this.checkphone(values.phone) == false) {
- return false;
- } else if (values.distribution == '' || values.distribution == null) {
- this.$toast('请选择配送地区');
- return false;
- } else if (values.address == '' || values.address == null) {
- this.$toast('请输入详细地址');
- return false;
- } else {
- return true;
- }
- },
- //校验联系电话
- checkphone(value) {
- const reg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
- if (value == '' || value == undefined || value == null) {
- this.$toast('请输入电话号码');
- return false;
- } else {
- if ((!reg.test(value)) && value != '') {
- this.$toast('请输入正确电话号码');
- return false;
- } else {
- return true;
- }
- }
- },
- //验证身份证号码
- verifyidcard(idCard) {
- var flag = false;
- //15位和18位身份证号码的正则表达式
- 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])$)$/;
- //如果通过该验证,说明身份证格式正确,但准确性还需计算
- if (regIdCard.test(idCard)) {
- if (idCard.length == 18) {
- var idCardWi = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2); //将前17位加权因子保存在数组里
- var idCardY = new Array(1, 0, 10, 9, 8, 7, 6, 5, 4, 3, 2); //这是除以11后,可能产生的11位余数、验证码,也保存成数组
- var idCardWiSum = 0; //用来保存前17位各自乖以加权因子后的总和
- for (var i = 0; i < 17; i++) {
- idCardWiSum += idCard.substring(i, i + 1) * idCardWi[i];
- }
- var idCardMod = idCardWiSum % 11;//计算出校验码所在数组的位置
- var idCardLast = idCard.substring(17);//得到最后一位身份证号码
- //如果等于2,则说明校验码是10,身份证号码最后一位应该是X
- if (idCardMod == 2) {
- if (idCardLast == "X" || idCardLast == "x") {
- flag = true;
- } else {
- this.$toast('身份证最后一位输入错误');
- flag = false;
- }
- } else {
- //用计算出的验证码与最后一位身份证号码匹配,如果一致,说明通过,否则是无效的身份证号码
- if (idCardLast == idCardY[idCardMod]) {
- flag = true;
- } else {
- this.$toast('请输入正确身份证号码');
- flag = false;
- }
- }
- } else if (idCard.length == 15) {
- var id17 = idCard.substring(0, 6) + '19' + idCard.substring(6);
- var parityBit = getParityBit(id17);
- var tempIdCard = id17 + parityBit;
- flag = validateIdCard(tempIdCard);
- }
- } else {
- this.$toast('身份证号码有误,请重新输入');
- flag = false;
- }
- return flag;
- },
- //提交表单
- onSubmit(values) {
- if (this.validatefrom(values)) {
- var vm = this;
- $.ajax({
- type: "POST",
- dataType: "json",
- url: "./kzq/tjoder.php",
- data: {
- goods: values.goods,
- name: values.username,
- uid: values.useridno,
- phone: values.phone,
- sf: vm.addresslist[0].name,
- city: vm.addresslist[1].name,
- xian: vm.addresslist[2].name,
- dizhi: values.address,
- oderid: values.oderid,
- time: values.time,
- channel:values.channel,
-
- },
- success: function (data) {
- console.log(data);
- // 根据服务器返回的状态码弹出提示信息
- if(data.status === 0) {
- alert(data.msg);
- // 延迟1秒后跳转回上一页
- setTimeout(function(){
- history.go(-1);
- }, 1000);
- } else if(data.status === 1) {
- alert(data.msg);
- } else {
- alert(data.msg);
- history.back();
- }
- }
- });
- }
- },
- //选择配送地址
- onConfirm(values) {
- var vm = this;
- if (values[0]['name'] == '') {
- this.$toast('请选择省份');
- } else if (values[1]['name'] == '') {
- this.$toast('请选择市区');
- } else if (values[2]['name'] == '') {
- this.$toast('请选择区域');
- } else {
- this.userinfo.distribution = values[0]['name'] + '/' + values[1]['name'] + '/' + values[2]['name']
- this.showArea = false;
- this.addresslist = values;
- }
- },
- }
- });
- </script>
- </html>
|