app.js 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785
  1. define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'common/services', 'common/directives','common/query/kind', 'common/query/brand', 'common/query/component', 'common/query/order', 'common/query/cart', 'common/query/goods', 'common/query/return' ,'angular-toaster', 'common/query/urlencryption', 'ui-jquery', 'common/query/bankTransfer', 'common/query/bankInfo', 'common/query/change', 'common/query/rate', 'common/query/logistics', 'common/query/address' ,'angular-toaster','common/query/collection', 'common/query/proofing', 'common/query/bill', 'common/query/user','file-upload', 'file-upload-shim', 'common/query/bankInfo' , 'common/query/responseLogistics', 'common/query/payment', 'common/query/afterSale', 'common/query/messageBoard', 'common/query/importDeclaration', 'common/query/enterprise', 'common/query/invoice', 'common/query/refund', 'common/query/recommendation', 'common/query/logisticsPort', 'common/query/storeInfo', 'common/query/tradeMessageNotice', 'common/query/tradeBasicProperties', 'common/query/browsingHistory', 'common/query/internalMessage', 'common/module/chat_web_module', 'angular-filter', 'common/query/vendor','common/query/seekPurchase', 'common/query/search', 'angular-sanitize'], function(angularAMD) {
  2. 'use strict';
  3. var app = angular.module('myApp', [ 'ui.router', 'ui.bootstrap', 'ng.local', 'ngTable', 'common.services', 'common.directives', 'tool.directives', 'common.query.kind', 'brandServices', 'componentServices', 'orderServices', 'cartServices', 'goodsServices', 'returnServices' , 'toaster', 'urlencryptionServices', 'ui.jquery', 'bankTransfer', 'bankInfo', 'changeServices','rateServices', 'logisticsServices', 'addressServices', 'toaster','collection','proofingServices', 'billServices', 'common.query.user', 'angularFileUpload', 'bankInfo', 'responseLogisticsService', 'PaymentService', 'afterSaleService', 'messageBoardServices', 'table.directives', 'importDeclaration', 'common.query.enterprise', 'invoiceServices', 'refundModule', 'recommendation','logisticsPortService', 'storeInfoServices', 'tradeMessageNoticeModule', 'tradeBasicPropertiesServices', 'BrowsingHistory', 'internalMessageServices', 'WebChatModule', 'angular.filter', 'vendorServices','seekPurchaseServices', 'searchService', 'ngSanitize']);
  4. app.init = function() {
  5. angularAMD.bootstrap(app);
  6. };
  7. // yangckTODO 提交时注释掉这段代码
  8. // 清除模板缓存,仅用于测试
  9. // app.run(function($rootScope, $templateCache) {
  10. // $rootScope.$on('$viewContentLoaded', function() {
  11. // $templateCache.removeAll();
  12. // });
  13. // });
  14. if (!Array.prototype.last){
  15. Array.prototype.last = function(){
  16. return this.length > 0 ? this[this.length - 1] : null;
  17. };
  18. }
  19. if (!Array.prototype.first){
  20. Array.prototype.first = function(){
  21. return this.length > 0 ? this[0] : null;
  22. };
  23. }
  24. // ui-router 路由配置
  25. app.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider){
  26. $urlRouterProvider.otherwise("/home");
  27. $stateProvider.state('home', angularAMD.route({
  28. url: '/home',
  29. templateUrl: 'static/view/usercenter/forstore/home_center.html',
  30. controller : 'homeCtrl',
  31. controllerUrl : 'app/controllers/forstore/buyer_home_ctrl'
  32. })).state('buyer_order', angularAMD.route({
  33. url: '/order',
  34. templateUrl: 'static/view/usercenter/forstore/buyer_order.html',
  35. controller: 'orderCtrl',
  36. controllerUrl: 'app/controllers/forstore/buyer_order_ctrl'
  37. })).state('messagePersonal', angularAMD.route({
  38. url: '/messagePersonal',
  39. templateUrl: 'static/view/usercenter/forstore/messagePersonal.html',
  40. controller: 'MessagePersonalCtrl',
  41. controllerUrl: 'app/controllers/forstore/messagePersonalCtrl'
  42. })).state('messagePublic', angularAMD.route({
  43. url: '/messagePublic',
  44. templateUrl: 'static/view/usercenter/forstore/messagePublic.html',
  45. controller: 'MessagePublicCtrl',
  46. controllerUrl: 'app/controllers/forstore/messagePublicCtrl'
  47. })).state('browsing-history', angularAMD.route({
  48. url: '/browsing-history',
  49. templateUrl: 'static/view/usercenter/forstore/browsing-history.html',
  50. controller: 'BrowsingHistoryCtrl',
  51. controllerUrl: 'app/controllers/forstore/browsingHistoryCtrl'
  52. })).state('my_wallet', angularAMD.route({
  53. url: '/wallet',
  54. templateUrl: 'static/view/usercenter/forstore/wallet.html',
  55. controller: 'walletCtrl',
  56. controllerUrl: 'app/controllers/forstore/buyer_wallet_ctrl'
  57. })).state('buyer_invoice', angularAMD.route({
  58. url: '/invoice',
  59. templateUrl: 'static/view/usercenter/forstore/buyer_invoice.html',
  60. controller: 'invoiceCtrl',
  61. controllerUrl: 'app/controllers/forstore/buyer_invoice_ctrl'
  62. })).state('buyer_no_invoice', angularAMD.route({
  63. url: '/noInvoice',
  64. title: '未开票',
  65. templateUrl: 'static/view/usercenter/forstore/buyer_no_invoice.html',
  66. controller: 'NoInvoiceCtrl',
  67. controllerUrl: 'app/controllers/forstore/buyer_no_invoice_ctrl'
  68. })).state('buyer_invoice-record', angularAMD.route({
  69. url: '/invoiceRecord',
  70. title: '开票记录',
  71. templateUrl: 'static/view/usercenter/forstore/buyer_invoice_record.html',
  72. controller: 'buyerInvoiceRecordCtrl',
  73. controllerUrl: 'app/controllers/forstore/buyer_invoice_record_ctrl'
  74. })).state('pay_center', angularAMD.route({
  75. url: '/payCenter',
  76. templateUrl: 'static/view/usercenter/forstore/pay_center.html',
  77. controller: 'payCenterCtrl',
  78. controllerUrl: 'app/controllers/forstore/pay_center_ctrl'
  79. }))
  80. /* .state('my_seek_purchase', angularAMD.route({
  81. url: '/seekPurchase',
  82. templateUrl: 'static/view/usercenter/forstore/seek_purchase.html',
  83. controller: 'seekPurchaseCtrl',
  84. controllerUrl: 'app/controllers/forstore/seek_purchase_ctrl'
  85. }))*/
  86. .state('buyer_logistics', angularAMD.route({
  87. url: '/buyerLogistics/:orderid',
  88. templateUrl: 'static/view/usercenter/forstore/buyer_logistics.html',
  89. controller: 'buyerLogisticsCtrl',
  90. controllerUrl: 'app/controllers/forstore/buyer_logistics_ctrl'
  91. })).state('buyerQueryLogistics', angularAMD.route({
  92. url: '/buyerQueryLogistics/:orderid',
  93. templateUrl: 'static/view/usercenter/forstore/query_logistics.html',
  94. controller: 'buyerQueryLogisticsCtrl',
  95. controllerUrl: 'app/controllers/forstore/query_logistics_ctrl'
  96. })).state('after_sale', angularAMD.route({
  97. url: '/afterSale',
  98. title: '申请售后',
  99. templateUrl: 'static/view/usercenter/forstore/after_sale.html',
  100. controller: 'afterSaleCtrl',
  101. controllerUrl: 'app/controllers/forstore/after_sale_ctrl'
  102. })).state('store_focus', angularAMD.route({
  103. url: '/storeFocus',
  104. title : '店铺关注',
  105. templateUrl : 'static/view/usercenter/forstore/store_focus.html',
  106. controller : 'storeFocusCtrl',
  107. controllerUrl : 'app/controllers/forstore/store_focus_ctrl'
  108. })).state('browsing_history', angularAMD.route({
  109. url: '/browsingHistory',
  110. title : '浏览历史',
  111. templateUrl : 'static/view/usercenter/forstore/browsing_history.html',
  112. controller : 'browsingHistoryCtrl',
  113. controllerUrl : 'app/controllers/forstore/browsing_history'
  114. })).state('account_manager', angularAMD.route({
  115. url: '/accountManager/:op',
  116. title: '账户管理',
  117. templateUrl: 'static/view/usercenter/forstore/account_manager.html',
  118. controller: 'accountManagerCtrl',
  119. controllerUrl: 'app/controllers/forstore/account_manager_ctrl'
  120. })).state('order_detail', angularAMD.route({
  121. url: '/order/detail/:orderid',
  122. title: '订单详情',
  123. templateUrl: 'static/view/usercenter/forstore/order_detail.html',
  124. controller: 'orderDetailCtrl',
  125. controllerUrl: 'app/controllers/forstore/order_detail_ctrl'
  126. })).state('buyer_cart', angularAMD.route({
  127. url: '/cart',
  128. title: '购物车',
  129. templateUrl: 'static/view/usercenter/forstore/buyer_cart.html',
  130. controller: 'buyerCartCtrl',
  131. controllerUrl: 'app/controllers/forstore/buyer_cart_ctrl'
  132. })).state('order_pay', angularAMD.route({
  133. url: '/order/pay/:orderid',
  134. title: '订单付款界面',
  135. templateUrl: 'static/view/usercenter/forstore/order_pay.html',
  136. controller: 'orderPayCtrl',
  137. controllerUrl: 'app/controllers/forstore/order_pay_ctrl'
  138. })).state('order_transfer', angularAMD.route({
  139. //bank transfer
  140. url : '/transfer/:orderid',
  141. templateUrl : 'static/view/usercenter/forstore/buyer_transfer.html',
  142. controllerUrl : 'app/controllers/forstore/buyer_transfer_ctrl',
  143. controller : 'buyerTransferCtrl'
  144. }))//之前的是为了店铺新增的,加于03月21日
  145. .state('index', angularAMD.route({
  146. // 个人中心首页
  147. url: '/home',
  148. templateUrl : 'static/view/usercenter/home.html',
  149. controller : 'UserCenterHomeCtrl',
  150. controllerUrl : 'app/controllers/UserCenterHomeCtrl'
  151. }))
  152. // .state('myOrder_todo', angularAMD.route({
  153. // // 我的未完成订单
  154. // url: '/home/myOrder_todo?state',
  155. // templateUrl : 'static/view/usercenter/myOrder_todo.html',
  156. // controller : 'MyOrderToDoCtrl',
  157. // controllerUrl : 'app/controllers/MyOrderToDoCtrl'
  158. // }))
  159. .state('myOrder_done', angularAMD.route({
  160. // 我的已完成订单
  161. url: '/home/myOrder_done',
  162. templateUrl : 'static/view/usercenter/myOrder_done.html',
  163. controller : 'MyOrderDoneCtrl',
  164. controllerUrl : 'app/controllers/MyOrderDoneCtrl'
  165. })).state('myOrderDetail', angularAMD.route({
  166. // 我的已完成订单详情
  167. url: '/home/myOrder/:orderid',
  168. templateUrl : 'static/view/usercenter/myOrderDetail.html',
  169. controller : 'MyOrderDetailCtrl',
  170. controllerUrl : 'app/controllers/MyOrderDetailCtrl'
  171. })).state('buyerOrderDetail', angularAMD.route({
  172. // 订单详情
  173. url: '/home/order/:orderid',
  174. templateUrl : 'static/view/usercenter/order_detail.html',
  175. controller : 'OrderDetailCtrl',
  176. controllerUrl : 'app/controllers/OrderDetailCtrl'
  177. })).state('myAfter_sales',angularAMD.route({
  178. //退、换货服务
  179. url: '/home/myAfter_sales/:orderid',
  180. templateUrl : 'static/view/usercenter/myAfter_sales.html',
  181. controller : 'AfterSaleCtrl',
  182. controllerUrl : 'app/controllers/AfterSaleCtrl'
  183. })).state('myReturn_done',angularAMD.route({
  184. //我的退货单
  185. url: '/home/myReturn_done',
  186. templateUrl : 'static/view/usercenter/myReturn_done.html',
  187. controller : 'MyReturnDoneCtrl',
  188. controllerUrl : 'app/controllers/MyReturnDoneCtrl'
  189. })).state('myReturn_done_detail', angularAMD.route({
  190. //退货单详情
  191. url: '/home/myReturn_done/:returnid',
  192. templateUrl : 'static/view/usercenter/myReturn_done_detail.html',
  193. controller : 'MyReturnDoneDetailCtrl',
  194. controllerUrl : 'app/controllers/MyReturnDoneDetailCtrl'
  195. })).state('myChange_done',angularAMD.route({
  196. //我的换货单
  197. url: '/home/myChange_done',
  198. templateUrl : 'static/view/usercenter/myChange_done.html',
  199. controller : 'MyChangeDoneCtrl',
  200. controllerUrl : 'app/controllers/MyChangeDoneCtrl'
  201. })).state('myChange_done_detail', angularAMD.route({
  202. //换货单详情
  203. url: '/home/myChange_done/:changeid',
  204. templateUrl : 'static/view/usercenter/myChange_done_detail.html',
  205. controller : 'MyChangeDoneDetailCtrl',
  206. controllerUrl : 'app/controllers/MyChangeDoneDetailCtrl'
  207. })).state('myRefund_done',angularAMD.route({
  208. title: '我的退款单',
  209. url: '/home/myRefund_done',
  210. templateUrl : 'static/view/usercenter/myRefund_done.html',
  211. controller : 'MyRefundDoneCtrl',
  212. controllerUrl : 'app/controllers/MyRefundDoneCtrl'
  213. })).state('myRefund_done_detail', angularAMD.route({
  214. title: '退款单详情',
  215. url: '/home/myRefund_done/:refundId',
  216. templateUrl : 'static/view/usercenter/myRefund_done_detail.html',
  217. controller : 'MyRefundDoneDetailCtrl',
  218. controllerUrl : 'app/controllers/MyRefundDoneDetailCtrl'
  219. })).state('myTest_done',angularAMD.route({
  220. //Test
  221. url: '/home/myTest_done',
  222. templateUrl : 'static/view/usercenter/Test.html',
  223. controller : 'MyTestDoneCtrl',
  224. controllerUrl : 'app/controllers/MyTestDoneCtrl'
  225. })).state('ship', angularAMD.route({
  226. title: '换货出货',
  227. url: '/ship/:id',
  228. templateUrl: 'static/view/usercenter/shipped.html',
  229. controllerUrl: 'app/controllers/ShippedCtrl',
  230. controller: 'ShippedCtrl'
  231. })).state('shipFreturn', angularAMD.route({
  232. title: '退货出货',
  233. url: '/shipFreturn/:id',
  234. templateUrl: 'static/view/usercenter/shippedFreturn.html',
  235. controllerUrl: 'app/controllers/ShippedForReturnCtrl',
  236. controller: 'ShippedForReturnCtrl'
  237. }))
  238. .state('histTransfer', angularAMD.route({
  239. url : '/home/historyTransfer',
  240. templateUrl : 'static/view/usercenter/histTransfer.html',
  241. controllerUrl : 'app/controllers/HistoryTransferCtrl',
  242. controller : 'HistoryTransferCtrl'
  243. })).state('brandCol', angularAMD.route({
  244. // 品牌收藏
  245. url : '/home/brancol',
  246. templateUrl: 'static/view/usercenter/brandStore.html',
  247. controllerUrl: 'app/controllers/BrandStoreCtrl',
  248. controller: 'BrandStoreCtrl'
  249. })).state('componentCol',angularAMD.route({
  250. // 器件收藏
  251. url : '/home/componentcol',
  252. templateUrl : 'static/view/usercenter/componentStore.html',
  253. controllerUrl : 'app/controllers/ComponentStoreCtrl',
  254. controller : 'ComponentStoreCtrl'
  255. })).state('shopping_cart', angularAMD.route({
  256. // 我的购物车
  257. //暂时弃用,现在直接通过连接的形式跳转到购物车界面
  258. url: '/product#/cart',
  259. templateUrl : 'static/view/usercenter/shopping_cart.html',
  260. controller : 'CartCtrl',
  261. controllerUrl : 'app/controllers/CartCtrl',
  262. title: '我的购物车'
  263. })).state('ship_address', angularAMD.route({
  264. //收货地址管理
  265. url : '/home/shipAddress',
  266. templateUrl : 'static/view/usercenter/addressAdmin.html',
  267. controller : 'adressAdminCtrl',
  268. controllerUrl : 'app/controllers/addressAdminCtrl'
  269. })).state('credit_card', angularAMD.route({
  270. url : '/home/creditCard',
  271. templateUrl : 'static/view/usercenter/creditCardAdmin.html',
  272. controller : 'creditCardAdminCtrl',
  273. controllerUrl : 'app/controllers/creditCardAdminCtrl'
  274. }))
  275. // .state('myProofing', angularAMD.route({
  276. // // 我的送样申请单
  277. // url: '/home/myProofing',
  278. // templateUrl : 'static/view/usercenter/myProofing.html',
  279. // controller : 'MyProofingCtrl',
  280. // controllerUrl : 'app/controllers/MyProofingCtrl'
  281. // }))
  282. // .state('unProofing', angularAMD.route({
  283. // // 我的送样申请单
  284. // url: '/home/unProofing',
  285. // templateUrl : 'static/view/usercenter/unProofing.html',
  286. // controller : 'UnProofingCtrl',
  287. // controllerUrl : 'app/controllers/UnProofingCtrl'
  288. // }))
  289. .state('bill_admin', angularAMD.route({
  290. //发票管理
  291. url : '/home/billAdmin',
  292. templateUrl : 'static/view/usercenter/billAdmin.html',
  293. controller : 'BillAdminCtrl',
  294. controllerUrl : 'app/controllers/BillAdminCtrl'
  295. })).state('bill_input', angularAMD.route({
  296. url : '/home/billInput/revise/:id',
  297. templateUrl : 'static/view/usercenter/billInput.html',
  298. controller : 'BillInputCtrl',
  299. controllerUrl : 'app/controllers/BillInputCtrl',
  300. resolve: {
  301. isNormal: function() {return 1207;}
  302. }
  303. })).state('bill_input_normal', angularAMD.route({
  304. url : '/home/billInput/normal',
  305. templateUrl : 'static/view/usercenter/billInput.html',
  306. controller : 'BillInputCtrl',
  307. controllerUrl : 'app/controllers/BillInputCtrl',
  308. resolve: {
  309. isNormal: function() {return 1206;}
  310. }
  311. })).state('bill_input_special', angularAMD.route({
  312. url : '/home/billInput/special',
  313. templateUrl : 'static/view/usercenter/billInput.html',
  314. controller : 'BillInputCtrl',
  315. controllerUrl : 'app/controllers/BillInputCtrl',
  316. resolve: {
  317. isNormal: function() {return 1205;}
  318. }
  319. })).state('bill_notice', angularAMD.route({
  320. url : '/home/billNotice',
  321. templateUrl : 'static/view/usercenter/billNotice.html'
  322. }))
  323. // .state('myOrder_bill', angularAMD.route({
  324. // url : 'myOrderBill',
  325. // templateUrl : 'static/view/usercenter/myOrderBill.html',
  326. // controller : 'myOrderBill',
  327. // controllerUrl : 'app/controllers/myOrderBill'
  328. // }))
  329. // .state('exception_processing', angularAMD.route({
  330. // // 异常申请
  331. // url : '/home/ex/exceptionProcessing/:orderid',
  332. // templateUrl : 'static/view/usercenter/exceptionProcessing.html',
  333. // controller : 'exceptionProcessingCtrl',
  334. // controllerUrl : 'app/controllers/exceptionProcessingCtrl'
  335. // }))
  336. // .state('exception_processing_detail', angularAMD.route({
  337. // // 异常申请详情
  338. // url : '/home/ex/exceptionProcessingDetail/:orderid',
  339. // templateUrl : 'static/view/usercenter/exceptionProcessingDetail.html',
  340. // controller : 'exceptionProcessingDetailCtrl',
  341. // controllerUrl : 'app/controllers/exceptionProcessingDetailCtrl'
  342. // }))
  343. // .state('exceptionNotify', angularAMD.route({
  344. // // 异常通知详情
  345. // url : '/home/ex/exceptionNotify/:applyId',
  346. // templateUrl : 'static/view/usercenter/exceptionNotify.html',
  347. // controller : 'exceptionNotifyCtrl',
  348. // controllerUrl : 'app/controllers/exceptionNotifyCtrl'
  349. // }))
  350. // .state('refund', angularAMD.route({
  351. // // 申请客服页面
  352. // url : '/home/myOrder_todo/refund',
  353. // templateUrl : 'static/view/usercenter/myOrderRefund.html'
  354. // }))
  355. // .state('returnGoods', angularAMD.route({
  356. // // 申请客服页面
  357. // url : '/home/myOrder_todo/returnGoods',
  358. // templateUrl : 'static/view/usercenter/myOrderReturnGoods.html'
  359. // }))
  360. // .state('import_declaration', angularAMD.route({
  361. // // 进口报关列表
  362. // url : '/home/import_declaration',
  363. // templateUrl : 'static/view/usercenter/import_declaration.html',
  364. // controller : 'importDeclarationCtrl',
  365. // controllerUrl : 'app/controllers/importDeclarationCtrl'
  366. // }))
  367. // .state('new_import_declaration', angularAMD.route({
  368. // //新增进口报关
  369. // url : '/home/new_import_declaration',
  370. // templateUrl : 'static/view/usercenter/new_import_declaration.html',
  371. // controller : 'newImportDeclarationCtrl',
  372. // controllerUrl : 'app/controllers/importDeclarationCtrl'
  373. // }))
  374. // .state('edtitAccount', angularAMD.route({
  375. // //新增进口报关
  376. // url : '/home/editAccount',
  377. // templateUrl : 'static/view/usercenter/editAccount.html',
  378. // controller : 'EditAccountCtrl',
  379. // controllerUrl : 'app/controllers/EditAccountCtrl'
  380. // }))
  381. .state('editShippingAddress', angularAMD.route({
  382. // 买家收货地址编辑页面
  383. url : '/shippingAddress/edit',
  384. templateUrl : 'static/view/usercenter/forstore/shipping_address_edit.html',
  385. controller : 'ShippingAddressEditCtrl',
  386. controllerUrl : 'app/controllers/forstore/shipping_address_edit_ctrl'
  387. })).state('firstRate', angularAMD.route({
  388. // 初次评价
  389. url : '/rate/firstRate/:orderid',
  390. templateUrl : 'static/view/usercenter/forstore/first_rate.html',
  391. controller : 'firstRateCtrl',
  392. controllerUrl : 'app/controllers/forstore/first_rate_ctrl'
  393. })).state('addRate', angularAMD.route({
  394. // 追加评价
  395. url : '/rate/addRate/:orderid',
  396. templateUrl : 'static/view/usercenter/forstore/add_rate.html',
  397. controller : 'addRateCtrl',
  398. controllerUrl : 'app/controllers/forstore/add_rate_ctrl'
  399. })).state('showRate', angularAMD.route({
  400. // 查看评价
  401. url : '/rate/showRate/:orderid',
  402. templateUrl : 'static/view/usercenter/forstore/show_rate.html',
  403. controller : 'showRateCtrl',
  404. controllerUrl : 'app/controllers/forstore/show_rate_ctrl'
  405. })).state('downPayment', angularAMD.route({
  406. // 线下付款
  407. url : '/downPayment/:orderid',
  408. templateUrl : 'static/view/usercenter/forstore/buyer_down_payment.html',
  409. controller : 'downPaymentCtrl',
  410. controllerUrl : 'app/controllers/forstore/buyer_down_payment_ctrl'
  411. })).state('buyerSeekPurchase', angularAMD.route({
  412. url: '/seekPurchase?type',
  413. templateUrl: 'static/view/usercenter/forstore/seekPurchase.html',
  414. controller: 'seekPurchaseCtrl',
  415. controllerUrl: 'app/controllers/forstore/seek_purchase_ctrl'
  416. })).state('buyerBomDetail', angularAMD.route({
  417. url: '/bomDetail/:id',
  418. templateUrl: 'static/view/usercenter/forstore/bomDetail.html',
  419. controller: 'bomDetailCtrl',
  420. controllerUrl: 'app/controllers/forstore/bom_detail_ctrl'
  421. }));
  422. }]);
  423. // 状态码 -> 描述
  424. app.filter('status', function(){
  425. var statusConfig = {
  426. '101': '已提交',
  427. '102': '已审核',
  428. '103': '未通过',
  429. '104': '已通过',
  430. '313': '已激活',
  431. '316': '已过账',
  432. '310': '未启用',
  433. '311': '待审核',
  434. '312': '未激活',
  435. '350': '未开通',
  436. '351': '已开通',
  437. '317': '已创建'
  438. };
  439. return function(data) {
  440. return statusConfig[data];
  441. }
  442. });
  443. // 状态码 -> 快递
  444. app.filter('logisticsCompany', function(){
  445. var logisticsCompanyConfig = {
  446. 'aae': 'AAE快递',
  447. 'aramex': 'Aramex快递',
  448. 'auspost': '澳大利亚邮政',
  449. 'annengwuliu': '安能物流快递',
  450. 'bht': 'BHT快递',
  451. 'baifudongfang': '百福东方物流',
  452. 'bangsongwuliu': '邦送物流',
  453. 'huitongkuaidi': '百世汇通快递',
  454. 'idada': '百成大达物流',
  455. 'coe': 'COE(东方快递)',
  456. 'city100': '城市100',
  457. 'chuanxiwuliu': '传喜物流',
  458. 'depx': 'DPEX',
  459. 'disifang': '递四方',
  460. 'dsukuaidi': 'D速物流',
  461. 'debangwuliu': '德邦物流',
  462. 'datianwuliu': '大田物流',
  463. 'dhl': 'DHL国际快递',
  464. 'dhlen': 'DHL(国际件)',
  465. 'dhlde': 'DHL(德国件)',
  466. 'dhlpoland': 'DHL(波兰件)',
  467. 'ems': 'EMS快递',
  468. 'emsguoji': 'EMS国际',
  469. 'fedex': 'FedEx(国际)',
  470. 'fedexus': 'FedEx(美国)',
  471. 'rufengda': '凡客如风大',
  472. 'feikangda': '飞康达物流',
  473. 'feibaokuaidi': '飞豹快递',
  474. 'fardarww': 'Fardar Worldwide',
  475. 'fandaguoji': '颿达国际',
  476. 'fedexuk': 'FedEx(英国件)',
  477. 'gangzhongnengda': '港中能达物流',
  478. 'gongsuda': '共速达',
  479. 'guotongkuaidi': '国通快递',
  480. 'gls': 'GLS',
  481. 'tiandihuayu': '华宇物流',
  482. 'hengluwuliu': '恒路物流',
  483. 'huaxialongwuliu': '华夏龙物流',
  484. 'hebeijianhua': '河北建华',
  485. 'jiajiwuliu': '佳吉物流',
  486. 'jiayiwuliu': '佳怡物流',
  487. 'jiayunmeiwuliu': '加运美快递',
  488. 'jixianda': '急先达物流',
  489. 'jinguangsudikuaijian': '京广速递快件',
  490. 'jinyuekuaidi': '晋越快递',
  491. 'jialidatong': '嘉里大通',
  492. 'jietekuaidi': '捷特快递',
  493. 'jd': '京东快递',
  494. 'jindawuliu': '金大物流',
  495. 'kuaijiesudi': '快捷快递',
  496. 'kangliwuliu': '康力物流',
  497. 'kuayue': '跨越物流',
  498. 'lianhaowuliu': '联昊通物流',
  499. 'longbangwuliu': '龙邦速递',
  500. 'lianbangkuaidi': '联邦快递',
  501. 'lejiedi': '乐捷递',
  502. 'lijisong': '立即送',
  503. 'minghangkuaidi': '民航快递',
  504. 'meiguokuaidi': '美国快递',
  505. 'menduimen': '门对门',
  506. 'mingliangwuliu': '明亮物流',
  507. 'ganzhongnengda': '能达速递',
  508. 'ocs': 'OCS',
  509. 'ontrac': 'OnTrac',
  510. 'pingandatengfei': '平安达腾飞',
  511. 'peixingwuliu': '陪行物流',
  512. 'quanfengkuaidi': '全峰快递',
  513. 'quanyikuaidi': '全一快递',
  514. 'quanritongkuaidi': '全日通快递',
  515. 'quanchenkuaidi': '全晨快递',
  516. 'sevendays': '7天连锁物流',
  517. 'shentong': '申通快递',
  518. 'shunfeng': '顺丰速运',
  519. 'suer': '速尔快递',
  520. 'haihongwangsong': '山东海红',
  521. 'shenghuiwuliu': '盛辉物流',
  522. 'shengfengwuliu': '盛丰物流',
  523. 'shangda': '上大物流',
  524. 'santaisudi': '三态速递',
  525. 'saiaodi': '赛澳递',
  526. 'shenganwuliu': '圣安物流',
  527. 'sxhongmajia': '山西红马甲',
  528. 'suijiawuliu': '穗佳物流',
  529. 'syjiahuier': '沈阳佳惠尔',
  530. 'tnt': 'TNT快递',
  531. 'tiantian': '天天快递',
  532. 'tonghetianxia': '通和天下',
  533. 'tianzong': '天纵物流',
  534. 'tntuk': 'TNT(英国件)',
  535. 'ups': 'UPS国际快递',
  536. 'wanxiangwuliu': '万象物流',
  537. 'weitepai': '微特派',
  538. 'wanjiawuliu': '万家物流',
  539. 'xinbangwuliu': '新邦物流',
  540. 'xinfengwuliu': '信丰物流',
  541. 'neweggozzo': '新蛋物流',
  542. 'hkpost': '香港邮政',
  543. 'xianglongyuntong': '祥龙运通物流',
  544. 'xianchengliansudi': '西安城联速递',
  545. 'yuantong': '圆通速递',
  546. 'yunda': '韵达快运',
  547. 'yuntongkuaidi': '运通快递',
  548. 'youzhengguonei': '邮政国内',
  549. 'youzhengguoji': '邮政国际',
  550. 'yuanchengwuliu': '远成物流',
  551. 'yafengsudi': '亚风速递',
  552. 'youshuwuliu': '优速快递',
  553. 'yuananda': '源安达快递',
  554. 'yuanfeihangwuliu': '原飞航物流',
  555. 'yuefengwuliu': '越丰物流',
  556. 'zhongtong': '中通快递',
  557. 'zhaijisong': '宅急送',
  558. 'zhongtiewuliu': '中铁快运',
  559. 'ztky': '中铁物流',
  560. 'zhongyouwuliu': '中邮物流',
  561. 'zhongtianwanyun': '中天万运',
  562. 'zhengzhoujianhua': '郑州建华',
  563. 'zhimakaimen': '芝麻开门'
  564. };
  565. return function(data) {
  566. return logisticsCompanyConfig[data];
  567. }
  568. });
  569. app.run(['$rootScope', 'BaseService', function($rootScope, BaseService) {
  570. $rootScope.rootPath = BaseService.getRootPath();
  571. $rootScope.page = 'user';// 导航栏状态,'个人中心'状态激活
  572. }]);
  573. // 个人中心左侧导航,这里只是读取rootScopt进行隐藏的控制
  574. app.controller('LeftMenuCtrl', ['$scope', '$rootScope', function($scope, $rootScope) {
  575. }]);
  576. app.controller('UserCenterHeaderCtrl', ['$scope', 'InternalMessage', /*'$rootScope',, '$q',*/ function ($scope, InternalMessage/*, $rootScope, , $q*/) {
  577. $scope.homeUrl = window.location.pathname.replace('/user', '');
  578. // 获取未读消息数量
  579. //根据用户的信息
  580. InternalMessage.getUnReadCount({recRole: 'BUYER'}, function (data) {
  581. $scope.unReadMessage = data.count || 0;
  582. }, function (responge) {
  583. })
  584. }]);
  585. app.controller('CollectCtrl', ['$scope', 'collectionService', 'toaster', '$rootScope', '$modal', function ($scope, collectionService, toaster, $rootScope, $modal) {
  586. $scope.collect = function (id) {
  587. var obj = {'componentid': id, 'kind': 2};
  588. collectionService.saveEntity({}, obj, function(data) {
  589. // 打开莫模态框
  590. $modal.open({
  591. templateUrl : $rootScope.rootPath + '/static/view/usercenter/modal/collectModel.html',
  592. controller : 'CollectModelCtrl',
  593. size : 'sm',
  594. resolve : {
  595. haveAdd : function(){
  596. if (data.data == "success"){
  597. return true;
  598. } else{
  599. return false;
  600. }
  601. }
  602. }
  603. });
  604. $rootScope.componentCount++;
  605. }, function(error) {
  606. toaster.pop('error', '收藏失败', error);
  607. });
  608. }
  609. }]);
  610. app.controller('CollectModelCtrl', ['$scope', '$modalInstance', 'haveAdd', function($scope, $modalInstance, haveAdd){
  611. $scope.haveAdd = haveAdd;
  612. $scope.cancel = function() {
  613. $modalInstance.dismiss();
  614. };
  615. }])
  616. app.controller('BankFeedBackCtrl', ['$scope','$modalInstance', function($scope, $modalInstance) {
  617. $scope.confirm = function() {
  618. $modalInstance.close();
  619. };
  620. $scope.dismiss = function() {
  621. $modalInstance.dismiss();
  622. }
  623. }]);
  624. //物流信息
  625. app.controller('listLogisticsCtrl', [ '$scope', '$modal', 'ResponseLogistics', '$modalInstance', 'lgtid', function($scope, $modal, ResponseLogistics, $modalInstance, lgtid){
  626. $scope.Info = [];
  627. $scope.getlogistics = function() {
  628. ResponseLogistics.get({id: lgtid}, {}, function(data) {
  629. $scope.Info = data;
  630. });
  631. };
  632. $scope.getlogistics();
  633. $scope.cancel = function() {
  634. $modalInstance.dismiss();
  635. };
  636. }]);
  637. app.filter('currencySysmbol', function() {
  638. return function(moneyParam, currency, add) {
  639. if(typeof(moneyParam) == 'undefined') {
  640. moneyParam = 0;
  641. }
  642. if(currency == 'RMB') {
  643. return "¥ " + moneyParam + " " + (typeof(add) == "undefined" ? '' : add);
  644. }else if(currency == "USD"){
  645. return "$ " + moneyParam;
  646. }else {
  647. return moneyParam;
  648. }
  649. }
  650. });
  651. app.filter('emailSymbol', function() {
  652. return function(email) {
  653. if(typeof(email) == 'undefined') {
  654. email = '';
  655. } else {
  656. const index = email.indexOf('@');
  657. email = email[0] + '***' + email.substring(index, email.length);
  658. }
  659. return email;
  660. }
  661. });
  662. app.filter('telPhoneSymbol', function() {
  663. return function(telPhone) {
  664. if(typeof(telPhone) == 'undefined') {
  665. telPhone = '';
  666. } else {
  667. telPhone = telPhone.substring(0, 3) + '****' + telPhone.substring(telPhone.length - 4, telPhone.length);
  668. }
  669. return telPhone;
  670. }
  671. });
  672. app.filter('billTypeFilter', function() {
  673. return function(type) {
  674. var kindStr;
  675. switch(type) {
  676. case 1205 :
  677. kindStr = "增值税(专用)发票";break;
  678. case '1205' :
  679. kindStr = "增值税(专用)发票";break;
  680. case 1206 :
  681. kindStr = "增值税普通发票"; break;
  682. default:
  683. kindStr = "增值税普通发票"; break;
  684. }
  685. return kindStr;
  686. }
  687. });
  688. /**
  689. * 买家中心头部
  690. */
  691. app.controller('UserCenterHeaderCtrl', ['$scope', '$rootScope', 'BaseService', 'InternalMessage', '$http', 'toaster', function ($scope, $rootScope, BaseService, InternalMessage, $http, toaster) {
  692. $scope.homeUrl = BaseService.getRootPath();
  693. console.info($rootScope.userInfo);
  694. InternalMessage.getUrl({}, function(data) {
  695. var url = data.url;
  696. if (url == "http://218.17.158.219:24000/message") {
  697. url = 'http://192.168.253.6:24000/message';
  698. }
  699. var param = {
  700. 'receiverUu': data.userUU,
  701. 'receiverEnuu': data.enUU,
  702. 'consumerApp': 'MALL',
  703. 'isRead': 0
  704. };
  705. $http({
  706. method: 'get',
  707. dataType: 'json',
  708. url: url + '/messages/count',
  709. params: param
  710. }).success(function (data) {
  711. $rootScope.unReadMessCount = data.count;
  712. }).error(function (err) {
  713. toaster.pop('error', err || '获取未读消息数量失败');
  714. });
  715. });
  716. // InternalMessage.getUnread({isRead: 0}, function (data) {
  717. // $rootScope.unReadMessCount = data.toRead;
  718. // }, function (err) {
  719. // toaster.pop('error', err || '获取未读消息数量失败');
  720. // })
  721. }]);
  722. /*InternalMessage.getUnread({isRead: 0}, function (data) {
  723. $rootScope.unReadMessCount = data.toRead;
  724. }, function (err) {
  725. toaster.pop('error', err || '获取未读消息数量失败');
  726. })
  727. }]);*/
  728. /**
  729. * 采购单状态
  730. */
  731. app.filter('orderStatus', function() {
  732. return function(status) {
  733. if (!status || status == '') {
  734. status = 501;
  735. }
  736. if (status == 501 || status == 503 || status == 504 || status == 524 || status == 525) {
  737. return '待付款';
  738. } else if (status == 505 || status == 406 || status == 407 || status == 403 || status == 408) {
  739. return '待发货';
  740. } else if (status == 404) {
  741. return '待收货';
  742. } else if (status == 405) {
  743. return '待收款';
  744. } else if (status == 520){
  745. return '交易完成';
  746. } else {
  747. return '已取消';
  748. }
  749. }
  750. });
  751. // 币别filter
  752. app.filter('currencyStr', function () {
  753. return function (str) {
  754. return typeof str == 'string' && str != 'RMB' && str != 'USD' ? str.startsWith('RMB') ? '¥' + str.substring(3, str.length) : '$' + str.substring(3, str.length) : '-';
  755. }
  756. });
  757. return app;
  758. });