Example #1
0
 def get(self, member_sid):
     _c = CustomerModule(self.application.dc)
     _page = self.get_argument('page',1)
     _count = self.get_argument('count', 1000)
     #_member, _details = _c.get_details(member_sid, _page, _count)
     _member, _details = _c.search_detail_from_member_sid(member_sid, _page, _count)
     return self.render('customer_details_low.html', member=_member, details=_details)
Example #2
0
 def get(self):
     _trade_no = self.get_argument('no', None)
     _c = CustomerModule(self.application.dc)
     _page = self.get_argument('page',1)
     _count = self.get_argument('count', 1000)
     _member, _details = None, []
     if _trade_no:
         _member, _details = _c.search_detail_from_trade_no(_trade_no, _page, _count)
     return self.render('trade_no_search.html', member=_member, details=_details)
Example #3
0
 def get(self):
     try:
         start = self.get_argument('start', '')
         end = self.get_argument('end', '')
         if end: end = end + " 23:59:59"
         shop_name = self.get_argument('shop_name', None)
         min_money = self.get_argument('min_money', 0)
         if min_money: min_money = int(min_money)
         max_money = self.get_argument('max_money', 0)
         if max_money: max_money = int(max_money)
         last_buy = self.get_argument('last_buy', None)
         payment_mode = self.get_argument('payment_mode', None)
         if last_buy: last_buy = datetime.datetime.now() - datetime.timedelta(days=int(last_buy)+1)
         categories = self.get_arguments('categories', None)
         is_refund = self.get_argument('is_refund', '')
         phone = self.get_argument('mobile', None)
         carriers = self.get_arguments('carriers', None)
         if not start or not end:
             start = "开始日期"
             end = "结束日期"
             raise StandardError()
         c = CustomerModule(self.application.dc)
         customers = c.search_user2(start, end, shop_name, min_money, max_money, last_buy, categories, is_refund, phone, carriers, payment_mode)
     except:
         logging.info( traceback.format_exc() )
         customers = []
     shop_names = ["王府井店","亚运村店","五棵松店","中关村店","朝阳门店","三里河店","来广营店","回龙观店","草桥店","下沙店","笕桥店","虚拟代销DC","DC分销中心","北京门店","杭州门店"]
     pathfile = 'customer_'+start+'to'+end[0:10]+shop_names[0]+'.xls'
     if customers :
         wb=xlwt.Workbook()
         ws=wb.add_sheet('1')
         name_list = ['用户ID','日期','消费门店','消费总额','购买数量','消费偏好','手机号','运营商','有无退货','支付方式','会员等级'] 
         _list = ['member_sid', 'last_buy', 'shop_names', 'sale_sum', 'sale_cnt', 'categories', 'mobile', 'carrier', 'is_refund', 'payment_modes','m_type']
         for i in range(0,len(name_list)) :
             ws.write(0,i,str(name_list[i]).decode('utf8'))
             for j in range(0,len(customers)) :
                 _value = str(customers[j][_list[i]]).decode('utf8')
                 if _list[i] == 'shop_names' :
                     _value = str("/".join(customers[j][_list[i]])).decode('utf8')
                 elif _list[i] == 'categories' :
                     _value = str("/".join(customers[j][_list[i]])).decode('utf8')
                 elif _list[i] == 'is_refund' :
                     _value = "有".decode('utf8') if customers[j][_list[i]] else "无".decode('utf8')
                 ws.write(j+1,i,_value)
         wb.save('static/xls/'+pathfile)
     return self.render('customer.html', customers = customers[:1000], shop_names = shop_names, pathfile=pathfile)