insert.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <template>
  2. <view>
  3. <navigator url="/store/deliveryAddress/index?title=选择地址" @click="toSelect" class="address-box"
  4. hover-class="navigator-hover">
  5. <view class="empty" v-if="address.contactsid == 0">
  6. 请选择收货地址
  7. </view>
  8. <view class="contacts" v-else>
  9. <view class="label">
  10. <text class="iconfont icon-dizhi-hui" />
  11. <text style="margin-right: 10px;">
  12. {{ address.name }}
  13. </text>
  14. <text>
  15. {{ address.phonenumber }}
  16. </text>
  17. </view>
  18. <view class="address">
  19. {{ getCity(address) }}
  20. </view>
  21. </view>
  22. <view class="iconfont icon-a-wodetiaozhuan" />
  23. </navigator>
  24. <view class="product">
  25. <u--image :src="product.cover" width="86" height="80" radius="8">
  26. <template v-slot:loading>
  27. <u-loading-icon color="red"></u-loading-icon>
  28. </template>
  29. </u--image>
  30. <view class="content">
  31. <view class="title u-line-1">{{ product.name }}</view>
  32. <view class="price-box">
  33. {{ product.pricetype == '一口价' ? '价格' : '定金' }}
  34. <text style="color: #E3041F;margin-left: 4px;">
  35. </text>
  36. <text class="price">
  37. {{ CNY(product.pricetype == '一口价' ? product.price : product.price_deposit, '') }}
  38. </text>
  39. <text style="color: #E3041F;margin-left: 4px;">
  40. </text>
  41. </view>
  42. </view>
  43. </view>
  44. <storeInfo ref="storeInfo" marTop="10" />
  45. <view class="address-box" hover-class="navigator-hover">
  46. <view class="empty">
  47. 小计
  48. </view>
  49. <view class="price">
  50. {{ CNY(product.pricetype == '一口价' ? product.price : product.price_deposit) }}
  51. </view>
  52. </view>
  53. <view class="footer">
  54. <view class="content">
  55. <view class="price-box">
  56. 总计:
  57. <view class="price">
  58. {{ CNY(product.pricetype == '一口价' ? product.price : product.price_deposit) }}
  59. </view>
  60. </view>
  61. <view class="submit" :class="address.contactsid == 0 || loading ? 'forbidden' : ''"
  62. hover-class="navigator-hover" @click="address.contactsid == 0 || loading ? '' : submit()">
  63. <u-loading-icon v-if="loading" />
  64. <block v-else>
  65. 支付
  66. </block>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. </template>
  72. <script>
  73. export default {
  74. data() {
  75. return {
  76. address: {
  77. contactsid: 0
  78. },
  79. product: {},
  80. loading: false
  81. }
  82. },
  83. onLoad(options) {
  84. if (options.data) {
  85. let data = JSON.parse(options.data)
  86. console.log(data)
  87. this.product = data;
  88. }
  89. this.getDefault()
  90. },
  91. methods: {
  92. getDefault() {
  93. this.$Http.basic({
  94. "id": 20240506103702,
  95. "content": {
  96. "where": {
  97. isdefault: 1
  98. }
  99. },
  100. }).then(res => {
  101. console.log("获取默认地址", res)
  102. if (this.cutoff(res.msg)) return;
  103. if (res.data.length) this.address = res.data[0];
  104. })
  105. },
  106. submit() {
  107. this.loading = true;
  108. let store = this.$refs.storeInfo.detail;
  109. console.log(this.address)
  110. this.$Http.basic({
  111. "id": 20240429152502,
  112. "content": {
  113. "sa_custorderid": 0,
  114. "items": [
  115. {
  116. "sa_fadid": this.product.sa_fadid,
  117. "qty": 1
  118. }
  119. ],
  120. "rec_contactsid": this.address.contactsid,
  121. "sys_enterpriseid": store.sys_enterpriseid,
  122. "sa_storeid": store.sa_storeid,
  123. "remarks": ""
  124. },
  125. }).then(res => {
  126. this.loading = false;
  127. console.log("创建订单", res)
  128. if (this.cutoff(res.msg)) return;
  129. })
  130. },
  131. toSelect() {
  132. this.$Http.selectAddress = function (address) {
  133. this.address = address;
  134. uni.navigateBack();
  135. delete this.$Http.selectAddress
  136. }.bind(this)
  137. }
  138. },
  139. }
  140. </script>
  141. <style lang="scss" scoped>
  142. .address-box {
  143. display: flex;
  144. align-items: center;
  145. justify-content: space-between;
  146. margin-top: 10px;
  147. width: 100vw;
  148. height: 64px;
  149. background: #FFFFFF;
  150. padding: 0 10px;
  151. box-sizing: border-box;
  152. .empty {
  153. font-family: Source Han Sans SC, Source Han Sans SC;
  154. font-size: 14px;
  155. color: #333333;
  156. }
  157. .price {
  158. font-family: Source Han Sans SC, Source Han Sans SC;
  159. font-size: 16px;
  160. color: #E3041F;
  161. }
  162. .contacts {
  163. .label {
  164. line-height: 20px;
  165. font-family: Source Han Sans SC, Source Han Sans SC;
  166. font-weight: bold;
  167. font-size: 14px;
  168. color: #000000;
  169. .iconfont {
  170. font-size: 12px;
  171. color: #333333;
  172. margin-right: 5px;
  173. }
  174. }
  175. .address {
  176. line-height: 17px;
  177. font-family: Source Han Sans SC, Source Han Sans SC;
  178. font-size: 12px;
  179. color: #666666;
  180. margin-top: 7px;
  181. }
  182. }
  183. }
  184. .product {
  185. display: flex;
  186. width: 100vw;
  187. background: #fff;
  188. padding: 10px;
  189. box-sizing: border-box;
  190. margin-top: 10px;
  191. .content {
  192. margin-left: 20px;
  193. flex: 1;
  194. height: 100%;
  195. .title {
  196. line-height: 24px;
  197. font-family: Source Han Sans SC, Source Han Sans SC;
  198. font-weight: bold;
  199. font-size: 16px;
  200. color: #333333;
  201. margin-top: 10px;
  202. }
  203. .price-box {
  204. margin-top: 10px;
  205. font-size: 12px;
  206. color: #333333;
  207. .price {
  208. color: #E3041F;
  209. font-size: 18px;
  210. font-weight: bold;
  211. }
  212. }
  213. }
  214. }
  215. .footer {
  216. position: fixed;
  217. width: 100vw;
  218. height: 65px;
  219. background: #FFFFFF;
  220. box-shadow: 0px -2px 6px 1px rgba(0, 0, 0, 0.16);
  221. bottom: 0;
  222. left: 0;
  223. padding: 10px;
  224. padding-top: 5px;
  225. box-sizing: border-box;
  226. .content {
  227. display: flex;
  228. align-items: center;
  229. justify-content: space-between;
  230. height: 45px;
  231. width: 100%;
  232. .price-box {
  233. display: flex;
  234. font-size: 14px;
  235. color: #333333;
  236. .price {
  237. color: #E3041F;
  238. font-size: 16px;
  239. font-weight: bold;
  240. }
  241. }
  242. .submit {
  243. display: flex;
  244. align-items: center;
  245. justify-content: center;
  246. width: 100px;
  247. height: 45px;
  248. background: #C30D23;
  249. border-radius: 5px;
  250. font-family: PingFang SC, PingFang SC;
  251. font-size: 14px;
  252. color: #FFFFFF;
  253. }
  254. }
  255. }
  256. .forbidden {
  257. opacity: .6;
  258. }
  259. </style>