Commit 3c222875 by ss.dai

提交

parent a07fe37d
...@@ -107,6 +107,7 @@ bool FmPlugin::GetOnDutyCashiers(QList<CashierObject> &cashiersList, QString &er ...@@ -107,6 +107,7 @@ bool FmPlugin::GetOnDutyCashiers(QList<CashierObject> &cashiersList, QString &er
bool FmPlugin::DoOrderEntry(const OrderObject *orderObject, QString &error) bool FmPlugin::DoOrderEntry(const OrderObject *orderObject, QString &error)
{ {
_GetOrderStr(orderObject);
QString dirPath = QString("%1/orders").arg(QCoreApplication::applicationDirPath()); QString dirPath = QString("%1/orders").arg(QCoreApplication::applicationDirPath());
QDir dir; QDir dir;
dir.mkdir(dirPath); dir.mkdir(dirPath);
...@@ -347,9 +348,10 @@ QString FmPlugin::_GetOrderStr( const OrderObject *orderObject) ...@@ -347,9 +348,10 @@ QString FmPlugin::_GetOrderStr( const OrderObject *orderObject)
rObj.insert("XsDate", QDateTime::fromTime_t(orderObject->create_time).toString("yyyy-MM-dd hh:mm:ss")); rObj.insert("XsDate", QDateTime::fromTime_t(orderObject->create_time).toString("yyyy-MM-dd hh:mm:ss"));
rObj.insert("OprtID", 1); rObj.insert("OprtID", 1);
rObj.insert("OprtCode", "001"); rObj.insert("OprtCode", "001");
rObj.insert("YsTotal", YsTotal); rObj.insert("YsTotal", QString::number(YsTotal,'f',2));
float sca = (orderObject->total_fee-orderObject->send_fee-orderObject->service_fee-orderObject->dis_shop_fee)/orderObject->total_fee;
float sca = (float)(orderObject->total_fee-orderObject->send_fee-orderObject->service_fee-orderObject->dis_shop_fee)/orderObject->product_fee;
float SsTotal =0; float SsTotal =0;
QJsonArray products; QJsonArray products;
for(int i=0; i < orderObject->proList.count(); i++) for(int i=0; i < orderObject->proList.count(); i++)
...@@ -358,16 +360,17 @@ QString FmPlugin::_GetOrderStr( const OrderObject *orderObject) ...@@ -358,16 +360,17 @@ QString FmPlugin::_GetOrderStr( const OrderObject *orderObject)
tObj.insert("LnNo", i+1); tObj.insert("LnNo", i+1);
tObj.insert("PluCode", orderObject->proList.at(i)->pid); tObj.insert("PluCode", orderObject->proList.at(i)->pid);
tObj.insert("PluName", orderObject->proList.at(i)->name); tObj.insert("PluName", orderObject->proList.at(i)->name);
tObj.insert("Price", _Penny2Dollar(orderObject->proList.at(i)->price).toFloat()); tObj.insert("Price", _Penny2Dollar(orderObject->proList.at(i)->price));
tObj.insert("XsCount", orderObject->proList.at(i)->productAmount); tObj.insert("XsCount", QString::number(orderObject->proList.at(i)->productAmount,'f', 2));
if((i+1) == orderObject->proList.count()) if((i+1) == orderObject->proList.count())
{ {
tObj.insert("YsTotal", YsTotal-SsTotal); tObj.insert("YsTotal",QString::number(YsTotal-SsTotal,'f',2) );
}else }else
{ {
float Ys = _Penny2Dollar(orderObject->proList.at(i)->price*orderObject->proList.at(i)->productAmount).toFloat()*sca;
tObj.insert("YsTotal", Ys); float Ys = _Penny2Dollar((orderObject->proList.at(i)->price*orderObject->proList.at(i)->productAmount)*sca).toFloat();
tObj.insert("YsTotal", QString::number(Ys,'f',2));
SsTotal += Ys; SsTotal += Ys;
} }
...@@ -381,7 +384,7 @@ QString FmPlugin::_GetOrderStr( const OrderObject *orderObject) ...@@ -381,7 +384,7 @@ QString FmPlugin::_GetOrderStr( const OrderObject *orderObject)
tObj.insert("SerialNo", 1); tObj.insert("SerialNo", 1);
tObj.insert("ZfCode", "001"); tObj.insert("ZfCode", "001");
tObj.insert("ZfName", "非码外卖"); tObj.insert("ZfName", "非码外卖");
tObj.insert("ZfTotal", YsTotal); tObj.insert("ZfTotal", QString::number(YsTotal,'f',2));
tObj.insert("TradeNo", ""); tObj.insert("TradeNo", "");
payDetails.insert(0, tObj); payDetails.insert(0, tObj);
rObj.insert("PayDetails", payDetails); rObj.insert("PayDetails", payDetails);
......
...@@ -19,6 +19,16 @@ void OrderObject::FromJson(const QJsonObject &json) ...@@ -19,6 +19,16 @@ void OrderObject::FromJson(const QJsonObject &json)
return; return;
} }
int OrderObject::getproduct_fee() const
{
return product_fee;
}
void OrderObject::setproduct_fee(const int &v)
{
product_fee = v;
}
int OrderObject::getdis_shop_fee() const int OrderObject::getdis_shop_fee() const
{ {
return dis_shop_fee; return dis_shop_fee;
......
...@@ -55,6 +55,8 @@ public: ...@@ -55,6 +55,8 @@ public:
Q_PROPERTY (int dis_shop_fee READ getdis_shop_fee WRITE setdis_shop_fee) Q_PROPERTY (int dis_shop_fee READ getdis_shop_fee WRITE setdis_shop_fee)
Q_PROPERTY (int service_fee READ getservice_fee WRITE setservice_fee) Q_PROPERTY (int service_fee READ getservice_fee WRITE setservice_fee)
Q_PROPERTY (int product_fee READ getproduct_fee WRITE setproduct_fee)
QString address; //地址 QString address; //地址
QString channel; //渠道 QString channel; //渠道
QString channelName; //渠道名称 QString channelName; //渠道名称
...@@ -94,8 +96,11 @@ public: ...@@ -94,8 +96,11 @@ public:
int dis_shop_fee; //商户承担的优惠金额 int dis_shop_fee; //商户承担的优惠金额
int service_fee; //外卖平台服务费 int service_fee; //外卖平台服务费
int product_fee; //商品总价
protected: protected:
int getproduct_fee() const;
void setproduct_fee(const int& v);
int getdis_shop_fee() const; int getdis_shop_fee() const;
void setdis_shop_fee(const int& v); void setdis_shop_fee(const int& v);
int getservice_fee() const; int getservice_fee() const;
......
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