Beispiel #1
0
def deliver():
    """确认收货"""

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

    args = request.args
    order_id = toint(args.get('order_id', 0))

    if order_id <= 0:
        return ''

    ods = OrderDeliverService(order_id, uid)
    try:
        ods.deliver()
    except OrderException as e:
        msg = u'%s' % e.msg
        log_error(msg)
        return ''

    text, code = OrderStaticMethodsService.order_status_text_and_action_code(
        ods.order)

    return render_template('mobile/order/order.html.j2',
                           order=ods.order,
                           text=text,
                           code=code)
Beispiel #2
0
def cancel():
    """取消订单"""

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

    args = request.args
    order_id = toint(args.get('order_id', 0))
    cancel_desc = args.get('cancel_desc', '').strip()

    if order_id <= 0:
        return ''

    ocs = OrderCancelService(order_id, uid, cancel_desc)
    try:
        ocs.cancel()
    except OrderException as e:
        msg = u'%s' % e.msg
        log_error(msg)
        return ''

    text, code = OrderStaticMethodsService.order_status_text_and_action_code(
        ocs.order)

    return render_template('mobile/order/order.html.j2',
                           order=ocs.order,
                           text=text,
                           code=code)
Beispiel #3
0
def comment():
    """ 评价中心 """
    resjson.action_code = 21

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

    params = request.args.to_dict()

    p = toint(params.get('p', '1'))
    ps = toint(params.get('ps', '10'))
    is_pending = toint(params.get('is_pending', '0'))

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

    if is_pending not in [0, 1]:
        return resjson.print_json(resjson.PARAM_ERROR)

    data_temp = OrderStaticMethodsService.order_comments(uid, params, True)

    data = {'is_pending': data_temp['is_pending'], 'pending_count': data_temp['pending_count'],
            'unpending_count': data_temp['unpending_count'], 'comments': data_temp['comments']}

    return resjson.print_json(0, u'ok', data)
Beispiel #4
0
def detail(order_id):
    """订单详情"""

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

    data = OrderStaticMethodsService.detail_page(order_id, uid)

    return render_template('mobile/order/detail.html.j2', **data)
Beispiel #5
0
def paging():
    """加载分页"""

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

    data = OrderStaticMethodsService.orders(uid, request.args.to_dict())

    return render_template('mobile/order/paging.html.j2', **data)
Beispiel #6
0
def index():
    """订单列表页"""
    resjson.action_code = 10

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

    data = OrderStaticMethodsService.orders(uid, request.args.to_dict())
    data['tab_status'] = request.args.get('tab_status', '0')

    return resjson.print_json(0, u'ok', data)
Beispiel #7
0
def index():
    """订单列表页"""

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

    data = OrderStaticMethodsService.orders(uid, request.args.to_dict())
    data['paging_url'] = url_for('mobile.order.paging', **request.args)
    data['tab_status'] = request.args.get('tab_status', '0')

    return render_template('mobile/order/index.html.j2', **data)
Beispiel #8
0
def detail(order_id):
    """订单详情"""

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

    data = OrderStaticMethodsService.detail_page(order_id, uid)
    # pc端订单详情不支持再次购买,排除掉指令[5]
    data['code'] = list(set(data['code']) - set([5]))

    return render_template('pc/order/detail.html.j2', **data)
Beispiel #9
0
def comment(is_pagination=True):
    """pc站 - 评价中心"""

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

    data = OrderStaticMethodsService.order_comments(uid,
                                                    request.args.to_dict(),
                                                    True)

    return render_template('pc/order/comment.html.j2', **data)
Beispiel #10
0
def detail():
    """订单详情"""

    resjson.action_code = 11

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

    order_id = toint(request.args.get('order_id', '0'))

    if order_id <= 0:
        return resjson.print_json(resjson.PARAM_ERROR)

    data = OrderStaticMethodsService.detail_page(order_id, uid)

    return resjson.print_json(0, u'ok', data)
Beispiel #11
0
def comment():
    """手机站 - 评价中心"""

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

    data_temp = OrderStaticMethodsService.order_comments(
        uid, request.args.to_dict(), False)

    data = {
        'is_pending': data_temp['is_pending'],
        'pending_count': data_temp['pending_count'],
        'unpending_count': data_temp['unpending_count'],
        'comments': data_temp['comments']
    }

    return render_template('mobile/order/comment.html.j2', **data)
Beispiel #12
0
def apply_step0(order_id):
    """pc站 - 申请售后服务-选择产品"""

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

    data = OrderStaticMethodsService.detail_page(order_id, uid)
    #pc端订单详情不支持再次购买,排除掉指令[5]
    data['code'] = list(set(data['code']) - set([5]))

    #申请售后的存在多条售后记录
    aftersale_all         = db.session.query(Aftersales.goods_data,Aftersales.aftersales_id).\
                            filter(Aftersales.order_id == order_id).\
                            filter(Aftersales.status.in_([1,2])).all()
    data['aftersale_all'] = aftersale_all

    return render_template('pc/aftersales/apply_step0.html.j2', **data)
Beispiel #13
0
def index():
    """订单列表页"""

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

    data = OrderStaticMethodsService.orders(uid, request.args.to_dict(), True)

    # pc端订单列表支持,支付、详情、售后3个指令,其余指令排除,即排除[2,3,4,5,6]
    if data.get("orders"):
        excel_code = [2, 3, 4, 5, 6]
        action_code = data.get('codes')
        for order in data.get("orders"):
            temp = set(action_code[order.order_id]) - set(excel_code)
            action_code[order.order_id] = list(temp)

    data['tab_status'] = request.args.get('tab_status', '0')

    return render_template('pc/order/index.html.j2', **data)