12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- app.controller('widgetCtrl', ['$scope', '$http', '$timeout', '$q', 'toaster', 'FileUploader', function ($scope, $http, $timeout, $q, toaster, FileUploader) {
- //文件提交控件
- var uploader = $scope.uploader = new FileUploader({
- url: '/common/upload?category=wechatValidate&type=wechatValidate',
- queueLimit: 1, //文件个数
- removeAfterUpload: true //上传后删除文件
- });
- //注册上传事件
- uploader.onCompleteItem = function (fileItem, response, status, headers) {
- if (response.payload) {
- //适配数据
- response.data = response.payload;
- }
- if (response.result) {
- toaster.pop("success", "提示", "上传成功!请点击检查");
- $scope.fileLink = location.protocol + "//" + location.host + "/" + response.data;
- } else {
- toaster.pop("error", "失败", response.description);
- }
- clearUploader();
- };
- uploader.onErrorItem = function (fileItem, response, status, headers) {
- toaster.pop("error", "提示", "上传失败,请重试");
- clearUploader();
- };
- /*恢复上传框初始状态*/
- function clearUploader() {
- $("#fileUpload").val("");
- uploader.clearQueue();
- uploader.cancelAll();
- }
- /************预充值***********************/
- var defaultValue = {
- agent: {id: "", nickname: "-选择代理商-"},
- };
- //下拉框数据
- $scope.condition = {
- agent: [defaultValue.agent],
- };
- //查询条件
- $scope.query = {
- agent: defaultValue.agent,
- cardNoStart: "",
- cardNoEnd: "",
- money: 120,
- };
- $scope.ngEvent = {
- prepChargeCard: function () {
- if (!$scope.query.agent || !$scope.query.agent.id) {
- toaster.pop("info", "提示", "请选择代理商!");
- return;
- }
- var data = {
- agentId: $scope.query.agent.id,
- cardNoStart: $scope.query.cardNoStart,
- cardNoEnd: $scope.query.cardNoEnd,
- money: $scope.query.money,
- };
- $http({
- method: 'POST',
- url: "/manager/initCardsBalance",
- data: data
- }).then(function (response) {
- toaster.pop("success", "提示", "预充值成功!");
- }, function (response) {
- toaster.pop("error", "提示", "保存失败!");
- });
- }
- };
- //不传分页参数则获取全部代理商
- $http.get('/agent/getAgentsDetailList', {}).then(function (data) {
- data = data.data
- $scope.condition.agent = data.data.dataList;
- $scope.condition.agent.unshift(defaultValue.agent);//可以选空
- });
- }]);
|