Commit d06edf78 by 冷斌

Merge remote-tracking branch 'origin/master'

parents ad488e7f f3c708db
...@@ -899,4 +899,39 @@ div::-webkit-scrollbar { ...@@ -899,4 +899,39 @@ div::-webkit-scrollbar {
/* Goods Detail */ /* Goods Detail */
.goods_detail_top { .goods_detail_top {
}
/* 真题 */
.zhenti_my_collect_list_container {
position: relative;
box-sizing: border-box;
padding-top: 2.25rem;
}
.zhenti_tab {
position: fixed !important;
top: 2.75rem;
width: 100%;
height: 2.25rem;
}
.zhenti_tab_normal {
font-size:14px;
font-weight:600;
color:rgba(51,51,51,1);
}
.zhenti_tab_selected {
font-size:14px;
font-weight:600;
color:rgba(101,192,0,1);
}
.zhenti_my_collect_cell {
padding: 0.75rem;
margin-bottom: 0.5rem;
}
.zhenti_my_collect_cell_time {
margin-top: 0.75rem;
} }
\ No newline at end of file
...@@ -180,7 +180,6 @@ ...@@ -180,7 +180,6 @@
<div @click="onHotKeyword('{$vo.video_title|mStr=10}')" class="search_flex_item layout_center"> <div @click="onHotKeyword('{$vo.video_title|mStr=10}')" class="search_flex_item layout_center">
<span class="text_14_400 color_999999">{$vo.video_title|mStr=10}</span> <span class="text_14_400 color_999999">{$vo.video_title|mStr=10}</span>
</div> </div>
<!-- <li><a <eq name="vo.type" value="1">href="{:U('course/Video/view',array('id'=>$vo['id']))}"<else/>href="{:U('live/Index/view',array('id'=>$vo['id']))}"</eq>>{$vo.video_title|mStr=10}</a></li> -->
</volist> </volist>
</div> </div>
</div> </div>
......
...@@ -139,7 +139,9 @@ ...@@ -139,7 +139,9 @@
<van-tabbar-item> <van-tabbar-item>
<span class="text_10_400">真题题库</span> <span class="text_10_400">真题题库</span>
<template #icon="props"> <template #icon="props">
<img :src="props.active ? '__THEME__/img/zhenti.png' : '__THEME__/img/zhenti_s.png'" /> <a href="{:U('home/Home/exams')}">
<img :src="props.active ? '__THEME__/img/zhenti.png' : '__THEME__/img/zhenti_s.png'" />
</a>
</template> </template>
</van-tabbar-item> </van-tabbar-item>
<van-tabbar-item> <van-tabbar-item>
......
<include file="__THEME__/public_header_w3g"/> <include file="__THEME__/public_header_w3g" />
<link rel="stylesheet" type="text/css" href="{$Think.APPS_URL}/exams/_static/css/public.css">
<link rel="stylesheet" type="text/css" href="{$Think.APPS_URL}/exams/_static/icon/iconfont.css"> <div id="app">
<link rel="stylesheet" type="text/css" href="{$Think.APPS_URL}/exams/_static/css/public_header_footer_media.css"> <div class="layout_v tab_container">
<link rel="stylesheet" type="text/css" href="{$Think.APPS_URL}/exams/_static/css/exam_2.0.css"> <van-tabs :border="false" v-model="tab" sticky @change="onTopTab" line-width="72px" line-height="4px" background="white"
color="#A3E460" title-inactive-color="#333333" title-active-color="#A3E460">
<div class="cover"></div>
<van-tab>
<div class="min-height-wrap"> <span slot="title" v-bind:class="tab == 0 ? 'tab_text_selected' : 'tab_text_normal'">
<div class="suren-box"> 真题演练
<ul class="suren-coas"> </span>
<li <php>if(!$_GET['tab'] || $_GET['tab'] == 1){</php>class="on"<php>}</php>> <a href="{:U('home/Home/exams',['tab'=>1])}">练习记录</a></li> <van-sticky :offset-top="44">
<li <eq name="Think.get.tab" value="2">class="on"</eq>><a href="{:U('home/Home/exams',['tab'=>2])}">考试记录</a></li> <div class="layout_v">
<li <eq name="Think.get.tab" value="3">class="on"</eq>><a href="{:U('home/Home/exams',['tab'=>3])}">错题记录</a></li> <van-dropdown-menu active-color="#333333">
<li <eq name="Think.get.tab" value="4">class="on"</eq>><a href="{:U('home/Home/exams',['tab'=>4])}">题目收藏</a></li> <van-dropdown-item title="筛选" ref="item">
<li <eq name="Think.get.tab" value="5">class="on"</eq>><a href="{:U('home/Home/exams',['tab'=>5])}">高频练习</a></li> <div class="drop_down_grid">
</ul> <div class="drop_down_option_selected">全部</div>
<div class="asmarfr-pr"> <div class="drop_down_option">事业单位</div>
<switch name="Think.get.tab"> <div class="drop_down_option">公考面试</div>
<case value="3"> <div class="drop_down_option">教师</div>
<!--错题记录--> <div class="drop_down_option">财会</div>
<php>if($list['data']){</php> <div class="drop_down_option">银行</div>
<ul class="suren-content"> <div class="drop_down_option">法考</div>
<volist name="list.data" id="vo"> <div class="drop_down_option">考研</div>
<li> </div>
<a href="#"> </van-dropdown-item>
<span> </van-dropdown-menu>
<h4>{$vo.paper_info.exams_paper_title}</h4> <div class="drop_down_selected_container">
<p>{$vo['update_time']|friendlyDate}</p> <div class="color_primary text_14_400 drop_down_selected_item">公务员</div>
</span> </div>
<strong>{$vo.wrong_count}道错题</strong> </div>
<a href="{:U('exams/Index/wrongExamsroom',['joinType'=>1,'paper_id'=>$vo['exams_paper_id'],'temp'=>$vo['exams_users_id']])}" class='btn exams'>错题再练</a> </van-sticky>
<a class='btn del deleteExeams' data-temp_id="{$vo.exams_users_id}">删除</a> <div class="layout_v list_container">
</a> <!-- 项目1 -->
</li> <div v-for="(item, index) in zhenti" :key="index" class="class_item layout_h">
</volist> <div class="class_left layout_v weight_full">
</ul> <div class="layout_h">
<php>}else{</php> <div v-if="item.price > 0" class="mark_orange layout_center">付费</div>
<include file="__THEME__/no_data_w3g" /> <div v-if="item.price == 0" class="mark_green layout_center">免费</div>
<php>}</php> <span class="text_14_600 color_333333 weight_full van-multi-ellipsis--l2" style="margin-left: 0.625rem;">{{item.title}}</span>
</case> </div>
<case value="4"> <div class="layout_h" style="margin-top: 1.25rem;">
<!--题目收藏--> <span class="text_12_400 color_999999">题数:{{item.count}}</span>
<php>if($list['data']){</php> <span class="class_attr text_12_400 color_999999">推荐用时:{{item.time}}m</span>
<ul class="suren-content collection"> <span class="class_attr text_12_400 color_999999">{{item.person}}</span>
<volist name="list.data" id="vo"> </div>
<li> </div>
<a href="#"> <div class="class_right layout_center">
<span> <div v-if="item.price > 0" class="button_orange layout_center">¥{{item.price}}</div>
<php>if($vo['question_info']['content']){</php> <div v-if="item.price == 0" class="button_green layout_center">开始做题</div>
<h4>{:t($vo['question_info']['content'])}</h4> </div>
<php>}else{</php> </div>
<h4 style="color: #F00;">该试题已被删除</h4> </div>
<php>}</php> </van-tab>
<p>{$vo['ctime']|friendlyDate}</p>
</span> <van-tab>
<php>if($vo['question_info']['content']){</php> <span slot="title" v-bind:class="tab == 1 ? 'tab_text_selected' : 'tab_text_normal'">
<a href="{:U('exams/Index/showQuestioninfo',['question_id'=>$vo['source_id']])}" class="btn exams">查看题目</a> 真题下载
<a class='btn del deleteCollection' data-question_id="{$vo.source_id}">删除</a> </span>
<php>}else{</php> <van-sticky :offset-top="44">
<a class='btn del deleteCollection' style="right: -95px;" data-question_id="{$vo.source_id}">删除</a> <van-dropdown-menu active-color="#333333">
<php>}</php> <van-dropdown-item title="筛选" ref="item">
<div class="drop_down_grid">
</a> <div class="drop_down_option_selected">全部</div>
</li> <div class="drop_down_option">事业单位</div>
</volist> <div class="drop_down_option">公考面试</div>
</ul> <div class="drop_down_option">教师</div>
<php>}else{</php> <div class="drop_down_option">财会</div>
<include file="__THEME__/no_data_w3g" /> <div class="drop_down_option">银行</div>
<php>}</php> <div class="drop_down_option">法考</div>
</case> <div class="drop_down_option">考研</div>
<case value="5"> </div>
<!--高频练习--> </van-dropdown-item>
<php>if($list['data']){</php> </van-dropdown-menu>
<ul class="suren-content"> </van-sticky>
<volist name="list.data" id="vo"> <div class="layout_v list_container">
<li> <!-- 项目1 -->
<a href="#"> <div class="class_item layout_h">
<span> <div class="class_left layout_v weight_full">
<h4>{$vo.exams_paper_title}</h4> <div class="layout_h">
<p>{$vo['update_time']|friendlyDate}</p> <div class="mark_green layout_center">免费</div>
</span> <span class="text_14_600 color_333333 weight_full van-multi-ellipsis--l2" style="margin-left: 0.625rem;">2020年国家公务员《行测》试卷(省级)-名师版</span>
<strong>0分</strong> </div>
<a href="{:U('exams/Index/wrongExamsroom',['joinType'=>1,'paper_id'=>$vo['exams_paper_id'],'temp'=>$vo['exams_users_id'],'is_highwrong'=>1])}" class='btn exams'>开始练习</a> <div class="layout_h" style="margin-top: 1.25rem;">
<!-- <a class='btn del deleteExeams' data-temp_id="{$vo.exams_users_id}">删除</a> --> <span class="text_12_400 color_999999">题数:45</span>
</a> <span class="class_attr text_12_400 color_999999">推荐用时:45m</span>
</li> <span class="class_attr text_12_400 color_999999">45121已做</span>
</volist> </div>
</ul> </div>
<php>}else{</php> <div class="class_right layout_center">
<include file="__THEME__/no_data_w3g" /> <div class="button_green layout_center">下载试题</div>
<php>}</php> </div>
</case> </div>
<default /> <!-- 项目2 -->
<!--练习记录 考试记录--> <div class="class_item layout_h">
<php>if($list['data']){</php> <div class="class_left layout_v weight_full">
<ul class="suren-content"> <div class="layout_h">
<volist name="list.data" id="vo"> <div class="mark_orange layout_center">付费</div>
<li> <span class="text_14_600 color_333333 weight_full van-multi-ellipsis--l2" style="margin-left: 0.625rem;">2020年国家公务员《行测》试卷(省级)-名师版</span>
<span> </div>
<h4>{$vo.paper_info.exams_paper_title}<if condition="$vo['course_title']"><a href="{:U('course/Video/view',array('id'=>$vo['vid']))}">{$vo.course_title}</a></if></h4> <div class="layout_h" style="margin-top: 1.25rem;">
<p>{$vo['update_time']|friendlyDate}</p> <span class="text_12_400 color_999999">题数:45</span>
</span> <span class="class_attr text_12_400 color_999999">推荐用时:45m</span>
<php>if($vo['progress'] == 100){</php> <span class="class_attr text_12_400 color_999999">45121已做</span>
<strong>{$vo.score|default="0"}分</strong> </div>
<a href="{:U('exams/Index/examsresult',['joinType'=>$vo['exams_mode'],'paper_id'=>$vo['exams_paper_id'],'temp'=>$vo['exams_users_id']])}" class='btn show'>查看结果</a> </div>
<a class='btn del deleteExeams' data-temp_id="{$vo.exams_users_id}">删除</a> <div class="class_right layout_center">
<php>}else{</php> <div class="button_green layout_center">下载试题</div>
<i class="icon icon-weiwancheng"></i> </div>
<a href="{:U('exams/Index/examsroom',['joinType'=>$vo['exams_mode'],'paper_id'=>$vo['exams_paper_id'],'temp'=>$vo['exams_users_id']])}" class='btn exams'>继续答题</a> </div>
<a class='btn del deleteExeams' data-temp_id="{$vo.exams_users_id}">删除</a> </div>
<php>}</php> </van-tab>
</li>
</volist> <van-tab>
</ul> <span slot="title" v-bind:class="tab == 2 ? 'tab_text_selected' : 'tab_text_normal'">
<php>}else{</php> 我的题库
<include file="__THEME__/no_data_w3g" /> </span>
<php>}</php> <div class="layout_v zhenti_my_collect_list_container">
</switch> <div class="layout_h zhenti_tab">
</div> <div @click="onMyTab(0)" class="layout_center weight_full" :class="myTab == 0 ? 'zhenti_tab_selected' : 'zhenti_tab_normal'">已做</div>
</div> <div @click="onMyTab(1)" class="layout_center weight_full" :class="myTab == 1 ? 'zhenti_tab_selected' : 'zhenti_tab_normal'">收藏</div>
</div> </div>
<div v-if="myTab == 1" class="zhenti_my_collect_cell layout_v">
<include file="__THEME__/public_footer_w3g"/> <div class="text_16_600 color_333333">某种糖果的进价为12元/千克,现购进这种糖果若干千克,每天销售10千克,且从第二天起每天都比前一天降价2元/千克。已知以6元/千克的价格销售的那天正好卖完最后10千克,且总销售额是总进货成本的2倍。问总共进了多少千克这种糖果?</div>
<script src="{$Think.APPS_URL}/exams/_static/js/public_header_footer_media.js"></script> <div class="text_12_400 color_999999 zhenti_my_collect_cell_time">2020-04-04 03:12:56</div>
<script src="{$Think.APPS_URL}/exams/_static/js/swipe.js" charset="utf-8"></script> </div>
<script type="text/javascript"> <!-- 项目2 -->
$(function(){ <div v-if="myTab == 0" class="class_item layout_h">
$('.suren-content li').rhuiSwipe('swipeLeft', function(event){ <div class="class_left layout_v weight_full">
var left = 0; <div class="layout_h">
$(this). find(".btn").each(function(){ <div class="mark_orange layout_center">付费</div>
left += $(this).width(); <span class="text_14_600 color_333333 weight_full van-multi-ellipsis--l2" style="margin-left: 0.625rem;">2020年国家公务员《行测》试卷(省级)-名师版</span>
$(this).css({lineHeight:$(this).height()+'px'}); </div>
}); <div class="layout_h" style="margin-top: 1.25rem;">
$(this).animate({left:"-"+left+"px"},500); <span class="text_12_400 color_primary">得分:80</span>
$(this).siblings().css("left","0px"); <span class="class_attr text_12_400 color_999999">2020-04-04 03:12:56</span>
}, { </div>
// 可选参数 </div>
isStopPropagation: false, <div class="class_right layout_center">
isPreventDefault: false, <div class="button_green layout_center">查看详情</div>
triggerOnMove: true </div>
}); </div>
$('.suren-content li').rhuiSwipe('swipeRight', function(event){ </div>
$(this).animate({left:"0px"},500); </van-tab>
$(this).siblings().animate({left:0},500);
}, { </van-tabs>
// 可选参数 </div>
isStopPropagation: false, <van-tabbar v-model="active" @change="onChange" :fixed="true" :route="false" :safe-area-inset-bottom="true"
isPreventDefault: false, active-color="#65C000" inactive-color="#363636">
triggerOnMove: true <van-tabbar-item>
}); <span class="text_10_400">名师课堂</span>
<template #icon="props">
$('.suren-content li').click(function(){ <a href="{:U('classroom/Index/index')}">
if($(this).css("left") == '0px'){ <img :src="props.active ? '__THEME__/img/minshi.png' : '__THEME__/img/minshi_s.png'" />
var left = 0; </a>
$(this).find(".btn").each(function(){ </template>
left += $(this).width(); </van-tabbar-item>
$(this).css({lineHeight:$(this).height()+'px'}); <van-tabbar-item>
}); <span class="text_10_400">真题题库</span>
$(this).animate({left:"-"+left+"px"},500); <template #icon="props">
$(this).siblings().css("left","0px"); <a href="{:U('home/Home/exams')}">
}else{ <img :src="props.active ? '__THEME__/img/zhenti.png' : '__THEME__/img/zhenti_s.png'" />
$(this).animate({left:"0px"},500); </a>
$(this).siblings().animate({left:0},500); </template>
} </van-tabbar-item>
<van-tabbar-item>
}); <span class="text_10_400">考试咨询</span>
<template #icon="props">
<a href="{:U('classroom/Index/find')}">
// 删除考试记录 <img :src="props.active ? '__THEME__/img/zixun.png' : '__THEME__/img/zixun_s.png'" />
$(".deleteExeams").live('click',function(){ </a>
var temp_id = $(this).data('temp_id'); </template>
ui.confirm('确认删除该记录吗?', { </van-tabbar-item>
yes: function () { <van-tabbar-item>
$.post('{:U("exams/Index/deleteExeams")}',{temp_id:temp_id},function(res){ <span class="text_10_400">会员中心</span>
if(typeof(res) != "object"){ <template #icon="props">
try{ <if condition="$_SESSION['mid']">
var res = JSON.parse(res); <a href="{:U('home/User/index')}">
}catch(e){ <else />
ui.error("请求出错,请稍后再试"); <a href="{:U('basic/Passport/login')}">
return false; </if>
} <img :src="props.active ? '__THEME__/img/huiyuan.png' : '__THEME__/img/huiyuan_s.png'" />
} </a>
if(res.status == 1){ </template>
ui.success(res.data.info); </van-tabbar-item>
window.location.reload(); </van-tabbar>
}else{ </div>
ui.error(res.message);
return false; <script type="text/javascript">
} new Vue({
}); el: '#app',
} data: function() {
}); return {
}); active: 1,
// 取消收藏 tab: 0,
$(".deleteCollection").live('click',function(){ myTab: 0,
var question_id = $(this).data('question_id'); zhenti: [],
download: [],
ui.confirm('确认删除该试题吗?', { myYiZuo: [],
yes: function () { myCollect: []
// 后台 }
$.post(U('exams/Index/collect'),{action:0,source_id:question_id},function(res){ },
if(typeof(res) != 'object'){ mounted:function(){
try{ $("#preloader").hide();
var res = JSON.parse(res); this.onTopTab(0)
}catch(e){ },
ui.error("处理异常,请重新尝试"); computed: {
return false; currentItems: function() {
} if(this.tab == 0) {
} return this.zhenti
} else if(this.tab == 1) {
if(res.status == 1){ return this.download
ui.success(res.data.info); } else {
window.location.reload(); return this.myTab == 0 ? this.myYiZuo : this.myCollect
return true; }
}else{ }
ui.error(res.message); },
return false; methods: {
} onChange: function(tab) {
});
} },
}); onTopTab: function(tab) {
}); if(this.tab == 0) {
this.loadZhenti()
var p = 1; } else if(this.tab == 1) {
$(window).scroll(function(){
var scrollTop = $(this).scrollTop(); } else {
var scrollHeight = $(document).height();
var windowHeight = $(this).height(); }
if(scrollTop + windowHeight == scrollHeight){ },
if(!p || p >= parseInt("{$list['totalPages']}")){ onMyTab: function(tab) {
return false; this.myTab = tab
}else{ },
p = p+1; //加载真题
$.ajax({ loadZhenti: function() {
type: "GET", let that = this
url:"{:U('home/Home/exams',['tab'=>$_GET['tab']])}", $.ajax({
data:{ type: "GET",
tab:'{$Think.get.tab}', url: "{:U('exams/Index/paper')}" + "&api=1",
p:p dataType: "json",
}, success: function(res) {
dataType:"json", if(res.status == 1) {
success:function(res){ let array = res.data.data
if(typeof(res) != 'object'){ that.zhenti = [].concat(array.map( r => {
try{ return {
var res = JSON.parse(res); id: r.exams_paper_id,
}catch(e){ title: r.exams_paper_title,
ui.error("处理异常,请重新尝试"); price: r.price,
return false; count: r.questions_count,
} time: r.reply_time,
} person: "0已做"
}
if(res.status == 1){ }))
$(".asmarfr-pr ul").append(res.data.html); }
return true; }
} })
}
} }
}); })
}
}
});
});
</script> </script>
<include file="__THEME__/public_header_w3g"/>
<link rel="stylesheet" type="text/css" href="{$Think.APPS_URL}/exams/_static/css/public.css">
<link rel="stylesheet" type="text/css" href="{$Think.APPS_URL}/exams/_static/icon/iconfont.css">
<link rel="stylesheet" type="text/css" href="{$Think.APPS_URL}/exams/_static/css/public_header_footer_media.css">
<link rel="stylesheet" type="text/css" href="{$Think.APPS_URL}/exams/_static/css/exam_2.0.css">
<div class="cover"></div>
<div class="min-height-wrap">
<div class="suren-box">
<ul class="suren-coas">
<li <php>if(!$_GET['tab'] || $_GET['tab'] == 1){</php>class="on"<php>}</php>> <a href="{:U('home/Home/exams',['tab'=>1])}">练习记录</a></li>
<li <eq name="Think.get.tab" value="2">class="on"</eq>><a href="{:U('home/Home/exams',['tab'=>2])}">考试记录</a></li>
<li <eq name="Think.get.tab" value="3">class="on"</eq>><a href="{:U('home/Home/exams',['tab'=>3])}">错题记录</a></li>
<li <eq name="Think.get.tab" value="4">class="on"</eq>><a href="{:U('home/Home/exams',['tab'=>4])}">题目收藏</a></li>
<li <eq name="Think.get.tab" value="5">class="on"</eq>><a href="{:U('home/Home/exams',['tab'=>5])}">高频练习</a></li>
</ul>
<div class="asmarfr-pr">
<switch name="Think.get.tab">
<case value="3">
<!--错题记录-->
<php>if($list['data']){</php>
<ul class="suren-content">
<volist name="list.data" id="vo">
<li>
<a href="#">
<span>
<h4>{$vo.paper_info.exams_paper_title}</h4>
<p>{$vo['update_time']|friendlyDate}</p>
</span>
<strong>{$vo.wrong_count}道错题</strong>
<a href="{:U('exams/Index/wrongExamsroom',['joinType'=>1,'paper_id'=>$vo['exams_paper_id'],'temp'=>$vo['exams_users_id']])}" class='btn exams'>错题再练</a>
<a class='btn del deleteExeams' data-temp_id="{$vo.exams_users_id}">删除</a>
</a>
</li>
</volist>
</ul>
<php>}else{</php>
<include file="__THEME__/no_data_w3g" />
<php>}</php>
</case>
<case value="4">
<!--题目收藏-->
<php>if($list['data']){</php>
<ul class="suren-content collection">
<volist name="list.data" id="vo">
<li>
<a href="#">
<span>
<php>if($vo['question_info']['content']){</php>
<h4>{:t($vo['question_info']['content'])}</h4>
<php>}else{</php>
<h4 style="color: #F00;">该试题已被删除</h4>
<php>}</php>
<p>{$vo['ctime']|friendlyDate}</p>
</span>
<php>if($vo['question_info']['content']){</php>
<a href="{:U('exams/Index/showQuestioninfo',['question_id'=>$vo['source_id']])}" class="btn exams">查看题目</a>
<a class='btn del deleteCollection' data-question_id="{$vo.source_id}">删除</a>
<php>}else{</php>
<a class='btn del deleteCollection' style="right: -95px;" data-question_id="{$vo.source_id}">删除</a>
<php>}</php>
</a>
</li>
</volist>
</ul>
<php>}else{</php>
<include file="__THEME__/no_data_w3g" />
<php>}</php>
</case>
<case value="5">
<!--高频练习-->
<php>if($list['data']){</php>
<ul class="suren-content">
<volist name="list.data" id="vo">
<li>
<a href="#">
<span>
<h4>{$vo.exams_paper_title}</h4>
<p>{$vo['update_time']|friendlyDate}</p>
</span>
<strong>0分</strong>
<a href="{:U('exams/Index/wrongExamsroom',['joinType'=>1,'paper_id'=>$vo['exams_paper_id'],'temp'=>$vo['exams_users_id'],'is_highwrong'=>1])}" class='btn exams'>开始练习</a>
<!-- <a class='btn del deleteExeams' data-temp_id="{$vo.exams_users_id}">删除</a> -->
</a>
</li>
</volist>
</ul>
<php>}else{</php>
<include file="__THEME__/no_data_w3g" />
<php>}</php>
</case>
<default />
<!--练习记录 考试记录-->
<php>if($list['data']){</php>
<ul class="suren-content">
<volist name="list.data" id="vo">
<li>
<span>
<h4>{$vo.paper_info.exams_paper_title}<if condition="$vo['course_title']"><a href="{:U('course/Video/view',array('id'=>$vo['vid']))}">{$vo.course_title}</a></if></h4>
<p>{$vo['update_time']|friendlyDate}</p>
</span>
<php>if($vo['progress'] == 100){</php>
<strong>{$vo.score|default="0"}分</strong>
<a href="{:U('exams/Index/examsresult',['joinType'=>$vo['exams_mode'],'paper_id'=>$vo['exams_paper_id'],'temp'=>$vo['exams_users_id']])}" class='btn show'>查看结果</a>
<a class='btn del deleteExeams' data-temp_id="{$vo.exams_users_id}">删除</a>
<php>}else{</php>
<i class="icon icon-weiwancheng"></i>
<a href="{:U('exams/Index/examsroom',['joinType'=>$vo['exams_mode'],'paper_id'=>$vo['exams_paper_id'],'temp'=>$vo['exams_users_id']])}" class='btn exams'>继续答题</a>
<a class='btn del deleteExeams' data-temp_id="{$vo.exams_users_id}">删除</a>
<php>}</php>
</li>
</volist>
</ul>
<php>}else{</php>
<include file="__THEME__/no_data_w3g" />
<php>}</php>
</switch>
</div>
</div>
</div>
<include file="__THEME__/public_footer_w3g"/>
<script src="{$Think.APPS_URL}/exams/_static/js/public_header_footer_media.js"></script>
<script src="{$Think.APPS_URL}/exams/_static/js/swipe.js" charset="utf-8"></script>
<script type="text/javascript">
$(function(){
$('.suren-content li').rhuiSwipe('swipeLeft', function(event){
var left = 0;
$(this). find(".btn").each(function(){
left += $(this).width();
$(this).css({lineHeight:$(this).height()+'px'});
});
$(this).animate({left:"-"+left+"px"},500);
$(this).siblings().css("left","0px");
}, {
// 可选参数
isStopPropagation: false,
isPreventDefault: false,
triggerOnMove: true
});
$('.suren-content li').rhuiSwipe('swipeRight', function(event){
$(this).animate({left:"0px"},500);
$(this).siblings().animate({left:0},500);
}, {
// 可选参数
isStopPropagation: false,
isPreventDefault: false,
triggerOnMove: true
});
$('.suren-content li').click(function(){
if($(this).css("left") == '0px'){
var left = 0;
$(this).find(".btn").each(function(){
left += $(this).width();
$(this).css({lineHeight:$(this).height()+'px'});
});
$(this).animate({left:"-"+left+"px"},500);
$(this).siblings().css("left","0px");
}else{
$(this).animate({left:"0px"},500);
$(this).siblings().animate({left:0},500);
}
});
// 删除考试记录
$(".deleteExeams").live('click',function(){
var temp_id = $(this).data('temp_id');
ui.confirm('确认删除该记录吗?', {
yes: function () {
$.post('{:U("exams/Index/deleteExeams")}',{temp_id:temp_id},function(res){
if(typeof(res) != "object"){
try{
var res = JSON.parse(res);
}catch(e){
ui.error("请求出错,请稍后再试");
return false;
}
}
if(res.status == 1){
ui.success(res.data.info);
window.location.reload();
}else{
ui.error(res.message);
return false;
}
});
}
});
});
// 取消收藏
$(".deleteCollection").live('click',function(){
var question_id = $(this).data('question_id');
ui.confirm('确认删除该试题吗?', {
yes: function () {
// 后台
$.post(U('exams/Index/collect'),{action:0,source_id:question_id},function(res){
if(typeof(res) != 'object'){
try{
var res = JSON.parse(res);
}catch(e){
ui.error("处理异常,请重新尝试");
return false;
}
}
if(res.status == 1){
ui.success(res.data.info);
window.location.reload();
return true;
}else{
ui.error(res.message);
return false;
}
});
}
});
});
var p = 1;
$(window).scroll(function(){
var scrollTop = $(this).scrollTop();
var scrollHeight = $(document).height();
var windowHeight = $(this).height();
if(scrollTop + windowHeight == scrollHeight){
if(!p || p >= parseInt("{$list['totalPages']}")){
return false;
}else{
p = p+1;
$.ajax({
type: "GET",
url:"{:U('home/Home/exams',['tab'=>$_GET['tab']])}",
data:{
tab:'{$Think.get.tab}',
p:p
},
dataType:"json",
success:function(res){
if(typeof(res) != 'object'){
try{
var res = JSON.parse(res);
}catch(e){
ui.error("处理异常,请重新尝试");
return false;
}
}
if(res.status == 1){
$(".asmarfr-pr ul").append(res.data.html);
return true;
}
}
});
}
}
});
});
</script>
\ No newline at end of file
...@@ -103,7 +103,9 @@ ...@@ -103,7 +103,9 @@
<van-tabbar-item> <van-tabbar-item>
<span class="text_10_400">真题题库</span> <span class="text_10_400">真题题库</span>
<template #icon="props"> <template #icon="props">
<img :src="props.active ? '__THEME__/img/zhenti.png' : '__THEME__/img/zhenti_s.png'" /> <a href="{:U('home/Home/exams')}">
<img :src="props.active ? '__THEME__/img/zhenti.png' : '__THEME__/img/zhenti_s.png'" />
</a>
</template> </template>
</van-tabbar-item> </van-tabbar-item>
<van-tabbar-item> <van-tabbar-item>
......
...@@ -423,7 +423,7 @@ class GoodsAction extends Action ...@@ -423,7 +423,7 @@ class GoodsAction extends Action
$this->assign('sple_score', $sple_score); $this->assign('sple_score', $sple_score);
$this->assign('split_score_pro', $split_score['sple_score']); $this->assign('split_score_pro', $split_score['sple_score']);
$this->assign($data); $this->assign('data', $data);
$this->assign('address', $address); $this->assign('address', $address);
$this->assign('address_list', $address_list); $this->assign('address_list', $address_list);
$this->assign('credit', (int)$credit['score']); $this->assign('credit', (int)$credit['score']);
......
...@@ -35,6 +35,45 @@ ...@@ -35,6 +35,45 @@
finished-text="没有更多了" finished-text="没有更多了"
@load="onLoad"> @load="onLoad">
<template v-if="tab == 0">
<div @click="onItem(item)" v-for="(item, idx) in options[0].items" :key="idx" class="home_class_item layout_v">
<div class="layout_h">
<van-image
style="margin-right: 0.75rem;"
height="72"
width="128"
fit="cover"
:src="item.cover">
</van-image>
<div class="weight_full layout_v">
<span class="text_14_600 color_333333 van-multi-ellipsis--l2">{{item.title}}</span>
<span class="text_14_600 color_FF3B3B" style="margin-top: 0.5rem;">{{item.price}}</span>
<span class="text_12_400 color_999999">{{item.count}}人正在学习</span>
</div>
</div>
</div>
</template>
<template v-if="tab == 1">
<div v-for="(item, idx) in options[1].items" :key="idx" class="layout_v home_question_item">
<div v-if="item.price == 0" class="layout_h">
<div class="home_item_mark_green layout_center">免费</div>
<span class="text_14_600 color_333333 weight_full van-multi-ellipsis--l2" style="margin-right: 1.5rem;margin-left: 0.625rem;">{{item.title}}</span>
<div @click="onItem(item)" class="home_button_green layout_center">开始做题</div>
</div>
<div v-else class="layout_h">
<div class="home_item_mark_orange layout_center">付费</div>
<span class="text_14_600 color_333333 weight_full van-multi-ellipsis--l2" style="margin-right: 1.5rem;margin-left: 0.625rem;">{{item.title}}</span>
<div @click="onItem(item)" class="home_button_orange layout_center">¥{{item.price}}</div>
</div>
<div class="layout_h_b" style="margin-top: 0.5rem;">
<span class="text_14_600 color_FF3B3B">¥{{item.price}}</span>
<van-image src="__THEME__/img/down_load_icon.png" width="13" height="16" ></van-image>
</div>
<div class="home_divider divider"></div>
</div>
</template>
<template v-if="tab == 2"> <template v-if="tab == 2">
<div @click="onItem(item)" v-for="(item, idx) in options[2].items" :key="idx" class="home_item_goods layout_h"> <div @click="onItem(item)" v-for="(item, idx) in options[2].items" :key="idx" class="home_item_goods layout_h">
<van-image <van-image
...@@ -181,6 +220,11 @@ ...@@ -181,6 +220,11 @@
if(this.tab == 2) { if(this.tab == 2) {
let url = "{:U('mall/Goods/view')}" let url = "{:U('mall/Goods/view')}"
window.location.href = url.replace(/\[.*?\]/g, item.uid) window.location.href = url.replace(/\[.*?\]/g, item.uid)
} else if(this.tab == 0) {
let url = "{:U('course/Video/view')}"
window.location.href = url.replace(/\[.*?\]/g, item.id)
} else {
} }
}, },
onTab: function(idx) { onTab: function(idx) {
...@@ -206,7 +250,6 @@ ...@@ -206,7 +250,6 @@
success: function (data) { success: function (data) {
that.loading = false that.loading = false
let res = data let res = data
let opt = that.options[2]
opt.items = opt.items.concat(res.data.map( r => { return { opt.items = opt.items.concat(res.data.map( r => { return {
uid: r.uid, uid: r.uid,
title: r.title, title: r.title,
...@@ -219,11 +262,57 @@ ...@@ -219,11 +262,57 @@
} }
}) })
} else if(that.tab == 1) { } else if(that.tab == 1) {
$.ajax({
type: "GET",
url: "{:U('exams/Index/paper')}" + "&api=1",
dataType: "json",
success: function(data) {
that.loading = false
let res = data
let opt = that.options[1]
if(res.status == 1) {
let result = res.data
let array = result.data.length > 0 ? result.data : []
opt.items = array.map( r => {
return {
id: r.exams_paper_id,
title: r.exams_paper_title,
price: r.price
}
})
opt.page = result.nowPage
opt.finished = result.nowPage >= result.totalPages
that.finished = result.nowPage >= result.totalPages
}
}
})
} else { } else {
let on = "{$marketConf['order_switch']}" == 1
$.ajax({
type: "GET",
url: "{:U('course/Video/index')}" + "?api=1",
dataType: "json",
success: function(data) {
that.loading = false
let res = data
let array = res.data.length > 0 ? res.data : []
opt.items = array.map( r => {
let pi = r.mz_price
return {
id: r.id,
title: r.video_title,
cover: r.image_url,
price: pi.price == 0 ? '免费' : ('¥' + pi.price),
count: on ? r.video_order_count_mark : r.video_order_count
}
})
opt.page = res.nowPage
opt.finished = res.nowPage >= res.totalPages
that.finished = res.nowPage >= res.totalPages
}
})
} }
} },
} }
}) })
......
<include file="__THEME__/public_header_w3g"/> <include file="__THEME__/public_header_w3g"/>
<link href="__APP__/css/pay_video_3g.css" rel="stylesheet">
<style> <style>
#BOX{width: 100%;background-color: white;display:none;} body {
#BOX>div:nth-child(1){width:100%;height:40px;text-align: center;line-height:40px;border-bottom: solid 2px #d3d7db;font-size:16px;} padding: 0 !important;
#BOX>div:nth-child(2){width:100%;border-bottom: solid 1px #d3d7db;} }
.add{width: 90%;margin:0 auto; line-height: 40px;padding: 0 5px;margin: 5px auto;background-color: #f8f8f8;}
#BOX .add .add_name{float: left;}
#BOX .add .add_phone{float: right;}
#BOX .add .add_address{clear: both;}
.df_administration>dd>a{display:none;}
.df_administration>dd>div>p>a{margin-top:10px;text-align: right;}
.xianzhilength{width:70%;overflow:hidden; text-overflow: ellipsis;white-space: nowrap;display: inline-block;}
.body{
background-color: #f5f5f5;
}
</style> </style>
<div class="body"> <div id="app">
<div class="wrap"> <div class="layout_v">
<div class="min-height-wrap"> <div class="pay_course_info layout_h">
<div class="class_order_tit">确认订单</div> <van-image :src="info.cover" fit="cover" width="120" height="68"></van-image>
<!--商品信息--> <div class="layout_v" style="margin-left: 0.75rem;">
<dl class="df_course-info"> <span class="text_14_600 color_333333">{{info.title}}</span>
<dt><h3>商品信息</h3></dt> <span class="text_14_600 color_FF3B3B" style="margin-top: 0.5rem;">¥{{info.price}}</span>
<dd> </div>
<a href="{:U('mall/Goods/view',['id'=>$goods_id])}"> </div>
<span> <div class="layout_h_v pay_course_bottom">
<img src="{:getCover($cover_id,120,120)}" width="120" height="70" alt="{:mStr($title,10)}"> <span class="text_16_600 color_333333">选择数量</span>
</span> <div class="layout_h_v_c" style="margin-top: 0.75rem;">
<h3>{:mStr($title,20)}</h3> <span style="margin-right: 0.25rem;">数量:</span>
<div>{:mStr($info,50)}</div> <van-icon @click="onMinus" name="__THEME__/img/minus.png" size="20" ></van-icon>
</a> <span class="text_16_600 color_primary" style="margin-left: 0.5rem;margin-right: 0.5rem;">{{count}}</span>
</dd> <van-icon @click="onPlus" name="__THEME__/img/plus.png" size="20" ></van-icon>
</dl> </div>
</div>
<!--支付方式--> <div @click="onAddress" class="layout_h" style="padding: 0.75rem;min-height: 5.5rem;">
<dl class="df_pay-style"> <van-icon class="self_center" name="__THEME__/img/address_icon.png" size="28" ></van-icon>
<dt><h3>支付方式</h3></dt> <div class="layout_v weight_full self_center" style="margin-right: 0.625rem;margin-left: 0.75rem;">
<php>if($is_wx){unset($payWay['支付宝支付']);}$firstPayWay = current($payWay);</php> <span v-if="!hasAddress" class="text_16_400 color_999999">添加收货信息</span>
<if condition="in_array('alipay',$payConfig['pay']) and ($is_wx eq false)"> <div v-if="hasAddress" class="layout_h">
<dd value="alipay" class="paytype"><a class="icon icon-zhifubao1"></a><span class="name">支付宝</span><i <if condition='($firstPayWay eq alipay)'>class="icon icon-xuanze"</if>></i></dd> <span class="text_16_400 color_333333" style="margin-right: 0.5rem;">{{address.address}}</span>
</if> <span class="text_14_400 color_999999">{{address.phone}}</span>
</div>
<if condition="in_array('wxpay',$payConfig['pay'])"> <div v-if="hasAddress" class="text_14_400 color_333333" style="margin-top: 0.5rem;">{{address.location + address.address}}</div>
<dd value="wxpay" class="paytype"><a class="icon icon-weixinzhifu1"></a><span class="name">微信支付</span><i <if condition='$is_wx or $firstPayWay eq wxpay'>class="icon icon-xuanze"</if> style="border: 1px solid rgb(237, 237, 237);"></i></dd> </div>
</if> <van-icon class="self_center" name="__THEME__/img/right_arrow.png" size="12" ></van-icon>
</div>
<if condition="in_array('credpay',$payConfig['pay'])"> <div class="layout_v pay_course_bottom">
<dd value="credpay" class="paytype"><a class="icon icon-iconfont"></a><span class="name">积分支付</span><span>(剩余积分{$credit|default=0})</span><i <if condition='($firstPayWay eq credpay)'>class="icon icon-xuanze"</if> style="border: 1px solid rgb(237, 237, 237);"></i></dd> <span class="text_16_600 color_333333" style="margin-bottom: 0.75rem;">选择支付方式</span>
</if> <div class="layout_h_b">
</dl> <div class="layout_h_v_c">
<p class="other">注:人民币与积分的兑换比例为 {$split_score_pro}</p> <van-image height="28" width="28" fit="cover" src="__THEME__/img/weichat_logo.png"></van-image>
<!-- 新增功能-收货管理 --> <span class="text_14_400 color_333333" style="margin-left: 0.75rem;">微信</span>
<dl class="df_administration">
<a href="JavaScript:">
<dt><h3>收货管理</h3></dt>
<dd>
<div>
<p>
<if condition="$address">
<span class="name">{$address.name} </span>
<span class="phone"> {$address.phone}</span>
<span class="address">{$address.location}</span><!-- 修改-->
<span class="xianzhilength"> {$address.address}</span>
<else/>
<a class="xinzeng" href="{:U('home/User/address',['param'=>$_GET['vst']])}">新增地址</a>
</if>
</p>
<if condition="$address_list">
<i class="icon icon-youjiantou"></i>
</if>
</div>
</dd>
</a>
</dl>
<!--实付金额-->
<dl class="df_pay-price">
<dd><h3>实付金额</h3><p id="pay_money">¥{$lastPrice/$sple_score}</p></dt>
</dl>
<!--购买协议-->
<div class="df_pay-protocol">
<p><i class="icon icon-xuanze" attr="1"></i>我已阅读并同意<a href="{:U('basic/Single/info',array('id'=>'buy'))}">《{$site['site_keyword']}购买协议》</a></p>
</div>
<!--提交订单-->
<div class="df_pay-buy">
<h3>合计:<strong id="pay_money2">¥{$lastPrice/$sple_score}</strong></h3>
<a href="javascript:;" onclick="buyOperat(this,{$goods_id});" type="submit">提交</a>
</div>
<form action="{:U('classroom/Pay/buyGoods')}" method="POST" id="buyfrom">
<if condition="$is_wx and in_array('wxpay',$payConfig['pay'])">
<input type="hidden" value="wxpay" name="pay" />
<else/>
<volist name="payWay" id="vo" offset="0" length="1">
<input type="hidden" value="{$vo}" name="pay" />
</volist>
</if>
<input type="hidden" value="{$lastPrice}" name="total" />
<input type="hidden" value="{$count}" name="count" />
<input type="hidden" value="{$goods_id}" name="goods_id" />
<input type="hidden" value="{$address.id}" name="address_id" />
</form>
</div>
</div>
</div>
<!--选择收货地址弹框-->
<div id="BOX" >
<div>选择收货地址</div>
<div>
<foreach name="address_list" item="l">
<div class="add" data-id="{$l.id}">
<div class="add_name">{$l.name}</div>
<div class="add_phone">{$l.phone}</div>
<div class="add_address">
<span class="add_address1">{$l.location}</span>
<span class="add_address2">{$l.address}</span>
</div>
</div>
</foreach>
</div> </div>
<van-icon class="self_center" name="__THEME__/img/picker_y@3x.png" size="20" ></van-icon>
</div>
</div>
<div style="margin: 1.5rem 0.75rem;" class="layout_h_v_c">
<van-icon @click="agree = !agree" size="22" :name="agree ? '__THEME__/img/picker_y@3x.png' : '__THEME__/img/unpicker.png'" style="margin-right: 0.5rem;"></van-icon>
我已阅读并同意<a href="{:U('basic/Single/info',array('id'=>'buy'))}"><span class="color_primary">《{$site['site_keyword']}购买协议》</span></a>
</div>
</div>
<div class="layout_h_v_c fixed_bottom_bar">
<span class="text_14_600 color_333333" style="margin-right: 0.5rem;">合计</span>
<span class="text_14_600 color_FF3B3B">¥{{totalPrice}}</span>
<span class="text_12_400 color_999999">{{discount}}</span>
<div class="weight_full layout_h_r">
<div @click="onBuy" class="vip_buy_pay_button layout_center"><span class="text_14_400 color_white">确认支付</span></div>
</div>
</div>
</div> </div>
<if condition="$is_wx eq false">
<style>
#_ts_box_h5{width:290px;height:180px;text-align: center;color: #535353;border-radius: 5px;position: fixed;background: #fff;-webkit-box-shadow: 0 2px 5px #dddddd;-moz-box-shadow: 0 2px 5px #dddddd;-khtml-box-shadow: 0 2px 5px #dddddd;-ms-box-shadow: 0 0 15px #888888;box-shadow: 0 0 15px #888888;z-index: 997;left: 5%;top: 35%;margin: 0 auto;background: #fff;}
._hide_box_h5{z-index:996;filter:alpha(opacity=50);background:#666;opacity: 0.5;-moz-opacity: 0.5;left:0;top:0;height:99%;width:100%;position:fixed;}
#_ts_box_h5 ._box_hd{padding: 20px 0px;color: black;font-size: 16px;border-bottom: 1px solid rgba(0, 0, 0, 0.16);}
#_layer-content{padding: 15px 0px;color: rgba(255, 35, 0, 0.69);font-size: 16px;border-bottom: 1px solid rgba(0, 0, 0, 0.1);}
._layer-wt{padding: 15px 0px;color: #908d8d;font-size: 16px;}
</style>
<div class="_hide_box_h5" style="display: none;"></div>
<div id="_ts_box_h5" style="display: none;">
<div class="_box_hd" >请确认微信支付是否完成</div>
<div id="_layer-content">已完成支付</div>
<div class="_layer-wt"><a href="{:U('classroom/Pay/buyGoods',['vst'=>$_GET['vst']])}">支付遇到问题,联系客服</a></div>
</div>
</if>
<script> <script>
new Vue({
$(function(){ el: "#app",
$(".df_pay-style dd:last-child").children("i").css("border","1px solid #ededed"); data: function() {
$(".df_pay-style dd").on("click",function(){ return {
var val = $(this).attr('value'), count: 1,
total = "{$lastPrice}", agree: false,
multiple = "{$sple_score}", info: "",
actual_pay = total/multiple; address: ""
}
$('input:hidden[name="pay"]').val(val); },
//$('input:hidden[name="total"]').val(actual_pay);
if(val == 'credpay'){
$("#pay_money,#pay_money2").text("¥"+actual_pay+" ("+total+"积分)");
}else{
$("#pay_money,#pay_money2").text("¥"+actual_pay);
}
$(this).children("i").attr("class","icon icon-xuanze").css("border","1px solid transparent").parent().siblings().children("i").removeAttr("class","icon icon-xuanze").css("border","1px solid #ededed");
});
$(".df_pay-protocol i").on("click",function(){
var proVal = $(this).attr("attr");
if(proVal==1){
$(this).attr("attr","0").css("color","#656565");
}else{
$(this).attr("attr","1").css("color","#57BC4C")
}
});
//修改地址操作
$(".icon-youjiantou").click(function(){
var param= "{$_GET['vst']}";
location.href="{:U('home/User/address')}"+'?'+'param'+'='+param;
});
})
'<if condition="$is_wx eq false">'
$(function(){
var wpay = "{$_GET['wpay']}";
var ppn = "{$_GET['ppn']}";
if(wpay != ''){
$('._hide_box_h5,#_ts_box_h5').show();
$('#_layer-content').click(function(){
$('._hide_box_h5,#_ts_box_h5').hide();
s = setInterval(function(){
$.ajax({
url: "{:U('classroom/Pay/getPayStatus')}",
data:{pay_pass_num:ppn},
type:'post',
success: function(res){
try{
res = JSON.parse(res);
if(res.status == 1){
clearInterval(s);
ui.success('购买成功');
setTimeout(function(){
window.location.href = res.data;
},2000);
}
}catch(e){
return;
}
}
});
},1800);
});
}
});
'</if>'
/**
* 删除字符串str的首尾空格
* @name trim
* @grammar UM.utils.trim(str) => String
*/
var trim =function (str) {
return str.replace(/(^[ \t\n\r]+)|([ \t\n\r]+$)/g, '');
}
//购买操作
var buyOperat = function(sbt,gid){
if(MID<=0){
ui.confirm('请先登录', {
yes: function () {
window.location.href = "{:U('basic/Passport/login')}";
}
});
return false;
}
if(!gid){
ui.error('参数错误');
return false;
}
var address_id = $('input:hidden[name="address_id"]').val();
if(!address_id){
ui.error("请选择收货地址");
return false;
}
if($('.df_pay-protocol i.icon-xuanze').attr('attr') != '1'){
ui.error("购买必须同意《{$site['site_keyword']}购买协议》");
return false;
}
var form = $(sbt).parents('form');
var pay = $('input:hidden[name="pay"]').val();
if(pay!='alipay' && pay!='wxpay' && pay!='credpay'){
ui.error('支付方式错误');
return false;
}
$(sbt).attr('style','background:rgba(102, 102, 102, 0.65)').removeAttr('onclick');
if(pay == 'wxpay'){
var s = 0;
$.ajax({
url: "{:U('classroom/Pay/buyGoods')}",
data:$('#buyfrom').serialize(),
async:false,
type:'post',
success: function(data){
if(typeof data != 'object'){
var data = eval('('+data+')');
}
clearInterval(s);
if(data.status == 1){
var pay_pass_num = data.data.pay_pass_num;
'<if condition="$is_wx">'
WeixinJSBridge.invoke(
'getBrandWCPayRequest',JSON.parse(data.data.html),
function(res){
if(res.err_msg == "get_brand_wcpay_request:ok" ){
s = setInterval(function(){
$.ajax({
url: "{:U('classroom/Pay/getPayStatus')}",
data:{pay_pass_num:pay_pass_num},
type:'post',
success: function(res){
try{
res = JSON.parse(res);
if(res.status == 1){
clearInterval(s);
ui.success('购买成功');
setTimeout(function(){
window.location.href = res.data;
},1500);
}
}catch(e){
return;
}
}
});
},1800);
}
}
);
'<else/>'
var a = document.createElement('a');
a.href = data.data.html;
a.click();
return false;
'</if>'
}else{
ui.error(data.info);
setTimeout(function(){
window.location.href = window.location.href;
},1500);
}
},
error: function(){
return false
}
});
}else {
if(pay == 'alipay'){
$("#buyfrom").submit();
}else{
var url = "{:U('mall/Goods/doSaveGoods')}";
}
$.ajax({
type: "POST",
url: url,
data:$('#buyfrom').serialize(),
dataType:"json",
success:function(res){
var res = getResponseData(res);
if(res.status == 1){
ui.success(res.message);
setTimeout(function(){
window.location.href = "{:U('mall/Goods/view',['id'=>$goods_id])}";
},'1500');
}else{
//显示提交按钮
setInterval(function(){
$(sbt).attr("onclick","buyOperat(this,'{$goods_id}')").removeAttr('style');
}, 1000);
ui.error(res.message);
return false;
}
}
});
}
}
window.onload=function(){
$(".add").on("click",function(){ created:function(){
var id = $(this).data('id'); let d = {:json_encode($data)};
$("input[name='address_id']").val(id); let ad = {:json_encode($address)};
$(".df_administration .name").html($(this).children('.add_name').html()) this.info = d
$(".df_administration .phone").html($(this).children('.add_phone').html()) this.address = ad
$(".df_administration .address").html($(this).children().children('.add_address1').html()) console.log(d)
$(".df_administration .xianzhilength").html($(this).children().children('.add_address2').html()) console.log(ad)
}) },
$(".df_administration").on("click",function(){
if($(".add").length>0){ computed: {
$(".body").css("display","none") hasAddress: function() {
$("#BOX").css("display","block") return this.address != "" && this.address != undefined
$("#BOX").on("click",".add",function(){ },
$("#BOX").css("display","none") totalPrice: function() {
$(".body").css("display","block") return this.info.lastPrice
}) },
$("#BOX").on("click",function(){ discount: function() {
$("#BOX").css("display","none") return "(运费:¥" + this.info.fare + ")"
$(".body").css("display","block") }
},
methods: {
onMinus: function() {
if(this.count - 1 > 1) {
this.count += 1
}
},
onPlus: function() {
this.count += 1
},
onBuy: function() {
if(MID <= 0) {
ui.confirm('请先登录', {
yes: function () {
window.location.href = "{:U('basic/Passport/login')}";
}
}) })
return
} }
}) let that = this
} if(!that.hasAddress) {
ui.error("请选择收货地址")
return
}
if(!that.agree) {
ui.error("购买必须同意《{$site['site_keyword']}购买协议》")
return
}
$.ajax({
url: "{:U('classroom/Pay/buyGoods')}",
data: {
goods_id: that.info.uid,
total: that.totalPrice,
count: that.count,
address_id: that.address.id,
pay: "wxpay"
},
async:false,
type:'post',
success: function(res) {
console.log(res)
if(res.status == 1) {
} else {
ui.error(res.info ? res.info : res.data)
}
}
})
},
checkPayStatus: function(num) {
let that = this
$.ajax({
url: "{:U('classroom/Pay/getPayStatus')}",
data:{ pay_pass_num: num},
type:'post',
success: function(res){
try{
res = JSON.parse(res)
if(res.status == 1){
ui.success('购买成功')
setTimeout(function(){
window.location.href = res.data
}, 1500);
} else {
that.setTimeout(() => { that.checkPayStatus(num) }, 1000)
}
}catch(e){
return
}
}
})
},
onAddress: function() {
let url = "{:U('home/User/address',['param'=>$_GET['vst']])}"
window.location.href = url
}
}
})
</script> </script>
......
<include file="__THEME__/public_header_w3g"/>
<link href="__APP__/css/pay_video_3g.css" rel="stylesheet">
<style>
#BOX{width: 100%;background-color: white;display:none;}
#BOX>div:nth-child(1){width:100%;height:40px;text-align: center;line-height:40px;border-bottom: solid 2px #d3d7db;font-size:16px;}
#BOX>div:nth-child(2){width:100%;border-bottom: solid 1px #d3d7db;}
.add{width: 90%;margin:0 auto; line-height: 40px;padding: 0 5px;margin: 5px auto;background-color: #f8f8f8;}
#BOX .add .add_name{float: left;}
#BOX .add .add_phone{float: right;}
#BOX .add .add_address{clear: both;}
.df_administration>dd>a{display:none;}
.df_administration>dd>div>p>a{margin-top:10px;text-align: right;}
.xianzhilength{width:70%;overflow:hidden; text-overflow: ellipsis;white-space: nowrap;display: inline-block;}
.body{
background-color: #f5f5f5;
}
</style>
<div class="body">
<div class="wrap">
<div class="min-height-wrap">
<div class="class_order_tit">确认订单</div>
<!--商品信息-->
<dl class="df_course-info">
<dt><h3>商品信息</h3></dt>
<dd>
<a href="{:U('mall/Goods/view',['id'=>$goods_id])}">
<span>
<img src="{:getCover($cover_id,120,120)}" width="120" height="70" alt="{:mStr($title,10)}">
</span>
<h3>{:mStr($title,20)}</h3>
<div>{:mStr($info,50)}</div>
</a>
</dd>
</dl>
<!--支付方式-->
<dl class="df_pay-style">
<dt><h3>支付方式</h3></dt>
<php>if($is_wx){unset($payWay['支付宝支付']);}$firstPayWay = current($payWay);</php>
<if condition="in_array('alipay',$payConfig['pay']) and ($is_wx eq false)">
<dd value="alipay" class="paytype"><a class="icon icon-zhifubao1"></a><span class="name">支付宝</span><i <if condition='($firstPayWay eq alipay)'>class="icon icon-xuanze"</if>></i></dd>
</if>
<if condition="in_array('wxpay',$payConfig['pay'])">
<dd value="wxpay" class="paytype"><a class="icon icon-weixinzhifu1"></a><span class="name">微信支付</span><i <if condition='$is_wx or $firstPayWay eq wxpay'>class="icon icon-xuanze"</if> style="border: 1px solid rgb(237, 237, 237);"></i></dd>
</if>
<if condition="in_array('credpay',$payConfig['pay'])">
<dd value="credpay" class="paytype"><a class="icon icon-iconfont"></a><span class="name">积分支付</span><span>(剩余积分{$credit|default=0})</span><i <if condition='($firstPayWay eq credpay)'>class="icon icon-xuanze"</if> style="border: 1px solid rgb(237, 237, 237);"></i></dd>
</if>
</dl>
<p class="other">注:人民币与积分的兑换比例为 {$split_score_pro}</p>
<!-- 新增功能-收货管理 -->
<dl class="df_administration">
<a href="JavaScript:">
<dt><h3>收货管理</h3></dt>
<dd>
<div>
<p>
<if condition="$address">
<span class="name">{$address.name} </span>
<span class="phone"> {$address.phone}</span>
<span class="address">{$address.location}</span><!-- 修改-->
<span class="xianzhilength"> {$address.address}</span>
<else/>
<a class="xinzeng" href="{:U('home/User/address',['param'=>$_GET['vst']])}">新增地址</a>
</if>
</p>
<if condition="$address_list">
<i class="icon icon-youjiantou"></i>
</if>
</div>
</dd>
</a>
</dl>
<!--实付金额-->
<dl class="df_pay-price">
<dd><h3>实付金额</h3><p id="pay_money">¥{$lastPrice/$sple_score}</p></dt>
</dl>
<!--购买协议-->
<div class="df_pay-protocol">
<p><i class="icon icon-xuanze" attr="1"></i>我已阅读并同意<a href="{:U('basic/Single/info',array('id'=>'buy'))}">《{$site['site_keyword']}购买协议》</a></p>
</div>
<!--提交订单-->
<div class="df_pay-buy">
<h3>合计:<strong id="pay_money2">¥{$lastPrice/$sple_score}</strong></h3>
<a href="javascript:;" onclick="buyOperat(this,{$goods_id});" type="submit">提交</a>
</div>
<form action="{:U('classroom/Pay/buyGoods')}" method="POST" id="buyfrom">
<if condition="$is_wx and in_array('wxpay',$payConfig['pay'])">
<input type="hidden" value="wxpay" name="pay" />
<else/>
<volist name="payWay" id="vo" offset="0" length="1">
<input type="hidden" value="{$vo}" name="pay" />
</volist>
</if>
<input type="hidden" value="{$lastPrice}" name="total" />
<input type="hidden" value="{$count}" name="count" />
<input type="hidden" value="{$goods_id}" name="goods_id" />
<input type="hidden" value="{$address.id}" name="address_id" />
</form>
</div>
</div>
</div>
<!--选择收货地址弹框-->
<div id="BOX" >
<div>选择收货地址</div>
<div>
<foreach name="address_list" item="l">
<div class="add" data-id="{$l.id}">
<div class="add_name">{$l.name}</div>
<div class="add_phone">{$l.phone}</div>
<div class="add_address">
<span class="add_address1">{$l.location}</span>
<span class="add_address2">{$l.address}</span>
</div>
</div>
</foreach>
</div>
</div>
<if condition="$is_wx eq false">
<style>
#_ts_box_h5{width:290px;height:180px;text-align: center;color: #535353;border-radius: 5px;position: fixed;background: #fff;-webkit-box-shadow: 0 2px 5px #dddddd;-moz-box-shadow: 0 2px 5px #dddddd;-khtml-box-shadow: 0 2px 5px #dddddd;-ms-box-shadow: 0 0 15px #888888;box-shadow: 0 0 15px #888888;z-index: 997;left: 5%;top: 35%;margin: 0 auto;background: #fff;}
._hide_box_h5{z-index:996;filter:alpha(opacity=50);background:#666;opacity: 0.5;-moz-opacity: 0.5;left:0;top:0;height:99%;width:100%;position:fixed;}
#_ts_box_h5 ._box_hd{padding: 20px 0px;color: black;font-size: 16px;border-bottom: 1px solid rgba(0, 0, 0, 0.16);}
#_layer-content{padding: 15px 0px;color: rgba(255, 35, 0, 0.69);font-size: 16px;border-bottom: 1px solid rgba(0, 0, 0, 0.1);}
._layer-wt{padding: 15px 0px;color: #908d8d;font-size: 16px;}
</style>
<div class="_hide_box_h5" style="display: none;"></div>
<div id="_ts_box_h5" style="display: none;">
<div class="_box_hd" >请确认微信支付是否完成</div>
<div id="_layer-content">已完成支付</div>
<div class="_layer-wt"><a href="{:U('classroom/Pay/buyGoods',['vst'=>$_GET['vst']])}">支付遇到问题,联系客服</a></div>
</div>
</if>
<script>
$(function(){
$(".df_pay-style dd:last-child").children("i").css("border","1px solid #ededed");
$(".df_pay-style dd").on("click",function(){
var val = $(this).attr('value'),
total = "{$lastPrice}",
multiple = "{$sple_score}",
actual_pay = total/multiple;
$('input:hidden[name="pay"]').val(val);
//$('input:hidden[name="total"]').val(actual_pay);
if(val == 'credpay'){
$("#pay_money,#pay_money2").text("¥"+actual_pay+" ("+total+"积分)");
}else{
$("#pay_money,#pay_money2").text("¥"+actual_pay);
}
$(this).children("i").attr("class","icon icon-xuanze").css("border","1px solid transparent").parent().siblings().children("i").removeAttr("class","icon icon-xuanze").css("border","1px solid #ededed");
});
$(".df_pay-protocol i").on("click",function(){
var proVal = $(this).attr("attr");
if(proVal==1){
$(this).attr("attr","0").css("color","#656565");
}else{
$(this).attr("attr","1").css("color","#57BC4C")
}
});
//修改地址操作
$(".icon-youjiantou").click(function(){
var param= "{$_GET['vst']}";
location.href="{:U('home/User/address')}"+'?'+'param'+'='+param;
});
})
'<if condition="$is_wx eq false">'
$(function(){
var wpay = "{$_GET['wpay']}";
var ppn = "{$_GET['ppn']}";
if(wpay != ''){
$('._hide_box_h5,#_ts_box_h5').show();
$('#_layer-content').click(function(){
$('._hide_box_h5,#_ts_box_h5').hide();
s = setInterval(function(){
$.ajax({
url: "{:U('classroom/Pay/getPayStatus')}",
data:{pay_pass_num:ppn},
type:'post',
success: function(res){
try{
res = JSON.parse(res);
if(res.status == 1){
clearInterval(s);
ui.success('购买成功');
setTimeout(function(){
window.location.href = res.data;
},2000);
}
}catch(e){
return;
}
}
});
},1800);
});
}
});
'</if>'
/**
* 删除字符串str的首尾空格
* @name trim
* @grammar UM.utils.trim(str) => String
*/
var trim =function (str) {
return str.replace(/(^[ \t\n\r]+)|([ \t\n\r]+$)/g, '');
}
//购买操作
var buyOperat = function(sbt,gid){
if(MID<=0){
ui.confirm('请先登录', {
yes: function () {
window.location.href = "{:U('basic/Passport/login')}";
}
});
return false;
}
if(!gid){
ui.error('参数错误');
return false;
}
var address_id = $('input:hidden[name="address_id"]').val();
if(!address_id){
ui.error("请选择收货地址");
return false;
}
if($('.df_pay-protocol i.icon-xuanze').attr('attr') != '1'){
ui.error("购买必须同意《{$site['site_keyword']}购买协议》");
return false;
}
var form = $(sbt).parents('form');
var pay = $('input:hidden[name="pay"]').val();
if(pay!='alipay' && pay!='wxpay' && pay!='credpay'){
ui.error('支付方式错误');
return false;
}
$(sbt).attr('style','background:rgba(102, 102, 102, 0.65)').removeAttr('onclick');
if(pay == 'wxpay'){
var s = 0;
$.ajax({
url: "{:U('classroom/Pay/buyGoods')}",
data:$('#buyfrom').serialize(),
async:false,
type:'post',
success: function(data){
if(typeof data != 'object'){
var data = eval('('+data+')');
}
clearInterval(s);
if(data.status == 1){
var pay_pass_num = data.data.pay_pass_num;
'<if condition="$is_wx">'
WeixinJSBridge.invoke(
'getBrandWCPayRequest',JSON.parse(data.data.html),
function(res){
if(res.err_msg == "get_brand_wcpay_request:ok" ){
s = setInterval(function(){
$.ajax({
url: "{:U('classroom/Pay/getPayStatus')}",
data:{pay_pass_num:pay_pass_num},
type:'post',
success: function(res){
try{
res = JSON.parse(res);
if(res.status == 1){
clearInterval(s);
ui.success('购买成功');
setTimeout(function(){
window.location.href = res.data;
},1500);
}
}catch(e){
return;
}
}
});
},1800);
}
}
);
'<else/>'
var a = document.createElement('a');
a.href = data.data.html;
a.click();
return false;
'</if>'
}else{
ui.error(data.info);
setTimeout(function(){
window.location.href = window.location.href;
},1500);
}
},
error: function(){
return false
}
});
}else {
if(pay == 'alipay'){
$("#buyfrom").submit();
}else{
var url = "{:U('mall/Goods/doSaveGoods')}";
}
$.ajax({
type: "POST",
url: url,
data:$('#buyfrom').serialize(),
dataType:"json",
success:function(res){
var res = getResponseData(res);
if(res.status == 1){
ui.success(res.message);
setTimeout(function(){
window.location.href = "{:U('mall/Goods/view',['id'=>$goods_id])}";
},'1500');
}else{
//显示提交按钮
setInterval(function(){
$(sbt).attr("onclick","buyOperat(this,'{$goods_id}')").removeAttr('style');
}, 1000);
ui.error(res.message);
return false;
}
}
});
}
}
window.onload=function(){
$(".add").on("click",function(){
var id = $(this).data('id');
$("input[name='address_id']").val(id);
$(".df_administration .name").html($(this).children('.add_name').html())
$(".df_administration .phone").html($(this).children('.add_phone').html())
$(".df_administration .address").html($(this).children().children('.add_address1').html())
$(".df_administration .xianzhilength").html($(this).children().children('.add_address2').html())
})
$(".df_administration").on("click",function(){
if($(".add").length>0){
$(".body").css("display","none")
$("#BOX").css("display","block")
$("#BOX").on("click",".add",function(){
$("#BOX").css("display","none")
$(".body").css("display","block")
})
$("#BOX").on("click",function(){
$("#BOX").css("display","none")
$(".body").css("display","block")
})
}
})
}
</script>
<include file="__THEME__/public_footer_w3g" />
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
</style> </style>
<div id="app"> <div id="app">
<div class="layout_v"> <div class="layout_v" style="padding-bottom: 5rem;">
<div class="goods_detail_top layout_v"> <div class="goods_detail_top layout_v">
<van-image width="100%" height="160" :src="info.cover" ></van-image> <van-image width="100%" height="160" :src="info.cover" ></van-image>
<span class="text_18_600 color_333333" style="margin: 0.75rem;margin-bottom: 0;">{{info.title}}</span> <span class="text_18_600 color_333333" style="margin: 0.75rem;margin-bottom: 0;">{{info.title}}</span>
...@@ -27,21 +27,20 @@ ...@@ -27,21 +27,20 @@
<div class="weight_full layout_h_r"> <div class="weight_full layout_h_r">
<div @click="onBuy" class="vip_buy_pay_button layout_center"><span class="text_14_400 color_white">立即购买</span></div> <div @click="onBuy" class="vip_buy_pay_button layout_center"><span class="text_14_400 color_white">立即购买</span></div>
<span style="margin-right: 0.75rem;" class="text_12_400 color_999999 self_center">0</span> <span style="margin-right: 0.75rem;" class="text_12_400 color_999999 self_center">{{info.num}}人已购买</span>
</div> </div>
</div> </div>
</div> </div>
<script> <script>
let uid = '{$uid}'
new Vue({ new Vue({
el: "#app", el: "#app",
created:function(){ created:function(){
this.info = {:json_encode($data)}; this.info = {:json_encode($data)};
this.order = {:json_encode($goodsOrder)};
console.log(this.info) console.log(this.info)
console.log(this.order)
}, },
data: function() { data: function() {
...@@ -53,8 +52,32 @@ ...@@ -53,8 +52,32 @@
methods: { methods: {
onBuy: function() { onBuy: function() {
if(uid<=0) {
} ui.confirm('请先登录', {
yes: function () {
window.location.href = "{:U('basic/Passport/login')}"
}
})
} else {
$.ajax({
type: "POST",
url: "{:U('mall/Goods/getPayUrl')}",
data:{
count: 1,
goods_id: this.info.uid,
},
dataType:"json",
success:function(res){
var res = getResponseData(res);
if(res.status == 1){
window.location.href = res.data;
}else{
ui.error(res.message);
}
}
})
}
},
} }
}) })
</script> </script>
......
<include file="__THEME__/public_header_w3g"/>
<!-- <script src="__THEME__/js/core.js"></script>
<script src="__THEME__/js/common.js"></script>
<link rel="stylesheet" href="__APP__/css/view_3g.css"> -->
<div id="app">
<div class="layout_v">
</div>
</div>
<div class="body">
<div class="malltop clearfix">
<img class="bg" src="{:getCover($data['cover_id'],360,360)}" alt="{$data.title}" />
<a class="malltop_nav" href="javascript:history.go(-1);"></a>
<div class="boxcont">
<div class="briefIntr">
{$data.title}
</div>
<div class="Price_new">
<p><if condition="in_array('credpay',$payConfig['pay'])">积分<else/>金额</if><input type="hidden" id="price" name="price" value="{$data.price}" /><if condition="in_array('credpay',$payConfig['pay'])">{$data.price}<else/>{$data['price']/$sple_score}</if> <span>(快递费:<if condition="in_array('credpay',$payConfig['pay'])">{$data.fare}积分<else/>¥{$data['fare']/$sple_score}</if></span></p>
<p>兑换人数:{$data.goods_count}</p>
</div>
<div class="portant">
<div>
<span class="exchange">兑换数量</span>
<div>
<a class="adbtn minus" href="javascript:;">-</a>
<input id="count" name="count" type="text" value="1" onkeyup="formatMoneyWith6digts(this);"/>
<a class="adbtn add" href="javascript:;">+</a>
</div>
<if condition="$data.stock heq 0">
<span style="color: #FF3C41;">(无货)</span>
<else/>
<span style="color: #7B7B7B;">(有货)</span>
</if>
</div>
<div>
<if condition="$data.stock heq 0">
<a class="clickhd" href="javascript:;" style='background-color: gray'>兑换</a>
<else />
<a class="clickhd" href="javascript:;" onclick="saveGoods();">兑换</a>
</if>
</div>
</div>
</div>
<!-- <div class="txt">
<div class="info">
<div class="fl">所需<if condition="in_array('credpay',$payConfig['pay'])">积分<else/>金额</if><input type="hidden" id="price" name="price" value="{$data.price}" /><span><if condition="in_array('credpay',$payConfig['pay'])">{$data.price}<else/>{$data['price']/$sple_score}</if></span></div>
<ul class="fr">
<li><p>{$data.stock}</p>仓库剩余</li>
<li><p>{$data.goods_count}</p>兑换人数</li>
</ul>
</div>
<dl>
<dt>配送</dt>
<php>if($address['location']){</php>
<dd id="charge_address">
<em id="old">{$address.location}&nbsp;&nbsp;{$address.address}</em>
</dd>
<php>}else{</php>
<a href="{:U('home/User/address')}" style="color: #188eee;">新增地址</a>
<php>}</php>
<input class="address_id" name="address_id" value="{$address.id}" type="hidden" />
<dt>快递费</dt>
<dd><if condition="in_array('credpay',$payConfig['pay'])">{$data.fare}积分<else/>¥{$data['fare']/$sple_score}</if></dd>
</dl>
<dl>
<dt>简介</dt>
<dd><php>if($data['info']){</php>{$data.info|msubstr=0,87,'utf-8',true}<php>}else{</php>暂时没有该商品的相关简介<php>}</php></dd>
</dl>
<dl class="position">
<dt>数量</dt>
<dd>
<a class="adbtn minus" href="javascript:;">-</a>
<input id="count" name="count" type="text" value="1" onkeyup="formatMoneyWith6digts(this);"/>
<a class="adbtn add" href="javascript:;">+</a><span>件</span>
</dd>
<a class="dh" href="javascript:;" onclick="saveGoods();">兑换</a>
</dl>
</div> -->
</div>
<div class="mallbot">
<div class="mallmain-hd">
<ul>
<li class="choose on"><a href="javascript:;">详情</a></li>
<li class="choose"><a href="javascript:;">兑换记录</a></li>
</ul>
</div>
<div class="mallmain-bd goodsInfo" style="display: block;font-size: 13px;">
<php>if(!$data['details']){</php>
<p>暂时没有该商品的详情介绍</p>
<php>}else{</php>
{$data.details}
<php>}</php>
</div>
<div class="mallmain-bd goodsInfo" style="display: none;">
<ul class="mallrecordlist">
<php>if(!$goodsOrder){</php>
<li><span>暂时还没有人兑换过该商品</span></li>
<php>}else{</php>
<volist name="goodsOrder" id="re" offset="0" length="6">
<li>
<img src="{:getUserFace($re['uid'],'m')}" alt="{$re.uname}">
<h3><span>{$re.ctime}</span>{$re.uname}</h3>
<p><span>{$re.price}</span>积分兑换了{$re.count}个{$re['goods_info'].title}</p>
</li>
</volist>
<php>}</php>
</ul>
</div>
</div>
</div>
<a class="backtop"></a>
<script>
$(function(){
$(".choose").click(function(){
$(this).addClass("on").siblings().removeClass();
var index = $(this).index();
$(".goodsInfo").hide().eq(index).show();
});
var total_count = '{$data.stock}';
if(total_count < 1){
total_count = 1;
}
$(".add").click(function(){
var t =$(this).prev("input");
var num = parseInt(t.val());
if( num >= total_count){
t.val(total_count);
}else{
t.val(num+1);
}
});
$(".minus").click(function(){
var inputObj = $(this).next("input");
var t=parseInt(inputObj.val());
if(t <= 1){
inputObj.val(1);
}else{
inputObj.val(t-1);
}
});
//地址选择操作
$("#charge_address").click(function(){
ui.box.load(U('mall/Goods/getAddress'),'选择收货地址');
});
});
/*function changeAddress() {
var address_id = $("input[type='radio']:checked").val();
if(!address_id || address_id == '' || address_id == undefined){
ui.error("请选择地址");
return false;
}
$.post(U('mall/Goods/getAddress'),{address_id:address_id},function(msg){
var msg = getResponseData(msg);
if(msg.status == 1){
$(".address_id").val(msg.data['id']);
msg.data = msg.data['location'] + msg.data['address'];
$("#old").html(msg.data);
ui.box.close();
}
});
};*/
// 关闭弹窗
function cancel() {
ui.box.close();
}
function formatMoneyWith6digts( obj ){
obj.value = obj.value.replace(/\D/g,'')
var stock = parseInt('{$data.stock}');
if(obj.value < 1){
obj.value = 1;
}
if(obj.value > stock){
obj.value = stock;
}
}
var uid = '{$uid}';
var goods_id = "{$data['goods_id']}";
function saveGoods(){
if(uid<=0){
ui.confirm('请先登录', {
yes: function () {
window.location.href = "{:U('basic/Passport/login')}";
}
});
return false;
}
var price = $("#price").val();
var count = $("#count").val();
var fare = '{$data.fare}';
var total = price * count;
var goods_id = '{$Think.get.id}';
/*var address_id = $(".address_id").val();
if(!address_id){
ui.error("请选择收货地址");
return false;
}*/
$.ajax({
type: "POST",
url: "{:U('mall/Goods/getPayUrl')}",
data:{
count:count,
goods_id:goods_id,
//address_id:address_id,
},
dataType:"json",
success:function(res){
var res = getResponseData(res);
if(res.status == 1){
window.location.href = res.data;
}else{
ui.error(res.message);
return false;
}
}
});
/*ui.confirm("确定要花费"+total+"积分兑换"+count+"个{$data.title}?", {
yes: function () {
$.ajax({
type: "POST",
url:"{:U('mall/Goods/doSaveGoods')}",
data:{
count:count,
total:total,
fare:fare,
goods_id:goods_id,
address_id:address_id,
},
dataType:"json",
success:function(res){
var res = getResponseData(res);
if(res.status == 1){
ui.success(res.message);
setTimeout(function(){
location.reload();
},'1500');
}else{
ui.error(res.message);
return false;
}
}
});
}
});*/
}
function charge_address(){
ui.box.load(U('mall/Goods/getAddress'),'选择收货地址');
}
</script>
<include file="__THEME__/public_footer_w3g"/>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment