list.js 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. ;
  2. var operationPage = new Vue({
  3. el: "#operationPage",
  4. data: {
  5. isRequset:true,
  6. noMore: false,
  7. userId: 0,
  8. StatusList:[
  9. {value:0,name:'所有'},
  10. {value:1,name:'已提交'},
  11. {value:2,name:'已对接'},
  12. {value:3,name:'已评价'},
  13. {value:4,name:'已取消'}
  14. ],
  15. listQuery:{
  16. userId:0,
  17. linkName : '',
  18. mobile : '',
  19. pageNum:1,
  20. pageSize:10
  21. },
  22. listRecord: 0,
  23. pageInput: '1',
  24. operationList:[],
  25. confirmedCount:'',//待確認數量
  26. paymentCount:'',//待付款
  27. waitShipmentsCount:'',//待发货
  28. shipmentsCount:'',//已发货
  29. salesReturnCount:'',//退货款
  30. },
  31. filters: {
  32. stateExp:function (state){ //订单状态文字和颜色
  33. var stateText = '',
  34. stateTextObject={
  35. 2:'已绑定',
  36. 1:'未绑定'
  37. };
  38. Object.keys(stateTextObject).forEach(function(key){
  39. if(key == state){
  40. stateText = stateTextObject[key]
  41. }
  42. });
  43. return stateText;
  44. },
  45. stateTextExp:function (state){ //订单状态文字和颜色
  46. var stateText = '',
  47. stateTextObject={
  48. 1:'有效',
  49. 2:'已使用',
  50. 3:'已过期'
  51. };
  52. Object.keys(stateTextObject).forEach(function(key){
  53. if(key == state){
  54. stateText = stateTextObject[key]
  55. }
  56. });
  57. return stateText;
  58. }
  59. },
  60. computed: {
  61. pageTotal: function () {
  62. var total = Math.ceil(this.listRecord / this.listQuery.pageSize);
  63. return total > 0 ? total : 1;
  64. },
  65. showPageBtn: function () {
  66. var total = Math.ceil(this.listRecord / this.listQuery.pageSize);
  67. total = total > 0 ? total : 1;
  68. var index = this.listQuery.pageNum, arr = [];
  69. if (total <= 6) {
  70. for (var i = 1; i <= total; i++) {
  71. arr.push(i);
  72. }
  73. return arr;
  74. }
  75. if (index <= 3) return [1, 2, 3, 4, 5, 0, total];
  76. if (index >= total - 2) return [1, 0, total - 4, total - 3, total - 2, total - 1, total];
  77. return [1, 0, index - 2, index - 1, index, index + 1, index + 2, 0, total];
  78. }
  79. },
  80. methods: {
  81. toPagination: function (pageNum) {//点击切换分页
  82. if (pageNum <= this.pageTotal) {
  83. this.listQuery.pageNum = pageNum;
  84. this.GetQueryListData();
  85. }
  86. },
  87. checkNum: function () {//输入跳转分页
  88. if (this.pageInput > this.pageTotal) {
  89. this.pageInput = this.pageTotal;
  90. } else if (this.pageInput < 1) {
  91. this.pageInput = 1;
  92. }
  93. },
  94. GetQueryListData:function(){//查询运营人员列表
  95. var _self = this;
  96. UserApi.GetMyOperationList(_self.listQuery,function (response) {
  97. if(response.code == 0){
  98. var data = response.data;
  99. if(data.results && data.results.length>0) {
  100. _self.operationList = [];
  101. _self.operationList = data.results;
  102. _self.listRecord = data.totalRecord;
  103. }else{
  104. _self.operationList = [];
  105. _self.operationList = data.results;
  106. }
  107. _self.isRequset = false;
  108. }else{
  109. CAIMEI.Alert(response.msg, '确定', false);
  110. }
  111. })
  112. },
  113. searchOperationFn:function(){//点击搜索
  114. this.GetQueryListData();
  115. },
  116. UpdataOperationFn:function(data){//更新邀请码
  117. var _self = this;
  118. CAIMEI.Modal('确定更新邀请码吗?更新后将会短信通知该运营人员','取消','确定',function () {
  119. UserApi.UpdateInvitationCode({id:data.id},function (response) {
  120. if(response.code == 0 ){ //删除成功
  121. CAIMEI.dialog(response.msg,true,function () {
  122. _self.GetQueryListData();
  123. });
  124. }else{
  125. CAIMEI.Alert(response.msg,'确定',false);
  126. }
  127. })
  128. });
  129. },
  130. DeleteOperationFn:function(data){//删除运营人员
  131. var _self = this;
  132. CAIMEI.Modal('确定删除运营人员吗?','取消','确定',function () {
  133. UserApi.DeleteMyOperation({id:data.id},function (response) {
  134. if(response.code == 0 ){ //删除成功
  135. CAIMEI.dialog('删除成功',true,function () {
  136. _self.GetQueryListData();
  137. });
  138. }else{
  139. CAIMEI.Alert(response.msg,'确定',false);
  140. }
  141. })
  142. });
  143. },
  144. ColorFn: function(state){//设置邀请码状态亚瑟
  145. var stateColor = '',
  146. stateColorObject={
  147. 1:'#1DEDC5',
  148. 2:'#1D7DED',
  149. 3:'#ED1D1D'
  150. };
  151. Object.keys(stateColorObject).forEach(function(key){
  152. if(key == state){
  153. stateColor = stateColorObject[key]
  154. }
  155. });
  156. return stateColor;
  157. },
  158. statusColorFn: function(state){//设置状态颜色
  159. var stateColor = '',
  160. stateColorObject={
  161. 1:'#333333',
  162. 2:'#13ce66'
  163. };
  164. Object.keys(stateColorObject).forEach(function(key){
  165. if(key == state){
  166. stateColor = stateColorObject[key]
  167. }
  168. });
  169. return stateColor;
  170. },
  171. },
  172. mounted: function () {
  173. if(globalUserData){
  174. this.userId = globalUserData.userId;
  175. this.listQuery.orderState = CAIMEI.getUrlParam('state');
  176. this.listQuery.userId = this.userId;
  177. this.GetQueryListData();
  178. }
  179. console.log(this.listQuery.orderState)
  180. $('.navLayout').find('.navList').removeClass("on").find('.con').hide().find('a').removeClass("on");
  181. $('.navLayout').find('.navList').eq(1).addClass("on").find('.con').show().find('a').eq(1).addClass("on");
  182. }
  183. });