1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <script>
- function changeSelect(_self, action) {
- if(action == 'exclude' || action == 'view_exclude')
- {
- var dom = $('#temp_exclude_spu');
- } else {
- var dom = $('#temp_selected_spu');
- }
- if ($(_self).hasClass('select')) {
- var btnVal = $(_self).data('id');
- var string = dom.val();
- var ids = string.split(',');
- var index = ids.indexOf(String(btnVal));
- if(!!~index)
- {
- ids.splice(index, 1);
- }
- var str = ids.join(',');
- $(_self).removeClass('select btn-info').addClass('btn-warning unselect').find('i').removeClass('fa-check').addClass('fa-times');
- dom.val(str);
- } else {
- var btnVal = $(_self).data('id');
- var str = dom.val() + ',' + btnVal;
- if (str.substr(0, 1) == ',') str = str.substr(1);
- $(_self).addClass('select btn-info').removeClass('btn-warning unselect').find('i').addClass('fa-check').removeClass('fa-times');
- dom.val(str);
- }
- paraDiscount.ids = str;
- console.log(paraDiscount.ids);
- }
- function sendIds(action) {
- if(action == 'exclude' || action == 'view_exclude')
- {
- var string = $('#temp_exclude_spu').val();
- $('#exclude_spu').val(string);
- } else {
- var string = $('#temp_selected_spu').val();
- $('#selected_spu').val(string);
- }
- if (string) {
- var count = string.split(',').length;
- } else {
- count = 0
- }
- if(action == 'exclude' || action == 'view_exclude')
- {
- $('.countExcludeSpu').html(count);
- } else {
- $('.countSpu').html(count);
- }
- $('#spu_modal').modal('hide');
- }
- </script>
|