123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238 |
- <div class="weui-btn-area">
- <div style="display:flex; flex-direction: row; justify-content: space-between">
- <div class="weui-flex__item">
- <div class="placeholder" style="display: inline;align-items: flex-start">当前参团:</div>
- <div style="display: inline;align-items: flex-start" id="Buycount"></div>
- </div>
- </div>
- <div class="weui-flex__item">
- <div style="display: inline;align-items: flex-end">状 态:</div>
- <div style="display: inline;margin-top: 1vh;" id="myStatus"></div>
- </div>
- <div class="weui-flex__item" id="xe1">
- <div style="display: inline;align-items: flex-end">单人限额:</div>
- <div style="display: inline;margin-top: 1vh;" id="xe"></div>
- </div>
- <div class="weui-flex__item" id="tc1">
- <div style="display: inline;align-items: flex-end">剩余套餐(份):</div>
- <div style="display: inline;margin-top: 1vh;" id="tc"></div>
- </div>
- <div class="weui-flex" style="display:flex; flex-direction: row; justify-content: space-between">
- <div class="weui-flex__item">
- <div style="display: inline;align-items: flex-start">我的团购:</div>
- <div style="display: inline;">
- <input type="text" id="buyCount"
- style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh; width: 50%;font-size: 16px;margin-top: 1vh;"
- onkeyup="this.value=this.value.replace(/[^0-9-]+/,'');" min="1" maxlength="4"
- onchange="changeBuy()">
- </div>
- </div>
- </div>
- <div class="weui-flex__item">
- <div style="display: inline;">金 额¥:</div>
- <div style="display: inline;font-size: 16px" id="myMenory"></div>
- </div>
- <div class="weui-flex">
- <div class="weui-flex__item">
- <div style="display: inline;">联系电话:</div>
- <div class="weui-flex__item" style="display: inline;">
- <input type="text" maxlength="11" id="myPhone" onkeyup="value=value.replace(/[^\d]/g,'')"
- maxlength=11
- style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh; width: 50%;font-size: 16px;margin-top: 1vh;">
- </div>
- </div>
- </div>
- <div style=" flex-direction: row; justify-content: space-between;">
- <div style="display: inline;align-items: flex-start"
- ">备 注:
- </div>
- <textarea id="Myremarks" class="weui-textarea" placeholder="输入内容(200字内)" rows="3"
- style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; margin-top: 1vh;"
- maxlength="200"></textarea>
- </div>
- <div style="display:flex; flex-direction: row; justify-content: space-between; margin-top: 1vh; margin-bottom: 5vh;">
- <#if type==1>
- <a onclick="buyBack()" href="javascript:;" class="weui-btn weui-btn_default"
- style="margin-top: 0;width: 30%;">返回</a>
- <#else>
- <a id="MybuyRepeal" onclick="MybuyBack()" href="javascript:;" class="weui-btn weui-btn_default"
- style="margin-top: 0;width: 30%;">撤销</a>
- <a onclick="buyBack()" href="javascript:;" class="weui-btn weui-btn_default"
- style="margin-top: 0;width: 30%;">返回</a>
- </#if>
- <a id="buyCommit" onclick="buyCommit()" href="javascript:;" class="weui-btn weui-btn_primary"
- style="margin-top: 0;width: 30%;">提交</a>
- </div>
- </div>
- <#include "/home/frag.foot.ftl" />
- <script>
- (function ($) {
- $.ajax({
- url: '/query/getAll/status',
- data: {
- jmId: $('#jmBuy').val(),
- userId: $('#buyuserId').val(),
- },
- type: 'GET',
- success: function (data) {
- console.log(data);
- $("#Buycount").html(data.data.count);
- $("#myStatus").html(getStatus(data.data.tgStatus));
- $("#myPhone").val(data.data.phone);
- if (data.data.roleType == 1) {
- $("#tc1").toggle();
- } else {
- $("#tc").html(data.data.tgMaxNum - data.data.count);
- }
- if (data.data.myRemark != null)
- $('#Myremarks').text(data.data.myRemark);
- if (data.data.buyMoney != null)
- $('#buyCount').val(data.data.buyCount);
- if (data.data.buyMoney != null)
- $('#myMenory').text(Math.round(data.data.buyMoney * 10) / 10);
- if (data.data.tgItemNum == 0) {
- $('#xe1').toggle();
- } else {
- $('#xe').html(data.data.tgItemNum);
- }
- },
- error: function () {
- }
- });
- })(jQuery);
- <#--返回-->
- function buyBack() {
- // window.history.back();
- window.location.href = "/user/homeIndex.html?userId=" + $('#buyuserId').val() + "&userType=" + 1 + "&show=tuangou";
- }
- /*撤销*/
- function MybuyBack() {
- $.ajax({
- url: '/home/back/buyBack',
- data: {
- userId: $('#buyuserId').val(),
- buyCount: $('#buyCount').val(),
- phone: $('#myPhone').val(),
- myRemark: $('#Myremarks').val(),
- buyMoney: $('#myMenory').text(),
- jmId: $('#jmBuy').val(),
- },
- type: 'GET',
- success: function (data) {
- console.log(data);
- if (data.data == 1) {
- buyBack();
- } else {
- $.alert("该套餐已过截止日期或者已发货中不允许撤单");
- }
- },
- error: function () {
- }
- });
- }
- //提交
- function buyCommit() {
- if ($('#buyCount').val() == '' || $('#buyCount').val() == undefined) {
- $.alert("请填写团购数量");
- return;
- }
- if ($('#myPhone').val() == undefined || $('#myPhone').val() == '') {
- $.alert("请填写联系电话");
- return;
- }
- if (!(/^1[345789]\d{9}$/.test($('#myPhone').val()))) {
- $.alert("手机号码有误,请重填");
- return false;
- }
- /* if ($('#Myremarks').val() == undefined || $('#Myremarks').val() == '') {
- $.alert("请填写备注");
- return;
- }*/
- changeBuy();
- $.ajax({
- url: '/home/home/buyGroup',
- data: {
- userId: $('#buyuserId').val(),
- buyCount: $('#buyCount').val(),
- phone: $('#myPhone').val(),
- myRemark: $('#Myremarks').val(),
- buyMoney: $('#myMenory').text(),
- jmId: $('#jmBuy').val(),
- count: $('#tc').html(),
- },
- type: 'GET',
- async: false,
- success: function (data) {
- console.log(data.data);
- if (data.data == 3) {
- if ($("#tc").html() == 0) {
- $.alert("团购套餐已售空");
- return false;
- }
- $.alert("团购套餐只剩" + $('#tc').html() + "份");
- return false;
- } else if (data.data == 4) {
- $.alert("团购数量已经超过单人限额");
- return false;
- }
- buyBack();
- },
- error: function () {
- }
- });
- }
- //输入购买的数量
- function changeBuy() {
- if ($('#buyCount').val() < 1) {
- $('#buyCount').val('')
- $.alert('请输入大于0的整数')
- return;
- }
- $.ajax({
- url: '/query/getAll/status',
- data: {
- jmId: $('#jmBuy').val(),
- userId: $('#buyuserId').val(),
- },
- type: 'GET',
- async: false,
- success: function (data) {
- console.log(data);//
- $("#myMenory").html(Math.round($('#buyCount').val() * data.data.tgPrice * 10) / 10)
- },
- error: function () {
- }
- });
- }
- //1 在团 2 发货 3完成 4取消',
- function getStatus(v) {
- if (v == 1) {
- return "<span style='color:green;'>在团</span>";
- } else if (v == 2) {
- return "<span style='color:Black;'>发货</span>";
- } else if (v == 3) {
- return "完成";
- } else if (v == 4) {
- return "<span style='color:red;'>取消</span>";
- }
- }
- </script>
|