「已注销」 2019-04-11 19:55
浏览 1644

IE浏览器下直接报错SCRIPT1002: 语法错误 index.html, 行420 字符2 其他浏览器无任何错误

我用的的单独vue.js文件 其他的浏览器没有任何影响 请问一下各位 这是哪里不正确,百度也查了 改一个地方其他的地方又给你一个错 改着后面谷歌之类的浏览器都用不了了,

const BASE_URL = '/admin.php/pay/'; const USERID = '142'; const app = new Vue({ el: '#app', data: { product_type: 1, level: 1, grades: [], products: [], choose_product: null, choose_prodouct_id: null, time: 5, name: null, address: null, phone: null, note: '', delivery: 0, pay: 'wechatpay', title: '提示', content: '内容', number: 1, timer: null, order_id: null, shunfeng: 15 }, computed: { product_select_class() { return function(type) { return this.product_type == type ? 'select-class select-hover' : 'select-class'; } }, level_select_class() { return function(level) { return this.level == level ? 'insurance-select select-hover' : 'insurance-select'; } }, time_select_class() { return function(time) { return this.time == time ? 'insurance-select select-hover' : 'insurance-select'; } }, delivery_select_class() { return function(delivery) { return this.delivery == delivery ? 'insurance-select select-hover' : 'insurance-select'; } }, pay_btn_select_class() { return function(pay) { if (pay === 'wechatpay') { return this.pay === pay ? 'btn-wechatpay pay_type_active' : 'btn-alipay'; } else if (pay === 'alipay') { return this.pay === pay ? 'btn-alipay pay_type_active' : 'btn-wechatpay'; } } }, pay_check_select_class() { return function(pay) { if (pay === 'wechatpay') { return this.pay === pay ? 'pay_type_wechatcheck pay_type_wchecked' : 'pay_type_alipaycheck'; } else if (pay === 'alipay') { return this.pay === pay ? 'pay_type_alipaycheck pay_type_achecked' : 'pay_type_wechatcheck'; } } }, prodouct_select_class() { return function(prodouct) { return this.choose_prodouct_id == prodouct ? 'insurance-select select-hover' : 'insurance-select'; } }, has_level() { if (this.product_type == 1 || this.product_type == 6) { return true; } return false; }, totalPrice() { return (price) => { let outher = this.delivery == 1 ? this.shunfeng : 0; return parseFloat(parseFloat((price * this.number) + (outher * this.number)).toFixed(2)); } } }, created() { this.fetchData(); }, methods: { fetchData() { this.fetchGrades(); this.fetchProduct(); }, reduce() { if (this.number > 1) { this.number --; } }, add() { this.number ++; }, async fetchGrades() { this.grades = await this.getNormal(BASE_URL + 'grades'); }, async fetchProduct() { let url = BASE_URL + 'products'; switch(Number(this.product_type)) { case 1: this.products = await this.getNormal(url, {type: this.product_type, grade: this.level, time: this.time}); break; case 4: this.products = await this.getNormal(url, {type: this.product_type}); break; case 3: this.products = await this.getNormal(url, {type: this.product_type}); break; case 6: this.products = await this.getNormal(url, {type: this.product_type, grade: this.level}); break; } }, async getNormal(url, params = null, method="GET", data=null) { if (params) { let paramsArray = []; Object.keys(params).forEach(key => paramsArray.push(key + '=' + params[key])); if (url.search(/\?/) === -1) { url += '?' + paramsArray.join('&'); } else { url += '&' + paramsArray.join('&'); } } return new Promise((resolve, reject) => { $.ajax({ type: method, url: url, dataType: 'json', data: data, success: (response) => { resolve(response) } }) }); }, async choose_level(grade) { this.level = grade; this.clean_choose_product(); await this.fetchProduct(); }, async choose_time(time) { this.time = time; this.clean_choose_product(); await this.fetchProduct(); }, async choose_product_type(type) { this.product_type = type; this.clean_choose_product(); await this.fetchProduct(); }, choose_delivery(delivery) { this.delivery = delivery; }, choose_pay(pay) { this.pay = pay; }, choose_product_func(product) { this.choose_product = { 'id': product.id, 'name': product.name, 'price': product.price, } this.choose_prodouct_id = product.id; }, clean_choose_product() { this.choose_prodouct_id = null; this.choose_product = null; }, async confirm() { if (!this.choose_product) { return this.openTip("请选择产品!", "提示: "); } const numberReg = /^[0-9]*$/ let pay = this.pay === 'wechatpay' ? 'weixin' : 'zhifubaoweixin'; // let formData = new FormData(); let url = BASE_URL + 'production'; let data = { 'userid': USERID, 'value': this.choose_product.id, 'pay': pay, } // formData.append('userid', USERID); // formData.append('value', this.choose_product.id); // formData.append('pay', pay); if (this.product_type == 4) { if (!this.name) { return this.openTip('请填写收货人姓名!'); } if (!this.phone) { return this.openTip('请填写联系电话!'); } if (!this.address) { return this.openTip('请填写收货地址!'); } if (!numberReg.test(this.number)) { return this.openTip('请输入正确的数量!'); } if (this.number < 1) { return this.openTip('购买数量必须大于1!'); } if (this.delivery == null) { return this.openTip('请选择快递类型!'); } data.name = this.name; data.phone = this.phone; data.address = this.address; data.note = this.note; data.number = this.number; data.courier = this.delivery; // formData.append('name', this.name); // formData.append('phone', this.phone); // formData.append('address', this.address); // formData.append('note', this.note); // formData.append('number', this.number); // formData.append('courier', this.delivery); } // 发送POST请求 let response = await this.getNormal(url, {type: 2}, 'POST', data); if (response.code === 'error') { return this.openTip(response.msg) } // 展示二维码 let title = pay === 'weixin' ? '请使用微信扫一扫付款' : '请使用支付宝扫一扫付款' this.openTip('', title); $('#qrcode').html(''); $('#qrcode').qrcode(response.msg); this.order_id = response.order_id; // 设置定时器请求后台接口 this.timer = setInterval(this.order_status, 1000 * 3); }, async order_status() { url = BASE_URL + 'status'; response = await this.getNormal(url, {order_id: this.order_id}); if (response.status == 1) { this.title = '付款成功, 即将跳装到购买记录页面!'; clearInterval(this.timer); setTimeout(function() { window.location.href = '/admin.php/pay/record'; }, 3000); } }, openTip(content='', title='提示') { this.title = title; this.content = content; $('#myModal').modal({ keyboard: false }); }, closeTip() { this.title = ''; this.content = ''; $('#myModal').modal('hide'); clearInterval(this.timer); } } });
  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥50 易语言把MYSQL数据库中的数据添加至组合框
    • ¥20 求数据集和代码#有偿答复
    • ¥15 关于下拉菜单选项关联的问题
    • ¥20 java-OJ-健康体检
    • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
    • ¥15 使用phpstudy在云服务器上搭建个人网站
    • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
    • ¥15 vue3+express部署到nginx
    • ¥20 搭建pt1000三线制高精度测温电路
    • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况