Commit 7f75e0ff697b94278ff85fbd8dc06bc8af66eee5
1 parent
61508808
Exists in
master
1. 商品隐藏信息页面功能实现。
Showing
6 changed files
with
139 additions
and
1 deletions
Show diff stats
app-wx/modules/check/controllers/DefaultController.php
... | ... | @@ -165,6 +165,7 @@ class DefaultController extends BaseController |
165 | 165 | { |
166 | 166 | $e = new stdClass(); |
167 | 167 | $e->success = false; |
168 | + $e->data = ""; | |
168 | 169 | $e->message = ''; |
169 | 170 | $numberCode = $this->request->post('number_code'); |
170 | 171 | $uuid = $this->request->post('uuid'); |
... | ... | @@ -181,7 +182,9 @@ class DefaultController extends BaseController |
181 | 182 | $e->message = '提取码错误!'; |
182 | 183 | return $this->renderJson($e); |
183 | 184 | } |
185 | + $hasRecord->product_image_path = ImageManager::getUrl($hasRecord->product_image_path); | |
184 | 186 | $e->success = true; |
187 | + $e->data = $hasRecord->toArray(); | |
185 | 188 | $e->message = '获取成功!'; |
186 | 189 | return $this->renderJson($e); |
187 | 190 | } | ... | ... |
app-wx/modules/check/views/default/index.php
... | ... | @@ -27,6 +27,7 @@ $redirectInfo=$this->context->checkUserLevel('', true, "none"); |
27 | 27 | <?=$this->render('pages/submit-template', ['asset' => $asset])?> |
28 | 28 | <?=$this->render('pages/error-template', ['asset' => $asset])?> |
29 | 29 | <?=$this->render('pages/success-template', ['asset' => $asset])?> |
30 | +<?=$this->render('pages/info-template', ['asset' => $asset])?> | |
30 | 31 | |
31 | 32 | <script> |
32 | 33 | var redirect="<?=$redirectInfo['redirect_url']?>"; | ... | ... |
app-wx/modules/check/views/default/pages/info-template.php
0 → 100644
... | ... | @@ -0,0 +1,67 @@ |
1 | +<?php | |
2 | + | |
3 | +use yii\helpers\Url; | |
4 | + | |
5 | +$baseUrl = Url::base(true); | |
6 | +?> | |
7 | +<style> | |
8 | + #info .page-content { | |
9 | + background-color: #fff; | |
10 | + } | |
11 | + #info .scan-image-div { | |
12 | + padding-top: 1.25rem; | |
13 | + text-align: center; | |
14 | + } | |
15 | + #info .scan-image { | |
16 | + width: 11.25rem; | |
17 | + height: 11.03rem; | |
18 | + margin: 0 auto; | |
19 | + } | |
20 | + #info .scan-tip { | |
21 | + margin: 0 auto; | |
22 | + width: 85%; | |
23 | + font-size:0.94rem; | |
24 | + text-align: left; | |
25 | + font-weight:400; | |
26 | + color:rgba(106,106,106,1); | |
27 | + line-height:1.41rem; | |
28 | + margin-top: 1.84rem; | |
29 | + } | |
30 | + | |
31 | + #info .title{ | |
32 | + font-size:1.06rem; | |
33 | + font-weight:500; | |
34 | + color:rgba(0,0,0,1); | |
35 | + line-height:1.68rem; | |
36 | + } | |
37 | + | |
38 | + #info .content{ | |
39 | + font-size:0.94rem; | |
40 | + font-weight:400; | |
41 | + color:rgba(106,106,106,1); | |
42 | + line-height:1.41rem; | |
43 | + } | |
44 | +</style> | |
45 | +<script id="info-template" type="text/template"> | |
46 | + <div class="pages" id="info"> | |
47 | + <div class="page"> | |
48 | + <div class="page-content"> | |
49 | + <div class="scan-image-div"> | |
50 | + <img src="{{#js_compare "this.product_image_path != ''"}}{{product_image_path}}{{else}}<?=$baseUrl?>/i/check/error.png{{/js_compare}}" class="scan-image"/> | |
51 | + </div> | |
52 | + <div class="scan-tip"> | |
53 | + <div class="title"> | |
54 | + 发货地址: | |
55 | + </div> | |
56 | + <div class="content" id="send_address">{{delivery_address}}</div> | |
57 | + </div> | |
58 | + <div class="scan-tip"> | |
59 | + <div class="title"> | |
60 | + 商家留言: | |
61 | + </div> | |
62 | + <div class="content" id="leavemsg">{{leave_message}}</div> | |
63 | + </div> | |
64 | + </div> | |
65 | + </div> | |
66 | + </div> | |
67 | +</script> | ... | ... |
app-wx/web/dist/js/check-app.js
1 | -define("check-app",["mk7/app"],function(n){var e=Dom7,t=function(){var n=e(".ui-loading-block");0==n.length&&(e(".view-main").html('<div class="ui-loading-block" id="ui-loading"><div class="ui-loading-cnt"><div class="spinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div><div id="loader-inner"><p></p></div> </div> </div>'),window.waitingTime=1e4,window.loaderTimer&&clearTimeout(window.loaderTimer),window.loaderTimer=setTimeout(function(){var n=document.getElementById("loader-inner"),e=document.createElement("p");e.className="notice",n&&(e.innerHTML='加载速度太慢?试试<a class="link" href="#" onclick="javascript:location.reload();return false;">重新加载</a>',n.appendChild(e))},window.waitingTime))},o=!0;return n.name="check",n.routes={index:function(){return o=!1,t(),n.runController("index")},"*":function(){return o=!1,t(),n.runController("index")},"scan-count/:uuid/:scancount":function(e,i){return o=!1,t(),n.runController("scan-count",{uuid:e,scancount:i})},"warning/:uuid":function(e){return o=!1,t(),n.runController("warning",{uuid:e})},"submit/:uuid":function(e){return o=!1,t(),n.runController("submit",{uuid:e})},"error/:uuid":function(e){return o=!1,t(),n.runController("error",{uuid:e})},"success/:uuid":function(e){return o=!1,t(),n.runController("success",{uuid:e})}},n}),define("check/error-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,e,t,o,i){var n=new n,c=Dom7;Template7;return n.run=function(){var n=this;n.setPageTitle("验证结果"),n.render()},n.bindEvents=function(){c(".back-button").click(function(){window.history.go(-1)})},n}),define("check/index-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,e,t,o,i){var n=new n,c=Dom7,r=(Template7,1),a=0,u=2,s=0;return n.run=function(){var n=this;n.setPageTitle("验证标签"),i.config({debug:!1,appId:window.$site.appid,timestamp:window.$site.timestamp,nonceStr:window.$site.noncestr,signature:window.$site.signature,jsApiList:["openLocation","getLocation","scanQRCode"]}),n.scanQrcode(),n.render()},n.bindEvents=function(){var n=this;c(".scan-button").click(function(){n.scanQrcode()})},n.scanQrcode=function(){var n=this;i.ready(function(){i.scanQRCode({needResult:1,desc:"scanQRCode desc",success:function(o){var i=o.resultStr,d=c.parseUrlQuery(i);if(null!=d&&void 0!==d&&null!=d.uuid&&void 0!==d.uuid){var d=d.uuid.split("@"),l=e.to("smart#enter/"+d[0]),m=e.to("check#scan-count/"+d[0]+"/"+s),f=e.to("check#warning/"+d[0]);c.ajax({method:"POST",url:e.to("check/default/check-active"),data:{uuid:d[0]},dataType:"json",beforeSend:function(){n.showIndicator()},success:function(n){s=n.scan_count,m=e.to("check#scan-count/"+d[0]+"/"+s),n.success==r?window.location.href=m:n.success==a?window.location.href=l:n.success==u?window.location.href=f:window.location.href=f},error:function(n){},complete:function(e){n.hideIndicator()}})}else t.toast({content:"请扫描智能防伪二维码"})}})})},n}),define("check/scan-count-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,e,t,o,i){var n=new n,c=Dom7,r=(Template7,0),a="";return n.run=function(){var n=this;r=parseInt(n.params.scancount),a=n.params.uuid,n.setPageTitle("验证标签"),n.render(),c(".count-num").html(r)},n.bindEvents=function(){c(".scan-button").click(function(){""!=a&&void 0!=a?window.location.href=e.to("check#submit/"+a):window.location.href=e.to("check#index")})},n}),define("check/submit-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,e,t,o,i){var n=new n,c=Dom7,r=(Template7,"");return n.run=function(){var n=this;r=n.params.uuid,n.setPageTitle("验证标签"),i.config({debug:!1,appId:window.$site.appid,timestamp:window.$site.timestamp,nonceStr:window.$site.noncestr,signature:window.$site.signature,jsApiList:["chooseImage","previewImage","uploadImage","getLocalImgData"]}),n.render()},n.bindEvents=function(){var n=this;c(".scan-image").click(function(){n.uploadImg(c(this))}),c(".scan-button").click(function(){var o=c(".scan-image").attr("data");return t.isEmpty(o)?(t.toast({content:"请拍照文件上传后再试!"}),!1):void c.ajax({method:"POST",url:e.to("check/default/check-actived"),data:{upload_file:o},dataType:"json",beforeSend:function(){n.showIndicator()},success:function(n){try{n.success?window.location.href=e.to("check#success/"+r):window.location.href=e.to("check#error/"+r)}catch(o){t.toast({content:"出错",closeDelay:3e3})}},error:function(n){t.toast({content:"提交出错,请联系系统管理员"})},complete:function(e){n.hideIndicator()}})})},n.uploadImg=function(n){var e=this;i.ready(function(){i.chooseImage({count:1,sizeType:["compressed"],sourceType:["album","camera"],success:function(t){t.localIds.length>0&&e.upload(t.localIds,n)}})})},n.upload=function(n,o){var r=this;return void 0==n[0]?"":void i.uploadImage({localId:n[0],isShowProgressTips:1,success:function(n){c.ajax({method:"POST",url:e.to("check/default/update-serviceid"),data:{service_id:n.serverId},dataType:"json",beforeSend:function(){r.showIndicator()},success:function(n){try{if(n.success){var e=n.img_path;o.attr("data",e),o.attr("src",n.show_path)}else t.toast({content:n.message,closeDelay:3e3})}catch(i){t.toast({content:"出错",closeDelay:3e3})}},error:function(n){t.toast({content:"提交出错,请联系系统管理员"})},complete:function(n){r.hideIndicator()}})},fail:function(n){r.app.alert(JSON.stringify(n))}})},n}),define("check/success-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,e,t,o,i){var n=new n,c=Dom7;Template7;return n.run=function(){var n=this;n.setPageTitle("验证结果"),n.render()},n.bindEvents=function(){c(".back-button").click(function(){window.history.go(-1)})},n}),define("check/warning-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,e,t,o,i){var n=new n,c=Dom7,r=(Template7,"");return n.run=function(){var n=this;r=n.params.uuid,n.setPageTitle("验证标签"),n.render()},n.bindEvents=function(){c(".scan-jump-button").click(function(){""!=r&&void 0!=r?window.location.href=e.to("smart#enter/"+r):window.location.href=e.to("check#index")})},n}); | |
2 | 1 | \ No newline at end of file |
2 | +define("check-app",["mk7/app"],function(n){var e=Dom7,t=function(){var n=e(".ui-loading-block");0==n.length&&(e(".view-main").html('<div class="ui-loading-block" id="ui-loading"><div class="ui-loading-cnt"><div class="spinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div><div id="loader-inner"><p></p></div> </div> </div>'),window.waitingTime=1e4,window.loaderTimer&&clearTimeout(window.loaderTimer),window.loaderTimer=setTimeout(function(){var n=document.getElementById("loader-inner"),e=document.createElement("p");e.className="notice",n&&(e.innerHTML='加载速度太慢?试试<a class="link" href="#" onclick="javascript:location.reload();return false;">重新加载</a>',n.appendChild(e))},window.waitingTime))},o=!0;return n.name="check",n.routes={index:function(){return o=!1,t(),n.runController("index")},"*":function(){return o=!1,t(),n.runController("index")},"scan-count/:uuid/:scancount":function(e,i){return o=!1,t(),n.runController("scan-count",{uuid:e,scancount:i})},"warning/:uuid":function(e){return o=!1,t(),n.runController("warning",{uuid:e})},"submit/:uuid":function(e){return o=!1,t(),n.runController("submit",{uuid:e})},"error/:uuid":function(e){return o=!1,t(),n.runController("error",{uuid:e})},"success/:uuid":function(e){return o=!1,t(),n.runController("success",{uuid:e})},"info/:uuid/:number_code":function(e,i){return o=!1,t(),n.runController("info",{uuid:e,number_code:i})}},n}),define("check/error-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,e,t,o,i){var n=new n,c=Dom7;Template7;return n.run=function(){var n=this;n.setPageTitle("验证结果"),n.render()},n.bindEvents=function(){c(".back-button").click(function(){window.history.go(-1)})},n}),define("check/index-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,e,t,o,i){var n=new n,c=Dom7,r=(Template7,1),a=0,u=2,s=0;return n.run=function(){var n=this;n.setPageTitle("验证标签"),i.config({debug:!1,appId:window.$site.appid,timestamp:window.$site.timestamp,nonceStr:window.$site.noncestr,signature:window.$site.signature,jsApiList:["openLocation","getLocation","scanQRCode"]}),n.scanQrcode(),n.render()},n.bindEvents=function(){var n=this;c(".scan-button").click(function(){n.scanQrcode()})},n.scanQrcode=function(){var n=this;i.ready(function(){i.scanQRCode({needResult:1,desc:"scanQRCode desc",success:function(o){var i=o.resultStr,d=c.parseUrlQuery(i);if(null!=d&&void 0!==d&&null!=d.uuid&&void 0!==d.uuid){var d=d.uuid.split("@"),l=e.to("smart#enter/"+d[0]),m=e.to("check#scan-count/"+d[0]+"/"+s),f=e.to("check#warning/"+d[0]);c.ajax({method:"POST",url:e.to("check/default/check-active"),data:{uuid:d[0]},dataType:"json",beforeSend:function(){n.showIndicator()},success:function(n){s=n.scan_count,m=e.to("check#scan-count/"+d[0]+"/"+s),n.success==r?window.location.href=m:n.success==a?window.location.href=l:n.success==u?window.location.href=f:window.location.href=f},error:function(n){},complete:function(e){n.hideIndicator()}})}else t.toast({content:"请扫描智能防伪二维码"})}})})},n}),define("check/info-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,e,t,o,i){var n=new n,c=Dom7;Template7;return n.run=function(){var n=this;n.setPageTitle("验证结果"),n.loadData(n.params.uuid,n.params.number_code)},n.bindEvents=function(){c(".back-button").click(function(){window.history.go(-1)})},n.loadData=function(n,o){var i=this;c.ajax({method:"POST",url:e.to("check/default/get-info"),data:{uuid:n,number_code:o},dataType:"json",beforeSend:function(){i.showIndicator()},success:function(n){try{n.success?i.render(n.data):t.toast({content:n.message,closeDelay:3e3})}catch(e){t.toast({content:"出错",closeDelay:3e3})}},error:function(n){t.toast({content:"提交出错,请联系系统管理员"})},complete:function(n){i.hideIndicator()}})},n}),define("check/scan-count-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,e,t,o,i){var n=new n,c=Dom7,r=(Template7,0),a="";return n.run=function(){var n=this;r=parseInt(n.params.scancount),a=n.params.uuid,n.setPageTitle("验证标签"),n.render(),c(".count-num").html(r)},n.bindEvents=function(){c(".scan-button").click(function(){""!=a&&void 0!=a?window.location.href=e.to("check#submit/"+a):window.location.href=e.to("check#index")})},n}),define("check/submit-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,e,t,o,i){var n=new n,c=Dom7,r=(Template7,"");return n.run=function(){var n=this;r=n.params.uuid,n.setPageTitle("验证标签"),i.config({debug:!1,appId:window.$site.appid,timestamp:window.$site.timestamp,nonceStr:window.$site.noncestr,signature:window.$site.signature,jsApiList:["chooseImage","previewImage","uploadImage","getLocalImgData"]}),n.render()},n.bindEvents=function(){var n=this;c(".scan-image").click(function(){n.uploadImg(c(this))}),c(".scan-button").click(function(){var o=c(".scan-image").attr("data");return t.isEmpty(o)?(t.toast({content:"请拍照文件上传后再试!"}),!1):void c.ajax({method:"POST",url:e.to("check/default/check-actived"),data:{upload_file:o},dataType:"json",beforeSend:function(){n.showIndicator()},success:function(n){try{n.success?window.location.href=e.to("check#success/"+r):window.location.href=e.to("check#error/"+r)}catch(o){t.toast({content:"出错",closeDelay:3e3})}},error:function(n){t.toast({content:"提交出错,请联系系统管理员"})},complete:function(e){n.hideIndicator()}})})},n.uploadImg=function(n){var e=this;i.ready(function(){i.chooseImage({count:1,sizeType:["compressed"],sourceType:["album","camera"],success:function(t){t.localIds.length>0&&e.upload(t.localIds,n)}})})},n.upload=function(n,o){var r=this;return void 0==n[0]?"":void i.uploadImage({localId:n[0],isShowProgressTips:1,success:function(n){c.ajax({method:"POST",url:e.to("check/default/update-serviceid"),data:{service_id:n.serverId},dataType:"json",beforeSend:function(){r.showIndicator()},success:function(n){try{if(n.success){var e=n.img_path;o.attr("data",e),o.attr("src",n.show_path)}else t.toast({content:n.message,closeDelay:3e3})}catch(i){t.toast({content:"出错",closeDelay:3e3})}},error:function(n){t.toast({content:"提交出错,请联系系统管理员"})},complete:function(n){r.hideIndicator()}})},fail:function(n){r.app.alert(JSON.stringify(n))}})},n}),define("check/success-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,e,t,o,i){var n=new n,c=Dom7,r=(Template7,"");return n.run=function(){var n=this;r=n.params.uuid,n.setPageTitle("验证结果"),n.render()},n.bindEvents=function(){var n=this;c(".btn-submit").click(function(){var o=c(".input-num").val();return t.isEmpty(o)?(t.toast({content:"请填写提取码"}),c(".input-num").focus(),!1):t.isEmpty(r)?(t.toast({content:"缺少必要参数请退出重试"}),!1):void c.ajax({method:"POST",url:e.to("check/default/get-info"),data:{uuid:r,number_code:o},dataType:"json",beforeSend:function(){n.showIndicator()},success:function(n){try{n.success?window.location.href=e.to("check#info/"+r+"/"+o):t.toast({content:n.message,closeDelay:3e3})}catch(i){t.toast({content:"出错",closeDelay:3e3})}},error:function(n){t.toast({content:"提交出错,请联系系统管理员"})},complete:function(e){n.hideIndicator()}})})},n}),define("check/warning-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,e,t,o,i){var n=new n,c=Dom7,r=(Template7,"");return n.run=function(){var n=this;r=n.params.uuid,n.setPageTitle("验证标签"),n.render()},n.bindEvents=function(){c(".scan-jump-button").click(function(){""!=r&&void 0!=r?window.location.href=e.to("smart#enter/"+r):window.location.href=e.to("check#index")})},n}); | |
3 | 3 | \ No newline at end of file | ... | ... |
app-wx/web/src/js/check/app.js
... | ... | @@ -70,6 +70,11 @@ define( |
70 | 70 | _autoLoading(); |
71 | 71 | return app.runController('success',{uuid: uuid}); |
72 | 72 | }, |
73 | + 'info/:uuid/:number_code': function (uuid, number_code) { | |
74 | + fromOutside = false; | |
75 | + _autoLoading(); | |
76 | + return app.runController('info',{uuid: uuid, number_code: number_code}); | |
77 | + }, | |
73 | 78 | } |
74 | 79 | |
75 | 80 | return app; | ... | ... |
... | ... | @@ -0,0 +1,62 @@ |
1 | +/** | |
2 | + * 验证结果控制器 | |
3 | + */ | |
4 | +define( | |
5 | + "check/info-controller", | |
6 | + [ | |
7 | + 'mk7/controller', | |
8 | + 'mk7/url', | |
9 | + 'mk7/utils', | |
10 | + 'mk7/modals', | |
11 | + 'mk7/jweixin' | |
12 | + ], | |
13 | + function (ctrl, url, utils, modals, jweixin) { | |
14 | + var ctrl = new ctrl(); | |
15 | + var $$ = Dom7; | |
16 | + var t7 = Template7; | |
17 | + | |
18 | + ctrl.run = function () { | |
19 | + var me = this; | |
20 | + me.setPageTitle("验证结果"); | |
21 | + me.loadData(me.params.uuid, me.params.number_code) | |
22 | + }; | |
23 | + | |
24 | + ctrl.bindEvents = function () { | |
25 | + var me = this; | |
26 | + $$(".back-button").click(function () { | |
27 | + window.history.go(-1); | |
28 | + }); | |
29 | + }; | |
30 | + | |
31 | + ctrl.loadData = function (uuid, numberCode) { | |
32 | + var me = this; | |
33 | + $$.ajax({ | |
34 | + method : "POST", | |
35 | + url: url.to('check/default/get-info'), | |
36 | + data : {uuid: uuid, number_code: numberCode}, | |
37 | + dataType : "json", | |
38 | + beforeSend : function(){ | |
39 | + me.showIndicator(); | |
40 | + }, | |
41 | + success : function(res){ | |
42 | + try { | |
43 | + if(res.success) { | |
44 | + me.render(res.data); | |
45 | + } else { | |
46 | + utils.toast({content:res.message, closeDelay:3000}); | |
47 | + } | |
48 | + } catch(ex) { | |
49 | + utils.toast({content:'出错', closeDelay:3000}); | |
50 | + } | |
51 | + }, | |
52 | + error : function(res){ | |
53 | + utils.toast({content:"提交出错,请联系系统管理员"}); | |
54 | + }, | |
55 | + complete : function(res){ | |
56 | + me.hideIndicator(); | |
57 | + }, | |
58 | + }); | |
59 | + } | |
60 | + return ctrl; | |
61 | + } | |
62 | +); | |
0 | 63 | \ No newline at end of file | ... | ... |