app.js 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038
  1. define([ 'angularAMD', 'ngLocal', 'common/services', 'common/directives', 'common/query/brand', 'common/query/kind', 'common/query/component', 'common/query/goods','common/query/rate', 'common/query/cart', 'common/query/order', 'common/query/address', 'common/query/invoice', 'common/query/property', 'common/query/kindAdvice', 'common/query/propertyAdvice', 'common/query/return' , 'common/query/change', 'common/query/logistics', 'ui.router', 'ui-bootstrap', 'ui-form', 'ui-jquery', 'angular-toaster', 'ngDraggable', 'angular-sanitize', 'ngTable', 'dynamicInput', 'jquery-imagezoom', 'file-upload', 'file-upload-shim', 'common/query/urlencryption' , 'common/query/purchase', 'common/query/vendor', 'common/query/goods', 'common/query/bankTransfer', 'common/query/enterprise', 'common/query/bill', 'common/query/receipt', 'common/query/collection', 'common/query/express', 'common/query/bankInfo','common/query/charge', 'common/query/statistics', 'common/query/currency', 'jquery-chart', 'common/query/responseLogistics', 'common/query/goodsPrice', 'common/query/address' , 'common/query/search', 'common/query/urlencryption', 'common/query/releaseProInfo', 'common/query/makerDemand', 'common/query/afterSale', 'common/query/messageBoard', 'common/query/logistics', 'common/query/storeInfo', 'common/query/recommendation', 'common/query/user', 'common/query/logisticsPort', 'common/query/cms', 'common/query/material', 'common/query/storeCms', 'common/query/productImport', 'common/query/stockInOut', 'common/module/store_recommend_product', 'common/module/chat_web_module', 'common/query/standardPutOnAdmin', 'common/query/storeViolations', 'common/query/internalMessage', 'common/query/installments', 'common/query/product', ,'common/query/UASBatchPutOnProperty'], function(angularAMD) {
  2. 'use strict';
  3. /**
  4. * 自定义Array对象的属性last 方法
  5. * 调用获取数组的最后一个元素
  6. */
  7. Array.prototype.last = function() {
  8. return this.length > 0 ? this[this.length - 1] : null;
  9. };
  10. var app = angular.module('myApp', [ 'ui.router', 'ui.bootstrap', 'ng.local', 'ui.form', 'ui.jquery', 'toaster', 'ngDraggable', 'tool.directives', 'ngSanitize', 'common.query.kind', 'common.services', 'brandServices', 'componentServices', 'goodsServices', 'rateServices','cartServices', 'orderServices', 'addressServices', 'invoiceServices', 'common.query.propertyAdvice', 'propertyServices', 'returnServices' , 'changeServices', 'logisticsServices', 'common.query.kindAdvice', 'ngTable', 'ngDynamicInput', 'common.directives', 'angularFileUpload', 'urlencryptionServices', 'purchaseServices', 'vendorServices', 'goodsServices', 'bankTransfer', 'common.query.enterprise', 'billServices', 'receiptServices', 'collection', 'expressServices', 'bankInfo','Charge', 'statisticsServices', 'currencyService', 'responseLogisticsService', 'PriceServices', 'addressServices', 'searchService', 'urlencryptionServices', 'ReleaseProductByBatchService', 'makerDemand', 'afterSaleService', 'messageBoardServices', 'logisticsServices', 'table.directives', 'storeInfoServices', 'recommendation', 'common.query.user', 'logisticsPortService', 'cmsService', 'materialServices', 'StoreCmsServices', 'productImportModule', 'stockInOutModule', 'StoreCmsModule', 'WebChatModule', 'StandardPutOnAdminModule', 'StoreViolationsServices', 'internalMessageServices', 'common.query.product', 'ui.tour', 'installmentServices', 'UASBatchPutOnPropertyModule']);
  11. //初始化,启动时载入app
  12. app.init = function() {
  13. angularAMD.bootstrap(app);
  14. };
  15. // ui-router 路由配置
  16. app.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider){
  17. $urlRouterProvider.otherwise("/index");
  18. $stateProvider.state('vendor_index', angularAMD.route({
  19. url: '/index',
  20. templateUrl: 'static/view/vendor/forstore/vendor_index.html',
  21. title: '卖家中心首页',
  22. controllerUrl: 'app/controllers/forstore/vendor_index_ctrl',
  23. controller: 'vendorIndexCtrl'
  24. })).state('message', angularAMD.route({
  25. url: '/message',
  26. templateUrl: 'static/view/vendor/forstore/messagePersonal.html',
  27. title: '消息',
  28. controller: 'MessageCtrl',
  29. controllerUrl: 'app/controllers/forstore/messageCtrl'
  30. })).state('browsing-history', angularAMD.route({
  31. url: '/browsing-history',
  32. templateUrl: 'static/view/vendor/forstore/browsing-history.html',
  33. title: '浏览历史',
  34. controller: 'BrowsingHistoryCtrl',
  35. controllerUrl: 'app/controllers/forstore/browsingHistoryCtrl'
  36. })).state('vendor_order', angularAMD.route({
  37. url: '/order/center',
  38. templateUrl: 'static/view/vendor/forstore/vendor_order.html',
  39. title: '订单中心',
  40. controllerUrl: 'app/controllers/forstore/vendor_order_ctrl',
  41. controller: 'vendorOrderCtrl'
  42. })).state('vendor_logistics', angularAMD.route({
  43. url: '/logistics/:purchaseid',
  44. templateUrl: 'static/view/vendor/forstore/vendor_logistics.html',
  45. title: '物流信息',
  46. controllerUrl: 'app/controllers/forstore/vendor_logistics_ctrl',
  47. controller: 'vendorLogisticsCtrl'
  48. })).state('vendor_query_logistics', angularAMD.route({
  49. url: '/logistics/query/:purchaseid',
  50. templateUrl: 'static/view/vendor/forstore/query_logistics.html',
  51. title: '查询物流',
  52. controllerUrl: 'app/controllers/forstore/query_logistics_ctrl',
  53. controller: 'vendorQueryLogisticsCtrl'
  54. })).state('vendor_account_management', angularAMD.route({
  55. url: '/account/management/:op',
  56. templateUrl: 'static/view/vendor/forstore/vendor_account_management.html',
  57. title: '账户管理',
  58. controllerUrl: 'app/controllers/forstore/vendor_account_management_ctrl',
  59. controller: 'vendorAccountManagementCtrl'
  60. })).state('vendor_after_sale', angularAMD.route({
  61. url: '/after/sale',
  62. templateUrl: 'static/view/vendor/forstore/vendor_after_sale.html',
  63. title: '售后服务',
  64. controllerUrl: 'app/controllers/forstore/vendor_after_sale_ctrl',
  65. controller: 'vendorAfterSaleCtrl'
  66. })).state('vendor_brand_apply', angularAMD.route({
  67. url: '/brand/apply/:uuid',
  68. templateUrl: 'static/view/vendor/forstore/vendor_brand_apply.html',
  69. title: '品牌申请',
  70. controllerUrl: 'app/controllers/forstore/vendor_brand_apply_ctrl',
  71. controller: 'vendorBrandApplyCtrl'
  72. })).state('vendor_brand_reapply', angularAMD.route({
  73. url: '/brand/reapply/:id',
  74. templateUrl: 'static/view/vendor/forstore/vendor_brand_apply.html',
  75. title: '品牌再次申请',
  76. controllerUrl: 'app/controllers/forstore/vendor_brand_apply_ctrl',
  77. controller: 'vendorBrandApplyCtrl'
  78. })).state('vendor_brand_apply_list', angularAMD.route({
  79. url: '/brand/apply_list',
  80. templateUrl: 'static/view/vendor/forstore/vendor_brand_apply_list.html',
  81. title: '品牌申请列表',
  82. controllerUrl: 'app/controllers/forstore/vendor_brand_apply_list_ctrl',
  83. controller: 'vendorBrandApplyListCtrl'
  84. })).state('vendor_component_apply', angularAMD.route({
  85. url: '/component/apply',
  86. templateUrl: 'static/view/vendor/forstore/vendor_component_apply.html',
  87. title: '器件单个申请',
  88. controllerUrl: 'app/controllers/forstore/vendor_component_apply_ctrl',
  89. controller: 'vendorComponentApplyCtrl'
  90. })).state('vendor_component_batchapply', angularAMD.route({
  91. url: '/component/batchapply',
  92. templateUrl: 'static/view/vendor/forstore/vendor_component_batchapply.html',
  93. title: '器件申请批量',
  94. controllerUrl: 'app/controllers/forstore/vendor_component_batchapply_ctrl',
  95. controller: 'vendorComponentBatchApplyCtrl'
  96. })).state('vendor_component_applylist', angularAMD.route({
  97. url: '/component/applylist',
  98. templateUrl: 'static/view/vendor/forstore/vendor_component_applylist.html',
  99. title: '器件申请单个列表',
  100. controllerUrl: 'app/controllers/forstore/vendor_component_applylist_ctrl',
  101. controller: 'vendorComponentApplyListCtrl'
  102. })).state('vendor_component_batchapplylist', angularAMD.route({
  103. url: '/component/batchapplylist',
  104. templateUrl: 'static/view/vendor/forstore/vendor_component_batchapplylist.html',
  105. title: '器件申请批量列表',
  106. controllerUrl: 'app/controllers/forstore/vendor_component_batchapplylist_ctrl',
  107. controller: 'vendorComponentBatchApplyListCtrl'
  108. })).state('vendor_goods', angularAMD.route({
  109. url: '/goods',
  110. templateUrl: 'static/view/vendor/forstore/vendor_goods.html',
  111. title: '货品管理',
  112. controllerUrl: 'app/controllers/forstore/vendor_goods_ctrl',
  113. controller: 'vendorGoodsCtrl'
  114. })).state('vendor_manufacture', angularAMD.route({
  115. url: '/manufacture',
  116. templateUrl: 'static/view/vendor/forstore/vendor_manufacture.html',
  117. title: '原厂认证',
  118. controllerUrl: 'app/controllers/forstore/vendor_manufacture_ctrl',
  119. controller: 'vendorManufactureCtrl'
  120. })).state('vendor_stock_agent', angularAMD.route({
  121. url: '/stock/agent',
  122. templateUrl: 'static/view/vendor/forstore/vendor_stock_agent.html',
  123. title: '库存寄售',
  124. controllerUrl: 'app/controllers/forstore/vendor_stock_agent_ctrl',
  125. controller: 'vendorStockAgentCtrl'
  126. })).state('vendor_store_apply', angularAMD.route({
  127. url: '/store-apply',
  128. templateUrl: 'static/view/vendor/forstore/vendor_store_apply.html',
  129. title: '开店申请',
  130. controllerUrl: 'app/controllers/forstore/vendor_store_apply_ctrl',
  131. controller: 'vendorStoreApplyCtrl'
  132. })).state('vendor_store_wait', angularAMD.route({
  133. url: '/store-apply/wait',
  134. templateUrl: 'static/view/vendor/forstore/vendor_store_wait.html',
  135. title: '开店申请-申请中',
  136. controllerUrl: 'app/controllers/forstore/vendor_store_wait_ctrl',
  137. controller: 'vendorStoreWaitCtrl'
  138. })).state('vendor_store_info', angularAMD.route({
  139. url: '/store-apply/finish',
  140. templateUrl: 'static/view/vendor/forstore/vendor_store_info.html',
  141. title: '我的店铺-已申请',
  142. controllerUrl: 'app/controllers/forstore/vendor_store_info_ctrl',
  143. controller: 'vendorStoreInfoCtrl'
  144. })).state('vendor_store_maintain', angularAMD.route({
  145. url: '/store/maintain',
  146. templateUrl: 'static/view/vendor/forstore/vendor_store_maintain.html',
  147. title: '我的店铺-维护',
  148. controllerUrl: 'app/controllers/forstore/vendor_store_maintain_ctrl',
  149. controller: 'vendorStoreMaintainCtrl'
  150. })).state('vendor_store_close', angularAMD.route({
  151. url: '/store/close',
  152. templateUrl: 'static/view/vendor/forstore/vendor_store_close.html',
  153. title: '店铺关闭',
  154. controllerUrl: 'app/controllers/forstore/vendor_store_close_ctrl',
  155. controller: 'vendorStoreColseCtrl'
  156. })).state('vendor_delivery', angularAMD.route({
  157. url: '/delivery/:ids',
  158. templateUrl: 'static/view/vendor/forstore/vendor_delivery.html',
  159. title: '卖家发货',
  160. controllerUrl: 'app/controllers/forstore/vendor_delivery_ctrl',
  161. controller: 'vendorDeliveryCtrl'
  162. }))//3月24日 开始 增加店铺的功能,下面的代码是之前写得。
  163. .state('home', angularAMD.route({
  164. // 器件展示首页
  165. url: '/home',
  166. templateUrl: 'static/view/vendor/home.html',
  167. title: '主页',
  168. controllerUrl: 'app/controllers/HomeCtrl',
  169. controller: 'HomeCtrl'
  170. })).state('putOn', angularAMD.route({
  171. // 发布产品
  172. title: '发布产品',
  173. url: '/putOn/:prodUuid',
  174. templateUrl: 'static/view/vendor/putOn.html',
  175. controllerUrl: 'app/controllers/PutOnCtrl',
  176. controller: 'PutOnCtrl'
  177. })).state('salingGoods', angularAMD.route({
  178. // 销售中的产品
  179. title: '销售中产品',
  180. url: '/salingGoods',
  181. templateUrl: 'static/view/vendor/salingGoods.html',
  182. controllerUrl: 'app/controllers/SalingGoodsCtrl',
  183. controller: 'SalingGoodsCtrl'
  184. })).state('goodsDetail', angularAMD.route({
  185. // 产品详情
  186. title: '产品详情',
  187. url: '/goodsDetail/:batchCode',
  188. templateUrl: 'static/view/vendor/goods_detail.html',
  189. controllerUrl: 'app/controllers/GoodsDetailCtrl',
  190. controller: 'GoodsDetailCtrl'
  191. })).state('downedGoods', angularAMD.route({
  192. // 已下架产品
  193. title: '已下架产品',
  194. url: '/downedGoods',
  195. templateUrl: 'static/view/vendor/downedGoods.html',
  196. controllerUrl: 'app/controllers/DownedGoodsCtrl',
  197. controller: 'DownedGoodsCtrl'
  198. })).state('goodsPrice', angularAMD.route({
  199. // 价格库
  200. title: '价格库',
  201. url: '/goodsPrice',
  202. templateUrl: 'static/view/vendor/goods_price.html',
  203. controllerUrl: 'app/controllers/GoodsPriceCtrl',
  204. controller: 'GoodsPriceCtrl'
  205. })).state('invoice', angularAMD.route({
  206. // 出货单
  207. title: '出货单',
  208. url: '/invoice',
  209. templateUrl: 'static/view/vendor/invoice.html',
  210. controllerUrl: 'app/controllers/InvoiceCtrl',
  211. controller: 'InvoiceCtrl'
  212. })).state('invoice_detail', angularAMD.route({
  213. // 出货单详情
  214. title: '出货单详情',
  215. url: '/invoice/:invoiceid',
  216. templateUrl: 'static/view/vendor/invoice_detail.html',
  217. controllerUrl: 'app/controllers/InvoiceDetailCtrl',
  218. controller: 'InvoiceDetailCtrl'
  219. })).state('invoiceChange', angularAMD.route({
  220. // 出货单
  221. title: '换货出货单',
  222. url: '/invoiceChange',
  223. templateUrl: 'static/view/vendor/invoiceChange.html',
  224. controllerUrl: 'app/controllers/InvoiceChangeCtrl',
  225. controller: 'InvoiceChangeCtrl'
  226. })).state('invoiceChangeDetail', angularAMD.route({
  227. // 换货出货单详情
  228. title: '换货出货单详情页',
  229. url: '/invoiceChange/:invoiceChangeId',
  230. templateUrl: 'static/view/vendor/invoice_change_detail.html',
  231. controllerUrl: 'app/controllers/InvoiceChangeDetailCtrl',
  232. controller: 'InvoiceChangeDetailCtrl'
  233. })).state('return', angularAMD.route({
  234. // 退货管理
  235. title: '退货单',
  236. url: '/return',
  237. templateUrl: 'static/view/vendor/return.html',
  238. controllerUrl: 'app/controllers/ReturnCtrl',
  239. controller: 'ReturnCtrl'
  240. })).state('change', angularAMD.route({
  241. // 换货管理
  242. title: '换货单',
  243. url: '/change',
  244. templateUrl: 'static/view/vendor/change.html',
  245. controllerUrl: 'app/controllers/ChangeCtrl',
  246. controller: 'ChangeCtrl'
  247. })).state('returnDetail', angularAMD.route({
  248. // 退货单明细
  249. title: '退货单明细',
  250. url: '/return/:returnid',
  251. templateUrl: 'static/view/vendor/return_detail.html',
  252. controllerUrl: 'app/controllers/ReturnDetailCtrl',
  253. controller: 'ReturnDetailCtrl'
  254. })).state('changeDetail', angularAMD.route({
  255. // 换货单明细
  256. title: '换货单明细',
  257. url: '/change/:changeid',
  258. templateUrl: 'static/view/vendor/change_detail.html',
  259. controllerUrl: 'app/controllers/ChangeDetailCtrl',
  260. controller: 'ChangeDetailCtrl'
  261. })).state('tradeRecord', angularAMD.route({
  262. // 交易记录
  263. title: '交易记录',
  264. url: '/tradeRecord',
  265. templateUrl: 'static/view/vendor/tradeRecord.html',
  266. controllerUrl: 'app/controllers/TradeRecordCtrl',
  267. controller: 'TradeRecordCtrl'
  268. })).state('requestPayment', angularAMD.route({
  269. // 付款申请记录
  270. title: '交易记录',
  271. url: '/requestPayRecord',
  272. templateUrl: 'static/view/vendor/requestPayRecord.html',
  273. controllerUrl: 'app/controllers/RequestPayRecordCtrl',
  274. controller: 'RequestPayRecordCtrl'
  275. })).state('tradeRecordDetail', angularAMD.route({
  276. // 交易记录详情
  277. title: '交易记录详情',
  278. url: '/tradeRecord/:receiptid',
  279. templateUrl: 'static/view/vendor/trade_record_detail.html',
  280. controllerUrl: 'app/controllers/TradeRecordDetailCtrl',
  281. controller: 'TradeRecordDetailCtrl'
  282. })).state('brand_matenance', angularAMD.route({
  283. // 品牌维护
  284. title: '品牌维护',
  285. url: '/home/brandMaintenance',
  286. templateUrl : 'static/view/vendor/brandMaintenance.html',
  287. controller : 'BrandMaintenanceCtrl',
  288. controllerUrl : 'app/controllers/BrandMaintenanceCtrl'
  289. })).state('component_matenance', angularAMD.route({
  290. // 标准器件维护
  291. title: '器件维护',
  292. url: '/home/componentMaintenance',
  293. templateUrl : 'static/view/vendor/componentMaintenance.html',
  294. controller : 'ComponentMaintenanceCtrl',
  295. controllerUrl : 'app/controllers/ComponentMaintenanceCtrl'
  296. })).state('component_batchMatenance', angularAMD.route({
  297. // 标准器件批量维护
  298. title: '器件批量维护',
  299. url: '/home/componentBatchMaintenance',
  300. templateUrl : 'static/view/vendor/componentBatchMaintenance.html',
  301. controller : 'ComponentBatchMaintenanceCtrl',
  302. controllerUrl : 'app/controllers/ComponentBatchMaintenanceCtrl'
  303. })).state('component_batchMatenanceDetail', angularAMD.route({
  304. // 标准器件批量维护详情
  305. title: '器件批量维护详情',
  306. url: '/home/componentBatchMaintenance/detail/:submitId',
  307. templateUrl : 'static/view/vendor/componentBatchSubmit_dt.html',
  308. controller : 'ComponentBatchSubmitDtCtrl',
  309. controllerUrl : 'app/controllers/ComponentBatchSubmitDtCtrl'
  310. })).state('component_batchCreate', angularAMD.route({
  311. // 新增标准器件批量维护申请
  312. title: '新增器件批量维护',
  313. url: '/home/componentBatchMaintenance/create',
  314. templateUrl : 'static/view/vendor/component_batch_create.html',
  315. controller : 'ComponentBatchCreateCtrl',
  316. controllerUrl : 'app/controllers/ComponentBatchCreateCtrl'
  317. })).state('publishByBatch', angularAMD.route({
  318. //批量发布产品
  319. title: '批量发布产品',
  320. url: '/publishByBatch',
  321. templateUrl: 'static/view/vendor/publishByBatch.html',
  322. controllerUrl: 'app/controllers/PublishByBatchCtrl',
  323. controller: 'PublishByBatchCtrl'
  324. })).state('releaseProductByBatch', angularAMD.route({
  325. //批量发布产品(大量)
  326. title: '批量发布产品(大量)',
  327. url: '/releaseProductByBatch',
  328. templateUrl: 'static/view/vendor/releaseProductByBatch.html',
  329. controllerUrl: 'app/controllers/ReleaseProductByBatchCtrl',
  330. controller: 'ReleaseProductByBatchCtrl'
  331. })).state('entryCheck', angularAMD.route({
  332. title: '批量出货',
  333. url: '/entryCheck/:ids',
  334. templateUrl: 'static/view/vendor/entryCheck.html',
  335. controllerUrl: 'app/controllers/CheckSaveCtrl',
  336. controller: 'CheckSaveCtrl'
  337. })).state('shipFchange', angularAMD.route({
  338. title: '换货单批量出货',
  339. url: '/shipFchange/:ids',
  340. templateUrl: 'static/view/vendor/shipFchange.html',
  341. controllerUrl: 'app/controllers/ShipFchangeCtrl',
  342. controller: 'ShipFchangeCtrl'
  343. })).state('cusPurchase', angularAMD.route({
  344. title: '订单管理',
  345. url: '/cusPurchase',
  346. templateUrl: 'static/view/vendor/cusPurchase.html',
  347. controllerUrl: 'app/controllers/cusPurchaseCtrl',
  348. controller: 'cusPurchaseCtrl'
  349. })).state('exceptionApply', angularAMD.route({
  350. title: '异常申请',
  351. url: '/exception/exceptionApply/:purchaseId',
  352. templateUrl: 'static/view/vendor/exceptionApply.html',
  353. controllerUrl: 'app/controllers/exceptionApplyCtrl',
  354. controller: 'exceptionApplyCtrl'
  355. })).state('exceptionApplyDetails', angularAMD.route({
  356. title: '异常申请详情',
  357. url: '/exception/exceptionApplyDetails/:applyId',
  358. templateUrl: 'static/view/vendor/exceptionApplyDetails.html',
  359. controllerUrl: 'app/controllers/exceptionApplyDetailsCtrl',
  360. controller: 'exceptionApplyDetailsCtrl'
  361. })).state('exceptionNotify', angularAMD.route({
  362. title: '异常通知',
  363. url: '/exception/exceptionNotify/:applyId',
  364. templateUrl: 'static/view/vendor/exceptionNotify.html',
  365. controllerUrl: 'app/controllers/exceptionNotifyCtrl',
  366. controller: 'exceptionNotifyCtrl'
  367. })).state('cusPurchaseDetail', angularAMD.route({
  368. title: '订单详情',
  369. url: '/cusPurchase/:purchaseid',
  370. templateUrl: 'static/view/vendor/cusPurchase_detail.html',
  371. controllerUrl: 'app/controllers/cusPurchaseDetailCtrl',
  372. controller: 'curPurchaseDetailCtrl'
  373. })).state('proofing', angularAMD.route({
  374. // 客户送样申请单
  375. url: '/proofing',
  376. templateUrl : 'static/view/vendor/proofing.html',
  377. controller : 'MyProofingCtrl',
  378. controllerUrl : 'app/controllers/MyProofingCtrl'
  379. })).state('invoiceProofing', angularAMD.route({
  380. // 送样出货单
  381. url: '/invoiceProofing',
  382. templateUrl : 'static/view/vendor/invoiceProofing.html',
  383. controller : 'InvoiceProofingCtrl',
  384. controllerUrl : 'app/controllers/InvoiceProofingCtrl'
  385. })).state('faStatistics', angularAMD.route({
  386. title: '财务管理总体情况统计',
  387. url: '/faStatistics',
  388. templateUrl: 'static/view/vendor/faStatistics.html',
  389. controllerUrl: 'app/controllers/FaStatisticsCtrl',
  390. controller: 'FaStatisticsCtrl'
  391. })).state('faInOut', angularAMD.route({
  392. title: '财务管理收支管理',
  393. url: '/faInOut',
  394. templateUrl: 'static/view/vendor/faInOut.html',
  395. controllerUrl: 'app/controllers/FaInOutCtrl',
  396. controller: 'FaInOutCtrl'
  397. })).state('faBill', angularAMD.route({
  398. title: '财务管理发票管理',
  399. url: '/faBill',
  400. templateUrl: 'static/view/vendor/faBill.html',
  401. controllerUrl: 'app/controllers/FaBillCtrl',
  402. controller: 'FaBillCtrl'
  403. })).state('faBank', angularAMD.route({
  404. title: '财务管理账户查询',
  405. url: '/faBank',
  406. templateUrl: 'static/view/vendor/faBank.html',
  407. controllerUrl: 'app/controllers/FaBankCtrl',
  408. controller: 'FaBankCtrl'
  409. })).state('sendExpress', angularAMD.route({
  410. title: '我要寄快递',
  411. url: '/express/send',
  412. templateUrl: 'static/view/vendor/sendExpress.html',
  413. controllerUrl: 'app/controllers/SendExpressCtrl',
  414. controller: 'SendExpressCtrl'
  415. })).state('recordExpress', angularAMD.route({
  416. title: '物流服务',
  417. url: '/express/record',
  418. templateUrl: 'static/view/vendor/recordExpress.html',
  419. controllerUrl: 'app/controllers/RecordExpressCtrl',
  420. controller: 'RecordExpressCtrl'
  421. })).state('listExpress', angularAMD.route({
  422. title: '电子面单',
  423. url: '/express/list',
  424. templateUrl: 'static/view/vendor/listExpress.html',
  425. controllerUrl: 'app/controllers/ListExpressCtrl',
  426. controller: 'ListExpressCtrl'
  427. })).state('credit_card', angularAMD.route({
  428. url : '/creditCard',
  429. templateUrl : 'static/view/vendor/creditCardAdmin.html',
  430. controllerUrl : 'app/controllers/creditCardAdminCtrl',
  431. controller : 'creditCardAdminCtrl'
  432. })).state('address_admin', angularAMD.route({
  433. url : '/addressAdmin',
  434. templateUrl : 'static/view/vendor/addressAdmin.html',
  435. controller : 'addressAdminCtrl',
  436. controllerUrl : 'app/controllers/addressAdminCtrl'
  437. })).state('charge', angularAMD.route({
  438. title: '议价单管理',
  439. url: '/charge',
  440. templateUrl: 'static/view/vendor/charge.html',
  441. controllerUrl: 'app/controllers/ChargeCtrl',
  442. controller: 'ChargeCtrl'
  443. })).state('puchaseBillAdmin', angularAMD.route({
  444. title: '采购单发票管理',
  445. url: '/puchase/bill/admin',
  446. templateUrl: 'static/view/vendor/puchaseBillAdmin.html',
  447. controllerUrl: 'app/controllers/puchaseBillAdminCtrl',
  448. controller: 'puchaseBillAdminCtrl'
  449. })).state('openBill', angularAMD.route({
  450. title: '开发票',
  451. url: '/bill/open/:id',
  452. templateUrl: 'static/view/vendor/openBill.html',
  453. controllerUrl: 'app/controllers/openBillCtrl',
  454. controller: 'openBillCtrl'
  455. })).state('purchase_detail', angularAMD.route({
  456. title : '采购单详情',
  457. url : '/purchase/detail/:purchaseId',
  458. templateUrl : 'static/view/vendor/forstore/purchase_detail.html',
  459. controllerUrl : "app/controllers/forstore/purchase_detail",
  460. controller : 'purchaseDetailCtrl'
  461. })).state('vendor_productOn', angularAMD.route({
  462. title : '产品导入',
  463. url : '/vendor_productOn',
  464. // templateUrl : 'static/view/vendor/forstore/vendor_upload.html',
  465. // controllerUrl : "app/controllers/forstore/vendor_upload_ctrl",
  466. // controller : 'vendorUploadCtrl'
  467. // templateUrl : 'static/view/vendor/forstore/vendor_productOn.html',
  468. templateUrl : 'static/view/vendor/forstore/product_file.html',
  469. controllerUrl : "app/controllers/forstore/vendor_productOn_ctrl",
  470. controller : 'vendorProductOnCtrl'
  471. })).state('product_repository', angularAMD.route({
  472. title : '产品库',
  473. url : '/product_repository',
  474. // templateUrl : 'static/view/vendor/forstore/vendor_upload.html',
  475. // controllerUrl : "app/controllers/forstore/vendor_upload_ctrl",
  476. // controller : 'vendorUploadCtrl'
  477. templateUrl : 'static/view/vendor/forstore/vendor_proRepository.html',
  478. controllerUrl : "app/controllers/forstore/vendor_proRepository_ctrl",
  479. controller : 'vendorProductRepostoryCtrl'
  480. })).state('vendor_upload', angularAMD.route({
  481. title : '标准上架',
  482. url : '/vendor_upload',
  483. templateUrl : 'static/view/vendor/forstore/vendor_upload.html',
  484. controllerUrl : "app/controllers/forstore/vendor_upload_ctrl",
  485. controller : 'vendorUploadCtrl'
  486. })).state('vendor_repository', angularAMD.route({
  487. title : '仓库管理',
  488. url : '/vendor_repository',
  489. templateUrl : 'static/view/vendor/forstore/vendor_repository.html',
  490. controllerUrl : "app/controllers/forstore/vendor_repository_ctrl",
  491. controller : 'vendorRepositoryCtrl'
  492. })).state('vendor_material', angularAMD.route({
  493. title : '物料资料',
  494. url : '/vendor_material',
  495. templateUrl : 'static/view/vendor/forstore/vendor_material.html',
  496. controllerUrl : "app/controllers/forstore/vendor_materialCtrl",
  497. controller : 'vendor_materialCtrl'
  498. })).state('vendor_material_erp', angularAMD.route({
  499. title : '可上架产品toErp',
  500. url : '/vendor_material_erp?standardParam',
  501. templateUrl : 'static/view/vendor/forstore/erp/vendor_material_erp.html',
  502. controllerUrl : "app/controllers/forstore/vendor_materialCtrl",
  503. controller : 'vendor_materialCtrl'
  504. })).state('vendor_material_unstandard_erp', angularAMD.route({
  505. title : '暂不可上架产品toErp',
  506. url : '/vendor_material_unstandard_erp?standardParam',
  507. templateUrl : 'static/view/vendor/forstore/erp/vendor_material_unstandard_erp.html',
  508. controllerUrl : "app/controllers/forstore/vendor_materialCtrl",
  509. controller : 'vendor_materialCtrl'
  510. })).state('vendor_onSale', angularAMD.route({
  511. title : '在售产品',
  512. url : '/vendor_onSale',
  513. templateUrl : 'static/view/vendor/forstore/vendor_onSale.html',
  514. controllerUrl : "app/controllers/forstore/vendor_onSaleCtrl",
  515. controller : 'vendor_onSaleCtrl'
  516. })).state('vendor_onSale_erp', angularAMD.route({
  517. title : '已上架产品toErp',
  518. url : '/vendor_onSale_erp',
  519. templateUrl : 'static/view/vendor/forstore/erp/vendor_onSale_erp.html',
  520. controllerUrl : "app/controllers/forstore/vendor_onSaleCtrl",
  521. controller : 'vendor_onSaleCtrl'
  522. })).state('vendor_standardPutOn', angularAMD.route({
  523. title : '标准上架管理',
  524. url : '/vendor_standardPutOn',
  525. templateUrl : 'static/view/vendor/forstore/vendor_standard_putOn.html',
  526. controllerUrl : "app/controllers/forstore/vendor_standard_putOn_ctrl",
  527. controller : 'vendor_standardPutOnCtrl'
  528. })).state('vendor_undercarriage', angularAMD.route({
  529. title : '下架产品',
  530. url : '/vendor_undercarriage',
  531. templateUrl : 'static/view/vendor/forstore/vendor_undercarriage.html',
  532. controllerUrl : "app/controllers/forstore/vendor_undercarriageCtrl",
  533. controller : 'vendor_undercarriageCtrl'
  534. })).state('vendor_undercarriage_erp', angularAMD.route({
  535. title : '上下架历史toErp',
  536. url : '/vendor_undercarriage_erp',
  537. templateUrl : 'static/view/vendor/forstore/erp/vendor_undercarriage_erp.html',
  538. controllerUrl : "app/controllers/forstore/vendor_undercarriageCtrl",
  539. controller : 'vendor_undercarriageCtrl'
  540. })).state('pay_center', angularAMD.route({
  541. url: '/payCenter?tab',
  542. templateUrl: 'static/view/vendor/forstore/pay_center.html',
  543. controller: 'payCenterCtrl',
  544. controllerUrl: 'app/controllers/forstore/pay_center_ctrl'
  545. })).state('vendor_deliveryRule', angularAMD.route({
  546. title : '配送规则',
  547. url: '/vendor_deliveryRule',
  548. templateUrl : 'static/view/vendor/forstore/vendor_delivery_rule.html',
  549. controller: 'vendorDeliveryRuleCtrl',
  550. controllerUrl: 'app/controllers/forstore/vendor_deliveryRule_ctrl'
  551. })).state('vendor_distributor', angularAMD.route({
  552. title : '配送商',
  553. url: '/vendor_distributor',
  554. templateUrl : 'static/view/vendor/forstore/vendor_distributor.html',
  555. controller: 'vendorDistributorCtrl',
  556. controllerUrl: 'app/controllers/forstore/vendor_distributor_ctrl'
  557. })).state('vendor_takeSelf', angularAMD.route({
  558. title : '自提点',
  559. url: '/vendor_takeSelf',
  560. templateUrl : 'static/view/vendor/forstore/vendor_take_self.html',
  561. controller: 'vendorTakeSelfCtrl',
  562. controllerUrl: 'app/controllers/forstore/vendor_takeSelf_ctrl'
  563. })).state('messagePersonal', angularAMD.route({
  564. url: '/messagePersonal',
  565. templateUrl: 'static/view/vendor/forstore/messagePersonal.html',
  566. controller: 'MessagePersonalCtrl',
  567. controllerUrl: 'app/controllers/forstore/messagePersonalCtrl'
  568. })).state('messagePublic', angularAMD.route({
  569. url: '/messagePublic',
  570. templateUrl: 'static/view/vendor/forstore/messagePublic.html',
  571. controller: 'MessagePublicCtrl',
  572. controllerUrl: 'app/controllers/forstore/messagePublicCtrl'
  573. })).state('vendorInvoice', angularAMD.route({
  574. url: '/vendor_invoice',
  575. title:'发票管理',
  576. templateUrl: 'static/view/vendor/forstore/vendor-invoice.html',
  577. controller: 'vendorInvoiceCtrl',
  578. controllerUrl: 'app/controllers/forstore/vendor_invoice_ctrl'
  579. })).state('showRate', angularAMD.route({
  580. url: '/showRate/:orderId/:buyEmail',
  581. templateUrl: 'static/view/vendor/forstore/showRate.html',
  582. controller: 'showRateCtrl',
  583. controllerUrl: 'app/controllers/forstore/show_rate_ctrl'
  584. }));
  585. }]);
  586. // 状态码 -> 描述
  587. app.filter('status', function(){
  588. var statusConfig = {
  589. '103': '未通过',
  590. '104': '已通过',
  591. '311': '待审核'
  592. };
  593. return function(data) {
  594. return statusConfig[data];
  595. }
  596. });
  597. app.run(['$rootScope', '$state', '$q', 'BaseService', 'StoreInfo', function($rootScope, $state, $q, BaseService, StoreInfo) {
  598. $rootScope.rootPath = BaseService.getRootPath();
  599. $rootScope.page = 'vendor';// 导航栏状态,'个人中心'状态激活
  600. $rootScope.$on('$stateChangeStart', function (event, toState) {
  601. var getToStateName = function () {
  602. if ($rootScope.store && (!$rootScope.store.status || $rootScope.store.status === 'OPENED')) {
  603. return 'vendor_store_maintain';
  604. } else if ($rootScope.store && $rootScope.store.status && $rootScope.store.status !== 'OPENED') {
  605. return 'vendor_store_close';
  606. } else if ($rootScope.applyStatus === 'NONE') {
  607. return 'vendor_store_apply';
  608. } else if ($rootScope.applyStatus === 'PREPARE') {
  609. return 'vendor_store_wait';
  610. } else if ($rootScope.applyStatus === 'PASS') {
  611. return 'vendor_store_info';
  612. } else {
  613. return 'vendor_index';
  614. }
  615. };
  616. // 创建店铺的Promise对象
  617. var deferred = $q.defer();
  618. StoreInfo.existStore({}, {}, function (store) {
  619. deferred.resolve(store);
  620. }, function (error) {
  621. deferred.reject(error);
  622. });
  623. var storePromise = deferred.promise;
  624. $rootScope.storePromise = storePromise;
  625. // 创建开店申请的Promise对象
  626. var deferred1 = $q.defer();
  627. StoreInfo.findShopOwnerApplyByNormalStatus({}, {}, function (result) {
  628. deferred1.resolve(result);
  629. }, function (error) {
  630. deferred1.reject(error);
  631. });
  632. var applyPromise = deferred1.promise;
  633. // 合并多个Promise对象
  634. $q.all([storePromise, applyPromise]).then(function (result) {
  635. $rootScope.store = result[0] && result[0].uuid ? result[0] : null;
  636. $rootScope.applyInfo = null;
  637. if (result[1] && result[1].success) {
  638. $rootScope.applyInfo = result[1].data;
  639. $rootScope.applyStatus = result[1].data ? result[1].data.status : 'NONE';
  640. } else {
  641. $rootScope.applyStatus = 'NONE';
  642. }
  643. if (toState.name === 'vendor_store_apply' && $rootScope.applyStatus !== 'NONE') {
  644. event.preventDefault();
  645. console.log('route', toState.name, getToStateName());
  646. $state.go(getToStateName());
  647. return ;
  648. }
  649. if (toState.name == 'vendor_store_wait' && $rootScope.applyStatus !== 'PREPARE') {
  650. event.preventDefault();
  651. console.log('route', toState.name, getToStateName());
  652. $state.go(getToStateName());
  653. return ;
  654. }
  655. if (toState.name == 'vendor_store_info' && ($rootScope.applyStatus !== 'PASS' || $rootScope.store)) {
  656. event.preventDefault();
  657. console.log('route', toState.name, getToStateName());
  658. $state.go(getToStateName());
  659. return ;
  660. }
  661. if (toState.name == 'vendor_store_maintain' && (!$rootScope.store || ($rootScope.store && $rootScope.store.status && $rootScope.store.status !== 'OPENED'))) {
  662. event.preventDefault();
  663. console.log('route', toState.name, getToStateName());
  664. $state.go(getToStateName());
  665. return ;
  666. }
  667. if (toState.name == 'vendor_store_close' && (!$rootScope.store || ($rootScope.store && (!$rootScope.store.status || $rootScope.store.status === 'OPENED')))) {
  668. event.preventDefault();
  669. console.log('route', toState.name, getToStateName());
  670. $state.go(getToStateName());
  671. return ;
  672. }
  673. console.log('route', toState.name);
  674. })['catch'](function () {
  675. $rootScope.store = null;
  676. $rootScope.applyInfo = null;
  677. $rootScope.applyStatus = 'NONE';
  678. event.preventDefault();
  679. console.log('route', toState.name, 'vendor_index');
  680. $state.go('vendor_index');
  681. });
  682. });
  683. }]);
  684. // 商品下架模态框
  685. app.controller('GoodsDischargeCtrl', ['$scope', 'toaster', '$modalInstance', 'goods', 'Goods', function($scope, toaster, $modalInstance, goods, Goods){
  686. //现在定义最大的天数为九天
  687. $scope.maxNumber = [1, 2, 3, 4, 5, 6, 7, 8, 9];
  688. $scope.goods = goods;//产品
  689. // 原来的库存
  690. $scope.goods.oldReserve = goods.reserve;
  691. $scope.newreserve = $scope.goods.oldReserve;
  692. //改变最后一个分段的数量。
  693. $scope.changeDisnum = function (newReserve) {
  694. $scope.goods.prices[$scope.goods.prices.length - 1].end = newReserve;
  695. }
  696. // 更新库存信息
  697. $scope.updateGoods = function(){
  698. /* // 日期格式化为指定格式
  699. var getNowFormatDate = function (date) {
  700. var seperator1 = "-";
  701. var year = date.getFullYear();
  702. var month = date.getMonth() + 1;
  703. var strDate = date.getDate();
  704. if (month >= 1 && month <= 9) {
  705. month = "0" + month;
  706. }
  707. if (strDate >= 0 && strDate <= 9) {
  708. strDate = "0" + strDate;
  709. }
  710. var currentdate = year + seperator1 + month + seperator1 + strDate;
  711. return currentdate;
  712. };
  713. $scope.goods.produceDate = getNowFormatDate($scope.goods.produceDate);*/
  714. $scope.goods.reserve = $scope.newreserve;
  715. //更新分段信息
  716. if(!changeQtyPrice()) {
  717. return ;
  718. };
  719. //验证库存信息
  720. if(!$scope.checkGoodsInfo($scope.goods)) {
  721. return ;
  722. }
  723. Goods.updateGoods({}, $scope.goods, function(data){
  724. toaster.pop('success', '修改成功');
  725. $modalInstance.close();
  726. }, function(response){
  727. toaster.pop('error', '修改失败', response.data);
  728. });
  729. };
  730. /**
  731. * 比较交货周期的大小
  732. * @param min 本来是最小值
  733. * @param max 本来是最大值
  734. * @param type 2 表示当前验证的香港交期, 1表示当前验证的是大陆交期
  735. * @returns {boolean} true 表示验证通过,false 表示验证失败。
  736. */
  737. $scope.compareNum = function(min, max, type) {
  738. if(min < 1 || min > 9 || max < 1 || max > 9) {
  739. toaster.pop('warning', '交期的时间必须是1-9天之内');
  740. }
  741. if(!min || !max) {
  742. if(type == 1) {
  743. toaster.pop('warning', '大陆交期存在空值,请重新操作');
  744. }else if(type == 2){
  745. toaster.pop('warning', '香港交期存在空值,请重新操作');
  746. }
  747. return false;
  748. }
  749. if(min > max) {
  750. if(type == 1) {
  751. toaster.pop('warning', '大陆交期最短交期大于最大交期');
  752. }else if(type == 2){
  753. toaster.pop('warning', '香港交期最短交期大于最大交期');
  754. }
  755. return false;
  756. }
  757. return true;
  758. }
  759. // 下架全部产品
  760. $scope.dischargeAll = function(){
  761. $scope.goods.reserve = 0;
  762. $scope.goods.status = 602;
  763. Goods.batchDown({batchCodes : $scope.goods.batchCode}, {}, function(data){
  764. toaster.pop('success', '下架成功');
  765. $modalInstance.close();
  766. }, function(response){
  767. toaster.pop('error', '下架失败', response.data);
  768. $modalInstance.close();
  769. });
  770. };
  771. //取消模态框
  772. $scope.cancel = function() {
  773. $modalInstance.close();
  774. };
  775. // 打开日期输入框控件
  776. $scope.openDatePicker = function($event, openParam) {
  777. $event.preventDefault();
  778. $event.stopPropagation();
  779. $scope.goods[openParam] = !$scope.goods[openParam];
  780. };
  781. // 插入分段
  782. $scope.setMidQty = function(midQty) {
  783. if (midQty >= $scope.newreserve){
  784. toaster.pop('warning', '分段数量不可大于等于库存量');
  785. return ;
  786. } else if (midQty < $scope.goods.minBuyQty) {
  787. toaster.pop('warning', '分段数量不可小于最小起订量');
  788. return ;
  789. }else if($scope.goods.prices.length > 2) {
  790. toaster.pop('warning', '价格分段不能超过3个分段');
  791. return ;
  792. }else {
  793. var index = -1;
  794. for(var i = 0; i < $scope.goods.prices.length; i++) {
  795. var o = $scope.goods.prices[i];
  796. if(o.start < midQty && o.end > midQty) {
  797. index = i + 1;
  798. break;
  799. }
  800. }
  801. if(index != -1 && midQty) {
  802. $scope.goods.prices.splice(index, 0, {start: midQty});
  803. $scope.goods.prices[index].end = $scope.goods.prices[index - 1].end;
  804. $scope.goods.prices[index - 1].end = midQty - 1;
  805. $scope.midQty = null;
  806. }
  807. }
  808. };
  809. // 删除分段设置
  810. $scope.deleteQtyPrice = function(index, form) {
  811. $scope.goods.prices[index-1].end = $scope.goods.prices[index].end;
  812. $scope.goods.prices.splice(index, 1);
  813. $scope.goods.prices[$scope.goods.prices.length-1].end = $scope.goods.reserve;
  814. form.$dirty = true;
  815. };
  816. //下架部分产品时,分段最大数量改为库存量
  817. var changeQtyPrice = function() {
  818. var price = $scope.goods.prices;
  819. var previousEnd = -1;
  820. for(var i = 0; i < price.length; i++){
  821. if(price[i].start <= previousEnd) {
  822. toaster.pop('info', "提示", "存在上一个分段的结束值大于下一个分段的起始值");
  823. return false;
  824. }
  825. if(price[i].start >= price[i].end) {
  826. toaster.pop('info', "提示", "存在分段的起始值大于等于分段的结束值");
  827. return false;
  828. }
  829. if(price[i].end > $scope.newreserve){
  830. toaster.pop('info', "提示", "存在分段的结束值大于新库存数量");
  831. return false;
  832. }
  833. previousEnd = price[i].end;
  834. }
  835. $scope.goods.prices[0].start = $scope.goods.minBuyQty || 0;
  836. return true;
  837. };
  838. }]);
  839. app.controller('CollectCtrl', ['$scope', 'collectionService', 'toaster', '$rootScope', function ($scope, collectionService, toaster, $rootScope) {
  840. $scope.collect = function (id) {
  841. var obj = {'componentid': id, 'kind': 2};
  842. collectionService.saveEntity({}, obj, function(data) {
  843. toaster.pop('success', '收藏成功');
  844. $rootScope.componentCount++;
  845. }, function(error) {
  846. toaster.pop('error', '收藏失败', error);
  847. })
  848. }
  849. }]);
  850. //物流信息
  851. app.controller('listLogisticsCtrl', [ '$scope', '$modal', 'ResponseLogistics', '$modalInstance', 'lgtid', function($scope, $modal, ResponseLogistics, $modalInstance, lgtid){
  852. $scope.Info = [];
  853. $scope.getlogistics = function() {
  854. ResponseLogistics.get({id: lgtid}, {}, function(data) {
  855. $scope.Info = data;
  856. });
  857. };
  858. $scope.getlogistics();
  859. $scope.cancel = function() {
  860. $modalInstance.dismiss();
  861. };
  862. }]);
  863. /**
  864. * 卖家中心头部
  865. */
  866. app.controller('VendorCenterHeaderCtrl', ['$scope', 'BaseService'/*, 'InternalMessage'*/, function ($scope, BaseService/*, InternalMessage*/) {
  867. $scope.homeUrl = BaseService.getRootPath();
  868. // InternalMessage.getUnReadCount({recRole: 'SELLER'}, function (data) {
  869. // $scope.unReadMessage = data.count;
  870. // }, function (responge) {
  871. //
  872. // })
  873. }]);
  874. /**
  875. * 卖家中心菜单控制器
  876. */
  877. app.controller('VendorMenuCtrl', ['$scope', 'StoreInfo','$rootScope', function ($scope, StoreInfo, $rootScope) {
  878. /* //是寄售店铺
  879. $scope.isCONSIGNMENT = false;
  880. StoreInfo.findShopOwnerApplyByNormalStatus({}, {}, function (result) {
  881. if (!result.data) {
  882. $scope.isCONSIGNMENT = true;
  883. }else if (result.data.type == 'CONSIGNMENT' || result.data.status == 'PREPARE'){
  884. $scope.isCONSIGNMENT = true;
  885. }}, function (error) {
  886. });*/
  887. }]);
  888. /**
  889. * 配送规则提示共用控制器
  890. */
  891. app.controller('rule_tip_ctrl', ['$scope', 'toaster', '$modalInstance', 'type', 'tipModal', function ($scope, toaster, $modalInstance, type, tipModal) {
  892. $scope.tipModal = tipModal;
  893. $scope.type = type;
  894. $scope.cancelDelete = function () {
  895. $scope.tipModal = false;
  896. $modalInstance.dismiss();
  897. };
  898. $scope.hrefToRule = function () {
  899. $modalInstance.dismiss();
  900. window.location.href = 'vendor#vendor_deliveryRule';
  901. };
  902. /**
  903. * 监听点击的事件
  904. */
  905. document.onclick = function (event) {
  906. if($scope.tipModal) {
  907. if(event) {
  908. var tag = event.target;
  909. if(tag) {
  910. var attribute = tag.getAttribute("name");
  911. while(tag.nodeName != 'BODY') {
  912. if(attribute == 'rule_model' ||
  913. attribute == 'rule_cancel' || attribute == 'rule_href') {
  914. return ;
  915. }
  916. tag = tag.parentElement;
  917. attribute = tag.getAttribute("name");
  918. }
  919. $scope.$apply(function () {
  920. $scope.tipModal = false;
  921. $modalInstance.close();
  922. });
  923. }
  924. }
  925. }
  926. };
  927. }]);
  928. //币别的过滤器
  929. app.filter('currencySysmbol', function() {
  930. return function(moneyParam, currency, add) {
  931. if(typeof(moneyParam) == 'undefined') {
  932. moneyParam = 0;
  933. }
  934. if(currency == 'RMB') {
  935. return "¥ " + moneyParam + " " + (typeof(add) == "undefined" ? '' : add);
  936. }else if(currency == "USD"){
  937. return "$ " + moneyParam;
  938. }else {
  939. return moneyParam;
  940. }
  941. }
  942. });
  943. app.filter('firstchar', function () {
  944. return function (str) {
  945. if (str == null)
  946. return null;
  947. return str.substring(0, 1);
  948. };
  949. });
  950. /**
  951. * 采购单状态
  952. */
  953. app.filter('purchaseStatus', function() {
  954. return function(status) {
  955. if (!status || status == '') {
  956. status = 501;
  957. }
  958. if (status == 501 || status == 504 || status == 524 || status == 525) {
  959. return '待付款';
  960. } else if (status == 502 || status == 406) {
  961. return '待发货';
  962. } else if (status == 404) {
  963. return '待收货';
  964. } else if (status == 405 || status == 503 || status == 514) {
  965. return '待收款';
  966. } else if (status == 520){
  967. return '交易完成';
  968. } else {
  969. return '已取消';
  970. }
  971. }
  972. });
  973. app.controller('editPictureCtrl', ['$scope', 'pic', '$modalInstance', function ($scope, pic, $modalInstance) {
  974. console.log('log');
  975. $scope.pic = pic;
  976. $scope.cancel = function () {
  977. $modalInstance.close();
  978. };
  979. // 图片上传成功之后
  980. $scope.onUploadSuccess = function(data){
  981. $scope.pic = data.path;
  982. };
  983. $scope.confirm = function() {
  984. $modalInstance.close($scope.pic);
  985. }
  986. }]);
  987. return app;
  988. });