Commit 078e07da authored by wangqinghua's avatar wangqinghua

物品领用

parent bd58aed6
/**
* Automatically generated file. DO NOT MODIFY
*/
package io.ionic.smart19.starter;
public final class BuildConfig {
public static final boolean DEBUG = false;
public static final String APPLICATION_ID = "io.ionic.smart19.starter";
public static final String BUILD_TYPE = "release";
public static final String FLAVOR = "";
public static final int VERSION_CODE = 40309;
public static final String VERSION_NAME = "4.3.9";
}
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr format="reference" name="coordinatorLayoutStyle"/>
<color name="notification_action_color_filter">#ffffffff</color>
<color name="notification_icon_bg_color">#ff9e9e9e</color>
<color name="notification_material_background_media_default_color">#ff424242</color>
<color name="primary_text_default_material_dark">#ffffffff</color>
<color name="ripple_material_light">#1f000000</color>
<color name="secondary_text_default_material_dark">#b3ffffff</color>
<color name="secondary_text_default_material_light">#8a000000</color>
<declare-styleable name="CoordinatorLayout"><attr format="reference" name="keylines"/><attr format="color|reference" name="statusBarBackground"/></declare-styleable>
<declare-styleable name="CoordinatorLayout_Layout"><attr name="android:layout_gravity"/><attr format="string" name="layout_behavior"/><attr format="reference" name="layout_anchor"/><attr format="integer" name="layout_keyline"/><attr name="layout_anchorGravity">
<flag name="top" value="0x30"/>
<flag name="bottom" value="0x50"/>
<flag name="left" value="0x03"/>
<flag name="right" value="0x05"/>
<flag name="center_vertical" value="0x10"/>
<flag name="fill_vertical" value="0x70"/>
<flag name="center_horizontal" value="0x01"/>
<flag name="fill_horizontal" value="0x07"/>
<flag name="center" value="0x11"/>
<flag name="fill" value="0x77"/>
<flag name="clip_vertical" value="0x80"/>
<flag name="clip_horizontal" value="0x08"/>
<flag name="start" value="0x00800003"/>
<flag name="end" value="0x00800005"/>
</attr><attr format="enum" name="layout_insetEdge">
<enum name="none" value="0x0"/>
<enum name="top" value="0x30"/>
<enum name="bottom" value="0x50"/>
<enum name="left" value="0x03"/>
<enum name="right" value="0x05"/>
<enum name="start" value="0x00800003"/>
<enum name="end" value="0x00800005"/>
</attr><attr name="layout_dodgeInsetEdges">
<flag name="none" value="0x0"/>
<flag name="top" value="0x30"/>
<flag name="bottom" value="0x50"/>
<flag name="left" value="0x03"/>
<flag name="right" value="0x05"/>
<flag name="start" value="0x00800003"/>
<flag name="end" value="0x00800005"/>
<flag name="all" value="0x77"/>
</attr></declare-styleable>
<declare-styleable name="FontFamily"><attr format="string" name="fontProviderAuthority"/><attr format="string" name="fontProviderPackage"/><attr format="string" name="fontProviderQuery"/><attr format="reference" name="fontProviderCerts"/><attr name="fontProviderFetchStrategy">
<enum name="blocking" value="0"/>
<enum name="async" value="1"/>
</attr><attr format="integer" name="fontProviderFetchTimeout">
<enum name="forever" value="-1"/>
</attr></declare-styleable>
<declare-styleable name="FontFamilyFont"><attr name="fontStyle">
<enum name="normal" value="0"/>
<enum name="italic" value="1"/>
</attr><attr format="reference" name="font"/><attr format="integer" name="fontWeight"/><attr name="android:fontStyle"/><attr name="android:font"/><attr name="android:fontWeight"/></declare-styleable>
<dimen name="compat_button_inset_horizontal_material">4dp</dimen>
<dimen name="compat_button_inset_vertical_material">6dp</dimen>
<dimen name="compat_button_padding_horizontal_material">8dp</dimen>
<dimen name="compat_button_padding_vertical_material">4dp</dimen>
<dimen name="compat_control_corner_material">2dp</dimen>
<dimen name="notification_action_icon_size">32dp</dimen>
<dimen name="notification_action_text_size">13sp</dimen>
<dimen name="notification_big_circle_margin">12dp</dimen>
<dimen name="notification_content_margin_start">8dp</dimen>
<dimen name="notification_large_icon_height">64dp</dimen>
<dimen name="notification_large_icon_width">64dp</dimen>
<dimen name="notification_main_column_padding_top">10dp</dimen>
<dimen name="notification_media_narrow_margin">@dimen/notification_content_margin_start</dimen>
<dimen name="notification_right_icon_size">16dp</dimen>
<dimen name="notification_right_side_padding_top">2dp</dimen>
<dimen name="notification_small_icon_background_padding">3dp</dimen>
<dimen name="notification_small_icon_size_as_large">24dp</dimen>
<dimen name="notification_subtext_size">13sp</dimen>
<dimen name="notification_top_pad">10dp</dimen>
<dimen name="notification_top_pad_large_text">5dp</dimen>
<drawable name="notification_template_icon_bg">#3333B5E5</drawable>
<drawable name="notification_template_icon_low_bg">#0cffffff</drawable>
<item name="line1" type="id"/>
<item name="line3" type="id"/>
<item name="tag_transition_group" type="id"/>
<item name="text" type="id"/>
<item name="text2" type="id"/>
<item name="title" type="id"/>
<integer name="cancel_button_image_alpha">127</integer>
<integer name="status_bar_notification_info_maxnum">999</integer>
<string name="activity_name">@string/launcher_name</string>
<string name="app_name">部机关党建云</string>
<string name="launcher_name">@string/app_name</string>
<string name="status_bar_notification_info_overflow">999+</string>
<style name="TextAppearance.Compat.Notification" parent="@android:style/TextAppearance.StatusBar.EventContent"/>
<style name="TextAppearance.Compat.Notification.Info">
<item name="android:textSize">12sp</item>
<item name="android:textColor">?android:attr/textColorSecondary</item>
</style>
<style name="TextAppearance.Compat.Notification.Info.Media"/>
<style name="TextAppearance.Compat.Notification.Line2" parent="TextAppearance.Compat.Notification.Info"/>
<style name="TextAppearance.Compat.Notification.Line2.Media" parent="TextAppearance.Compat.Notification.Info.Media"/>
<style name="TextAppearance.Compat.Notification.Media"/>
<style name="TextAppearance.Compat.Notification.Time">
<item name="android:textSize">12sp</item>
<item name="android:textColor">?android:attr/textColorSecondary</item>
</style>
<style name="TextAppearance.Compat.Notification.Time.Media"/>
<style name="TextAppearance.Compat.Notification.Title" parent="@android:style/TextAppearance.StatusBar.EventContent.Title"/>
<style name="TextAppearance.Compat.Notification.Title.Media"/>
<style name="Widget.Compat.NotificationActionContainer" parent=""/>
<style name="Widget.Compat.NotificationActionText" parent=""/>
<style name="Widget.Support.CoordinatorLayout" parent="android:Widget">
<item name="statusBarBackground">#000000</item>
</style>
</resources>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
package com.cordova.plugins.sms;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.provider.Telephony;
import android.telephony.SmsManager;
import java.util.ArrayList;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.PluginResult;
import org.json.JSONArray;
import org.json.JSONException;
public class Sms extends CordovaPlugin {
public final String ACTION_SEND_SMS = "send";
public final String ACTION_HAS_PERMISSION = "has_permission";
public final String ACTION_REQUEST_PERMISSION = "request_permission";
private static final String INTENT_FILTER_SMS_SENT = "SMS_SENT";
private static final int SEND_SMS_REQ_CODE = 0;
private static final int REQUEST_PERMISSION_REQ_CODE = 1;
private CallbackContext callbackContext;
private JSONArray args;
@Override
public boolean execute(String action, final JSONArray args, final CallbackContext callbackContext) throws JSONException {
this.callbackContext = callbackContext;
this.args = args;
if (action.equals(ACTION_SEND_SMS)) {
boolean isIntent = false;
try {
isIntent = args.getString(2).equalsIgnoreCase("INTENT");
} catch (NullPointerException npe) {
// It might throw a NPE, but it doesn't matter.
}
if (isIntent || hasPermission()) {
sendSMS();
} else {
requestPermission(SEND_SMS_REQ_CODE);
}
return true;
}
else if (action.equals(ACTION_HAS_PERMISSION)) {
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, hasPermission()));
return true;
}
else if (action.equals(ACTION_REQUEST_PERMISSION)) {
requestPermission(REQUEST_PERMISSION_REQ_CODE);
return true;
}
return false;
}
private boolean hasPermission() {
return cordova.hasPermission(android.Manifest.permission.SEND_SMS);
}
private void requestPermission(int requestCode) {
cordova.requestPermission(this, requestCode, android.Manifest.permission.SEND_SMS);
}
public void onRequestPermissionResult(int requestCode, String[] permissions, int[] grantResults) throws JSONException {
for (int r : grantResults) {
if (r == PackageManager.PERMISSION_DENIED) {
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR, "User has denied permission"));
return;
}
}
if (requestCode == SEND_SMS_REQ_CODE) {
sendSMS();
return;
}
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, true));
}
private boolean sendSMS() {
cordova.getThreadPool().execute(new Runnable() {
@Override
public void run() {
try {
//parsing arguments
String separator = ";";
if (android.os.Build.MANUFACTURER.equalsIgnoreCase("Samsung")) {
// See http://stackoverflow.com/questions/18974898/send-sms-through-intent-to-multiple-phone-numbers/18975676#18975676
separator = ",";
}
String phoneNumber = args.getJSONArray(0).join(separator).replace("\"", "");
String message = args.getString(1);
String method = args.getString(2);
boolean replaceLineBreaks = Boolean.parseBoolean(args.getString(3));
// replacing \n by new line if the parameter replaceLineBreaks is set to true
if (replaceLineBreaks) {
message = message.replace("\\n", System.getProperty("line.separator"));
}
if (!checkSupport()) {
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR, "SMS not supported on this platform"));
return;
}
if (method.equalsIgnoreCase("INTENT")) {
invokeSMSIntent(phoneNumber, message);
// always passes success back to the app
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK));
} else {
send(callbackContext, phoneNumber, message);
}
return;
} catch (JSONException ex) {
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
}
}
});
return true;
}
private boolean checkSupport() {
Activity ctx = this.cordova.getActivity();
return ctx.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY);
}
@SuppressLint("NewApi")
private void invokeSMSIntent(String phoneNumber, String message) {
Intent sendIntent;
if ("".equals(phoneNumber) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
String defaultSmsPackageName = Telephony.Sms.getDefaultSmsPackage(this.cordova.getActivity());
sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("text/plain");
sendIntent.putExtra(Intent.EXTRA_TEXT, message);
if (defaultSmsPackageName != null) {
sendIntent.setPackage(defaultSmsPackageName);
}
} else {
sendIntent = new Intent(Intent.ACTION_VIEW);
sendIntent.putExtra("sms_body", message);
// See http://stackoverflow.com/questions/7242190/sending-sms-using-intent-does-not-add-recipients-on-some-devices
sendIntent.putExtra("address", phoneNumber);
sendIntent.setData(Uri.parse("smsto:" + Uri.encode(phoneNumber)));
}
this.cordova.getActivity().startActivity(sendIntent);
}
private void send(final CallbackContext callbackContext, String phoneNumber, String message) {
SmsManager manager = SmsManager.getDefault();
final ArrayList<String> parts = manager.divideMessage(message);
// by creating this broadcast receiver we can check whether or not the SMS was sent
final BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
boolean anyError = false; //use to detect if one of the parts failed
int partsCount = parts.size(); //number of parts to send
@Override
public void onReceive(Context context, Intent intent) {
switch (getResultCode()) {
case SmsManager.STATUS_ON_ICC_SENT:
case Activity.RESULT_OK:
break;
case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
case SmsManager.RESULT_ERROR_NO_SERVICE:
case SmsManager.RESULT_ERROR_NULL_PDU:
case SmsManager.RESULT_ERROR_RADIO_OFF:
anyError = true;
break;
}
// trigger the callback only when all the parts have been sent
partsCount--;
if (partsCount == 0) {
if (anyError) {
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR));
} else {
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK));
}
cordova.getActivity().unregisterReceiver(this);
}
}
};
// randomize the intent filter action to avoid using the same receiver
String intentFilterAction = INTENT_FILTER_SMS_SENT + java.util.UUID.randomUUID().toString();
this.cordova.getActivity().registerReceiver(broadcastReceiver, new IntentFilter(intentFilterAction));
PendingIntent sentIntent = PendingIntent.getBroadcast(this.cordova.getActivity(), 0, new Intent(intentFilterAction), 0);
// depending on the number of parts we send a text message or multi parts
if (parts.size() > 1) {
ArrayList<PendingIntent> sentIntents = new ArrayList<PendingIntent>();
for (int i = 0; i < parts.size(); i++) {
sentIntents.add(sentIntent);
}
manager.sendMultipartTextMessage(phoneNumber, null, parts, sentIntents, null);
}
else {
manager.sendTextMessage(phoneNumber, null, message, sentIntent, null);
}
}
}
package com.ohh2ahh.appavailability;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.json.JSONArray;
import org.json.JSONException;
import android.content.Context;
import android.content.pm.PackageManager;
public class AppAvailability extends CordovaPlugin {
@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
if(action.equals("checkAvailability")) {
String uri = args.getString(0);
this.checkAvailability(uri, callbackContext);
return true;
}
return false;
}
// Thanks to http://floresosvaldo.com/android-cordova-plugin-checking-if-an-app-exists
public boolean appInstalled(String uri) {
Context ctx = this.cordova.getActivity().getApplicationContext();
final PackageManager pm = ctx.getPackageManager();
boolean app_installed = false;
try {
pm.getPackageInfo(uri, PackageManager.GET_ACTIVITIES);
app_installed = true;
}
catch(PackageManager.NameNotFoundException e) {
app_installed = false;
}
return app_installed;
}
private void checkAvailability(String uri, CallbackContext callbackContext) {
if(appInstalled(uri)) {
callbackContext.success();
}
else {
callbackContext.error("");
}
}
}
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package cordova.plugins.screenorientation;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.json.JSONArray;
import org.json.JSONException;
import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.util.Log;
public class CDVOrientation extends CordovaPlugin {
private static final String TAG = "YoikScreenOrientation";
/**
* Screen Orientation Constants
*/
private static final String ANY = "any";
private static final String PORTRAIT_PRIMARY = "portrait-primary";
private static final String PORTRAIT_SECONDARY = "portrait-secondary";
private static final String LANDSCAPE_PRIMARY = "landscape-primary";
private static final String LANDSCAPE_SECONDARY = "landscape-secondary";
private static final String PORTRAIT = "portrait";
private static final String LANDSCAPE = "landscape";
@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) {
Log.d(TAG, "execute action: " + action);
// Route the Action
if (action.equals("screenOrientation")) {
return routeScreenOrientation(args, callbackContext);
}
// Action not found
callbackContext.error("action not recognised");
return false;
}
private boolean routeScreenOrientation(JSONArray args, CallbackContext callbackContext) {
String action = args.optString(0);
String orientation = args.optString(1);
Log.d(TAG, "Requested ScreenOrientation: " + orientation);
Activity activity = cordova.getActivity();
if (orientation.equals(ANY)) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
} else if (orientation.equals(LANDSCAPE_PRIMARY)) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
} else if (orientation.equals(PORTRAIT_PRIMARY)) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
} else if (orientation.equals(LANDSCAPE)) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
} else if (orientation.equals(PORTRAIT)) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
} else if (orientation.equals(LANDSCAPE_SECONDARY)) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
} else if (orientation.equals(PORTRAIT_SECONDARY)) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT);
}
callbackContext.success();
return true;
}
}
\ No newline at end of file
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
package io.ionic.smart19.starter;
import android.os.Bundle;
import org.apache.cordova.*;
public class MainActivity extends CordovaActivity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
// enable Cordova apps to be started in the background
Bundle extras = getIntent().getExtras();
if (extras != null && extras.getBoolean("cdvStartInBackground", false)) {
moveTaskToBack(true);
}
// Set by <content src="index.html" /> in config.xml
loadUrl(launchUrl);
}
}
<!-- Generated template for the FilterComponent component -->
<ion-content>
<ion-row class="padding-20-10">
<ion-col col-4 *ngFor="let item of list">
<div class="item-style">
{{item}}
</div>
</ion-col>
</ion-row>
</ion-content>
filter {
.item-style{
text-align: center;
background-color: #f2f2f2;
border-radius: 2px;
padding: 6px 2px;
}
}
import { Component } from '@angular/core';
import {NavParams} from "ionic-angular";
@Component({
selector: 'filter',
templateUrl: 'filter.html'
})
export class FilterComponent {
list = [];
constructor(private params:NavParams) {
this.list = this.params.get("list");
console.log(this.list);
}
}
<div class="main">
<div class="content" (click)="close()">
<div class="comment" (click)="stop($event)">
<div class="name">
{{goods.model}}
</div>
<ng-container *ngIf="goods.spe1">
<p class="p-name">规格1</p>
<div class="detail-item">
<span [ngClass]="choose.specs1 == item1?'select':''" *ngFor="let item1 of goods.spe1"
(click)="getSpecs(1,item1)">
{{item1}}
</span>
</div>
</ng-container>
<ng-container *ngIf="goods.spe2">
<p class="p-name">规格2</p>
<div class="detail-item">
<span [ngClass]="choose.specs2 == item2?'select':''" (click)="getSpecs(2,item2)"
*ngFor="let item2 of goods.spe2">
{{item2}}
</span>
</div>
</ng-container>
<ng-container *ngIf="goods.spe3">
<p class="p-name">规格1</p>
<div class="detail-item">
<span *ngFor="let item3 of goods.spe3" [ngClass]="choose.specs3 == item3?'select':''"
(click)="getSpecs(3,item3)">
{{item3}}
</span>
</div>
</ng-container>
<ng-container *ngIf="goods.spe4">
<p class="p-name">规格1</p>
<div class="detail-item">
<span *ngFor="let item4 of goods.spe4" [ngClass]="choose.specs4 == item4?'select':''"
(click)="getSpecs(4,item4)">
{{item4}}
</span>
</div>
</ng-container>
<ng-container *ngIf="goods.spe5">
<p class="p-name">规格1</p>
<div class="detail-item">
<span *ngFor="let item5 of goods.spe5" [ngClass]="choose.specs5 == item5?'select':''"
(click)="getSpecs(5,item5)">
{{item5}}
</span>
</div>
</ng-container>
<div class="choose-num">
<div>申请数量</div>
<div class="num">
<span class="reduce" (click)="reduce()">-</span>
<input type="number" value="1" [(ngModel)]="choose.amount">
<span class="add" (click)="add()">+</span>
</div>
</div>
<button class="submit-btn submit" (click)="submit()">确定</button>
</div>
</div>
</div>
spces {
.main {
background-color: rgba(0, 0, 0, .4);
height: 100%;
}
.content {
position: relative;
height: 100%;
width: 100%;
}
.comment {
position: absolute;
width: 100%;
bottom: 0;
height: 60%;
background: #fff;
border-top-right-radius: 8px;
border-top-left-radius: 8px;
padding: 5px 15px;
.name{
padding: 20px 5px;
font-size: 2rem;
font-weight: bold;
}
ion-icon {
font-size: 3rem;
font-weight: bold;
}
.p-name {
padding: 10px 5px;
font-weight: bold;
}
.detail-item {
margin-bottom: 20px;
margin-top: 10px;
span {
padding: 5px 20px;
background-color: #f2f2f2;
border-radius: 10px;
margin-right: 20px;
border: 1px solid #f2f2f2;
}
span.select{
background-color: #fdf8f2;
border: 1px solid #e42417;
color: #e42417;
}
}
.choose-spces {
display: flex;
div:last-child {
margin-left: auto;
}
}
.choose-num {
display: flex;
div:last-child {
margin-left: auto;
}
.num {
input {
width: 30px;
font-size: 1.2rem;
font-weight: bold;
text-align: center;
background-color: #f2f2f2;
border: 1px solid #f2f2f2;
margin: 0 8px;
}
span{
font-size: 1.6rem;
font-weight: bold;
}
}
}
.submit-btn{
position: absolute;
bottom: 20px;
margin-left: 8%;
}
}
}
import {Component} from '@angular/core';
import {NavParams, ViewController} from "ionic-angular";
/**
* Generated class for the SpcesComponent component.
*
* See https://angular.io/api/core/Component for more info on Angular
* Components.
*/
@Component({
selector: 'spces',
templateUrl: 'spces.html'
})
export class SpcesComponent {
goods;
choose = {
amount: <any>'1',
brand: '',
officeId: '',
model: '',
specs1: '',
specs2: '',
specs3: '',
specs4: '',
specs5: '',
};
constructor(private viewCtrl: ViewController, private params: NavParams) {
this.goods = this.params.get('goods');
if (this.goods.specs1) this.goods.spe1 = this.goods.specs1.split('/');
if (this.goods.specs2) this.goods.spe2 = this.goods.specs2.split('/');
if (this.goods.specs3) this.goods.spe3 = this.goods.specs3.split('/');
if (this.goods.specs4) this.goods.spe4 = this.goods.specs4.split('/');
if (this.goods.specs5) this.goods.spe5 = this.goods.specs5.split('/');
console.log(this.goods)
}
close() {
this.viewCtrl.dismiss();
}
stop(e) {
e.stopPropagation();
}
//增加
add() {
this.choose.amount++;
}
//减少
reduce() {
if (this.choose.amount > 1) {
this.choose.amount--;
}
}
//提交
submit() {
this.choose.brand = this.goods.brand;
this.choose.officeId = this.goods.id;
this.choose.model = this.goods.model;
console.log(this.choose)
this.viewCtrl.dismiss(this.choose);
}
getSpecs(index, item) {
if (index == 1) this.choose.specs1 = item;
if (index == 2) this.choose.specs2 = item;
if (index == 3) this.choose.specs3 = item;
if (index == 4) this.choose.specs4 = item;
if (index == 5) this.choose.specs5 = item;
}
}
<ion-header>
<ion-navbar>
<ion-title>购物车</ion-title>
</ion-navbar>
</ion-header>
<ion-content>
<ng-container *ngFor="let item of cartList">
<div class="goodsItem">
<div class="item-modal">
{{item.suppies.model}}
<span class="margin-left-10">
{{item.specs1}}
</span>
<span class="margin-left-10">
{{item.specs2}}
</span>
</div>
</div>
</ng-container>
</ion-content>
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import {ServeService} from "../../serve.service";
@Component({
selector: 'page-goods-cart',
templateUrl: 'goods-cart.html',
})
export class GoodsCartPage {
cartList = [];
constructor(public navCtrl: NavController, public navParams: NavParams,
private serveSer:ServeService) {
}
ionViewDidLoad() {
console.log('ionViewDidLoad GoodsCartPage');
this.getCart();
}
getCart(){
const data = {
P_pageNumber:'1',
P_pageSize:'100'
};
this.serveSer.shoppingCar(data).subscribe(
(res)=>{
this.cartList = res.list;
}
)
}
}
<ion-header>
<ion-navbar>
<ion-title>物品领用</ion-title>
<ion-buttons end>
<button ion-button icon-only (click)="goCart()" class="toolbar-icon">
<span style="color: #ffffff" class="icon iconfont icon-cart"></span>
</button>
</ion-buttons>
</ion-navbar>
</ion-header>
<ion-content>
<ion-refresher (ionRefresh)="doRefresh($event)">
<ion-refresher-content pullingText="下拉刷新"
refreshingSpinner="bubbles">
</ion-refresher-content>
</ion-refresher>
<div class="search-div">
<ion-icon class="icon-search" name="search"></ion-icon>
<input class="input-search" [(ngModel)]="obj.params" type="text" placeholder="请输入关键字">
<span class="text" (click)="search()">搜索</span>
</div>
<div class="type-div">
<div class="type-list">
<ng-container *ngFor="let item of typeList">
<div class="type" [ngStyle]="{'color':obj.type == item?'#e42417':''}" (click)="filterType(item)">
{{item}}
</div>
</ng-container>
</div>
<div class="filter-div">
<span class="filter" (click)="fliter()">筛选</span>
</div>
</div>
<ng-container *ngFor="let item of goodsList">
<div class="goodsItem">
<div class="item-modal">
{{item.model}}
<span class="margin-left-10">
{{item.specs1}}
</span>
<span class="margin-left-10">
{{item.specs2}}
</span>
</div>
<div class="item-icon">
<div class="img-star">
<span class="icon iconfont icon-star-simple-surfac"></span>
<span class="icon iconfont icon-star-simple-surfac"></span>
<span class="icon iconfont icon-star-simple-surfac"></span>
<span class="icon iconfont icon-star-simple-surfac"></span>
<span class="icon iconfont icon-star-simple-surfac"></span>
</div>
<div class="img-cart" (click)="choose(item)">
<span class="icon iconfont icon-cart"></span>
</div>
</div>
</div>
</ng-container>
<ion-infinite-scroll (ionInfinite)="doInfinite($event)">
<ion-infinite-scroll-content
loadingSpinner="bubbles"
loadingText="加载中"></ion-infinite-scroll-content>
</ion-infinite-scroll>
</ion-content>
import {NgModule} from '@angular/core';
import {IonicPageModule} from 'ionic-angular';
import {GoodsCollectPage} from './goods-collect';
import {GoodsCartPage} from "./goods-cart/goods-cart";
import {GoodsOrderPage} from "./goods-order/goods-order";
@NgModule({
declarations: [
GoodsCollectPage,
GoodsCartPage,
GoodsOrderPage
],
imports: [
IonicPageModule.forChild(GoodsCollectPage),
],
entryComponents: [
GoodsCartPage,
GoodsOrderPage,
]
})
export class GoodsCollectPageModule {
}
page-goods-collect {
.search-div {
position: relative;
padding: 10px;
.icon-search {
position: absolute;
top: 20px;
left: 20px;
color: #e42417;
font-size: 2.5rem;
}
.input-search {
background-color: #fdf8f2;
border-radius: 30px;
width: 85%;
height: 43px;
border: 1px solid #fdf8f2;
padding-left: 35px;
}
input::-webkit-input-placeholder { /* WebKit browsers */
color: #e42417;
}
input:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
color: #e42417;
}
input::-moz-placeholder { /* Mozilla Firefox 19+ */
color: #e42417;
}
input:-ms-input-placeholder { /* Internet Explorer 10+ */
color: #e42417;
}
.text {
position: absolute;
font-size: 1.6rem;
right: 8px;
top: 10px;
color: #999999;
padding: 10px;
}
}
.type-div{
position: relative;
.type-list{
display: flex;
align-items: center;
overflow-x: hidden;
white-space: nowrap;
.type{
padding: 10px;
font-weight: bold;
}
}
.filter-div{
position: absolute;
right: 0px;
top: 10px;
background-color: #fff;
z-index: 99;
padding-right: 10px;
}
}
.goodsItem {
border-bottom: 1px solid #ccc;
padding: 10px 15px;
.item-icon{
display: flex;
margin-top: 10px;
.img-star{
flex-direction: column;
flex-flow: column;
color: #facd70;
}
.img-cart{
margin-left: auto;
color: #c93638;
}
}
}
}
import {Component, ViewChild} from '@angular/core';
import {InfiniteScrollContent, IonicPage, ModalController, NavController, NavParams} from 'ionic-angular';
import {ServeService} from "../serve.service";
import {FilterComponent} from "../../../components/filter/filter";
import {timer} from "rxjs/observable/timer";
import {CommonService} from "../../../provide/common.service";
import {CommentComponent} from "../../../components/comment/comment";
import {SpcesComponent} from "../../../components/spces/spces";
import {GoodsCartPage} from "./goods-cart/goods-cart";
@IonicPage()
@Component({
selector: 'page-goods-collect',
templateUrl: 'goods-collect.html',
})
export class GoodsCollectPage {
@ViewChild(InfiniteScrollContent) infiniteScrollContent: InfiniteScrollContent;
goodsList = []; //商品列表
typeList = []; //分类
pageNumber = 1;
pageSize = 20;
obj = {
params: '',
type: ''
};
totalNum;
isLoad = true;
loadMore = true;
chooseObj;
constructor(public navCtrl: NavController, public navParams: NavParams,
private serveSer: ServeService, private modalCtrl: ModalController,
private commonSer: CommonService) {
}
ionViewDidLoad() {
this.getList();
this.getTypeList();
}
search(){
this.pageNumber = 1;
this.getList();
}
filterType(item){
this.obj.type = item;
this.getList();
}
//商品列表
getList() {
const data = {
P_pageNumber: this.pageNumber,
P_pageSize: this.pageSize,
param1: this.obj.params,
type: this.obj.type
};
this.serveSer.searchSupplies(data).subscribe(
(res) => {
this.goodsList = res.list;
this.totalNum = res.total;
}
)
}
//分类列表
getTypeList() {
this.serveSer.getTypeList().subscribe(
(res) => {
this.typeList = res.data;
}
)
}
//打开过滤条件
fliter() {
this.modalCtrl.create(FilterComponent, {list: this.typeList}, {
enterAnimation: 'modal-from-right-enter',
leaveAnimation: 'modal-from-right-leave'
}).present();
}
//下拉刷新
doRefresh(e) {
this.loadMore = true;
this.infiniteScrollContent.inf.enable(true);
const data = {
P_pageNumber: 1,
P_pageSize: this.pageSize,
param1: this.obj.params,
type: this.obj.type
};
this.serveSer.searchSupplies(data).subscribe(
(res) => {
this.goodsList = res.list;
this.totalNum = res.total;
timer(800).subscribe(() => {
this.commonSer.toast('刷新成功');
e.complete()
});
}
)
}
//加载更多
doInfinite(e) {
console.log("doInfinite")
if (this.totalNum == this.goodsList.length) {
console.log("没有更多了")
this.loadMore = false;
e.enable(false);
return false;
}
this.pageNumber++;
const data = {
P_pageNumber: this.pageNumber,
P_pageSize: this.pageSize,
param1: this.obj.params,
type: this.obj.type
};
this.serveSer.searchSupplies(data).subscribe(
(res) => {
this.totalNum = res.total;
res.list.forEach(e => {
this.goodsList.push(e);
});
timer(800).subscribe(() => e.complete());
}
)
}
//选择规格 数量
choose(item){
const goods = item;
let modal = this.modalCtrl.create(SpcesComponent, {goods: goods});
modal.onDidDismiss(res => {
if (res) {
this.chooseObj = res;
this.addCart();
}
})
modal.present();
}
//添加到购物车
addCart(){
const data = {
"status":1,
"orderSuppies":[this.chooseObj]
};
this.serveSer.saveOrder(data).subscribe(
(res)=>{
}
)
}
//购物车
goCart(){
this.navCtrl.push(GoodsCartPage);
}
}
<ion-header>
<ion-navbar>
<ion-title>goodsOrder</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
</ion-content>
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
@Component({
selector: 'page-goods-order',
templateUrl: 'goods-order.html',
})
export class GoodsOrderPage {
constructor(public navCtrl: NavController, public navParams: NavParams) {
}
ionViewDidLoad() {
console.log('ionViewDidLoad GoodsOrderPage');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment