【发布时间】:2023-03-26 10:35:01
【问题描述】:
我正在建立一个电子商务网站。我想在结帐时发送订单数据,但我无法制作订单数据。需要帮助
我在下面静态发送。它正在工作,但我怎样才能通过 this.mycart 对象的迭代使其动态化
const body = new HttpParams()
.set('user_id', user_id)
.set('address_id', '89')
.set('final_price', this.grandtotal)
.set('payment_method', 'cod')
.set('txnid', '')
.set('payment_status', '0')
.set('slot_time', '12pm to 2pm')
.set('product_id[0]', this.mycart[0].id)
.set('product_name[0]', this.mycart[0].name)
.set('product_price[0]', this.mycart[0].price)
.set('quantity[0]', this.mycart[0].quantity)
.set('product_unit[0]', this.mycart[0].value)
.set('product_id[1]', this.mycart[1].id)
.set('product_name[1]', this.mycart[1].name)
.set('product_price[1]', this.mycart[1].price)
.set('quantity[1]', this.mycart[1].quantity)
.set('product_unit[1]', this.mycart[1].value);
return this.httpClient.post(this.REST_API_SERVER+'user/place_order2', body.toString(), {
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
});
【问题讨论】:
-
请您添加更多信息。显示您的
this.mycart object的样子。
标签: post e-commerce ionic5 angular11