Пример #1
0
def root():
    """手机站 - 售后服务列表"""

    if not check_login():
        session['weixin_login_url'] = request.url
        return redirect(url_for('api.weixin.login'))
    uid = get_uid()

    params = request.args.to_dict()
    params['uid'] = uid
    _data = AfterSalesStaticMethodsService.aftersales(params)
    paging_url = url_for('mobile.aftersales.paging', **request.args)

    aftersales_status_text = {}
    for aftersale in _data['aftersales']:
        status_text, action_code = AfterSalesStaticMethodsService.aftersale_status_text_and_action_code(
            aftersale)
        aftersales_status_text[aftersale.aftersales_id] = status_text

    data = {
        'aftersales': _data['aftersales'],
        'paging_url': paging_url,
        'aftersales_status_text': aftersales_status_text
    }
    return render_template('mobile/aftersales/index.html.j2', **data)
Пример #2
0
def index():
    """ 售后服务列表 """

    resjson.action_code = 13

    if not check_login():
        return resjson.print_json(resjson.NOT_LOGIN)
    uid = get_uid()

    args = request.args
    p = toint(args.get('p', '1'))
    ps = toint(args.get('ps', '10'))

    if p <= 0 or ps <= 0:
        return resjson.print_json(resjson.PARAM_ERROR)

    params = {'uid': uid, 'p': p, 'ps': ps}
    _data = AfterSalesStaticMethodsService.aftersales(params)

    aftersales_status_text = {}
    for aftersale in _data['aftersales']:
        status_text, action_code = AfterSalesStaticMethodsService.aftersale_status_text_and_action_code(
            aftersale)
        aftersales_status_text[aftersale.aftersales_id] = status_text

    data = {
        'aftersales': _data['aftersales'],
        'aftersales_status_text': aftersales_status_text
    }
    return resjson.print_json(0, u'ok', data)