审查视图

public/themes/simpleboot3/portal/salesmangoods/salesman_goods_add.html 20.8 KB
anyv authored
1 2 3 4 5 6 7 8
<!DOCTYPE html>
<html lang="en">

<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>学考无忧-添加商品</title>
anyv authored
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
    <link rel="stylesheet" href="__TMPL__/public/assets/css//mui.min.css" />
    <link rel="stylesheet" href="__TMPL__/public/assets/css//mui.picker.min.css" />
    <link rel="stylesheet" href="__TMPL__/public/assets/css//reset.css" />
    <link rel="stylesheet" href="__TMPL__/public/assets/css//log.css" />
    <style>
        .log_six_add_photos{
            padding: 0.15rem 0.2rem;
            display: flex;
            justify-content: space-around;
            align-items: center;
        }
        .log_six_photo_ones{
            width: 1.6rem;
            height: 1.6rem;
        }
        .log_six_add_imgs{
            width: 100%;
            height:1.5rem;
        }
        .log_six_add_titles{
            display: none;
        }
        .log_six_pictyre_imgs{
            width: 1.6rem;
            height: 1.6rem;
        }
        .log_six_pictyre_titles{
            display: none;
        }
    </style>
anyv authored
39 40 41
</head>

<body>
anyv authored
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
<div class="tx_mask_tongyi">
    <div class="tx_maskCon_school">
        <div class="three_model_school">
            <div class="three_model_school_data" style="display: block;">
                <div class="three_model_school_name there_unActive">一年级</div>
                <div class="three_model_school_name">二年级</div>
                <div class="three_model_school_name">三年级</div>
                <div class="three_model_school_name">四年级</div>
                <div class="three_model_school_name">五年级</div>
                <div class="three_model_school_name">六年级</div>
                <div class="three_model_school_name">初一</div>
                <div class="three_model_school_name">初二</div>
                <div class="three_model_school_name">初三</div>
                <div class="three_model_school_name">高一</div>
                <div class="three_model_school_name">高二</div>
                <div class="three_model_school_name">高三</div>
            </div>
        </div>
    </div>
</div>
anyv authored
62 63 64 65 66 67 68 69 70 71 72
<div class="log_top_co">
    <!-- 顶部 -->
    <div class=" order_top log_top_co">
        <a href="javascript:history.back(-1)">
            <img src="__TMPL__/public/assets/images/left.png" alt="" />
        </a>
        <p>添加商品</p>
    </div>
</div>
<!-- 添加照片 -->
<div class="log_six_add_photo">
anyv authored
73 74 75 76 77 78 79 80 81 82
    <div class="log_six_photo_one">
        <div class="log_six_add_img">
            <img src="__TMPL__/public/assets/images/jiahao.png" id="show_img" alt="" />
        </div>
        <div class="log_six_add_title">
            添加照片
        </div>
        <div class="input_file">
            <input type="file" id="img1_file_img" name="avatar" />
        </div>
anyv authored
83
    </div>
anyv authored
84 85 86 87 88 89 90 91 92 93
    <div class="log_six_photo_one">
        <div class="log_six_add_img">
            <img src="__TMPL__/public/assets/images/jiahao.png" id="thumbnail" alt="" />
        </div>
        <div class="log_six_add_title">
            添加缩略图
        </div>
        <div class="input_file">
            <input type="file" id="img_file_suolue" name="avatar" />
        </div>
anyv authored
94
    </div>
anyv authored
95
anyv authored
96 97 98 99 100 101 102 103 104 105
</div>
<div class="log_six_wire"></div>
<!-- 输入框 -->
<div class="log_six_input">
    <div class="log_two_input">
        <div class="log_two_input_one ">
            <div class="log_two_input_title">
                书籍
            </div>
            <div class="log_two_input_contant">
anyv authored
106
                <input type="text" placeholder="请输入书籍名称" name="book_name" />
anyv authored
107 108 109 110 111 112 113
            </div>
        </div>
        <div class="log_two_input_one ">
            <div class="log_two_input_title">
                佣金
            </div>
            <div class="log_two_input_contant">
anyv authored
114
                <input type="text" placeholder="请输入下级推广佣金" name="money" />
anyv authored
115 116 117 118 119 120 121
            </div>
        </div>
        <div class="log_two_input_one">
            <div class="log_two_input_title">
                售价
            </div>
            <div class="log_two_input_contant">
anyv authored
122
                <input type="text" placeholder="输入售价" name="price" />
anyv authored
123 124 125 126 127 128 129
            </div>
        </div>
        <div class="log_two_input_one">
            <div class="log_two_input_title">
                定价
            </div>
            <div class="log_two_input_contant">
anyv authored
130
                <input type="text" placeholder="输入定价" name="pricing" />
anyv authored
131 132 133 134 135 136 137
            </div>
        </div>
        <div class="log_six_input_one">
            <div class="log_two_input_title" style="margin-top: 0.09rem;">
                商品说明
            </div>
            <div class="log_six_input_contant">
anyv authored
138
                <textarea cols="20" rows="3" placeholder="请输入商品说明" id="instr"></textarea>
anyv authored
139 140 141 142 143 144 145
            </div>
        </div>
        <div class="log_two_input_one">
            <div class="log_two_input_title">
                书号
            </div>
            <div class="log_two_input_contant">
anyv authored
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
                <input type="text" placeholder="请输入书号" name="book_number" />
            </div>
        </div>
        <div class="log_two_input_one">
            <div class="log_two_input_title">
                纸张
            </div>
            <div class="log_two_input_contant">
                <input type="text" placeholder="请输入纸张" name="paper" />
            </div>
        </div>
        <div class="log_two_input_one">
            <div class="log_two_input_title">
                装订
            </div>
            <div class="log_two_input_contant">
                <input type="text" placeholder="请输入装订" name="binding" />
            </div>
        </div>
        <div class="log_two_input_one">
            <div class="log_two_input_title">
                开本
            </div>
            <div class="log_two_input_contant">
                <input type="text" placeholder="请输入开本" name="book_size" />
            </div>
        </div>
        <div class="log_two_input_one">
            <div class="log_two_input_title">
                印刷
            </div>
            <div class="log_two_input_contant">
                <input type="text" placeholder="请输入印刷" name="printing" />
anyv authored
179 180 181 182 183 184 185
            </div>
        </div>
        <div class="log_two_input_one">
            <div class="log_two_input_title">
                作者
            </div>
            <div class="log_two_input_contant">
anyv authored
186
                <input type="text" placeholder="请输入作者名称" name="author" />
anyv authored
187 188 189 190 191 192 193
            </div>
        </div>
        <div class="log_two_input_one">
            <div class="log_two_input_title">
                出版社
            </div>
            <div class="log_two_input_contant">
anyv authored
194
                <input type="text" placeholder="请输入出版社名称" name="press" />
anyv authored
195 196 197 198 199 200 201
            </div>
        </div>
        <div class="log_two_input_one">
            <div class="log_two_input_title">
                出版时间
            </div>
            <div class="log_two_input_contant">
anyv authored
202
                <input type="text" placeholder="请输入作者名称" name="press_time" />
anyv authored
203 204 205 206 207 208 209 210
            </div>
        </div>
    </div>
</div>
<div class="log_six_wire"></div>
<!-- 套装 -->
<div class="log_six_select">
    <div class="log_six_select_contant">
anyv authored
211 212 213
        <div class="log_two_input_one">
            <div class="log_two_input_title">
                套装
anyv authored
214
            </div>
anyv authored
215 216
            <div class="log_two_input_contant">
                <input type="text" placeholder="请输入套装数量" name="suit" />
anyv authored
217 218
            </div>
        </div>
anyv authored
219
        <div class="log_six_select_top log_six_select_nianji">
anyv authored
220
            <div class="log_six_select_left">
anyv authored
221
                <div class="log_six_select_one" >
anyv authored
222 223
                    适合年级
                </div>
anyv authored
224
                <div class="log_six_select_two log_six_nianji_contant" id="grade" >
anyv authored
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242
                    请选择
                </div>
            </div>
            <div class="log_six_select_three">
                <img src="__TMPL__/public/assets/images/29.png" alt="" />
            </div>
        </div>
    </div>
</div>
<div class="log_six_wire"></div>
<div class="log_two_picture">
    <div class="log_two_picture_title">
        商品详情
    </div>
    <div class="log_six_file_picture">
        <div class="log_six_picture">
            <div class="log_six_picture_one">
                <div class="log_six_pictyre_img">
anyv authored
243
                    <img src="__TMPL__/public/assets/images/jiahao.png" alt="" id="img0" />
anyv authored
244 245 246 247 248
                </div>
                <div class="log_six_pictyre_title">
                    添加图片
                </div>
                <div class="input_files">
anyv authored
249
                    <input type="file" id="img0_file" name="avatar" />
anyv authored
250 251 252 253 254 255
                </div>
            </div>
        </div>
        <div class="log_six_picture">
            <div class="log_six_picture_one">
                <div class="log_six_pictyre_img">
anyv authored
256
                    <img src="__TMPL__/public/assets/images/jiahao.png" alt="" id="img1" />
anyv authored
257 258 259 260 261
                </div>
                <div class="log_six_pictyre_title">
                    添加图片
                </div>
                <div class="input_files">
anyv authored
262 263 264 265 266 267
                    <input type="file" id="img1_file" name="avatar" />
                </div>
            </div>
        </div>
        <div class="log_six_picture">
            <div class="log_six_picture_one">
anyv authored
268 269
                <div class="log_six_pictyre_img" onclick="openCamera()">
                    <!--<img src="__TMPL__/public/assets/images/jiahao.png" alt="" id="img2" />-->
anyv authored
270 271 272 273 274
                </div>
                <div class="log_six_pictyre_title">
                    添加图片
                </div>
                <div class="input_files">
4  
anyv authored
275
                    <!--<input type="file" id="img2_file" name="avatar" />-->
anyv authored
276 277 278 279 280 281
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 保存 -->
anyv authored
282
<div class="log_two_bottom_btn" onclick="Sure_add()">
anyv authored
283 284 285 286 287 288
    确定添加
</div>
<script src="__TMPL__/public/assets/js/jquery.js"></script>
<script src="__TMPL__/public/assets/js/base.js"></script>
<script src="__TMPL__/public/assets/js/mui.min.js"></script>
<script src="__TMPL__/public/assets/js/mui.picker.min.js"></script>
anyv authored
289
<script src="__TMPL__/public/assets/js/jquery-3.2.1.min.js"></script>
anyv authored
290
<script src="__TMPL__/public/assets/js/city.data-3.js"></script>
anyv authored
291
<script src="__TMPL__/public/assets/js/uploadfile.js"></script>
anyv authored
292 293 294 295
<script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script>

    function openCamera(){
5  
anyv authored
296 297
        wx.config({$jssdk});
       /* $.post("{:url('Salesmangoods/getSignPackage')}",{},function (data) {
5  
anyv authored
298
            data = JSON.parse(data);
5  
anyv authored
299 300 301 302 303 304
            wx.config({
                debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,测试完成后需要关闭。
                appId: data.appId, // 必填,公众号的唯一标识
                timestamp: data.timestamp, // 必填,生成签名的时间戳
                nonceStr: data.nonceStr, // 必填,生成签名的随机串
                signature: data.signature,// 必填,签名(加密后,下文有实现)
1  
anyv authored
305
                jsApiList: ['chooseImage'] // 必填,需要使用的JS接口列表,开发文档上有所有接口名称,根据需要选用就好。
5  
anyv authored
306
            });
5  
anyv authored
307
        });*/
4  
anyv authored
308
        
5  
anyv authored
309
        wx.chooseImage({
anyv authored
310
            count: 1, // 默认9
2  
anyv authored
311
            sizeType: ['original'], // 指定是原图还是压缩图,默认都有
anyv authored
312 313 314 315 316 317 318 319 320
            sourceType: ['album', 'camera'], // 指定来源是相册还是相机,默认都有
            success: function (res) {
                var localIds = res.localIds; // 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片
                wx.uploadImage({
                    localId: localIds.toString(), // 需要上传的图片的ID,由chooseImage接口获得
                    isShowProgressTips: 1, // 进度提示
                    success: function (res) {
                        var mediaId = res.serverId; // 返回图片的服务器端ID,即mediaId
                        //将获取到的 mediaId 传入后台 方法savePicture
5  
anyv authored
321
                        /*$.post(path+"/getImage/savePicture",{"mediaId":mediaId,"tmp":"填写证件的正反面参数"},function(res){
anyv authored
322
                            //填写你自己的业务逻辑
5  
anyv authored
323 324
                        });*/
                        console.log(res);
anyv authored
325 326 327 328 329 330
                    },
                    fail: function (res) {
                        alertModal('图片上传失败,请重试');
                    }
                });
            }
5  
anyv authored
331
        });
anyv authored
332 333
    }
</script>
anyv authored
334
<script>
anyv authored
335 336 337 338 339
    /**
     *确定添加
     */
    function Sure_add(){
        show_img = $('#show_img')[0].src;
anyv authored
340 341 342
        if(show_img == "http://www.xkeasy.com/themes/simpleboot3/public/assets/images/jiahao.png"){
            show_img = '';
        }
anyv authored
343
        thumbnail = $('#thumbnail')[0].src;
anyv authored
344 345 346
        if(thumbnail == "http://www.xkeasy.com/themes/simpleboot3/public/assets/images/jiahao.png"){
            thumbnail = '';
        }
anyv authored
347 348 349 350 351 352 353 354 355 356 357 358 359
        book_name = $("input[name='book_name']").val();
        money = $("input[name='money']").val();
        price = $("input[name='price']").val();
        pricing = $("input[name='pricing']").val();
        instr = $('#instr').val();
        book_number = $("input[name='book_number']").val();
        paper = $("input[name='paper']").val();
        book_size = $("input[name='book_size']").val();
        binding = $("input[name='binding']").val();
        author = $("input[name='author']").val();
        press = $("input[name='press']").val();
        press_time = $("input[name='press_time']").val();
        suit = $("input[name='suit']").val();
4  
anyv authored
360
        printing = $("input[name='printing']").val();
anyv authored
361 362
        grade = $("#grade").text();
        img0 = $('#img0')[0].src;
anyv authored
363 364 365
        if(img0 == "http://www.xkeasy.com/themes/simpleboot3/public/assets/images/jiahao.png"){
            img0 = '';
        }
anyv authored
366
        img1 = $('#img1')[0].src;
anyv authored
367 368 369
        if(img1 == "http://www.xkeasy.com/themes/simpleboot3/public/assets/images/jiahao.png"){
            img1 = '';
        }
anyv authored
370
        img2 = $('#img2')[0].src;
anyv authored
371 372 373
        if(img2 == "http://www.xkeasy.com/themes/simpleboot3/public/assets/images/jiahao.png"){
            img2 = '';
        }
anyv authored
374
4  
anyv authored
375
        $.post("{:url('Salesmangoods/Salesman_goods_add')}",{show_img:show_img,thumbnail:thumbnail,book_name:book_name,money:money,price:price,pricing:pricing,instr:instr,book_number:book_number,paper:paper,book_size:book_size,binding:binding,author:author,press:press,press_time:press_time,suit:suit,grade:grade,img0:img0,img1:img1,img2:img2,printing:printing},function(data){
anyv authored
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405
                if(data){
                    window.location.href = "{:url('salesmangoods/salesman_goods')}";
                }else{
                    alert('添加失败');
                }
        });
    }


</script>
<script>

    //选择年级
    $(".log_six_select_nianji").click(function(){
        $(".tx_mask_tongyi").css({
            display: "block"
        });
    })
    $(".tx_mask_tongyi .three_model_school_name").click(function(){
        var index = $(this).index();
        $('.log_six_nianji_contant').text($(this).text()).css("color", "#333");
        $(".tx_mask_tongyi").hide();
    })
    //取消弹窗
    $(document).mouseup(function(e) {
        var _con = $('.tx_maskCon_school');
        if(!_con.is(e.target) && _con.has(e.target).length === 0) {
            $('.tx_mask_tongyi').hide()
        }
    })
anyv authored
406 407 408
    //上传图片

    $(function() {
anyv authored
409 410
        $("#img1_file_img").change(function() {
            var img_size = $(this).get(0).files[0].size;
anyv authored
411
            if(img_size > 1024000) {
anyv authored
412
                alert("上传图片过大,请上传小于1M的图片");
anyv authored
413 414
            } else {
                $.ajaxFileUpload({
anyv authored
415
                    url: '/portal/Personalcenter/image_one_up', //用于文件上传的服务器端请求地址
anyv authored
416
                    secureuri: false, //是否需要安全协议,一般设置为false
anyv authored
417
                    fileElementId: 'img1_file_img', //文件上传域的ID
anyv authored
418 419
                    dataType: 'json', //返回值类型 一般设置为json
                    success: function(data) { //服务器成功响应处理函数
anyv authored
420 421 422 423 424 425
                        $('#show_img').attr("src","/uploads/"+data.data);
                        $(".log_six_add_photo").addClass("log_six_add_photos");
                        $(".log_six_photo_one").addClass("log_six_photo_ones");
                        $(".log_six_add_img").addClass("log_six_add_imgs");
                        $(".log_six_add_title").addClass("log_six_add_titles");
anyv authored
426 427 428 429
                    }
                });
            }
        });
anyv authored
430 431
        $("#img_file_suolue").change(function() {
            var img_size = $(this).get(0).files[0].size;
anyv authored
432
            if(img_size > 1024000) {
anyv authored
433
                alert("上传图片过大,请上传小于1M的图片");
anyv authored
434 435
            } else {
                $.ajaxFileUpload({
anyv authored
436
                    url: '/portal/Personalcenter/image_one_up', //用于文件上传的服务器端请求地址
anyv authored
437
                    secureuri: false, //是否需要安全协议,一般设置为false
anyv authored
438
                    fileElementId: 'img_file_suolue', //文件上传域的ID
anyv authored
439 440
                    dataType: 'json', //返回值类型 一般设置为json
                    success: function(data) { //服务器成功响应处理函数
anyv authored
441 442 443 444
                        $('#thumbnail').attr("src","/uploads/"+data.data);
                        $(".log_two_pi_one").addClass("log_two_pi_ones");
                        $(".log_two_pi_one_p").addClass("log_two_pi_one_ps");
                        $(".log_two_pi_one_icon").addClass("log_two_pi_one_icons");
anyv authored
445 446 447 448
                    }
                });
            }
        });
anyv authored
449 450 451

        $("#img0_file").change(function() {
            var img_size = $(this).get(0).files[0].size;
anyv authored
452
            if(img_size > 1024000) {
anyv authored
453
                alert("上传图片过大,请上传小于1M的图片");
anyv authored
454 455
            } else {
                $.ajaxFileUpload({
anyv authored
456
                    url: '/portal/Personalcenter/image_one_up', //用于文件上传的服务器端请求地址
anyv authored
457
                    secureuri: false, //是否需要安全协议,一般设置为false
anyv authored
458
                    fileElementId: 'img0_file', //文件上传域的ID
anyv authored
459 460
                    dataType: 'json', //返回值类型 一般设置为json
                    success: function(data) { //服务器成功响应处理函数
anyv authored
461 462 463 464
                        $('#img0').attr("src","/uploads/"+data.data);
                        $(".log_six_pictyre_img").addClass("log_six_pictyre_imgs");
                        $(".log_six_pictyre_title").addClass("log_six_pictyre_titles");
anyv authored
465 466 467 468
                    }
                });
            }
        });
anyv authored
469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507

        $("#img1_file").change(function() {
            var img_size = $(this).get(0).files[0].size;
            if(img_size > 1024000) {
                alert("上传图片过大,请上传小于1M的图片");
            } else {
                $.ajaxFileUpload({
                    url: '/portal/Personalcenter/image_one_up', //用于文件上传的服务器端请求地址
                    secureuri: false, //是否需要安全协议,一般设置为false
                    fileElementId: 'img1_file', //文件上传域的ID
                    dataType: 'json', //返回值类型 一般设置为json
                    success: function(data) { //服务器成功响应处理函数
                        $('#img1').attr("src","/uploads/"+data.data);
                        $(".log_six_pictyre_img").addClass("log_six_pictyre_imgs");
                        $(".log_six_pictyre_title").addClass("log_six_pictyre_titles");
                    }
                });
            }
        });

        $("#img2_file").change(function() {
            var img_size = $(this).get(0).files[0].size;
            if(img_size > 1024000) {
                alert("上传图片过大,请上传小于1M的图片");
            } else {
                $.ajaxFileUpload({
                    url: '/portal/Personalcenter/image_one_up', //用于文件上传的服务器端请求地址
                    secureuri: false, //是否需要安全协议,一般设置为false
                    fileElementId: 'img2_file', //文件上传域的ID
                    dataType: 'json', //返回值类型 一般设置为json
                    success: function(data) { //服务器成功响应处理函数
                        $('#img2').attr("src","/uploads/"+data.data);
                        $(".log_six_pictyre_img").addClass("log_six_pictyre_imgs");
                        $(".log_six_pictyre_title").addClass("log_six_pictyre_titles");
                    }
                });
            }
        });
anyv authored
508 509 510 511 512
    });
</script>
</body>

</html>