审查视图

public/themes/simpleboot3/portal/salesmangoods/salesman_goods_add.html 20.2 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">
4  
anyv authored
268
                <div class="log_six_pictyre_img" id="openCamera">
anyv authored
269
                    <img src="__TMPL__/public/assets/images/jiahao.png" id="img20" alt=""  />
4  
anyv authored
270
                </div><!--id="img2"-->
anyv authored
271 272 273 274
                <div class="log_six_pictyre_title">
                    添加图片
                </div>
                <div class="input_files">
4  
anyv authored
275
                    <!--<input type="file" id="openCamera" name="avatar" />-->
anyv authored
276 277 278
                </div>
            </div>
        </div>
7  
anyv authored
279
    </div><!--id="img2_file"-->
anyv authored
280 281
</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
<script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script>
7  
anyv authored
295 296
    $('#openCamera').click(function(){
5  
anyv authored
297
        wx.config({$jssdk});
5  
anyv authored
298
        wx.chooseImage({
anyv authored
299
            count: 1, // 默认9
2  
anyv authored
300
            sizeType: ['original'], // 指定是原图还是压缩图,默认都有
anyv authored
301 302 303
            sourceType: ['album', 'camera'], // 指定来源是相册还是相机,默认都有
            success: function (res) {
                var localIds = res.localIds; // 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片
anyv authored
304 305 306
                $('#img20').attr("src",localIds);
                $(".log_six_pictyre_img").addClass("log_six_pictyre_imgs");
                $(".log_six_pictyre_title").addClass("log_six_pictyre_titles");
anyv authored
307 308 309 310 311 312 313 314
                wx.uploadImage({
                    localId: localIds.toString(), // 需要上传的图片的ID,由chooseImage接口获得
                    isShowProgressTips: 1, // 进度提示
                    success: function (res) {
                        var mediaId = res.serverId; // 返回图片的服务器端ID,即mediaId
                        //将获取到的 mediaId 传入后台 方法savePicture
                        $.post("{:url('Salesmangoods/savePicture')}",{"mediaId":mediaId},function(res){
                            //填写你自己的业务逻辑
4  
anyv authored
315
                 
anyv authored
316
                        });
anyv authored
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332

                    },
                    fail: function (res) {
                        alertModal('图片上传失败,请重试');
                    }
                });
            }
        });

    });


</script>
<script>
    /**
     *确定添加
anyv authored
333 334 335
     */
    function Sure_add(){
        show_img = $('#show_img')[0].src;
anyv authored
336 337 338
        if(show_img == "http://www.xkeasy.com/themes/simpleboot3/public/assets/images/jiahao.png"){
            show_img = '';
        }
anyv authored
339
        thumbnail = $('#thumbnail')[0].src;
anyv authored
340 341 342
        if(thumbnail == "http://www.xkeasy.com/themes/simpleboot3/public/assets/images/jiahao.png"){
            thumbnail = '';
        }
anyv authored
343 344 345 346 347 348 349 350 351 352 353 354 355
        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
356
        printing = $("input[name='printing']").val();
anyv authored
357 358
        grade = $("#grade").text();
        img0 = $('#img0')[0].src;
anyv authored
359 360 361
        if(img0 == "http://www.xkeasy.com/themes/simpleboot3/public/assets/images/jiahao.png"){
            img0 = '';
        }
anyv authored
362
        img1 = $('#img1')[0].src;
anyv authored
363 364 365
        if(img1 == "http://www.xkeasy.com/themes/simpleboot3/public/assets/images/jiahao.png"){
            img1 = '';
        }
anyv authored
366
        img2 = $('#img2')[0].src;
anyv authored
367 368 369
        if(img2 == "http://www.xkeasy.com/themes/simpleboot3/public/assets/images/jiahao.png"){
            img2 = '';
        }
anyv authored
370
4  
anyv authored
371
        $.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
372 373 374 375 376
            if(data){
                window.location.href = "{:url('salesmangoods/salesman_goods')}";
            }else{
                alert('添加失败');
            }
anyv authored
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
        });
    }


</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
402 403 404
    //上传图片

    $(function() {
anyv authored
405 406
        $("#img1_file_img").change(function() {
            var img_size = $(this).get(0).files[0].size;
anyv authored
407
            if(img_size > 1024000) {
anyv authored
408
                alert("上传图片过大,请上传小于1M的图片");
anyv authored
409 410
            } else {
                $.ajaxFileUpload({
anyv authored
411
                    url: '/portal/Personalcenter/image_one_up', //用于文件上传的服务器端请求地址
anyv authored
412
                    secureuri: false, //是否需要安全协议,一般设置为false
anyv authored
413
                    fileElementId: 'img1_file_img', //文件上传域的ID
anyv authored
414 415
                    dataType: 'json', //返回值类型 一般设置为json
                    success: function(data) { //服务器成功响应处理函数
anyv authored
416 417 418 419 420 421
                        $('#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
422 423 424 425
                    }
                });
            }
        });
anyv authored
426 427
        $("#img_file_suolue").change(function() {
            var img_size = $(this).get(0).files[0].size;
anyv authored
428
            if(img_size > 1024000) {
anyv authored
429
                alert("上传图片过大,请上传小于1M的图片");
anyv authored
430 431
            } else {
                $.ajaxFileUpload({
anyv authored
432
                    url: '/portal/Personalcenter/image_one_up', //用于文件上传的服务器端请求地址
anyv authored
433
                    secureuri: false, //是否需要安全协议,一般设置为false
anyv authored
434
                    fileElementId: 'img_file_suolue', //文件上传域的ID
anyv authored
435 436
                    dataType: 'json', //返回值类型 一般设置为json
                    success: function(data) { //服务器成功响应处理函数
anyv authored
437 438 439 440
                        $('#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
441 442 443 444
                    }
                });
            }
        });
anyv authored
445 446 447

        $("#img0_file").change(function() {
            var img_size = $(this).get(0).files[0].size;
anyv authored
448
            if(img_size > 1024000) {
anyv authored
449
                alert("上传图片过大,请上传小于1M的图片");
anyv authored
450 451
            } else {
                $.ajaxFileUpload({
anyv authored
452
                    url: '/portal/Personalcenter/image_one_up', //用于文件上传的服务器端请求地址
anyv authored
453
                    secureuri: false, //是否需要安全协议,一般设置为false
anyv authored
454
                    fileElementId: 'img0_file', //文件上传域的ID
anyv authored
455 456
                    dataType: 'json', //返回值类型 一般设置为json
                    success: function(data) { //服务器成功响应处理函数
anyv authored
457 458 459 460
                        $('#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
461 462 463 464
                    }
                });
            }
        });
anyv authored
465 466 467 468 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

        $("#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
504 505 506 507 508
    });
</script>
</body>

</html>