作者 李涵

合并分支 'li' 到 'master'

渲染



查看合并请求 !5
<?php
/**
* Created by PhpStorm.
* User: yhbr
* Date: 2018/9/28
* Time: 16:12
*/
namespace app\cart\controller;
use app\cart\model\CartModel;
use cmf\controller\HomeBaseController;
class CartController extends HomeBaseController
{
public function addCart()
{
$cart = new CartModel;
$request = request();
if ($request->isAjax()) {
$gid = $request->param('gid');
$num = $request->param('num');
$cart->addToCart(session('user.id', $gid, $num));
}
}
public function editCart()
{
$request = request();
if ($request->isAjax()) {
$cart = [
'id' => $request->param('id'),
'num' => $request->param('num')
];
Db::name('cart')->update($cart);
}
}
public function delCart()
{
$request = request();
if ($request->isAjax()) {
if (Db::name('cart')->delete($request->param('id'))) {
$this->success('', '', true);
}
}
}
}
\ No newline at end of file
... ...
<?php
/**
* Created by PhpStorm.
* User: yhbr
* Date: 2018/9/28
* Time: 15:36
*/
namespace app\cart\model;
use think\Model;
use think\Db;
class CartModel extends Model
{
public function addToCart($uid, $gid, $num)
{
if ($this->checkIsExist($uid, $gid)) {
$cart = [
'uid' => $uid,
'gid' => $gid,
'num' => $num
];
if (Db::name('zj_cart')->insert($cart)) {
return true;
} else {
return false;
}
} else {
$map = [
'uid' => $uid,
'gid' => $gid
];
if (Db::name('zj_cart')->where($map)->setInc('num', $num)) {
return true;
} else {
return false;
}
}
}
private function checkIsExist($uid, $gid)
{
return (Db::name('zj_cart')->where(['uid' => $uid, 'gid' => $gid])->count() == 0) ? true : false;
}
}
\ No newline at end of file
... ...
... ... @@ -7,6 +7,12 @@ use think\Db;
class IndexController extends HomeBaseController
{
function _initialize()
{
parent::_initialize(); // TODO: Change the autogenerated stub
session('user.id', 8);
}
public function index()
{
$goods = new GoodsModel;
... ... @@ -20,4 +26,22 @@ class IndexController extends HomeBaseController
]);
}
/**
* 易连云打印机demo
*/
public function demo()
{
//调用打印机
//1.配置信息
$config = [
'partner' => '27606',
'machine_code' => '4004564414',
'apiKey' => '1580c3fc2adca994e18b0982b42af850518011d0',
'msign' => '6kdjyzsr4sf3'
];
//2.打印内容(以一行三列的表格为例,内容不允许出现回车换行,切记!)
$content = '<table><tr><td>银河百荣科技</td><td>demo</td><td>By Soul of Cinder</td></tr></table>';
printer($config, $content);
}
}
\ No newline at end of file
... ...
... ... @@ -93,16 +93,94 @@ class CenterController extends HomeBaseController
/**
* 地址管理
*/
public function addressManage() {
public function addressManage()
{
$address = Db::name('zj_user_place')
->field('id,name,province,city,county,mobile,is_sta')
->where(['uid'=>session('user.id')])
->field('id,name,province,city,county,mobile,is_sta,place')
->where(['uid' => session('user.id')])
->select()
->toArray();
print_r($address);exit();
return $this->fetch('address_manage', [
'data' => $address
]);
}
public function addAddress()
{
$request = request();
if ($request->isAjax()) {
$post = $request->param();
$code = $post['code'];
$label = $post['label'];
$arr1 = explode(',', $code);
$post['province_id'] = $arr1[0];
$post['city_id'] = $arr1[1];
$post['county_id'] = $arr1[2];
$arr2 = explode(' ', $label);
$post['province'] = $arr2[0];
$post['city'] = $arr2[1];
$post['county'] = $arr2[2];
unset($post['code']);
unset($post['label']);
$post['uid'] = session('user.id');
if (Db::name('zj_user_place')->insert($post)) {
$this->success('', url('user/Center/addressManage'), true);
}
} else {
return $this->fetch('add_address');
}
}
public function delAddress()
{
if (Db::name('zj_user_place')->delete(request()->param('id'))) {
$this->success('', '', true);
}
}
public function editAddress()
{
$request = request();
if ($request->isAjax()) {
$post = $request->param();
$code = $post['code'];
$label = $post['label'];
$arr1 = explode(',', $code);
$post['province_id'] = $arr1[0];
$post['city_id'] = $arr1[1];
$post['county_id'] = $arr1[2];
$arr2 = explode(' ', $label);
$post['province'] = $arr2[0];
$post['city'] = $arr2[1];
$post['county'] = $arr2[2];
unset($post['code']);
unset($post['label']);
$post['uid'] = session('user.id');
if (Db::name('zj_user_place')->update($post)) {
$this->success('', url('user/Center/addressManage'), true);
}
} else {
return $this->fetch('edit_address', [
'data' => Db::name('zj_user_place')
->field('id,name,mobile,place,province_id,city_id,county_id,province,city,county')
->where(['id' => $request->param('id')])
->find()
]);
}
}
public function setDefault()
{
Db::name('zj_user_place')->where(['uid' => session('user.id')])->update(['is_sta' => 1]);
Db::name('zj_user_place')->where(['id' => request()->param('id')])->update(['is_sta' => request()->param('is_sta')]);
}
public function myBalance()
{
return $this->fetch('my_balance', [
'balance' => Db::name('user')->where(['id' => session('user.id')])->value('balance')
]);
}
}
\ No newline at end of file
... ...
... ... @@ -112,8 +112,8 @@ body,html{
.goodreason{
font-size: 0.26rem;
color:RGBA(26, 26, 26, 1);
margin-top: 0.73rem;
height:1.4rem;
margin-top: 0.18rem;
height:1.8rem;
overflow: auto;
}
.phone{
... ... @@ -133,4 +133,4 @@ body,html{
padding: 0.36rem 0.35rem;
margin-top: 0.35rem;
}
\ No newline at end of file
}
... ...
... ... @@ -57,18 +57,18 @@ body,html{
.cart_tast{
color: #666666;
font-size: 0.26rem;
margin-top: 0.12rem;
margin-top: 0.1rem;
}
.inter{
color:#FF0000;
font-size: 0.24rem;
margin-top: 0.17rem;
margin-top: 0.1rem;
}
.addcart{
display:flex;
justify-content: space-between;
align-items: center;
margin-top: 0.08rem;
margin-top: 0.03rem;
height:0.5rem;
}
... ...
... ... @@ -64,14 +64,16 @@ body,html{
.text_img{
width:1.2rem;
height:1.2rem;
border-radius: 0.1rem;
}
.container_list{
display:flex;
border-bottom: 0.01rem solid #EBEBEB;
border-bottom: 1px solid #f5f5f5;
padding:0.23rem 0;
}
.text_img img{
width:100%;
border-radius: 0.1rem;
}
.container_info{
margin-left: 0.24rem;
... ... @@ -98,7 +100,7 @@ body,html{
display:flex;
justify-content: space-between;
align-items: center;
margin-top: 0.1rem;
margin-top: 0.03rem;
}
.people_weight{
width:2rem;
... ...
... ... @@ -40,8 +40,9 @@ body,html{
.list_name{
color:RGBA(83, 87, 92, 1);
font-size: 0.28rem;
height:0.26rem;
/*height:0.5rem;*/
line-height: 0.26rem;
}
.item{
margin-top: 0.16rem;
... ...
... ... @@ -58,6 +58,8 @@ body,html{
.good_content{
/*width:4.56rem;*/
height:1rem;
line-height: 1rem;
border-bottom: 1px solid #f5f5f5;
display:flex;
justify-content: space-between;
align-items: center;
... ... @@ -76,7 +78,7 @@ body,html{
}
.good_content .active em{
position: absolute;
top:0.45rem;
top:0.75rem;
left:0;
right:0;
width:0.8rem;
... ... @@ -97,6 +99,7 @@ body,html{
height:0.25rem;
text-align: center;
margin: 0 auto;
margin-top: 0.2rem;
}
.good_info_img{
width:7.5rem;
... ...
... ... @@ -61,7 +61,8 @@ body,html{
}
.specialword p{
width:1.2rem;
height:1.2rem;
text-align: center;
height:0.8rem;
font-size:0.28rem ;
color:#666666;
margin-top: 0.2rem;
... ... @@ -183,6 +184,7 @@ body,html{
left:0;
right:0;
background: #fff;
border-top:1px solid #f5f5f5;
}
... ...
... ... @@ -75,8 +75,8 @@ li.active {
margin-top:0;
}
.order_content{
background:RGBA(250, 250, 250, 1) ;
padding: 0.18rem;
/*background:RGBA(250, 250, 250, 1) ;*/
padding:0.18rem 0;
}
.content_text{
margin-left: 0.3rem;
... ... @@ -94,7 +94,7 @@ li.active {
color:#FE0A01;
}
.good_name{
width:4.5rem;
width:4.9rem;
color:#1A1A1A;
font-size: 0.26rem;
... ... @@ -107,7 +107,7 @@ li.active {
display:flex;
justify-content: space-between;
align-items: center;
margin-top:0.16rem;
margin-top:0.1rem;
}
.item_tast,.tast_num{
font-size: 0.26rem;
... ...
... ... @@ -20,11 +20,15 @@ body,html{
.people_name{
color:#1A1A1A;
font-size: 0.26rem;
height:0.2rem;
line-height: 0.2rem;
}
.people_phone{
color:#1A1A1A;
font-size: 0.26rem;
margin-left: 0.27rem;
height:0.2rem;
line-height: 0.2rem;
}
.people_place {
font-size: 0.26rem;
... ... @@ -61,10 +65,13 @@ body,html{
.order_img{
width:1.28rem;
height:1.28rem;
border-radius: 0.1rem;
}
.order_img img{
width:100%;
border-radius: 0.1rem;
}
.good_list{
width:4.5rem;
... ... @@ -118,7 +125,7 @@ body,html{
}
/*购买数量*/
.dispatch{
width:6.68rem;
width:6.86rem;
height:1.92rem;
margin: 0 auto;
background: #fff;
... ... @@ -306,7 +313,8 @@ body,html{
}
.buy_order_money{
width:4.6rem;
height:0.3rem;
line-height: 0.3rem;
display:flex;
justify-content:space-between;
align-items: center;
... ... @@ -325,6 +333,8 @@ body,html{
}
.buyorder,.ordermoney{
height:0.3rem;
line-height: 0.3rem;
color:#1A1A1A;
font-size: 0.28rem;
}
... ...
... ... @@ -226,7 +226,7 @@
}
.swiper-container-horizontal>.swiper-pagination-bullets,.swiper-pagination-custom,.swiper-pagination-fraction {
bottom: 10px;
bottom: -5px;
left: 0;
width: 100%
}
... ...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<link rel="stylesheet" href="__INDEX__/css/weui.css">
<link rel="stylesheet" href="__INDEX__/css/jquery-weui.css">
<link rel="stylesheet" href="__INDEX__/css/demos.css">
<link rel="stylesheet" href="https://at.alicdn.com/t/font_834805_9njxvxqweig.css">
<link rel="stylesheet" href="__INDEX__/css/base.css">
<link rel="stylesheet" href="__INDEX__/css/swiper.min.css">
<script type="text/javascript" src="__INDEX__/js/base.js"></script>
<title>添加地址</title>
<style>
body,html{
width:100%;
height:100%;
background: #F5F6FA;
}
.select_address{
width:6.86rem;
margin: 0 auto;
height:1.01rem;
border-bottom: 1px solid #f5f5f5;
display:flex;
/*justify-content: space-between;*/
align-items: center;
position: relative;
padding: 0 0.33rem;
}
.weui-cell{
/*display:flex;*/
/*justify-content: space-between;*/
/*align-items: center;*/
}
.detail_address{
width:6.86rem;
margin: 0 auto;
height:1.01rem;
border-bottom: 1px solid #f5f5f5;
display:flex;
/*justify-content: space-between;*/
align-items: center;
padding: 0 0.33rem;
}
.place{
width:1.5rem;
color:#1A1A1A;
font-size: 0.3rem;
}
.detailplace{
color:#999999;
font-size: 0.3rem;
}
.province{
color:#999999;
font-size: 0.3rem;
}
.weui-label {
width:1.3rem;
}
.detailplace{
border:none;
outline: none;
/*margin-right:0.6rem;*/
}
.select{
background: #fff;
}
.save{
width:6.86rem;
height:0.88rem;
background:#FE0A01;
color:#fff;
font-size:0.32rem ;
text-align: center;
line-height: 0.88rem;
border-radius: 0.44rem;
position:fixed;
bottom:0.55rem;
left:0;
right:0;
margin: 0 auto;
box-shadow:0px 15px 30px 0px rgba(254,10,1,0.24);
}
.icon-xiaotuziCduan_{
color:#999999;
font-size: 0.5rem;
position:absolute;
right:0.3rem;
z-index: 5;
}
.selectadd{
width:4.6rem;
position:relative;
border:none;
outline:none;
z-index: 8;
/*margin-left: 0.5rem;*/
}
</style>
</head>
<body>
<div class="container">
<div class="select">
<div class="select_address">
<p class="place">选择地区</p>
<div class="weui-cell" style="padding: 0">
<!--<div class="weui-cell__hd"><label for="date" class="weui-label place">选择地区</label></div>-->
<div class="weui-cell__bd">
<input class="weui-input selectadd" id="end" type="text" placeholder="请选择省市区" >
</div>
</div>
<p class="iconfont icon-xiaotuziCduan_"></p>
</div>
<div class="detail_address">
<p class="place">详细地址</p>
<input id="P" type="text" placeholder="请填写详细地址" class="detailplace">
</div>
<div class="detail_address">
<p class="place">收货人</p>
<input id="N" type="text" placeholder="请填写收货人" class="detailplace">
</div>
<div class="detail_address">
<p class="place">联系电话</p>
<input id="M" type="text" placeholder="请填写联系电话" class="detailplace">
</div>
</div>
<div class="save">保存</div>
</div>
</body>
<script type="text/javascript" src="__INDEX__/js/jquery-2.1.4.js"></script>
<script type="text/javascript" src="__INDEX__/js/fastclick.js"></script>
<script>
$(function() {
FastClick.attach(document.body);
});
</script>
<script type="text/javascript" src="__INDEX__/js/jquery-weui.js"></script>
<script type="text/javascript" src="__INDEX__/js/city-picker.js"></script>
<script>
$("#end,.icon-xiaotuziCduan").cityPicker({
title: "请选择地区"
});
</script>
<script>
$(".save").click(function () {
var code = $("#end").attr('data-codes');
var label = $("#end").val();
if(code == null || label == null || $("#P").val() == '' || $("#N").val() == '' || $("#M").val() == '') {
alert('请完善地址信息');
}else {
$.ajax({
url: "{:url('user/Center/addAddress')}",
data: {
code: code,
label: label,
place: $("#P").val(),
name: $("#N").val(),
mobile: $("#M").val()
},
type: "POST",
dataType: "JSON",
success: function (data) {
window.location.href = data.url;
}
})
}
})
</script>
</html>
... ...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<link rel="stylesheet" href="__INDEX__/css/weui.css">
<link rel="stylesheet" href="__INDEX__/css/jquery-weui.css">
<link rel="stylesheet" href="__INDEX__/css/demos.css">
<link rel="stylesheet" href="https://at.alicdn.com/t/font_834805_bx3vyrf79mj.css">
<link rel="stylesheet" href="__INDEX__/css/base.css">
<link rel="stylesheet" href="__INDEX__/css/swiper.min.css">
<script type="text/javascript" src="__INDEX__/js/base.js"></script>
<title>选择地址</title>
<style>
body,html{
background: RGBA(245, 246, 250, 1);
}
.icon-dizhi{
color:#999999;
font-size: 0.55rem;
}
.manageraddress{
border-bottom: 1px solid #f5f5f5;
padding-bottom: 0.41rem;
padding-top: 0.1rem;
}
.addresshead{
display:flex;
/*margin-top: 0.38rem;*/
margin-left: 0.23rem;
}
.place{
width:6rem;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color:#1A1A1A;
font-size: 0.26rem;
margin-left: 0.18rem;
margin-top: 0.2rem;
}
.info{
display:flex;
margin-left: 0.96rem;
}
.name{
color:#1A1A1A;
font-size: 0.28rem;
}
.telphone{
color:#1A1A1A;
font-size: 0.28rem;
margin-left: 0.59rem;
}
.icon-xuanzekuang{
font-size: 0.28rem;
color:#999999;
width:0.32rem;
text-align: center;
height:0.28rem;
line-height: 0.28rem;
}
.icon-xuanze-fangkuang{
width:0.32rem;
text-align: center;
font-size: 0.28rem;
height:0.28rem;
line-height: 0.28rem;
color:#FF0800;
}
.default_place{
color:#333333;
font-size: 0.24rem;
height:0.28rem;
line-height: 0.28rem;
margin-left: 0.11rem;
}
.default_body{
display:flex;
justify-content: space-between;
align-items: center;
padding: 0.26rem 0.32rem 0.26rem 0.8rem;
}
.default,.default_type,.edit,.delect{
display:flex;
}
.delect{
margin-left: 0.54rem;
}
.defauledi,.defaultdel{
color:#666666;
font-size: 0.24rem;
height:0.23rem;
line-height: 0.23rem;
margin-left: 0.1rem;
}
.icon-bianji,.icon-shanchu{
height:0.23rem;
line-height: 0.23rem;
}
.default_list{
background: #fff;
margin-top: 0.16rem;
}
.default_list:first-child{
margin-top: 0;
}
.addplace{
width:7.5rem;
height:1rem;
background: RGBA(254, 10, 1, 1);
color:#fff;
font-size: 0.36rem;
text-align: center;
line-height: 1rem;
position:fixed;
bottom:0;
left:0;
right:0
}
.managerplace{
padding-bottom:1.3rem;
}
.add_address{
color:#999999;
font-size: 0.36rem;
margin: 0.32rem 2.31rem 0 2.31rem;
}
.addressplus{
width:2.8rem;
height:0.8rem;
border:2px solid rgba(186,27,43,1);
border-radius:0.05rem;
color:#BA1B2B;
font-size: 0.32rem;
text-align: center;
line-height: 0.8rem;
margin: 0.28rem 2.34rem 0 2.34rem;
}
.deletewrapper{
width: 100%;
height: 100%;
background-color: rgba(0,0,0,0.5);
position:fixed;
top:0;
left:0;
right:0;
z-index: 5;
}
.deletepop{
width:5.2rem;
height:3rem;
background: #ffffff;
border-radius: 0.1rem;
position: absolute;
z-index: 6;
/*left:0.4rem;*/
/*top: 3rem;*/
top:50%;
left:50%;
transform: translate(-50%,-50%);
display: flex;
flex-direction: column;
align-items: center;
overflow: hidden;
padding-top: 0.29rem;
}
.suredelete{
color:#1A1A1A;
font-size: 0.32rem;
}
.certainornot{
font-size: 0.3rem;
color:#666666;
margin-top: 0.43rem;
}
.certain{
display:flex;
justify-content:space-between;
align-items: center;
border-top:1px solid #f5f5f5;
margin-top: 0.4rem;
}
.cancel,.sure{
width:2.6rem;
height:0.88rem;
line-height: 0.88rem;
color:#666666;
font-size: 0.3rem;
text-align: center;
}
.sure{
color:#FF0000;
}
.address_img{
width:3.2rem;
height:2.52rem;
margin: 0 auto;
margin-top: 3.06rem;
}
.address_img img{
width:100%;
}
</style>
</head>
<body>
<div class="deletewrapper" style="display:none">
<div class="deletepop">
<p class="suredelete">确认删除</p>
<p class="certainornot">确定删除该地址吗?</p>
<div class="certain">
<p class="cancel">取消</p>
<p class="sure">确认</p>
</div>
</div>
</div>
<div class="container">
<div class="noplace" style="display:none" >
<div class="address_img">
<img src="__INDEX__/img/searchaddress.png" alt="">
</div>
<p class="add_address">您还没有添加地址</p>
<div class="addressplus">添加地址</div>
</div>
<div class="haveplace" >
<div class="managerplace">
<volist name="data" id="vo">
<div class="default_list">
<div class="manageraddress">
<div class="addresshead">
<p class="iconfont icon-dizhi"></p>
<p class="place">{$vo.province}{$vo.city}{$vo.county}{$vo.place}</p>
</div>
<div class="info">
<p class="name">{$vo.name}</p>
<p class="telphone">{$vo.mobile}</p>
</div>
</div>
<div class="default_body">
<div class="default">
<if condition="$vo['is_sta'] eq '1'">
<p data-id="{$vo.id}" data-var="2" class="iconfont icon-xuanzekuang xuan" style="display: block"></p>
<p data-id="{$vo.id}" data-var="1" class="iconfont icon-xuanze-fangkuang" style="display:none"></p>
<else/>
<p data-id="{$vo.id}" data-var="1" class="iconfont icon-xuanzekuang xuan" style="display: none"></p>
<p data-id="{$vo.id}" data-var="2" class="iconfont icon-xuanze-fangkuang" style="display:block"></p>
</if>
<p class="default_place">默认地址</p>
</div>
<div class="default_type">
<div class="edit" data-url="{:url('user/center/editAddress',['id'=>$vo['id']])}">
<p class="iconfont icon-bianji"></p>
<p class="defauledi">编辑</p>
</div>
<div class="delect">
<p class="iconfont icon-shanchu"></p>
<p class="defaultdel" data-id="{$vo.id}">删除</p>
</div>
</div>
</div>
</div>
</volist>
</div>
<div class="addplace">新增收货地址</div>
</div>
</div>
<script src="__INDEX__/js/jquery.min.js"></script>
<script>
var id='';
//没有收获地址时候新增收获地址
$(".addressplus").click(function(){
window.location.href="{:url('user/Center/addAddress')}";
})
//有收获地址的时候新增收获地址
$(".addplace").click(function(){
window.location.href="{:url('user/Center/addAddress')}";
})
$(".edit").click(function(){
window.location.href=$(this).attr('data-url');
});
//删除地址
$(".defaultdel").click(function(){
id = $(this).attr('data-id');
$(".deletewrapper").show()
})
//删除确定
$(".sure").click(function(){
$(".deletewrapper").css("display","none")
$.ajax({
url:"{:url('user/Center/delAddress')}",
data:{
id:id,
},
type:"POST",
dataType:"JSON",
success: function (data) {
window.location.href=data.url;
}
})
})
$(".cancel").click(function(){
$(".deletewrapper").css("display","none")
})
//选择默认地址
console.log($(".xuan"))
$(".xuan").click(function(){
$(this).css("display","none");
$(this).siblings(".icon-xuanze-fangkuang").css("display","block");
$(this).parents(".default_list").siblings(".default_list").children(".default_body").children(".default").children(".icon-xuanze-fangkuang").css("display","none")
$(this).parents(".default_list").siblings(".default_list").children(".default_body").children(".default").children(".xuan").css("display","block")
id=$(this).attr('data-id');
$.ajax({
url:"{:url('user/Center/setDefault')}",
data:{
id:id,
is_sta:$(this).attr('data-var')
},
type:"POST",
dataType:"JSON",
})
})
$(".icon-xuanze-fangkuang").click(function(){
$(this).css("display","none");
$(this).siblings(".xuan").css("display","block")
$.ajax({
url:"{:url('user/Center/setDefault')}",
data:{
id:id,
is_sta:$(this).attr('data-var')
},
type:"POST",
dataType:"JSON",
})
})
</script>
</body>
</html>
... ...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<link rel="stylesheet" href="__INDEX__/css/weui.css">
<link rel="stylesheet" href="__INDEX__/css/jquery-weui.css">
<link rel="stylesheet" href="__INDEX__/css/demos.css">
<link rel="stylesheet" href="https://at.alicdn.com/t/font_834805_9njxvxqweig.css">
<link rel="stylesheet" href="__INDEX__/css/base.css">
<link rel="stylesheet" href="__INDEX__/css/swiper.min.css">
<script type="text/javascript" src="__INDEX__/js/base.js"></script>
<title>添加地址</title>
<style>
body,html{
width:100%;
height:100%;
background: #F5F6FA;
}
.select_address{
width:6.86rem;
margin: 0 auto;
height:1.01rem;
border-bottom: 1px solid #f5f5f5;
display:flex;
/*justify-content: space-between;*/
align-items: center;
position: relative;
padding: 0 0.33rem;
}
.weui-cell{
/*display:flex;*/
/*justify-content: space-between;*/
/*align-items: center;*/
}
.detail_address{
width:6.86rem;
margin: 0 auto;
height:1.01rem;
border-bottom: 1px solid #f5f5f5;
display:flex;
/*justify-content: space-between;*/
align-items: center;
padding: 0 0.33rem;
}
.place{
width:1.5rem;
color:#1A1A1A;
font-size: 0.3rem;
}
.detailplace{
color:#999999;
font-size: 0.3rem;
}
.province{
color:#999999;
font-size: 0.3rem;
}
.weui-label {
width:1.3rem;
}
.detailplace{
border:none;
outline: none;
/*margin-right:0.6rem;*/
}
.select{
background: #fff;
}
.save{
width:6.86rem;
height:0.88rem;
background:#FE0A01;
color:#fff;
font-size:0.32rem ;
text-align: center;
line-height: 0.88rem;
border-radius: 0.44rem;
position:fixed;
bottom:0.55rem;
left:0;
right:0;
margin: 0 auto;
box-shadow:0px 15px 30px 0px rgba(254,10,1,0.24);
}
.icon-xiaotuziCduan_{
color:#999999;
font-size: 0.5rem;
position:absolute;
right:0.3rem;
z-index: 5;
}
.selectadd{
width:4.6rem;
position:relative;
border:none;
outline:none;
z-index: 8;
/*margin-left: 0.5rem;*/
}
</style>
</head>
<body>
<div class="container">
<div class="select">
<div class="select_address">
<p class="place">选择地区</p>
<div class="weui-cell" style="padding: 0">
<!--<div class="weui-cell__hd"><label for="date" class="weui-label place">选择地区</label></div>-->
<div class="weui-cell__bd">
<input class="weui-input selectadd" id="end" type="text" placeholder="请选择省市区" value="{$data.province} {$data.city} {$data.county}" data-codes="{$data.province_id},{$data.city_id},{$data.county_id}">
</div>
</div>
<p class="iconfont icon-xiaotuziCduan_"></p>
</div>
<div class="detail_address">
<p class="place">详细地址</p>
<input id="P" type="text" placeholder="请填写详细地址" class="detailplace" value="{$data.place}">
</div>
<div class="detail_address">
<p class="place">收货人</p>
<input id="N" type="text" placeholder="请填写收货人" class="detailplace" value="{$data.name}">
</div>
<div class="detail_address">
<p class="place">联系电话</p>
<input id="M" type="text" placeholder="请填写联系电话" class="detailplace" value="{$data.mobile}">
</div>
</div>
<div class="save">保存</div>
</div>
</body>
<script type="text/javascript" src="__INDEX__/js/jquery-2.1.4.js"></script>
<script type="text/javascript" src="__INDEX__/js/fastclick.js"></script>
<script>
$(function() {
FastClick.attach(document.body);
});
</script>
<script type="text/javascript" src="__INDEX__/js/jquery-weui.js"></script>
<script type="text/javascript" src="__INDEX__/js/city-picker.js"></script>
<script>
$("#end,.icon-xiaotuziCduan").cityPicker({
title: "请选择地区"
});
</script>
<script>
$(".save").click(function () {
var code = $("#end").attr('data-codes');
var label = $("#end").val();
if(code == null || label == null || $("#P").val() == '' || $("#N").val() == '' || $("#M").val() == '') {
alert('请完善地址信息');
}else {
$.ajax({
url: "{:url('user/Center/editAddress')}",
data: {
code: code,
label: label,
place: $("#P").val(),
name: $("#N").val(),
mobile: $("#M").val(),
id:'{$data.id}'
},
type: "POST",
dataType: "JSON",
success: function (data) {
window.location.href = data.url;
}
})
}
})
</script>
</html>
... ...
... ... @@ -119,7 +119,7 @@
});
//我的积分
$(".interg").click(function(){
window.location.href='myintegration.html'
window.location.href="{:url('user/Center/myBalance')}";
})
//关于我们
$(".us").click(function(){
... ...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<link rel="stylesheet" href="https://at.alicdn.com/t/font_834805_0ml90wdq5hzm.css">
<link rel="stylesheet" href="__INDEX__/css/base.css">
<link rel="stylesheet" href="__INDEX__/css/swiper.min.css">
<script type="text/javascript" src="__INDEX__/js/base.js"></script>
<title>我的积分</title>
<style>
.head{
width:7.5rem;
height:3rem;
background:linear-gradient(-30deg,rgba(248,199,11,1),rgba(254,230,0,1));
padding-top: 0.7rem;
}
.total_integrate{
font-size:0.88rem;
color:#1A1A1A;
font-weight: bold;
width:6rem;
height:1.2rem;
margin: 0 auto;
text-align: center;
}
.remain{
width:6rem;
text-align: center;
margin: 0 auto;
font-size: 0.24rem;
color:#1A1A1A;
}
.list{
display:flex;
justify-content: space-between;
align-items: center;
padding: 0.39rem 0.32rem;
border-bottom: 1px solid #f5f5f5;
}
.record{
font-size: 0.287rem;
color:#1A1A1A;
}
.icon-jinru{
color:#CCCCCC
}
.integrate_list{
background: #fff;
}
</style>
</head>
<body>
<div class="container">
<div class="head">
<p class="total_integrate">{$balance}</p>
<p class="remain">积分余额</p>
</div>
<div class="integrate_list">
<div class="list takenote">
<p class="record">积分获取记录</p>
<P class="iconfont icon-jinru"></P>
</div>
<div class="list uselist">
<p class="record">积分使用记录</p>
<P class="iconfont icon-jinru"></P>
</div>
<div class="list friend">
<p class="record">赠送好友积分</p>
<P class="iconfont icon-jinru"></P>
</div>
<div class="list password">
<p class="record">积分怎样密码管理</p>
<P class="iconfont icon-jinru"></P>
</div>
</div>
</div>
</body>
<script src="__INDEX__/js/jquery.min.js"></script>
<script>
$(".takenote").click(function(){
window.location.href='gainintergral.html'
})
$(".uselist").click(function(){
window.location.href='gainintergral.html'
})
//赠送好友积分
$(".friend").click(function(){
window.location.href='friendlist.html'
})
$(".password").click(function(){
window.location.href='passwordmanager.html'
})
</script>
</html>
... ...
... ... @@ -1831,3 +1831,21 @@ function getBanner() {
return $res;
}
/**
* 易连云打印接口
* @param int $partner 用户ID
* @param string $machine_code 打印机终端号
* @param string $content 打印内容
* @param string $apiKey API密钥
* @param string $msign 打印机密钥
*/
function printer($config, $content)
{
$partner = $config['partner'];
$machine_code = $config['machine_code'];
$apiKey = $config['apiKey'];
$msign = $config['msign'];
require_once EXTEND_PATH . 'yly/printer.php';
$api = new \Yprint($partner, $machine_code, $content, $apiKey, $msign);
$api->action_print();
}
\ No newline at end of file
... ...
<?php
class Yprint
{
private $partner;
private $machine_code;
private $apiKey;
private $msign;
public $content;
function __construct($partner, $machine_code, $content, $apiKey, $msign)
{
$this->partner = $partner;
$this->machine_code = $machine_code;
$this->content = $content;
$this->apiKey = $apiKey;
$this->msign = $msign;
}
/**
* 生成签名sign
* @param array $params 参数
* @param string $apiKey API密钥
* @param string $msign 打印机密钥
* @return string sign
*/
public function generateSign($params)
{
//所有请求参数按照字母先后顺序排
ksort($params);
//定义字符串开始所包括的字符串
$stringToBeSigned = $this->apiKey;
//把所有参数名和参数值串在一起
foreach ($params as $k => $v) {
$stringToBeSigned .= urldecode($k . $v);
}
unset($k, $v);
//定义字符串结尾所包括的字符串
$stringToBeSigned .= $this->msign;
//使用MD5进行加密,再转化成大写
return strtoupper(md5($stringToBeSigned));
}
/**
* 生成字符串参数
* @param array $param 参数
* @return string 参数字符串
*/
public function getStr($param)
{
$str = '';
foreach ($param as $key => $value) {
$str = $str . $key . '=' . $value . '&';
}
$str = rtrim($str, '&');
return $str;
}
/**
* 打印接口
* @param int $partner 用户ID
* @param string $machine_code 打印机终端号
* @param string $content 打印内容
* @param string $apiKey API密钥
* @param string $msign 打印机密钥
*/
public function action_print()
{
$param = array(
"partner" => $this->partner,
'machine_code' => $this->machine_code,
'time' => time(),
);
//获取签名
$param['sign'] = $this->generateSign($param, $this->apiKey, $this->msign);
$param['content'] = $this->content;
$str = $this->getStr($param);
$this->sendCmd('http://open.10ss.net:8888', $str);
}
/**
* 发起请求
* @param string $url 请求地址
* @param string $data 请求数据包
* @return string 请求返回数据
*/
public function sendCmd($url, $data)
{
$curl = curl_init(); // 启动一个CURL会话
curl_setopt($curl, CURLOPT_URL, $url); // 要访问的地址
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检测
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); // 从证书中检查SSL加密算法是否存在
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Expect:')); //解决数据包大不能提交
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); // 使用自动跳转
curl_setopt($curl, CURLOPT_AUTOREFERER, 1); // 自动设置Referer
curl_setopt($curl, CURLOPT_POST, 1); // 发送一个常规的Post请求
curl_setopt($curl, CURLOPT_POSTFIELDS, $data); // Post提交的数据包
curl_setopt($curl, CURLOPT_TIMEOUT, 30); // 设置超时限制防止死循
curl_setopt($curl, CURLOPT_HEADER, 0); // 显示返回的Header区域内容
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回
$tmpInfo = curl_exec($curl); // 执行操作
if (curl_errno($curl)) {
echo 'Errno' . curl_error($curl);
}
curl_close($curl); // 关键CURL会话
return $tmpInfo; // 返回数据
}
}
\ No newline at end of file
... ...