order-details-controller.js 1.4 KB
/**
 * 维修中页
 */
define(
    "order/order-details-controller",
    [
        'mk7/controller',
        'mk7/url',
        'mk7/utils',
    ],

    function(ctrl, url, utils) {

        var $$ = Dom7;
        var t7 = Template7;
        var ctrl = new ctrl();

        var pageURL = 'order/default/order-details';
        ctrl.run = function () {
            var me = this;
            me.id = me.params.id;
            me.setPageTitle("维修单");
            me.loadPage();
        }
        ctrl.bindEvents = function () {
            var me = this;
            console.log("bindEvents");
            me.finishBtnEvent();
            me.goToComment();
        }
        ctrl.loadPage = function() {
            var me = this
            var pData = me.csrf({id: me.id});
            utils.httpGet(pageURL, pData, function(res) {
                var rData = res;
                me.render(rData);
            }, true)

        }
        ctrl.finishBtnEvent = function() {
            var me = this;
            $$('#order-details .finish-submit').click(function(e){
                window.location.href = url.to('order/#cost-list/'+me.id);
            })
        }
        ctrl.goToComment = function() {
            var me = this;
            $$('#order-details .rate-btn-cls').click(function(e){
                window.location.href = url.to('order/#rate/'+me.id)
            })

        }
        return ctrl;
    }
);