app.js 44 KB

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